+ 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.
5 Respostas
+ 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")
+ 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
0
Share your code 👌
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
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