0
What does ++a means in PYTHON?
I saw it in one challenge: def f(x, y): t= x%y ++t return t * x + y (returns 13)
4 Antworten
+ 18
There is no prefix operator in Python, unlike in other programming languages.
++a here does nothing. It simply places the addition operator twice in front of the variable. Take for example when a = 5,
a = 5
-a = -5
--a = 5
+a = 5
++a = 5
And because the values are not even printed, the original value of the variable will not be changed.
0
And I tried this:
a=0
++a
print(a)
And result was 0
0
First
I forgot to put
print(f(5, 3))
Second
I thank you all for trying, but you didn't help me. I actually just got confused for a moment and thought % means //.
- 4
it means t = t + 1