Course Content
Introduction to Python
Introduction to Python
Using 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:
price = 50 # Initial price price = price * (1 - 0.15) # Applying the discount print(price)
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.
Thanks for your feedback!
Using 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:
price = 50 # Initial price price = price * (1 - 0.15) # Applying the discount print(price)
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.
Thanks for your feedback!
Using 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:
price = 50 # Initial price price = price * (1 - 0.15) # Applying the discount print(price)
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.
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:
price = 50 # Initial price price = price * (1 - 0.15) # Applying the discount print(price)
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.