+ 2
Increment & decrement operators [python]
Okay so I've read that in python, the operators '++', '--' etc. are not implemented (like in c++). I also get the reason behind: they are not needed as often, thanks to iteration with range(8), and so on. But then what exactly happens when someone does use them? After testing: c = 0 c = ++c # seemingly nothing changes c = c++ # throws syntax error
2 Answers
+ 2
you cannot use this operators, because they are not implemented
when you do c=++c, it is something like c= -c. The second changes the sign of the number. When you use + instead of -, it doesn't change the sign. ++c is the same operation applied twice, so c=++c is the same as c=c
+ 1
thanks, makes sense
Hot today
Python — File Handling
0 Votes
Help me solve this (using loop)
3 Votes
What is wrong? Error on test.
1 Votes
Help me wiht python
1 Votes
Question is write a c program to print prime numbers up to n and print the largest number in array.
1 Votes
Help me
0 Votes