Code Monsters Academy
Home › Course contents › Level 4 - Roll Call
Looping over a list with for

Level 4 - Roll Call

Chapter 2 · Monster League

for doesn't only go with range — it can also take things out of a list one by one:

for m in team:
    print(m, "here!")

Each time around, m becomes the next member on the roster. Commas inside print let you say several things together.

GoalHave every member of the team say "Name here!"
TipPut the print line inside the for (indented 4 spaces).
Starting code
team = ["{PET}", "Lilywhisp", "Reefclaw"]
# Use for to make each member say "Name here!"
Practise this in the game
← Previous levelLevel 3 - New MembersNext level →Level 5 - True or False