Jul-24-2021, 08:10 PM
The for loop is not necessary with your code, I just used it to show an example of getting a different day from a different
you can modify your existing code to use
I have pretty much shown you how to do without actually altering your code myself
see this as another example
calendar.weekday
you can modify your existing code to use
calendar.day_name
I have pretty much shown you how to do without actually altering your code myself
see this as another example
import calendar weekday = calendar.weekday(2021, 7, 24) day_name = calendar.day_name[weekday] print(day_name) print(f"Day of the week in english is {day_name}")
Output:Saturday
Day of the week in english is Saturday
Think of calendar.day_name
as being a list of each day of the week with Monday at index 0, Tuesday at index 1 etc.