Python Forum
write a program which prints the day in english
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
write a program which prints the day in english
#4
calendar.weekday returns an int for the weekday, calendar.day_name is indexable using the weekday int
import calendar
for day in (23, 24, 25):
    weekday = calendar.weekday(2021, 7, day)
    print(f"Day of the week in english is {calendar.day_name[weekday]}")
Output:
Day of the week in english is Friday Day of the week in english is Saturday Day of the week in english is Sunday
Reply


Messages In This Thread
RE: write a program which prints the day in english - by Yoriz - Jul-24-2021, 07:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  zfill prints extra et the end of a var tester_V 4 1,068 Mar-24-2023, 06:59 PM
Last Post: tester_V
  (python) Can i get some help fixing a English to Morse translator? Pls AlexPython 7 1,776 Sep-12-2022, 02:55 AM
Last Post: AlexPython
  variable prints without being declared. ClockPillow 2 1,931 Jul-11-2021, 12:13 AM
Last Post: ClockPillow
  More non english characters johnboy1974 8 4,764 Apr-23-2021, 02:35 PM
Last Post: snippsat
  Output prints Account.id at the end? LastStopDEVS 5 2,948 Dec-19-2020, 05:59 AM
Last Post: buran
  I have an index error inline 76 but I write the program in a way that cant reach tha abbaszandi 2 2,189 Nov-13-2020, 07:43 AM
Last Post: buran
  Try/Exept prints only ones tester_V 11 4,193 Nov-03-2020, 02:38 AM
Last Post: tester_V
  loop only prints last character. mcmxl22 1 1,840 Feb-17-2020, 02:36 AM
Last Post: menator01
  How to write a script to execute a program need passing additional input? larkypython 2 2,709 Nov-23-2019, 04:38 AM
Last Post: larkypython
  English interpretation of the following file handing snippet mortch 5 3,356 May-30-2019, 08:10 AM
Last Post: mortch

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020