Programming Examples

Python program using if Elif else statement to find the number of days present in a month


Write a Python program using if Elif else statement to find the number of days present in a month:

month=eval(input("Enter Month Sr. No (ex: for Jan enter - 1 ): "))
if month==1 or month==3 or month==5 or month==7 or month==8 or month==10 or month==10 :
    print("Number of days in Month are 31")
elif month==4 or month==6 or month==9 or month==11:
    print("Number of days in Month are 30")
else:
    print("Number of days in Month are 28 or 29")
Output

Enter Month Sr. No (ex: for Jan enter - 1 ): 4

Number of days in Month are 30

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad