White Hat – Python Foundations
beginner15 XP

Variables & Data Types

Store information using variables and understand strings, numbers, and booleans

Variables & Data Types

A variable is like a labelled box — you put something inside it and refer to it by name.

Creating Variables

Python
name = "Alex"        # string
age = 12             # integer
height = 1.52        # float
is_student = True    # boolean

Type Conversion

Python
number_text = "42"
number = int(number_text)   # "42" → 42
print(number + 8)            # 50

String Concatenation

Python
first = "Hello"
second = "World"
print(first + " " + second)  # Hello World
⌨️

Type it yourself

Don't just read it — type the example from above into the box, press Run ▶, and watch what happens. Typing it yourself is how it really sticks! Stuck? Tap Show example.

Python · Playground
Output
Press ▶ Run to see your code come to life…

Quick check

01/3

Which data type stores text like a player's name?