Q:

Write a Python program to convert month name to a number of days

0

Write a Python program to convert month name to a number of days

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used python 3.7 compiler for debugging purpose.

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")

Result:

List of months: January, February, March, April, May, June, July, August, September, October, November, December

Input the name of Month: August

No. of days: 31 day

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a Python program to create the multiplicatio... >>
<< Write a Python program to check whether an alphabe...