Input function

Revision as of 14:39, 10 April 2011 by Smitschu (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In Python, the input function prompts the user for input. It has the following syntax

answer = input([prompt])

When called, it will print prompt to the screen, and wait for the user to type something and press enter. Then, the text the user entered is stored as a string in answer.

Because the user input is always stored as a string, to convert it to an integer or floating point number it's necessary to use one of Python's type conversion functions.

See Also

Python 3.2 Documentation