Homework Help – Python Beginners

Write a program in Python to get month number from the user and print number of days in that month as shown below:​

>>>Enter a month number: 4​

The number of days in April month is 30​

Hint:Create a list variable with names of all months

Create a list variable with number of days in each month (assume February has 28 days)

Use the month number as an index to get the month name and days from the lists

# DaysInTheMonth.py

# Replace ? with your code

monthNames = ['January', 'February', 'March', ?, 'December']

monthDays = [31, 28, 31, 30, ?, 31]

month = int(input("Enter a month number:")

print('The number of days in", monthNames[?], 'month is', monthDays[?])