Why do these three pieces of code nor fulfill a the conditions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why do these three pieces of code nor fulfill a the conditions?

Hello the code bits below do not work for all situations and I can't figure it out Code bit 1 if year%4==0 and year%100==0 and year%400==0: print('Leap year') else: print ('Not a leap') Code bit 2 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')

9th Oct 2021, 10:04 AM
Gemuh Hans
5 Answers
+ 3
Gemuh Hans , yes, you are right. these exercises are for pro members only.
9th Oct 2021, 7:14 PM
Lothar
Lothar - avatar
+ 2
Gemuh Hans , here is the description of a code coach exercise from the tutorial "python for beginners: try to follow it to get the correct logic: 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. happy coding! BTW: since you have solved the python for beginners tutorial to 100%, you must have solve this "end of module" exercise.
9th Oct 2021, 11:05 AM
Lothar
Lothar - avatar
+ 2
* If the year is divisible by 100 and 400 it is a leap year.. *If the year is divisible by 4 it is a leap year.. *Else not a leap year.. Take a look here... https://code.sololearn.com/codax0CQPMQW/?ref=app
9th Oct 2021, 11:34 AM
Indira
Indira - avatar
+ 1
Lothar not necessarily. I didn't do all the exercises because I didn't have a Pro subscription
9th Oct 2021, 3:23 PM
Gemuh Hans
0
Send the code url
9th Oct 2021, 11:18 AM
Sunday Yemi Olanisimi 🇳🇬
Sunday Yemi Olanisimi 🇳🇬 - avatar