Welcome to the Treehouse Community
Looking to learn something new?
Shazad Kazi10,758 Points
The Solution, Converting the player guess into an int?
I assumed that this bit of code would convert the player guess without causing an exception. However, when testing the game the player cannot enter a number with a decimal even if it is a whole number e.g 3.0 for 3
try: player_num = int(guess) except: print("That's not a whole number!") break
so if my guess was 5.5 it would've converted it to 5.
For example if this was typed in the shell?
a = 5.5 int(a)
Hanley Chan27,771 Points
This should work:
try: player_num = int(float(guess)) except: print("That's not a whole number!") break