- 1
Leap Year practice problem in new Python Beginners course
I feel like the question is written incorrectly and the whole thing doesnât make any sense really. Can someone else take a look and tell me if Iâm tripping and if so explain how it works. It seems like it should be easier Iâve already done 2/3 of Python Core so I figure that should be easy
10 Answers
+ 1
kole roper 
Try this
leapyear = False
year = int(input())
if year % 4 == 0:
	   if year % 100 == 0:
		      if year % 400 == 0:
			         leapyear = True
     else:
           leapyear = True
	
if leapyear:
     print ("Leap Year")
else:
     print ("Not a leap year")
+ 1
I have figured it out but thanks for the help. iâm sure the answers will help future people
+ 1
Pls someone help paste the leap question here.
0
Hunter Allen 
There is nothing wrong in that problem. You need to understand again.
You have to apply nested if condition to solve problem.
0
Ok i will try again thank you
0
year = int(input())
if year % 4:
else:
	print("Not a leap usae")
	if year % 100:
	else:
		print("Leap year")
		if year % 400:
			print("Leap year")
			else: 
				print("Not a leap year")
	
icant figure out what im doing wrong
0
thats what i have
0
please help
0
You need to read it again and try this code..
year=int(input())
if year%100==0:     
    if year%400==0:
        print("Leap year")
    else:
        print("Not a leap year")
else:
    if year%4==0:
        print("Leap year")
    else:
        print("Not a leap year")
0
Just figured it out. Don't need to put the % 100 == 0.
year = int(input())
#your code goes here
if year % 4 == 0 and year % 100 != 0:
    print("Leap year")
elif year % 400 == 0:
    print("Leap year")
elif year % 400 != 0:
    print("Not a leap year")
else:
    print("Not a leap year")



