Skip to content

Commit af21e0d

Browse files
committed
Add code and images of code
1 parent 7a877dc commit af21e0d

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This code will be used to find out the Numbers of day in a month.
2+
print(" -- This code is used to find the Number of days in a Month-- ")
3+
4+
import datetime
5+
6+
7+
def days_finder(month_number, year):
8+
leap = 0
9+
print(month_number)
10+
list_31 = [1, 3, 5, 7, 8, 10, 12]
11+
list_30 = [4, 6, 9, 11]
12+
if year % 4 == 0:
13+
leap = 1
14+
if month_number in list_30:
15+
number_of_days = 30
16+
elif month_number in list_31:
17+
number_of_days = 31
18+
else:
19+
number_of_days = 28 + leap
20+
return number_of_days
21+
22+
23+
def main():
24+
year = int(input("Enter the year "))
25+
month_number = (input(' Enter the Name of Month '))
26+
datetime_object = datetime.datetime.strptime(month_number, "%m")
27+
28+
month_name = datetime_object.strftime("%B")
29+
30+
print("Month Number ", month_number)
31+
month_number = int(month_number)
32+
33+
print("The Number of days in ", days_finder(month_number, year))
34+
35+
choice=int(input("Enter 1 to Continue or else to exit "))
36+
if choice == 1:
37+
main()
38+
else:
39+
exit
40+
41+
42+
main()
43+
Binary file not shown.

0 commit comments

Comments
 (0)