1

I was trying to teach a Python lesson to my son, and we are having a little problem... Can someone explain to me how this is happening?

PS >>>> python3
Python 3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from fractions import Fraction
answer = float(input("give me your number: ")) 
give me your number: .58

print ("your number in fraction is", Fraction(answer))
your number in fraction is 5224175567749775/9007199254740992

print ("your number in percent is ", 100*answer,"%")  
your number in percent is  57.99999999999999 %
martineau
  • 119,623
  • 25
  • 170
  • 301
poteus
  • 11
  • 1

0 Answers0