TDT4109/Exercise 4 - Inspera/10.py

21 lines
467 B
Python

month = input('Skriv inn en måned: ').lower()
if month == 'februar':
year = input('Skriv inn et år: ')
isLeapyear = int(year) % 4 == 0
print(29 if isLeapyear else 28)
else:
months = {
"januar": 31,
# "februar": 30,
"mars": 31,
"april": 30,
"mai": 31,
"juni": 30,
"july": 31, # Hmmm
"august": 31,
"september": 30,
"oktober": 31,
"november": 30,
"desember": 31
}
print(months[month])