+ 1

Tuition discount python lesson

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 i got task 1 and 2 but 3 is hidden? what do i have to do to satisfy the task? and how could i improve my code i feel like i put to much. my code score1 = int(input()) score2 = int(input()) #your code goes here if score1 <=69 and score2 >=83: print(int(10)) if score1 >=87 and score2 >=95: print(int(50))

2nd Jan 2022, 4:13 PM
Mike
10 Antworten
+ 1
score1 = int(input()) score2 = int(input()) avg = (score1 + score2 )/2 if avg >=90 and avg <= 100: print(50) elif avg >=80 and avg <= 89: print(30) elif avg >= 70 and avg <=79: print(10) elif avg >=0 and avg <=69: print(0)
3rd Jan 2022, 2:27 AM
NEZ
NEZ - avatar
+ 3
You need to print these values for average of both scores. 90-100 means 90 <= average_score <= 100 and so on
2nd Jan 2022, 5:04 PM
Simba
Simba - avatar
0
Why don't you add score1 and score2. Divide the result by 2. With the sample input you get 67 + 83 = 150. 150 / 2 = 75. With 75 you get a 10% discount.
2nd Jan 2022, 5:03 PM
Paul
Paul - avatar
0
Paul and Simba iv also done that it looks like this Average=score1+score2/2 If Average >=75: Print(int(10)) If Average >=91: Print(int(50)) Output now is 10 50 Instead of them being seperate outputs.
2nd Jan 2022, 5:06 PM
Mike
0
score1 = int(input()) score2 = int(input()) avg= (score1 + score2)/2 if avg>=70 and avg<=79: print('10') elif avg >=90 and avg ==100: print('50')... that's not the complete code, do the rest
2nd Jan 2022, 5:07 PM
NEZ
NEZ - avatar
0
Explanation: If you got 67 and 83 it will be 150 and avg will be 75 Then 75 comes in the range 70-79: then we will print: 10 If you got 82 and 51 then the sum will be 133 and avg will be 66.5 which comes in the critera 0-69:0% then you will print: 0
2nd Jan 2022, 5:11 PM
NEZ
NEZ - avatar
0
NEZ i tried it but it only outputting task 1 now task 2 doesnt output anything and neither does 3 which is resulting in a incomplete. when i use my old code it completes task 1 and 2. im stuck.
2nd Jan 2022, 6:34 PM
Mike
0
hey NEZ your code worked!. Thank you!. Do you happen to know why mine didn't?
5th Jan 2022, 3:50 PM
Mike
0
See your values you didn't gave relevant vals edit]: your code wasn't completed, see your range
6th Jan 2022, 2:03 AM
NEZ
NEZ - avatar
0
NEZ unfortunately I'm not sure what you Mean.
6th Jan 2022, 3:00 AM
Mike