Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele How to Store Numbers in Python | Variables and Types in Python
Introduction to Python
course content

Kurssisisältö

Introduction to Python

Introduction to Python

1. First Acquaintance with Python
2. Variables and Types in Python
3. Conditional Statements in Python
4. Other Data Types in Python
5. Loops in Python
6. Functions in Python

book
How to Store Numbers in Python

Variables in programming serve as storage units for data, allowing you to reuse values without recalculating them each time. Instead of repeating the math, you can store the result in a variable and access it whenever needed.

To remember a value for later, we give it a name by using a variable. The equals sign = lets us set a value for that variable.

12345678910
# Monthly salary salary = 4000 # Expenses rent = 1200 groceries = 500 # Calculate remaining balance balance = salary - rent - groceries print("Remaining balance:", balance)
copy
question mark

Which statement correctly explains how variables work?

Select the correct answer

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 1
Pahoittelemme, että jotain meni pieleen. Mitä tapahtui?
some-alt