Question
Task 2: Leap Years <2.1Conditionals; 3.1 Strings> Part A - Is this a leap year? Write a function is leap year(year) that calculates whether a
Task 2: Leap Years
<2.1Conditionals; 3.1 Strings>
Part A - Is this a leap year? Write a function is leap year(year) that calculates whether a given (CE) year is a leap year. The function must: take one argument: a positive integer representing a year (assumed to be CE) return True if that year was a leap year; return False if not NOTE: all years that are divisible by four are leap years, unless they are also divisible by 100, in which case they are only leap years if they are also divisible by 400.
Part B - 2000 was a leap year. Write a function leap year answer(year) that returns the string 'Year was a leap year', 'Year was not a leap year', 'Year will be a leap year', 'Year will not be a leap year'. For the purpose of tense, you may assume 2020 and any early year are past tense; the year 2021 and onwards are future tense. You may wish to call your function from Part A as part of this function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started