0
What did I do 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 My solution: score1 = int(input(67)) score2 = int(input(83)) average = 75 if average is >= (90-100): print("50") elif average is >= (80-89): print("30") elif average is >= (70-79): print("10") elif average is >= (0-69): print("0")
4 ответов
+ 14
Something like this:
name = input()
#Name of the student.
sem1_score = int(input())
sem2_score = int(input())
average = (sem1_score + sem2_score )/2
if average >=90 and average <= 100:
print(50)
elif average >=80 and average <= 89:
print(30)
elif average >= 70 and average <=79:
print(10)
elif average >=0 and average <=69:
print(0)
+ 5
Nola Born
There is no is >= for comparison. Simply just write >=
Also you can't compare in range like (90-100)
Here should be:-
if average >= 90 and average < 100:
elif average >= 80 and average < 90:
+ 1
Simba Are you able to tag this user in comment?
Nola Born
Link is not working
0
#Here is the code that worked for me
#Python
#Tuition Discounts
#Use chaining multiple conditions to write a program that will calculate the average score and define tutition fee discounts.
score1 = int(input())
score2 = int(input())
average_score = (score1 + score2) / 2
if average_score >= 90:
print("50")
elif average_score >= 80 and average_score <= 89:
print("30")
elif average_score >= 70 and average_score <= 79:
print("10")
elif average_score <= 69:
print("0")