Could anyone help me out with the output of this?!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Could anyone help me out with the output of this?!!

x=2 y=4 print(++x+++y) lt's output is 6. Could you explain how?

21st Sep 2017, 5:53 PM
P Poornima
P Poornima - avatar
2 Answers
+ 11
Python doesn't have post/pre increments. ++x is really just read as +(+x), where + is the identity operator. So, it doesn't really do anything.
21st Sep 2017, 6:02 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
thank you so much for ur help 😄
21st Sep 2017, 6:10 PM
P Poornima
P Poornima - avatar