0

who know the output if this code??

print(3++ + ++5) in interpreter what is output +-×÷

3rd May 2017, 1:02 PM
moon
11 Answers
+ 21
My initial thoughts were that it would be throwing errors, since prefix/postfix operators do not exist in Python. But yeah, @Mohammad @Tobi should be correct.
3rd May 2017, 2:11 PM
Hatsy Rei
Hatsy Rei - avatar
+ 14
i agree with @Mohammad and @Tobi
3rd May 2017, 2:08 PM
Agus Mei
Agus Mei - avatar
+ 6
++ is a operator (increment) in javascript but python doesn't have ++ operator. maybe ++ indicating that the number is positive integer here. so 3 + 5 = 8 P.S. I am a newbie in python. Just started the lesson.
3rd May 2017, 1:28 PM
Apel Mahmod
Apel Mahmod - avatar
+ 6
My guess would be, that the the last four of the plusses are evaluated as the unary plus operator, which just does nothing on integers.
3rd May 2017, 1:53 PM
Tob
Tob - avatar
+ 3
8 is an output 😅😅😅 in my interpreter Why not error
3rd May 2017, 1:03 PM
Nithiwat
Nithiwat - avatar
+ 3
@moon it's on C++.. Sorry 😮
3rd May 2017, 2:17 PM
Bilal E
Bilal E - avatar
0
@ nithiwat correct answer!!
3rd May 2017, 1:04 PM
moon
0
10 is an output
3rd May 2017, 1:04 PM
Ihtesham Qazi
Ihtesham Qazi - avatar
0
my interpreter is 8
3rd May 2017, 1:05 PM
moon
0
why ?? help pls this is python code
3rd May 2017, 1:06 PM
moon
- 1
It'll be 9. ++5: increment to 6 and then execute the code. 5++: execute the code first, then increment to 6. ++3+++5=10 ++3+5++=9 3+++++5=9 3+++++5=10 Hope you got it
3rd May 2017, 2:04 PM
Bilal E
Bilal E - avatar