0

i want to create a function in which the writes a date to his choice in dd/mm/yyyy type, and then it will print the day in the week for the wrriten date (i'm a begginer so should use simple slicing/conditions/imports (i was told as a clue to use calender.weekday). for ex:

Enter a date: 01/01/2000

Saturday

Enter a date: 27/11/2051

Monday

matt mayz
  • 11
  • 2
  • Welcome to Stack Overflow! Please read the [tour](https://stackoverflow.com/tour) and the guidelines about [homework questions](https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions). For any kind of question, HW or not, show what you have tried, and explain the problems you are facing. – Ignatius Reilly Aug 08 '22 at 20:00
  • Your question is duplicated. You can find the answer here. – TahooraMajlesi Aug 08 '22 at 20:03
  • Does this answer your question? [How do I get the day of week given a date?](https://stackoverflow.com/questions/9847213/how-do-i-get-the-day-of-week-given-a-date) – Ignatius Reilly Aug 08 '22 at 20:06
  • @TahooraMajlesi thanks! I just raised a flag for it. – Ignatius Reilly Aug 08 '22 at 20:06

1 Answers1

0

Use datetime()

from datetime import datetime
day = input("Enter your date in the format dd/mm/yy")
day = datetime.strptime(day, "%d/%m/%y")
print(day.strftime('%A'))`
dave
  • 11
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 11 '22 at 22:31