Python Im taking a beginner course so please do not use high
[Python] I\'m taking a beginner course, so please do not use higher technique
Problem to solve: A student took 5 courses and got an numeric grade for each course. We need to write a function called grading() to decide the letter grade for each course for the student.
1. This function will prompt the student to enter numeric grade for each of the 5 courses he/she took. (Use loops)
2. This function uses structured conditionals (meaning compound if... elif...else statements) to assign letter grade to the numeric grade from user input
Here are the grading scale:
If grade is greater or equals to 90, print \"letter grade is A\"
If grade is greater of equals to 80, and less than 90, print \"letter grade is B\"
If grade is greater or equals to 70, and less than 80, print \"letter grade is C\"
If grade is greater or equals to 60, and less than 70, print \"letter grade is D\"
If grade is less than 60, print \"letter grade is F\"
3. For this function, grade will be represented using an integer
Solution
def grade():
for i in range(0,5):
n = int(input(\"Enter you numeric grade:\"))
g=\'\'
if(n>=90):
g = \'A\'
elif(n>=80):
g=\'B\'
elif(n>=70):
g=\'C\'
elif(n>=60):
g=\'D\'
else:
g=\'F\'
print(\"Letter grade is \"+g)
grade()
![[Python] I\'m taking a beginner course, so please do not use higher technique Problem to solve: A student took 5 courses and got an numeric grade for each cours [Python] I\'m taking a beginner course, so please do not use higher technique Problem to solve: A student took 5 courses and got an numeric grade for each cours](/WebImages/29/python-im-taking-a-beginner-course-so-please-do-not-use-high-1080094-1761567069-0.webp)