Why the first one | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why the first one

Python uses special operator' ++'as a shortcut for which of the following? 1. none of these 2. x+=1 3. x=+1

23rd Feb 2020, 11:37 AM
QinghuiFox
QinghuiFox - avatar
8 Answers
+ 2
QinghuiFox that means that ++ is invalid in Python. Just like Utkarsh Sharma said. Try out these problems yourself. You will learn a lot. You are always your best teacher. Happy coding👍
23rd Feb 2020, 11:57 AM
XXX
XXX - avatar
+ 3
++ is not used in python instead of i++ There is i+=1
23rd Feb 2020, 11:47 AM
Utkarsh Sharma
Utkarsh Sharma - avatar
+ 2
Trying it out in code playground is better than guessing and asking. It's just 2 lines of code.
23rd Feb 2020, 11:44 AM
XXX
XXX - avatar
+ 1
Yes I did, but the answer is the first one, I don't know why the second one isn't right
23rd Feb 2020, 11:52 AM
QinghuiFox
QinghuiFox - avatar
0
I think the second is right maybe it is a simple question, I am stupid
23rd Feb 2020, 11:40 AM
QinghuiFox
QinghuiFox - avatar
0
ok Thanks for your help
23rd Feb 2020, 12:04 PM
QinghuiFox
QinghuiFox - avatar
0
The second one is not correct because is not the answer to the question. The question si about the '++' operator NOT about how can you increment by 1 in python.
11th May 2020, 2:51 PM
Adrian Lazar
Adrian Lazar - avatar