You are on page 1of 2

1)

def main():
grades = int(input("Insert the score that the student earned from 0-
100:"))
if 90 <= grades <= 100:
print("Student earned letter grade A")
elif 80 <= grades <= 89:
print("Student earned letter grade B")
elif 70 <= grades <= 79:
print("Student earned letter grade C")
elif 60 <= grades <= 69:
print("Student earned letter grade D")
elif grades < 60:
print("Student earned letter grade F")
else:
print("This program does not support the given score.")

main()

2)
def main():
kilometers = int(input("Insert speed of driver:"))
limit = int(input("What is the speed limit:"))
fine = int(50 + (limit * 5))
over120 = 200
if kilometers > limit:
print("Driver was driving at an illegal speed. Fine:", fine, "euros")
elif kilometers > limit and kilometers > 120:
print("Driver was driving at an illegal speed. Fine:", fine, "plus:",
over120, "euros for going over 120 km/h")
else:
print("Driver was driving at a legal speed. Drive Safe :)")

main()

3)
def main():
print("This program is for finding the surface area and volume of
spheres.")
import math
try:
c = float(input("what is the circumference?"))
radius = c / (2 * math.pi)
surface1 = 4 * math.pi * radius ** 2
volume1 = (4 / 3) * math.pi * radius ** 3
print("The surface area of the sphere with the circumference:", c,
"is", surface1, "and the volume of the sphere with the same circumference
is:", volume1)
# code that may raise a ValueError
except ValueError:
print("Circumference should be a number")
finally:
print("Program ended.")
main()

You might also like