Skip to content

Commit e4a6fde

Browse files
committed
codingexercise_mul_return.py
1 parent c3fae35 commit e4a6fde

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

codingexercise_mul_return.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
def leap_year(year):
2+
if year % 4 == 0:
3+
4+
if year % 100 == 0:
5+
6+
if year % 400 == 0:
7+
print("Leap Year")
8+
else:
9+
print("Not Leap Year")
10+
else:
11+
print("Leap year")
12+
def days_of_month(year,month):
13+
days_list=[31,28,31,30,31,30,31,31,30,31,30,31]
14+
if leap_year and month==2:
15+
return 29
16+
else:
17+
return days_list[month-1]
18+
year=int(input("Enter a year:"))
19+
month=int(input("Enter a month:"))
20+
days=days_of_month(year,month)
21+
print(days)

exercise_multiple_return_value.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def format_name(first,last):
2+
3+
if last=="" and first=="":
4+
return "enter valid input!"
5+
else:
6+
return [first.title(),last.title()]
7+
first=input("Enter first name:\n")
8+
last=input("Enter last name:\n")
9+
result=format_name(first,last)
10+
print(result)

0 commit comments

Comments
 (0)