⊗pyPmBsMOV 9 of 208 menu

Mathematical Operations with Variables in Python

Mathematical operations can be performed not only on numbers, but also on variables. Let's find the sum of the values ​​of two variables:

num1 = 1 num2 = 3 print(num1 + num2) # 4

It is not necessary to immediately output the result of the operation; you can first write it to some variable, and then output the value of this variable:

num1 = 1 num2 = 3 res = num1 + num2 # write the sum to the variable res print(res) # 4

Two numbers are given:

num1 = 5 num2 = 3

Find the sum of these numbers.

Two numbers are given:

num1 = 10 num2 = 6

Find the difference between these numbers.

Two numbers are given:

num1 = 7 num2 = 3

Find the product of these numbers.

Two numbers are given:

num1 = 15 num2 = 6

Find the quotient of these numbers.

Change the solution to the previous problem so that when dividing, the quotient is obtained without a remainder.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline