I am trying to make a simple code in python 3 that shows you the day when you enter the month year and day. This is the code:
from datetime import date
s = date(2016, 4, 29).weekday()
if s == 0:
print ("mon")
if s == 1:
print ("tue")
if s == 2:
print ("wed")
if s == 3:
print ("thurs")
if s == 4:
print ("fri")
if s == 5:
print ("sat")
if s == 6:
print ("sun")
The above code works, but I tried to do
from datetime import date
s = date(int(input())).weekday()
if s == 0:
print ("mon")
if s == 1:
print ("tue")
if s == 2:
print ("wed")
if s == 3:
print ("thurs")
if s == 4:
print ("fri")
if s == 5:
print ("sat")
if s == 6:
print ("sun")
so I could let users enter their own day, but it gives me the following error:
Traceback (most recent call last):
File "..\Playground\", line 2, in <module>
s = date(int(input())).weekday()
ValueError: invalid literal for int() with base 10: '2016,'
I used the input 2016, 4, 29 if it helps.