Stage 1 · Lesson 1 of 9
Variables, types and input
A is a name that points to a value, and every value has a type. The basic data types are int for whole numbers, float for decimals, str for text and bool for True or False. Python works out types while the program runs, which is called .
So the same name can point to a number now and a string later. That is convenient, and also a common source of bugs. The first trap arrives with input(), which reads .
It always returns a string, so input("Age: ") + 1 fails until you convert it with int(). Use type() to check what you have. Also learn the difference between = (store a value) and == (compare two values). Everything else in this stage builds on reading and converting values correctly.
A question to check yourself, an AI practice session and 3 cheat sheet entries come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Python Fundamentals
Design Gurus · Beginner · $50
Beginner Python with an in-browser exercise after nearly every lesson
- CourseFreeCS50's Introduction to Programming with Python
Harvard University · Beginner
Free Harvard course whose weekly problem sets make you write real programs