Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Operating With Variables | Variables
Introduction to Python | Mobile-Friendly
course content

Cursusinhoud

Introduction to Python | Mobile-Friendly

Introduction to Python | Mobile-Friendly

1. Python Basics
2. Variables
3. Strings

book
Operating With Variables

What can we do with the assigned variable? After creating variables with a specific value, you can access this value in the future by using the variable's name and performing available operations.

For example, we can use the variable chapter that was created several chapters ago. We can add 4 to find out the number of the current chapter. Suppose you want to use this value in the future. In that case, you need to create or reassign a new value to an existing variable.

123456
# Creating a variable chapter = 9 # Reassign variable chapter = chapter + 4 # Output modified value print(chapter)
copy

Suppose you have a variable level representing the current player's level. Suppose the player reaches the next level. You need to add 1 to the level variable and reassign the value.

question-icon

Fill in the blanks to complete the task.

# Initial level
level = 5
print("Level:", level)
= level
# Updated level
print("Level up! New level:", level)
Level: 5
Level up! New level: 6

Click or drag`n`drop items and fill in the blanks

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 5

Vraag AI

expand
ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

course content

Cursusinhoud

Introduction to Python | Mobile-Friendly

Introduction to Python | Mobile-Friendly

1. Python Basics
2. Variables
3. Strings

book
Operating With Variables

What can we do with the assigned variable? After creating variables with a specific value, you can access this value in the future by using the variable's name and performing available operations.

For example, we can use the variable chapter that was created several chapters ago. We can add 4 to find out the number of the current chapter. Suppose you want to use this value in the future. In that case, you need to create or reassign a new value to an existing variable.

123456
# Creating a variable chapter = 9 # Reassign variable chapter = chapter + 4 # Output modified value print(chapter)
copy

Suppose you have a variable level representing the current player's level. Suppose the player reaches the next level. You need to add 1 to the level variable and reassign the value.

question-icon

Fill in the blanks to complete the task.

# Initial level
level = 5
print("Level:", level)
= level
# Updated level
print("Level up! New level:", level)
Level: 5
Level up! New level: 6

Click or drag`n`drop items and fill in the blanks

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 5
Onze excuses dat er iets mis is gegaan. Wat is er gebeurd?
some-alt