forloop_loopingthroughalist

Run Settings
LanguagePython
Language Version
Run Command
print("for loops") print() # Looping through at list of integers numbers = [12, 13, 14, 15, 16, 17] total = 0 print("Looping through at list of integers") for number in numbers: print(number) total = total + number # Addtion + print("Total: " + str(total)) print() # Looping through a list of strings numbers = ['12', '13', '14', '15', '16', '17'] total = "" # a string variable, "" is the empty string print("Looping through a list of strings") for number in numbers: print(number) total = total + number # Not addtion, but concatenation print("Total: " + total) print() # Looping through at string beans = "this is a test" # FYI: A space is also a character, if not a letter. print("Looping through at string") for letter in beans: print(letter) print(beans) # THE END
Editor Settings
Theme
Key bindings
Full width
Lines