shift operator, ternary operator / conditional operator in python
print(4 >> 1) → 2 print(4 << 1) → 8 print(4 << 2) → 16 print(4 << 3) → 32 Left Shift: << Right Shift: >>. The ternary operator is a short way of writing an if-else condition in a single line. result = value_if_true if condition else value_if_false no1, no2 = 10, 20 result = 100 if no1 > no2 else 200 print(result) Because 10 > 20 is False, the value 200 is assigned to result. no1, no2, no3 = 10,…
We haven't written up this one. Dev.to has the full story — the link below goes straight to it.