Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (16.4k points)
I am Working on Converting the estimation of the foot to inches where 1 foot = 12 inches. I am ascertaining the height of an individual in inches. ex. 5.11 an individual of stature 5 foots and 11 inches implies absolute 71 inches. Is there any path in Python so I can isolate the int part and float part of float number for further calculations? any proposals are welcome.

1 Answer

0 votes
by (26.4k points)

You can actually use int(), if you want integer of a float



If you want to seperate the float, just subtract the float with int:

>>>5.1 - int(5.1)


To get the modulus of the float with 1:

>>> 5.1 % 1

0.09999999999999964 #use the round() function if you want 0.1

Interested to learn python in detail? Join python course fast!!

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 24, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer

Browse Categories