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
#11
(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 :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  zfill prints extra et the end of a var tester_V 4 850 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,540 Sep-12-2022, 02:55 AM
Last Post: AlexPython
  variable prints without being declared. ClockPillow 2 1,771 Jul-11-2021, 12:13 AM
Last Post: ClockPillow
  More non english characters johnboy1974 8 4,350 Apr-23-2021, 02:35 PM
Last Post: snippsat
  Output prints Account.id at the end? LastStopDEVS 5 2,718 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,013 Nov-13-2020, 07:43 AM
Last Post: buran
  Try/Exept prints only ones tester_V 11 3,738 Nov-03-2020, 02:38 AM
Last Post: tester_V
  loop only prints last character. mcmxl22 1 1,674 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,471 Nov-23-2019, 04:38 AM
Last Post: larkypython
  English interpretation of the following file handing snippet mortch 5 3,121 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