In python, to shorten assignments like this, a=a+b we use a+=b right? (assuming the variables a & b are pre-defined) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In python, to shorten assignments like this, a=a+b we use a+=b right? (assuming the variables a & b are pre-defined)

So my question here is, does this work on all operators like %, // & -? Check out my code, thanks ☺️ https://code.sololearn.com/c7u7dyH64NF3/?ref=app

31st Aug 2018, 10:17 AM
Eyob G. Hagos
Eyob G. Hagos - avatar
3 Answers
+ 3
Yes it does work! Feel free to try it out. Take a look at the documentation of in-place operators in python on sololearn or do a search online.
31st Aug 2018, 10:34 AM
Saithama
+ 2
of course.that's absolutely work.you must try it by yourself.coding is about practice and explore any possibilities
31st Aug 2018, 10:54 AM
Nafis Arinda Rizky Putra Handoko
Nafis Arinda Rizky Putra Handoko - avatar
0
Okay, thanks man
31st Aug 2018, 10:37 AM
Eyob G. Hagos
Eyob G. Hagos - avatar