Write a python program to input day, month number, and year from the user
and print the long date (in case of invalid input show appropriate error message)
Example: input : 24 , 4, 2021 then the output has to be 24th April 2021
Answers
Answer:
if (month > 12):
print("invalid Month")
raise SystemExit
if (month == 1,3,5,7,8,10,12):
(day > 31)
print("Invalid Day")
raise SystemExit
else:
(month == 2)
(day > 28)
print("Invalid Day")
raise SystemExit
else:
(month == 4,6,9,11)
(day > 30)
print("Invalid Day")
raise SystemExit
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February":
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February": print("No. of days: 28/29 days")
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February": print("No. of days: 28/29 days")elif month_name in ("April", "June", "September", "November"):
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February": print("No. of days: 28/29 days")elif month_name in ("April", "June", "September", "November"): print("No. of days: 30 days")
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February": print("No. of days: 28/29 days")elif month_name in ("April", "June", "September", "November"): print("No. of days: 30 days")elif month_name in ("January", "March", "May", "July", "August", "October", "December"):
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February": print("No. of days: 28/29 days")elif month_name in ("April", "June", "September", "November"): print("No. of days: 30 days")elif month_name in ("January", "March", "May", "July", "August", "October", "December"): print("No. of days: 31 day")
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February": print("No. of days: 28/29 days")elif month_name in ("April", "June", "September", "November"): print("No. of days: 30 days")elif month_name in ("January", "March", "May", "July", "August", "October", "December"): print("No. of days: 31 day")else:
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February": print("No. of days: 28/29 days")elif month_name in ("April", "June", "September", "November"): print("No. of days: 30 days")elif month_name in ("January", "March", "May", "July", "August", "October", "December"): print("No. of days: 31 day")else: print("Wrong month name")
print("List of months: January, February, March, April, May, June, July, August, September, October, November, December")month_name = input("Input the name of Month: ")if month_name == "February": print("No. of days: 28/29 days")elif month_name in ("April", "June", "September", "November"): print("No. of days: 30 days")elif month_name in ("January", "March", "May", "July", "August", "October", "December"): print("No. of days: 31 day")else: print("Wrong month name")