Fundamentals (Good) Exercises

Exercise 1 (What is your grade?)  

Python allows you to solicit information from the user.
One way to do this is using the input() function. Here is an example of how to use it.

user_input = input('Give me a number?')
print('You entered', user_input)

Run this code and explore.

Write a Python program that takes a numerical grade (0-100) as input and outputs the corresponding letter grade based on the following criteria:

Grade Score Range
A 70 - 100
B 50 - 69
C 35 - 49
Fail 0 - 34

Note:

  • Here is an example of the type of exchange expected.

    Enter the student's score: 85
    The student's letter grade is: A
  • Ensure your program handles unexpected inputs gracefully and displays a relevant error message.

Back to top