ในกรณีที่มีตัวดำเนินการหลายตัวในประโยคเดียวกัน ไพธอนจะดำเนินการตามลำดับความสำคัญดังนี้:
***,/,//,%+,-<,>,<=,>=,==,!=notandor
ตัวอย่างการใช้ตัวดำเนินการ
Python
x = 10
y = 5
sum = x + y # 15
difference = x - y # 5
product = x * y # 50
quotient = x / y # 2.0
floor_division = x // y # 2
remainder = x % y # 0
is_equal = x == y # False
is_greater = x > y # True
is_true = (x > 5) and (y < 10) # True