7. A program that receives the number of a month (1 for January, 2 for
February and so on) and displays the number of days in that month.
Assume that the year is a leap year.
Sample input-output:
Input
1
2
3
4
Output
31
29
31
30
Answers
Answered by
2
Answer:
num=int(input('Enter a number from 1-12: '))
if num in (4,6,9,11):
print('Number of days: ',30)
elif num==2:
print("Number of days:",29)
else:
print("Number of days:", 31)
There are other ways to write this program too. This is one way. Hope it helps :)
Similar questions