+ 3
Practice # 23.2 -Tuitio Discount.
I can not solve this task. The system does not accept just part of the code where avr_score >= 80 and discount = 30 (test 3). It says there is no output (output should be discount 30) I tried to change the condition and add avr_score less <= 89. But this was not help. If anyone has an idea what is going on please help. sem1_score = int(input()) sem2_score = int(input()) discount = 0 avr_score = (sem1_score + sem2_score) / 2 if avr_score >= 90: discount = 50 print(discount) elif avr_score >= 80: discount = 30 print(discount) elif avr_score >= 70: discount = 10 print(discount)
11 Respostas
+ 2
Ura!!!! It has worked. I added the condition < 70 and it solved the task
Thanks Shail Murtaza a lot!!! And every one. Together we are STRONG! 💪
sem1_score = int(input())
sem2_score = int(input())
discount = 0
avr_score = (sem1_score + sem2_score) / 2
if avr_score >= 90:
discount = 50
print(discount)
elif avr_score in range(80, 90):
discount = 30
print(discount)
elif avr_score >= 70:
discount = 10
print(discount)
elif avr_score < 70:
discount = 0
print(discount)
else:
print()
# место для вашего кода
+ 2
unfortunately, i am not able to assist you with your question.
also, out of respect to the original poster and contributors of this post, it is considered innapropriate to use someone elses post to try get answers to your question that is not related to the original post. please start a new post. starting a new post with your specific request will provide better exposure to the right individuals that know more about what you are asking. additionally, it will allow others with similar questions to find your post and hopefully find answers.
+ 1
That is the updated code. I restored the first code and added < 70 to make sure what had been the problem.
sem1_score = int(input())
sem2_score = int(input())
discount = 0
avr_score = (sem1_score + sem2_score) / 2
if avr_score >= 90:
discount = 50
print(discount)
elif avr_score >= 80:
discount = 30
print(discount)
elif avr_score >= 70:
discount = 10
print(discount)
elif avr_score < 70:
discount = 0
print(discount)
# место для вашего кода
+ 1
Congratulations! 🥳
a small hint: you can not change the discount value every time, for example, if this value you need to have constant and unchangeable. you can simply output the desired value directly to print(50), print(10)... etc.
+ 1
Thanks Ярослав for hint I will certainly try next time.
+ 1
i dont understand it either. 🤷♂️
0
Your program will not give any output if your avg_score will be less then 70
0
Hi! you missed another, final range of numbers to compare
0
i dont have access to this exercise, so i cant confirm this. the only thing i can think that is missing is an else statement after 70.
example:
if >=90:
print
elif >= 80:
print
elif >=70:
print
else:
discount=0
print(discount)
0
Thank you for your responses. I have changed the code, I hope in the offered way. I am not sure about using the range in condition expressions.
Still the test 3 is wrong and hidden.
sem1_score = int(input())
sem2_score = int(input())
discount = 0
avr_score = (sem1_score + sem2_score) / 2
if avr_score >= 90:
discount = 50
print(discount)
elif avr_score in range(80,90):
discount = 30
print(discount)
elif avr_score >= 70:
discount = 10
print(discount)
else:
print()
# место для вашего кода
0
It is great that the task is solved. But I still can't understand the connection between the second condition (>= 80) and the last one (< 70). Why without the last one there was the problem with the second.... 🤔