Jul-24-2021, 08:56 PM
(Jul-24-2021, 07:34 PM)ben1122 Wrote: I guess with my code its impossible to do it, I have to use a new code for it? i mean, restart it.No you just need to add the user input to what Yoriz has showed you.
I would add a function like to make cleaner,and the point is that no
if,elif
is needed for this.import calendar def day_of_week(year, month, day): weekday = calendar.weekday(year, month, day) print(f"Day of the week in english is {calendar.day_name[weekday]}") if __name__ == '__main__': year = int(input("Please choose your year: ")) month = int(input("Please choose your month: ")) day = int(input("Please choose your day: ")) day_of_week(year, month, day)Test.
Output:Please choose your year: 2021
Please choose your month: 7
Please choose your day: 24
Day of the week in english is Saturday