180k views
4 votes
If-else expression: Operator chaining.

Write an expression that will print "in high school" if the value of user_grade is between 9 and 12 (inclusive).
Sample output with input: 10
in high school

User Max Dunn
by
5.0k points

1 Answer

6 votes

Answer:

user_grade = int(input())

if 9<= user_grade <= 12:

print("in high school")

Step-by-step explanation:

*The code is in Python.

Get the input from the user and assign it to the user_grade

Check the value of the user_grade using if structure. If it is between 9 and 12 (inclusive), print "in high school" message

User Jsantell
by
5.8k points