There is a cure for that: read one (or more) of the many freely available tutorials onQuote:I am a beginner so I am unable to start it.

`Python`

and then try harder. A good start could be: Python Conditions[^].
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

s=int(input())

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)

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

I am a beginner so I have tried this

s=int(input())

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)

There is a cure for that: read one (or more) of the many freely available tutorials onQuote:I am a beginner so I am unable to start it.

`Python`

and then try harder. A good start could be: Python Conditions[^].
Permalink

Share this answer

v2

Comments

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`

.Quote:I am a beginner so I am unable to start it.

First step :

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

Structured Programming.pdf[^]

https://en.wikipedia.org/wiki/Top-down_and_bottom-up_design[^]

https://en.wikipedia.org/wiki/Structured_programming[^]

https://en.wikipedia.org/wiki/Edsger_W._Dijkstra[^]

https://www.cs.utexas.edu/users/EWD/ewd03xx/EWD316.PDF[^]

Program Development by Stepwise Refinement[^]

Permalink

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[^]

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[^]

Permalink

Share this answer

Comments

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.

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?

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

OriginalGriff
19-Apr-22 7:22am

You are kidding, right?

You can't write this code on your own:

You can't write this code on your own:

`bonus = 0`

Or this:`bonus = bonus + 1`

study lover
19-Apr-22 10:39am

I have updated my try still there is some error

OriginalGriff
19-Apr-22 10:56am

Did you actually read what I said, or just skim it and hope it'll work?

Read your code, and read what I suggested you did instead. See the difference?

Read your code, and read what I suggested you did instead. See the difference?

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