Skip to content

Tag: operators

Using multipe operators in Python sequentially

I’m trying to understand how Python handles using multiple sequential operators to add and subtract numbers. Here is an example of what I mean: I don’t understand what decides whether to add or subtract these two integers. I’ve used Python 3.11.1 for this example. Answer To understand how th…

New operators in Python

We can define intrinsic operators of Python as stated here. Just for curiosity, can we define new operators like $ or ***? (If so, then we can define ternary condition operators or rotate operators.) Answer Expanding on @fasouto answer, but adding a bit more code. While you cannot define new operators AND you…