0

number=int(input()) one=5.00 if number>1: number=(number*one)-(10/100)+(one+(one*(7/100))) print(number)#whats wr0n

Everything s right, but I want the decimal places to be two, but it outputs 3

27th Nov 2023, 12:04 PM
Keshav N
Keshav N - avatar
2 Answers
+ 6
You could use the 'round' function. https://code.sololearn.com/cYOgFS36e1ZH/?ref=app Another possibility is to use the 'format' method. Also, please use the sharing feature in the Code Playground to post code in the forum. edit: I added f-string and % operator methods in the code example.
27th Nov 2023, 12:43 PM
Keith
Keith - avatar
+ 3
Hey Keshav N, Try searching up 'precision handling python'. What you want to do can be described as increasing or decreasing the 'precision' of your calculations. It's pretty straight forward, have a look and lmk if you need anything else!
27th Nov 2023, 12:30 PM
Mohammed shoaib