Multiplication and division in Python | Sololearn: Learn to code for FREE!


Multiplication and division in Python

When I multiply 63 by (10/100), I get 6.300000000000001 but I want the output to be 6.30. How do I do that? I'm working on a code and I want my output to be in one or two decimal places but I don't know how to do that. If I multiply the same fraction by 70, I'll get 7.0. Can someone help me?

5/2/2022 7:54:36 AM

Gideon Ayivi

7 Answers

New Answer


write, ( 63 * 10 ) / 100, it will just give 6.3 Alternatively, πŸ‘‡πŸ‘‡ use str.format( ) do this way πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡


this will round up the resulting float number up to two digits after point. print(round(63*(10/100),2)) to make it easy to read: x = 63*(10/100) z = round(x,2) print(z)


Please go through string formatting It just take 3 min approx and u will have a understanding & the answer


It is work try it x = 63*(10/100) result = "{:.2f}".format(x) print(result)


i think this works: print(f"{63/(10/100):.2f}")



In python, to multiply number, we will use the asterisk character ” * ” to multiply number. After writing the above code (how to multiply numbers in Python), Ones you will print β€œ number ” then the output will appear as a β€œ The product is: 60 ”.