Write a program that takes an integer as input, representing a year in school. Output "Elementary school" for 0-5, "Middle school" for 6-8, "High school" for 9-12, "College" for 13-16, and "Post-secondary" for 17 and higher. Output "Invalid" for negative input. If the input is 7, the output is:

Relax

Respuesta :

In python:

year = int(input("Enter the school year: "))

if 0 <= year <= 5:

   print("Elementary school")

elif 6 <= year <= 8:

   print("Middle school")

elif 9 <= year <= 12:

   print("High School")

elif 13 <= year <= 16:

   print("College")

elif year >= 17:

    print("Post-secondary")

else:

   print("Invalid")

I hope this helps!

Otras preguntas