Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Math expressions: Familiar operators | Variables in Python
Python Tutorial for Beginners
Section 2. Chapitre 4
single

single

Math expressions: Familiar operators

Glissez pour afficher le menu

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

1
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.

1
loss = 30 - 45

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

1
dozens = 5 * 4

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

1
number = 36 / 9
Tâche

Glissez pour commencer à coder

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

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 4
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt