**New course!**Every coder should learn

**Generative AI!**

- 1

# Write the program plz i m getting bug for this hlp me

You need to make a program to take a year as input and output "Leap year" if itās a leap year, and "Not a leap year", if itās not. To check whether a year is a leap year or not, you need to check the following: 1) If the year is evenly divisible by 4, go to step 2. Otherwise, the year is NOT leap year. 2) If the year is evenly divisible by 100, go to step 3. Otherwise, the year is a leap year. 3) If the year is evenly divisible by 400, the year is a leap year. Otherwise, it is not a leap year. Sample Input 2000 Sample Output Leap year Use the modulo operator % to check if the year is evenly divisible by a number.

6 Answers

+ 4

+ 3

Seems do be a duplicate...
https://www.sololearn.com/Discuss/2699475/?ref=app
Please delete the other because it's same as this (only with less info).

+ 2

Gayathri Uppada Show your attempt

+ 1

year = int(input())
#your code goes here
if year%4 == 0:
if year%100==0:
if year%400==0:
print('Leap year')
else:
print("Not a leap year")
else:
print('Leap year')
else:
print("Not a leap year")

0

plz go n run the program i dt understand where the bug
year = int(input())
if year%4==0:
print("Leap year")
else:
if year%100==0:
print("Not a leap year")
else:
if year%400==0:
print("Leap year")
else:
print("Not a leap year")

0

Some logic missing .. i think if year%4==0 and not year%100==0
If it year%100==0 then must be year%400==0 :
In other cases, it must not a leap year...