+ 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))
10 Respuestas
+ 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)
+ 3
You need to print these values for average of both scores.
90-100 means 90 <= average_score <= 100 and so on
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.
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
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
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.
0
hey NEZ your code worked!. Thank you!. Do you happen to know why mine didn't?
0
See your values you didn't gave relevant vals
edit]: your code wasn't completed, see your range
0
NEZ unfortunately I'm not sure what you Mean.