⊗pyPmBsMOP 11 of 208 menu

Precedence of Mathematical Operations in Python

Python's mathematical operations have the same precedence as in regular mathematics. That is, multiplication and division are performed first, and then addition and subtraction. In the following example, 2 is first multiplied by 2, and then 3 is added to the result:

res = 2 * 2 + 3 # 7 (result 4 + 3) print(res)

The following code is given:

res = 2 + 3 * 4 print(res)

Tell me what will be output to the console.

The following code is given:

res = 10 - 6 / 3 print(res)

Tell me what will be output to the console.

The following code is given:

res = 10 - 6 * 3 - 5 print(res)

Tell me what will be output to the console.

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