3.5 Code Practice
Instructions
Input a grade number [9-12] and print Freshman, Sophomore, Junior . or
Senior . If it is not in [9-12], print Not in High School.
Sample Run 1
What grade are you in? 10
Sample Output 1
Sophomore
Sample Run 2
What grade are you in? 5
Sample Output 2
Not in High School
answer in Python​

Respuesta :

Answer:

grade = input("Enter grade")

def add(grade):

if grade == 9:

 print("Not in High School Freshman")

elif grade == 10:

 print("In High School")

 print("somophone")

elif grade == 11:

 print("in High School")

 print("Junior")

elif grade == 12:

 print("in High School")

 print("Senior")

else:

 print("Grade Not Accepted:")

return 0;

add(11)

Output:

Enter grade 11

in High School

Junior

Process finished with exit code 0

Explanation:

Firstly remember that this is a function, and not a program. Hence, you need to call the function to test it. A python program is interpreted line by line, Hence, we can test a function as well. Here we input a grade, and through the function find the details related to it and the print it out, which is clearly explained through the definition of the function.

Answer:

Python.

Explanation:

grade_number = input("What grade are you in? ")

/////////////////////////////////////////////////////////////////////

// Using if else control statements to print the right student level

if grade_number == 9:

   print("Freshman")

elif grade_number == 10:

   print("Sophomore")

elif grade_number == 11:

   print("Junior")

elif grade_number == 12:        

    print("Senior")

else:

    print("Not in High School")

Q&A Education