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 trialSal Mike
71 PointsI have two questions regarding this Lesson. 1. About the empty Search variable, 2. Why dont we use FOR Loop.?
I have two questions regarding this Lesson.
- About the empty Search variable, Why do we have to enter an empty search variable in the end.
- Why dont we use For Loop, and how do we use it.?
- My code does not prints the message just as in the tutorial. It does it only when I 'quit' the loop. Why is that.?
Please help
3 Answers
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsAbout the empty Search variable, Why do we have to enter an empty search variable in the end. the search variable is being declared at the beginning because it's going to be used multiple places (going to make sense when you learn about scope)
Why dont we use For Loop, and how do we use it.? because a for-loop only runs x-times and a while-loop runs until it's told to stop.
My code does not prints the message just as in the tutorial. It does it only when I 'quit' the loop. Why is that.? kinda hard to tell because you didn't provide any code :-)
Stephen Chamroeun
7,095 PointsJust by looking at your code, it looks like the search variable was not declared in the beginning. if your search is not declared with the var keyword, then your while condition is not going to work.
pat barosy
6,759 PointsI'm also having trouble understanding empty variables. How am I supposed to know when to use them in my code?
Sal Mike
71 PointsSal Mike
71 PointsCan you please explain a lil bit ; why do we use empty search variable in the beginning.?
Sal Mike
71 PointsSal Mike
71 PointsMy code does not prints the message just as in the tutorial. It does it only when I 'quit' the loop. Why is that.?
https://w.trhou.se/nhteg4ilcg