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

Course Content

Introduction to Python

Introduction to Python

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

bookUsing Variables

In the first lesson of this section, you set up a variable named chapter. Now, how can we tweak or change variables we've already set up? The good news is, you can adjust them just like you did with the values in the previous lessons.

Let's say you've got the cost of an item saved in the price variable and you want to apply a 15% discount. You can simply reassign the updated value like this:

123
price = 50 # Initial price price = price * (1 - 0.15) # Applying the discount print(price)
copy

Task

Since you first set up the chapter variable, you've gone through two more chapters. Add 2 to the chapter variable and reassign this new value to it.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 3
toggle bottom row

bookUsing Variables

In the first lesson of this section, you set up a variable named chapter. Now, how can we tweak or change variables we've already set up? The good news is, you can adjust them just like you did with the values in the previous lessons.

Let's say you've got the cost of an item saved in the price variable and you want to apply a 15% discount. You can simply reassign the updated value like this:

123
price = 50 # Initial price price = price * (1 - 0.15) # Applying the discount print(price)
copy

Task

Since you first set up the chapter variable, you've gone through two more chapters. Add 2 to the chapter variable and reassign this new value to it.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 3
toggle bottom row

bookUsing Variables

In the first lesson of this section, you set up a variable named chapter. Now, how can we tweak or change variables we've already set up? The good news is, you can adjust them just like you did with the values in the previous lessons.

Let's say you've got the cost of an item saved in the price variable and you want to apply a 15% discount. You can simply reassign the updated value like this:

123
price = 50 # Initial price price = price * (1 - 0.15) # Applying the discount print(price)
copy

Task

Since you first set up the chapter variable, you've gone through two more chapters. Add 2 to the chapter variable and reassign this new value to it.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

In the first lesson of this section, you set up a variable named chapter. Now, how can we tweak or change variables we've already set up? The good news is, you can adjust them just like you did with the values in the previous lessons.

Let's say you've got the cost of an item saved in the price variable and you want to apply a 15% discount. You can simply reassign the updated value like this:

123
price = 50 # Initial price price = price * (1 - 0.15) # Applying the discount print(price)
copy

Task

Since you first set up the chapter variable, you've gone through two more chapters. Add 2 to the chapter variable and reassign this new value to it.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 2. Chapter 3
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt