Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

int ("12.34")

Name: anonymous 2013-05-03 2:02

Hey guys, just a basic Python question here....

Why can I int () the string "12" but I cannot int ()the string "12.34"?  I know int () will round the decimal down, but instead of getting "12" for my answer I get an error message.  Why is this?

http://gyazo.com/cc8828227b59344751332da80184406c.png
^example above

Name: Anonymous 2013-05-03 3:13

int expects a string representation of... an integer. "12.34" is not that. You could try int(float("12.34")).

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-05-03 6:26

RTFM

INGTGTFYTT

Name: Anonymous 2013-05-03 13:57

12.34 is not an integer, believe it or not.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List