0

I'm very new to python but I was wondering if there is a way to check if a float is an integer e.g if the float = 9.0

Gyro161
  • 19
  • 4

1 Answers1

0

Yes there is.

x = 9.0
if x.is_integer():
    print("It's an int!")
else:
    print("It's not what we wanted.")
JimmyCarlos
  • 1,934
  • 1
  • 10
  • 24