Programming foundations

Stage 1 · Lesson 1 of 9

Variables, types and input

Your first language

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

Practise

  • Small exercises in your language track, with free feedback from a human mentor

Keep handy

  • The official tour: read the matching chapter after the course covers a topic

  • Quick syntax lookups and an online compiler for testing a snippet on a shared computer

Mark this stage as not done?