Lesson 2 of 34

Variables: Storing Values

7 min 20 XP

A variable is like a box that stores a value. We put a value into the box using =.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

You can change a variable's value at any time. Using a comma (,) inside print() adds a space between values automatically.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

Variable names: letters, numbers and _ only. They can't start with a number or contain spaces. name and Name are different variables.

Challenge

+20 XP

Create two variables, course = "Python" and fees = 4000, then print: Course: Python Fees: 4000

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.