0% found this document useful (0 votes)
56 views1 page

Leap Year

The document contains code to check if a number is even or odd, determine a grade based on test score percentages, and check if a year is a leap year. The even/odd code uses modulo to check if a number divided by 2 has a remainder. The grading code uses a series of if/elif statements to assign a letter grade based on test score ranges. The leap year code applies the rules that a year must be divisible by 4, 100, and 400 to be a leap year.

Uploaded by

alknoll
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views1 page

Leap Year

The document contains code to check if a number is even or odd, determine a grade based on test score percentages, and check if a year is a leap year. The even/odd code uses modulo to check if a number divided by 2 has a remainder. The grading code uses a series of if/elif statements to assign a letter grade based on test score ranges. The leap year code applies the rules that a year must be divisible by 4, 100, and 400 to be a leap year.

Uploaded by

alknoll
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 1

x = float(input("enter number to check if it is even or odd "))

y=x/2
z = int(y)

if (y != z):
print("this is an odd number")
elif(y == z):
print("this is an even number")
else:
print("error")

x = float(input("enter your results"))


if x >= 0.9:
print("A")
elif x >= 0.8 and x <= 0.9:
print("B")
elif x >= 0.7 and x <= 0.8:
print("C")
elif x >= 0.6 and x <= 0.7:
print("D")
elif x >= 0.5 and x <= 0.6:
print("E")
else: print("wrong input")

# If the year is evenly divisible by 4, it's a leap year.


# However, if that year is also evenly divisible by 100, it is not a leap year, unless...
# The year is also evenly divisible by 400, in which case it is a leap year.

x = float(input("enter the year"))


y = int(x)
if x / 4 != y/4:
if x/100 != y/4:
if x/400 != y/400:
print("it is a leap year")
else: print("not a leap year")
#not work!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy