Westonci.ca is the premier destination for reliable answers to your questions, brought to you by a community of experts. Connect with a community of experts ready to help you find accurate solutions to your questions quickly and efficiently. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.
Sagot :
Answer:
def year_type(yr):
if yr%400 == 0:
print('year', yr, ':' , 'is a leap year')
elif yr%100 ==0:
print('year' , yr, ':' , 'is not a leap year')
elif yr%4 ==0:
print('year', yr, ':', 'is a leap year')
else:
print('year', yr, ':', 'is not a leap year')
year_type(int(input('Enter a year value :')))
Explanation:
The function year_type was defined and takes in one argument which is the year value.
It check if the year is a leap year or not by using the conditional of statement.
If year is divisible by 400 program prints a leap year
If year is divisible by 100 program prints not a leap year
If year is divisible by 4 ; program prints a leap year
Else; everything outside the stated conditions, program prints not a leap year.
The function is called and the argument is supplied by the user using the input method.
We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. We hope our answers were useful. Return anytime for more information and answers to any other questions you have. Get the answers you need at Westonci.ca. Stay informed by returning for our latest expert advice.