python int( ) function

Viewed 123601

The code below shows error if a decimal (eg. 49.9) is sent to next variable. Can you please tell me why? Why does int() converts it into an integer?

next=raw_input("> ")
how_much = int(next)
if how_much < 50:
    print"Nice, you're not greedy, you win"
    exit(0)
else:
    dead("You greedy bastard!")

If I dont use int() or float() and just use:

how_much=next

then it moves to "else" even if I give the input as 49.8.

5 Answers
Related