Lesson 1 · Python Foundation
Getting information from the user.
Everything you've written in Python so far does exactly the same thing every run. Useful for practice, boring as a program.
input() changes that. It stops the program, waits for the user to type something, and hands back what they typed:
name = input("What's your name? ")
print("Hello,", name)
This is the input step from Chapter 1, appearing in your own code for the first time.
Here's the thing that catches every single beginner, and now you're ready for it.
Whatever the user types, input() returns it as a string. Even if they type 25, you get "25" — text.
So this looks right and fails:
age = input("Your age? ")
print(age + 5) # TypeError!
You learned the fix last chapter — convert it:
age = int(input("Your age? "))
print(age + 5) # works
The int() wraps around the input(), converting the moment it arrives.
5 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.