Course Content
Python Tutorial for Beginners
Python Tutorial for Beginners
Math expressions: Familiar operators
You can assign the result of a math expression to the variable.
lucky_number = 3 + 4
This displays 7 on the screen.
Here is a statement that subtracts 45 from 30, assigning the result, -15, to the variable.
loss = 30 - 45
This one assigns the product of 5 times 4 — the result is 20 — to the variable.
dozens = 5 * 4
This one assigns 36 divided by 9 — the result is 4 — to the variable.
number = 36 / 9
Task
Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.
Thanks for your feedback!
Math expressions: Familiar operators
You can assign the result of a math expression to the variable.
lucky_number = 3 + 4
This displays 7 on the screen.
Here is a statement that subtracts 45 from 30, assigning the result, -15, to the variable.
loss = 30 - 45
This one assigns the product of 5 times 4 — the result is 20 — to the variable.
dozens = 5 * 4
This one assigns 36 divided by 9 — the result is 4 — to the variable.
number = 36 / 9
Task
Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.
Thanks for your feedback!
Math expressions: Familiar operators
You can assign the result of a math expression to the variable.
lucky_number = 3 + 4
This displays 7 on the screen.
Here is a statement that subtracts 45 from 30, assigning the result, -15, to the variable.
loss = 30 - 45
This one assigns the product of 5 times 4 — the result is 20 — to the variable.
dozens = 5 * 4
This one assigns 36 divided by 9 — the result is 4 — to the variable.
number = 36 / 9
Task
Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.
Thanks for your feedback!
You can assign the result of a math expression to the variable.
lucky_number = 3 + 4
This displays 7 on the screen.
Here is a statement that subtracts 45 from 30, assigning the result, -15, to the variable.
loss = 30 - 45
This one assigns the product of 5 times 4 — the result is 20 — to the variable.
dozens = 5 * 4
This one assigns 36 divided by 9 — the result is 4 — to the variable.
number = 36 / 9
Task
Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.