Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Write a python program to find the new score after applying a bonus to it. Take the scores as input from the user. Rules of applying bonus points on the given score are given below-

if the number is up to 100, the bonus score is 7.
If the number is larger than 100, the bonus score is 25% of the number.
If the number is larger than 1000, the bonus score is 15% of the number.
Additional bonus score (accrued separately from the previous ones):
for even numbers -> + 1 point.

for numbers that end with 6 -> + 2 points

What I have tried:

I am a beginner so I have tried this
if s<=100 :
T = s + 7
elif (s>100 and s<=1000) :
T = s + 25*s/100
elif s > 1000 :
T = s + 15*s/100
else :
T = T
if s % 2 == 0 :
T = T+1
else :
T = T
if s % 10 == 6 :
T = T+2
else :
T = T
print (T)
Updated 19-Apr-22 4:39am

I am a beginner so I am unable to start it.
There is a cure for that: read one (or more) of the many freely available tutorials on Python and then try harder. A good start could be: Python Conditions[^].
Share this answer
study lover 19-Apr-22 2:55am    
What should be the code for last point i.e.for numbers that end with 6 -> + 2 points
CPallini 19-Apr-22 3:08am    
You may use the % operator: (n % 10) evaluates to 6, if n ends with 6.
I am a beginner so I am unable to start it.

First step : Train yourself to solve the problem by hand with many scores.
As you solve the problem by hand, pay attention to which rule/condition apply to which score as rules are not mutually exclusive.
You should end up with a procedure which get the expected result, this is basically your algorithm.

- Learn one or more analyze methods, E.W. Djikstra/N. Wirth Stepwize Refinement/top-Down method is a good start.
Structured Programming.pdf[^][^][^][^][^]
Program Development by Stepwise Refinement[^]
Share this answer
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
Share this answer
study lover 19-Apr-22 3:54am    
I have added what I tried Can you please help me now?
OriginalGriff 19-Apr-22 4:14am    
Store the "bonus score" in a variable when you do the range check instead of printing anything.
Then do the additional two checks, and modify the bonus value as needed.
Finally, print the result by adding the total bonus score to the base score.
study lover 19-Apr-22 5:58am    
couldn't understand
OriginalGriff 19-Apr-22 6:22am    
What part do you not understand?
What part of it can you do, and what can't you do?
study lover 19-Apr-22 6:37am    
I haven't understand how to store in a variable

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900