to get total score, print just once at the end
aliens = ['red', 'red', 'red', 'red', 'red', 'blue', 'blue', 'blue', 'green', 'green'] current_score = 0 for alien in aliens: if alien == 'red': current_score = current_score + 5 elif alien == 'blue': current_score += 10 # this is alternative, same as current_score = current_score + 10 elif alien == 'green': current_score += 20 print(f'Total score: {current_score}') # this is using f-string that require python 3.6+That said, normally one will use dict instead of huge if/elif/else block (look at @DeaD_EyE example) or read https://python-forum.io/Thread-if-struct...dictionary
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs