Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Math expressions: Familiar operators | Variables in Python
Python Tutorial for Beginners
course content

Contenido del Curso

Python Tutorial for Beginners

Python Tutorial for Beginners

1. Introduction to Programming
2. Variables in Python
3. Comments
4. If...Else Statement

Math expressions: Familiar operators

You can assign the result of a math expression to the variable.

1
lucky_number = 3 + 4
copy

This displays 7 on the screen.

Here is a statement that subtracts 45 from 30, assigning the result, -15, to the variable.

1
loss = 30 - 45
copy

This one assigns the product of 5 times 4 — the result is 20 — to the variable.

1
dozens = 5 * 4
copy

This one assigns 36 divided by 9 — the result is 4 — to the variable.

1
number = 36 / 9
copy

Tarea

Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.

Tarea

Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 2. Capítulo 4
toggle bottom row

Math expressions: Familiar operators

You can assign the result of a math expression to the variable.

1
lucky_number = 3 + 4
copy

This displays 7 on the screen.

Here is a statement that subtracts 45 from 30, assigning the result, -15, to the variable.

1
loss = 30 - 45
copy

This one assigns the product of 5 times 4 — the result is 20 — to the variable.

1
dozens = 5 * 4
copy

This one assigns 36 divided by 9 — the result is 4 — to the variable.

1
number = 36 / 9
copy

Tarea

Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.

Tarea

Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 2. Capítulo 4
toggle bottom row

Math expressions: Familiar operators

You can assign the result of a math expression to the variable.

1
lucky_number = 3 + 4
copy

This displays 7 on the screen.

Here is a statement that subtracts 45 from 30, assigning the result, -15, to the variable.

1
loss = 30 - 45
copy

This one assigns the product of 5 times 4 — the result is 20 — to the variable.

1
dozens = 5 * 4
copy

This one assigns 36 divided by 9 — the result is 4 — to the variable.

1
number = 36 / 9
copy

Tarea

Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.

Tarea

Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

You can assign the result of a math expression to the variable.

1
lucky_number = 3 + 4
copy

This displays 7 on the screen.

Here is a statement that subtracts 45 from 30, assigning the result, -15, to the variable.

1
loss = 30 - 45
copy

This one assigns the product of 5 times 4 — the result is 20 — to the variable.

1
dozens = 5 * 4
copy

This one assigns 36 divided by 9 — the result is 4 — to the variable.

1
number = 36 / 9
copy

Tarea

Divide the variable total by 3 and assign the result to the variable result. Display these 2 variables(total, result) on the screen.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 2. Capítulo 4
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt