Python Beginners – use if conditional statement to judge grade

Time:2020-10-31
x = int(input("x="))
If x < 0 or x > 100: # if it is not in the range of 0 -- 100, output error
    print("error")
Elif 100 > x > = 90: # if output a between 100 and 90
    print("A")
Elif 90 > x > = 80: # if B is output within 90-80
    print("B")
Elif 80 > x > = 70: # if C is output within 80-70
    print("C")
Elif 70 > x > = 60: # if D is output within 70-60
    print("D")
Else: if e is output within 60-70
    print("E")

 

Recommended Today

Go quick start 05 struct and interface: what functions do structs and interfaces implement?

structural morphology Structure definition A structure is an aggregation type, which can contain any type of values. These values are members of the structure defined by us, also known as fields. In go language, to customize a structure, you need to use the keyword combination of type and struct.A structure type named person is defined […]