In: Computer Science
Using python code
Developed a program to get students homework, midterm, and final exam grades and compute their average grades display average grade as a number and give them letter gardes. For this homework, I would like you to modify your to do the following.
Student grades MUST be between 0 and 100. If students input any number that is not in this range , program must keep asking to enter the correct number. Once student input correct grade, program should move on to next grade.
For example if a student had an average grade of 90, and student name is Alex Smith, the course code is CSCI1012, the program must display:
Student Name: Alex Student Last name : Smith Course: CSCI1012 Student Average grade: 90 Student final grade : A
Code: --
first=input('enter your first name: ') #taking input from user
for firstand last name and course name
last=input('enter your last name: ')
course=input('enter your course name: ')
while True:# take input valid marks
ho=input('enter homework marks out of 100 :
')
if not ho.isdecimal() or int(ho)<0 or
int(ho)>100: # validate marks if not in 100 then retake
print('enter valid marks
: ')
continue
else: # if valid then go for next mark
break
while True:
mid=input('enter mid marks out of 100 : ') #
validate marks if not in 100 then retake
if not mid.isdecimal() or int(mid)<0 or
int(mid)>100:
print('enter valid marks
: ')
continue
else: # if valid then go for next mark
break
while True:
fin=input('enter final marks out of 100 : ')#
validate marks if not in 100 then retake
if not fin.isdecimal() or int(fin)<0 or
int(fin)>100:
print('enter valid marks
: ')
continue
else: # if valid then go for next mark
break
avr=((int(ho)+int(mid)+int(fin))/3) # calculating avr marks
# printing studnet details
print("Student's first name:", first)
print("Student's last name:", last)
print("Course name:", course)
print("Average grade:",avr)
# printing gread according to avrage marks
if avr<101 and avr>90:
print("Student final grade : A")
elif avr<91 and avr>80:
print("Student final grade : B")
elif avr<81 and avr>70:
print("Student final grade :
C")
elif avr<71 and avr>60:
print("Student final grade :
D")
else :
print("Student final grade : E")
OUTPUT:__