+ 2

Operator precedence

In the python course, control structures, the operator precedence part: It seems from the question that follows it (as I found on another website) that OR takes precedence over AND and NOT, yet in the list of operator precedence these 3 get grouped together on the same line.

15th Sep 2017, 9:32 AM
Fabian de Korver
Fabian de Korver - avatar
4 odpowiedzi
+ 2
you can send suggestions to info@sololearn.com(if not mistaken). regarding, tag, I do not know for sure. you can insert post as reference. the easiest way, is to create comment in the course. (you can post what I wrote , I will not claim author rights :)
15th Sep 2017, 10:23 AM
yuri
+ 22
https://docs.python.org/3/reference/expressions.html Look at the table at the bottom of the page.
15th Sep 2017, 9:37 AM
Nithiwat
Nithiwat - avatar
+ 2
try this in code playground and get the feelings. print(not True or False and True) the rule of thumb is not a is like -1 for numbers a and b is :like (1*0), works like multiplication, and is before addition, a or b is like addition (1+0) so ( - 1 + 0 * 1) should be false
15th Sep 2017, 9:52 AM
yuri
0
🇹🇭Nithiwat🇹🇭 that was the website I was talking about. yuri, first time I've seen it compared to numbers, makes it easier to see why certain operators should go first. Maybe they should add this precedence in the part of the course I referenced? Cause currently it seems like there is no precedence, like with plus and minus in math. ps: is there a way to tag or quote people?
15th Sep 2017, 10:01 AM
Fabian de Korver
Fabian de Korver - avatar