Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 16 Online
OpenStudy (anonymous):

for this bit of codesumDigits = 0 for c in str(1952): sumDigits += int(c) print sumDigits the += can someone explain what it means in laymans terms, i get that it means adding but why is the equal sign always there in that type of code

OpenStudy (rsmith6559):

It's just a shorthand for: sumDigits = sumDigits + int( c ); It saves having to write sumDigits twice, but still assigns ( '=' ) the sum of sumDigits + int( c ) to sumDigits.

OpenStudy (anonymous):

Thanks, that is exactly what I need to know. :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!