1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
BARSIC [14]
4 years ago
6

3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a

round the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is: 1712 the output is: 1712 - leap year
Computers and Technology
2 answers:
Tju [1.3M]4 years ago
8 0

Answer:

year = int(input("Enter a year: "))

if (year % 4) == 0:

  if (year % 100) == 0:

      if (year % 400) == 0:

          print(str(year) + " - leap year")

      else:

          print(str(year) +" - not a leap year")

  else:

      print(str(year) + " - leap year")

else:

  print(str(year) + "- not a leap year")

Explanation:

*The code is in Python.

Ask the user to enter a year

Check if the <u>year mod 4</u> is 0 or not. If it is not 0, then the year is not a leap year. If it is 0 and if the <u>year mod 100</u> is not 0, then the year is a leap year. If the <u>year mod 100</u> is 0, also check if the <u>year mod 400</u> is 0 or not. If it is 0, then the year is a leap year. Otherwise, the year is not a leap year.

castortr0y [4]4 years ago
6 0

Answer:

i_year=int(input(""))

#check leap year

if((i_year % 4 == 0 and i_year % 100 != 0) or (i_year % 400 == 0)):

  print("{} is a leap year.".format(i_year))

else:

  print("{} is not a leap year.".format(i_year))

Explanation:

You might be interested in
Free response: Spot and Fix the Bug Respond to the following questions about your investigation into the bug with the counting g
Pepsi [2]

Answer:

Hello Dear,

The question doesn't have any code in it.

Please elaborate or expedite your question.

Explanation:

Please share the code file which is usually having an extension of .org.

3 0
4 years ago
I am currently building my own PC is there any part I should put first? Or is it just whatever?
Dominik [7]

Basically, I had the same question when I got my PC! You can do any part you choose as long as you put it together in the right place.

Hope this helped you!

4 0
3 years ago
Read 2 more answers
What are listed in the vertical columns across the top of the Event Editor?
jeka57 [31]

Answer:

a

Explanation:

7 0
4 years ago
Read 2 more answers
How does Technology impact any profession or occupation?
Brrunno [24]

Technology can create or dimish occupations.

Technology can also make the job easier

8 0
3 years ago
Hiw is Apple planning on returning to the music business​
inna [77]
By making more iPods
5 0
3 years ago
Other questions:
  • You are an inexperienced excel user and don���t know how to create your own formulas. you want to use one of the preconfigured f
    5·1 answer
  • What is an examlple of cyberbullying
    5·1 answer
  • Gina is upgrading your computer with a new processor. She installs the processor into your motherboard and adds the cooling syst
    13·2 answers
  • A typical item in a plan of procedure includes the name of the part of the ______ to
    5·1 answer
  • We need ____ pointers to build a linked list.
    6·1 answer
  • Assume hosts A and B are each connected to a switch Svia 100-Mbps links. The propagation delay on each link is 25μs. The switch
    15·1 answer
  • A value chosen by the responder to identify a unique IKE SA is a _________.
    7·1 answer
  • A gui allows you to interact with objects on the screen such as icons and buttons true or false
    15·1 answer
  • Throughout the lecture, the teacher speaks about the defintion of "Science"
    5·2 answers
  • Manufactured computers and cell phones are part of which industry? Electronics Chemicals Machinery Metal products
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!