Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Leap Year Issue
#1
Hello,
I am facing an issue when I use Years' like 100, 1000. I am not sure, why is this happening.

print("***********Leap Year**************")
Year = int(input("Please enter an year to see if it is a Lear Year "))
print("Year entered is ", Year)
while Year!=0:
    if(Year % 4 == 0):
        if(Year % 100 !=0 or Year % 400 == 0):
            print(f'{Year} is a Leap Year')
            Year = int(input("Please enter an year to see if it is a Lear Year "))
            print(Year)
    else:
        print("Not a Leap Year")
        Year = int(input("Please enter an year to see if it is a Lear Year "))
        print(Year)
Output:
Please enter an year to see if it is a Lear Year 400 Year entered is 400 400 is a Leap Year Please enter an year to see if it is a Lear Year 100 100 Process finished with exit code -1
Reply


Messages In This Thread
Leap Year Issue - by spalisetty06 - Jul-02-2020, 12:04 PM
RE: Leap Year Issue - by Larz60+ - Jul-02-2020, 03:05 PM
RE: Leap Year Issue - by pyzyx3qwerty - Jul-02-2020, 03:16 PM
RE: Leap Year Issue - by bowlofred - Jul-02-2020, 03:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to get year not the entire year & time mbrown009 2 1,007 Jan-09-2023, 01:46 PM
Last Post: snippsat
  Problem with module time and leap seconds Pedroski55 3 1,364 Oct-07-2022, 11:27 PM
Last Post: Pedroski55
Photo Algorithm for leap year (structogramm coder_sw99 3 2,335 Jul-23-2021, 02:13 PM
Last Post: DeaD_EyE
  Leap Year MartinEvtimov 14 25,606 Mar-10-2017, 01:46 AM
Last Post: Larz60+
  leap year program issue jashajmera 3 3,997 Feb-04-2017, 11:51 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020