CoderDojoSV / beginner-python

Create programs with Python! 6-week workshop
Past Project
51 stars 26 forks source link

Clarify the difference between raw_input and input #1

Closed cartr closed 11 years ago

cartr commented 11 years ago

We should explain the difference between raw_input and input (one returns a string, the other converts to a number). I've added an example that demonstrates that the return value of input("How old are you? ") is a number by adding 1 to it.

wescpy commented 10 years ago

Sorry I didn't see this earlier. We should actually avoid using/promoting/talking about input(). If we do talk about it, we should tell people to avoid it. It is a security hole and dangerous enough to be removed in 3.0 -- raw_input() is renamed to and replaces input(). (If people want the same functionality, then they can explicitly do an eval(input()) in 3.x.