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

0

1 Answer 1

1

Yes there is.

x = 9.0 if x.is_integer(): print("It's an int!") else: print("It's not what we wanted.") 
Sign up to request clarification or add additional context in comments.

2 Comments

do I put what I want to happen in the brackets? if x.is_integer()
Yes, I've updated the answer for you. :-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.