Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

canuckfan34

  • 3 years ago

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

  • This Question is Closed
  1. rsmith6559
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    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.

  2. canuckfan34
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy