Where am i getting it wrong ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Where am i getting it wrong ?

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 discount, depending on the score. Sample Input 67 83 Sample Output 10 Explanation Average of 67 and 83 is 75, which is in range of 70 to 79 and gets a 10% discount. Do not include the % symbol in the output.

17th May 2021, 9:04 AM
Lungisani
Lungisani - avatar
5 Answers
+ 1
score1 = int(input()) score2 = int(input()) #your code goes here av_score = (score1 + score2) / 2 if (av_score >= 70 or av_score <= 79): print ("10")
17th May 2021, 9:50 AM
Lungisani
Lungisani - avatar
+ 1
You have to use โ€œandโ€. maybe you can simplify (paeudo code) If avg < 70 => 0 Elif avg < 80 => 10 Elif avg < 90 => 30 Else => 50
17th May 2021, 10:10 AM
Eze
0
Share your code ๐Ÿ‘Œ
17th May 2021, 9:48 AM
Eze
0
Perhaps just add in the other options for possible discounts like Eze said and also yes 'and' because using or means your code would cover anything less than 79 and anything greater than 70, meaning any number but I'd you use and then it has to be between the two specified. Ex: 70-79
19th May 2021, 4:36 AM
SeveredData
SeveredData - avatar
0
Firstly, You have to consider all the cases using if else if conditionals. Secondly, For the 10% case in your average, you have used 'or' in your 'if condition', which should have been 'and' instead
19th May 2021, 7:27 AM
Aqib
Aqib - avatar