Phone

+919997782184

Email

support@roboticswithpython.com

Geeks of Coding

Join us on Telegram

Home Forums Cody Bank Getting Started with Python Reply To: Getting Started with Python

#711
Abhishek TyagiAbhishek Tyagi
Keymaster

3.3 Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error. If the score is between 0.0 and 1.0, print a grade using the following table:
#Score Grade
#>= 0.9 Show A
#>= 0.8 Show B
#>= 0.7 Show C
#>= 0.6 Show D
#< 0.6 Show F
#If the user enters a value out of range, print a suitable error message and exit. For the test, enter a score of 0.85.

x = float(raw_input("Enter Score"))
if x <= 1 and x > 0:
    if x >= 0.9:
        print ("A")
    elif x >= 0.8:
        print ("B")
    elif x >= 0.7:
        print ("C")
    elif x >= 0.6:
        print ("D")
    elif x < 0.6:
        print ("D")
else:
    print ("error")