Question: Chapter 2 Exercises 2.6: Using a 'for loop' , write a program that calculated and prints all the leap years from 1900 to 2020 (inclusive).

 Chapter 2 Exercises 2.6: Using a 'for loop' , write a

Chapter 2 Exercises 2.6: Using a 'for loop' , write a program that calculated and prints all the leap years from 1900 to 2020 (inclusive). Make sure that you understand the rules for determining a leap year and use the modulo operator to manually calculate leap years. Do not use the calendar library. Then perform this calculation a second time using a 'while loop'. 2.7: Rewrite this following 'for loop' as a 'while loop' and create a working program: Hint: X is a constant variable. for i in range(1, X + 1): if X % i == 0: print(i)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!