Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def leap_year(year: int) -> bool: #takes a year in YYYY format, and returns True if it's a leap year, False otherwise# T =

def leap_year(year: int) -> bool:
   #takes a year in YYYY format, and returns True if it's a leap year, False otherwise#

   T = "True"
   F = "False"

   lyear = year % 4
   if lyear == 0:
       feb_max = 29
   else:
       feb_max = 28

   lyear = year % 100
   if lyear == 0:
       feb_max = 28

   lyear = year % 400
   if lyear ==0:
       feb_max = 29

   if feb_max == 29:
       return T
   else:
       return F
 

this is my code

when i try to run my check script i get response-

AssertionError: 'False' != False : leap_year() not returning correct True/False for a specific year

 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Programming In Java An Interdisciplinary Approach

Authors: Robert Sedgewick, Kevin Wayne

2nd Edition

0672337843, 9780672337840

More Books

Students also viewed these Programming questions

Question

What are two important limitations of the Heckscher- Ohlin theory?

Answered: 1 week ago