Date: 1st October 2017
Youtube Problem Statement: https://www.youtube.com/watch?v=owsqKkR2Bc0&t=10s
Youtube Solution: https://www.youtube.com/watch?v=Wzqknem7umY
Write a program in python to convert a given date to a day. The program should run in a loop and should keep asking if the user wants to quit. If the user wants to continue, he should be prompted to enter the date he wants to convert again.
Input format: You can choose any input format you want. However preferably it should be DD/MM/YYYY.
Output Format: The output should be the weekday, like "Monday", "Saturday" etc.
Enter a date to convert (DD/MM/YYYY):
Do you want to quit? (Y/N)
1 import datetime 2 def convert(day, month, year): 3 date = datetime.datetime.strptime(month + " " + day + ", " + year, "%m %d, %Y") 4 return date.strftime('%A') 5 while True: 6 print "Enter a date in the DD/MM/YYYY format" 7 date = raw_input() 8 date_arr = date.split("/") 9 day = convert(date_arr, date_arr, date_arr) 10 print "The day of the week is " + day 11 option = raw_input("Do you wish to quit? (Y/N)") 12 if option == "Y": 13 break