Could you please help to write a code for this program

0 votes
An year - against which they type Leap Year / Not Leap Year

The month number - against which they type the name of the corresponding month and the number of days in that month.

Refer the sample input and output statements for more details.
As a Python programmer, you have to create a Python module named ' with the following functionalities which will help the staff members for cross verifying the answers submitted by children against the right answers.

The ' module should contains the functions given below:
1. isleap(year) - to check if the given year is leap year or not

2. month_name(no) - that returns the name of the month, on entering the month's number

3. days_in_month(month,year) - that returns the number of days in a month

Sample Input 1:
Enter year as 4 digits (e.g: 2002):2016
Enter month number:1

Sample output 1:
Year: Leap Year
Month Name: January
Days in month: 31
Nov 4, 2020 in Python by HITESH
• 120 points

1 answer to this question.

0 votes

Hello, @Hitesh,

You can follow the below:

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

The output will be:

List of months: January, February, March, April, May, June, July, August, September, October, November, Decemb
Input the name of Month: April                                                                                
No. of days: 30 days 
answered Nov 4, 2020 by Roshni
• 10,500 points

Related Questions In Python

+1 vote
1 answer
+2 votes
0 answers
0 votes
1 answer

Write code to create a list of word lengths for the words in original_str using the accumulation pattern and assign the answer to a variable num_words_list.

Hi,  num_words_list = len(original_str.split()) original_str.split() - split words in ...READ MORE

answered May 27, 2020 in Python by Niroj
• 82,680 points
0 votes
1 answer

Write program/code for below input to get required output.

That is a "set subtraction" operation. Use ...READ MORE

answered Oct 6, 2020 in Python by Gitika
• 65,850 points
0 votes
1 answer
0 votes
1 answer

Need help extracting a schema to make use for an avro file in Python

Hi, nice question. So what I daily use ...READ MORE

answered Jan 10, 2019 in Python by Nymeria
• 3,540 points
+1 vote
10 answers

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

Just for the record: >>> int('55063.000000') Traceback (most recent ...READ MORE

answered Aug 17, 2020 in Python by pakainfo
• 200 points
+1 vote
7 answers
Send OTP
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP