I can't find my error, need help plss | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I can't find my error, need help plss

the problem is: The university gives students discounts on tuition fees depending on their performance: 90-100 => 50% 80-89 => 30% 70-79 => 10% 0-69 => 0% Write a program that will take the scores from the first and second semesters, then calculate the average score, and output the result, depending on the score. Sample Input 67 83 Sample Output 10 this is my lines: 1 name = input() 2 sem1 = int(input()) 3 sem2 = int(input()) 4 #your code goes here 5 average = (sem1 + sem2) / 2 6 if average <= 69 and average >= 0: 7 print("0") 8 elif average <= 79 and average >= 70: 9 print("10") 10 elif average <= 89 and average >= 80: 11 print("30") 12 else: 13 print("50")'' and when I try to run it it tells me EOFerror line 3

19th Aug 2020, 5:43 AM
Lorann Aziz
Lorann Aziz - avatar
10 Answers
+ 1
End of file error, make sure you have the correct number of inputs and each one is on its own line.
19th Aug 2020, 5:51 AM
JME
+ 2
score1 = int(input()) score2 = int(input()) ni = (score1 + score2) /2 if (ni >= 90 and ni <= 100): print('50') if (ni >= 80 and ni <= 89): print('30') if (ni >= 70 and ni <= 79): print('10') if (ni >= 0 and ni <= 69): print('0') try this one
30th Jun 2021, 8:23 AM
Hugues Rodrigue Tha Andela
Hugues Rodrigue Tha Andela - avatar
+ 2
score1 = int(input()) score2 = int(input()) ni = (score1 + score2) /2 if (ni >= 90 and ni <= 100): print('50') if (ni >= 80 and ni <= 89): print('30') if (ni >= 70 and ni <= 79): print('10') if (ni >= 0 and ni <= 69): print('0')
20th Dec 2021, 8:48 AM
Lema Kefyalew
Lema Kefyalew - avatar
+ 2
score1 = int(input()) score2 = int(input()) average = ((score1 + score2) // 2) if average >= 90: print(50) elif average >=80 and average<=89: print(30) elif average >=70 and average<=79: print(10) else: print(0)
8th Jan 2022, 2:03 PM
Ihor Princ
Ihor Princ - avatar
+ 1
done, thanks for explanation man !
19th Aug 2020, 6:04 AM
Lorann Aziz
Lorann Aziz - avatar
+ 1
remove the first line from the code name = input() is an error there only two input and the first input is taken by the name = input()
10th Oct 2020, 10:37 PM
Cipher
Cipher - avatar
+ 1
score1 = int(input()) score2 = int(input()) avescore = (score1 + score2)/2 #your code goes here if avescore >= 90 and avescore <= 100: print(50) elif avescore >= 80 and avescore <=89: print(30) elif avescore >= 70 and avescore <= 79: print(10) elif avescore >= 0 and avescore <=69: print(0)
20th Jul 2021, 5:59 AM
Jim
+ 1
sem_1 = int (input("Enter semester 1 : ")) sem_2 = int (input("Enter semester 2: ")) avg = (sem_1 + sem_2) /2 #avg = num / 2 #print (avg) if avg <= 100 and avg >=90: print ("50% off") elif avg <= 89 and avg >=80: print ("30% off") elif avg <= 79 and avg >= 70: print ("10% off") else: print ("0% off")
23rd Sep 2021, 9:37 PM
Devery Mcneely
Devery Mcneely - avatar
+ 1
sem1=int(input('Enter the semester 1 marks: ')) sem2=int(input('Enter the semester 2 marks: ')) avg=(sem1+sem2)/2 if(avg>=90 and avg<=100): print('50') elif(avg>=80 and avg<=89): print('30') elif(avg>=70and avg<=79): print('10') else: print('0')
21st Dec 2021, 5:04 PM
SANVIKA
+ 1
Below will work: score1 = int(input()) score2 = int(input()) score3 = (score1 + score2) / 2 if(score3 >= 90 and score3 <= 100): print('50') if(score3 >= 80 and score3 <=89): print('30') if(score3 >= 70 and score3 <= 79): print('10') if(score3 >= 0 and score3 <= 69): print('0') My initial code: #score1 = int(input()) #score2 = int(input()) #score3 = score1 + score2 / 2 #if(score3 >= 90 and score3 <= 100): # print('50%') # if(score3 >= 80 and score3 <=89): # print('30%') # if(score3 >= 70 and score3 <= 79): # print('10%') # if(score3 >= 0 and score3 <= 69): # print('0%') #NOTE: # 1. I did not have the parenthesis to calculate the average. # 2. My indentation was incorrect. # 3. My output had percentages. For some reason percentages cause an error. # Without the debugging of the above three points then I would not have successfully completed this practice.
5th Jan 2022, 5:26 PM
Frederick Samuels
Frederick Samuels - avatar