Python Forum

Full Version: write a program which prints the day in english
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Jul-24-2021, 08:10 PM)Yoriz Wrote: [ -> ]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 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.

Hi, thanks.
ill try it soon and update ( today a little problematic ), tommorow ill try it on my code and see if it works, ill update.
thanks again :)
Pages: 1 2