help?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help??

studentsLastName = input('Enter students last name\n') TotalMarks = int(input( 'Enter students total marks\n')) / 5 if TotalMarks >=59: Lettergrade=('F') elif TotalMarks >=60 and TotalMarks<70: Lettergrade=('D') elif TotalMarks >=70 and TotalMarks<80: Lettergrade=('C') elif TotalMarks >=80 and TotalMarks<90: Lettergrade=('B') elif TotalMarks >=90 and TotalMarks<100: Lettergrade=('A') else: LetterGrade=('F') print('Student ',studentsLastName,'has a score of ',TotalMarks,'which gives a grade of:') #####when I run it I don't get the results that I need.

4th Apr 2020, 2:31 AM
alisha jones
alisha jones - avatar
1 Answer
+ 1
Assume the TotalMarks is 74. Because 74 >= 59, Lettergrade become 'F' and the other elif statements won't execute. You have to either reorder your if and elif statements or change condition to TotalMarks < ...
4th Apr 2020, 3:02 AM
你知道規則,我也是
你知道規則,我也是 - avatar