How to convert a Decimal to Number(with decimal numbers) in Python

Question:

Suppose, I have a decimal expansion 2.896. I want to convert it to something like 2896. How can I achieve this in Python?

Asked By: Ankesh Anand

||

Answers:

Try this;

n = 2.896
n1 = int(str(n).replace(".",""))
Answered By: Sachin Kohli
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.