Python Beginner problems

  python-3.x

So I was writing a code of reversing a number in python :-

def intreverse(n):
  m= 0
  while n>0:
    (d,n)= (n%10,n/10)
    m= 10*m + d 
  return(m)
print(intreverse(45))

I got my results but I was wondering , since in python3 we get a float number.But why not in the above case. Like If I take n=45 , then updating the n:=4.5 but python consider it as 4 . why though ?? please clarify the doubt of this noob.

Source: Python-3x Questions

LEAVE A COMMENT