- 1

Can some one explain me the precedence and associativity of the operators in python 3 please

28th Jan 2020, 5:54 AM
juuzou
juuzou - avatar
3 Antworten
+ 3
juuzou Please don't spam the QA section with irrelevant questions. The app has all the answers, you just need to search/look for them. https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2280/?ref=app
28th Jan 2020, 6:12 AM
Mihai Apostol
Mihai Apostol - avatar
0
some operators go first disregaring order in which they are seen on the screen. for example: 1 + 2 * 3 == 7 because * has precedence over + so * is done first 2*3 = 6 1+6 = 7
28th Jan 2020, 6:02 AM
Brave Tea
Brave Tea - avatar
0
+ sign: Plus (5 + 6 = 11) - sign: Minus (5 - 6 = -1) * sign: Multiply (5 * 6 = 30) / sign: Divide (6 / 4 = 1.5) % sign: Remaining (4 % 6 = 2, 2 % 10= 0) // sign: Divide without decimal (5 // 2 = 2, 10 // 8 = 1) Note that it doesn't round the number up, it simply removes it, so even a result of a division that is 1.9, it'll turn to 1.
28th Jan 2020, 6:05 AM
coddy
coddy - avatar