Quick actions

cmd+k|ctrl+k

Navigation

Languages

Python Web -L04 (Operators Precedence)

Snippet info

Language

Python

Visibility

public

Author

victormakwaitat

Created

2025-02-06T01:08:12.962858Z

Updated

2025-02-06T02:15:19.176328Z

#result = 7 - 4 + 3 * 6 / 2 ** 2 % 5 (original)
result = 7 - 4 + (((3 * 6) /(2 ** 2)) % 5)
print(result)

#result = 10 + 3 * 2 < 20 and 15 % 4 == 3 or not 5 - 3 * 2 > 0 (original)
result = (((10 + (3 * 2)) < 20) and ((15 % 4) == 3)) or (not ((5 - (3 * 2)) > 0))
print(result)

# LEAPYEAR : year is multiple of 4 and not multiple of 100 or year is multiple of 400
def mult_leapyear(y):
    return (y % 4 == 0 and not y % 100 == 0) or (y % 400 == 0)
print(mult_leapyear(2000))
print(mult_leapyear(2100))
INFO