Floating point calculation problem

Chris Angelico rosuav at gmail.com
Sat Feb 2 06:20:12 EST 2013


On Sat, Feb 2, 2013 at 10:14 PM, Schizoid Man <schiz_man at 21stcentury.com> wrote:
> Scratch that, I'm not sure which result is right now, so need to look at the
> full calculations in details. What would be the difference between
> raw_input() and float(input())?
>
> Thanks again.

Depends on what you type in.

raw_input() takes a line from the keyboard (handwave) and returns it
as a string.

input() in 2.X takes a line from the keyboard and evaluates it as a
Python expression.

float() takes a string, float, int, etc, and returns the
nearest-equivalent floating point value.

What's the input you're giving to it?

ChrisA



More information about the Python-list mailing list