Skip to content

Commit 53eee93

Browse files
Merge pull request #1326 from Coder98321/master
Added a new program sWAP_cASE, which shows the use of swapcase() function.
2 parents 9aadb3d + a63135b commit 53eee93

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Gregorian_Calendar.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# An extra day is added to the calendar almost every four years as February 29, and the day is called a leap day. It corrects the calendar for the fact that our planet takes approximately 365.25 days to orbit the sun. A leap year contains a leap day.
2+
3+
# In the Gregorian calendar, three conditions are used to identify leap years:
4+
5+
# The year can be evenly divided by 4, is a leap year, unless:
6+
# The year can be evenly divided by 100, it is NOT a leap year, unless:
7+
# The year is also evenly divisible by 400. Then it is a leap year.
8+
# This means that in the Gregorian calendar, the years 2000 and 2400 are leap years, while 1800, 1900, 2100, 2200, 2300 and 2500 are NOT leap years.
9+
10+
def is_leap(year):
11+
leap = False
12+
if (year%4 == 0):
13+
leap = True
14+
if (year%100 == 0):
15+
leap = False
16+
if (year%400 == 0):
17+
leap = True
18+
return leap
19+
20+
year = int(input("Enter the year here: "))
21+
print(is_leap(year))
22+
23+
# If the given year is a leap year it outputs True else False

sWAP_cASE.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa.
2+
3+
def swap_case(s):
4+
return s.swapcase()
5+
6+
if __name__ == '__main__':
7+
s = input()
8+
result = swap_case(s)
9+
print(result)

0 commit comments

Comments
 (0)