Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDidier Borel
2,837 Pointsfor loop print items
i don't quite see what I am doing wrong here
def loopy(items):
for:input("> ")
print(input)
if: input=="STOP":
break
3 Answers
Tatiana Perry
17,156 Pointsdef loopy(items):
for item in items:
if item == "STOP":
break
print(item)
The if/break statement needs to be inside the loop before print.
Didier Borel
2,837 Pointsthxs Tatiana,
2 questions. what is the difference between == and = (1 or 2 equal signs)
and how do we know that item is a word python will understand, and differentiaite from items? is there a list of words or variables that python knows. ?
thxs
Steven Parker
231,248 Points- Two signs (==) is a test: "are these equal?". Just one = is an assigment: "copy the right side to the left side".
- You're talking about reserved words / language keywords. They are listed in the offical python docs.
Didier Borel
2,837 Pointsthis Steven. that answers my question