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 trialPhillip Bailey
1,822 PointsI created a response variable, and asked the question, but I couldn't figure which loop to run to keep testing it.
Task: create a team roster and keep asking the user to add names unless they say no. Then print the team roster, and index the players, etc.
During this challenge, I could successfully ask and input the proper data once. I then tried to iterate and keep asking questions by nesting an if else statement. I then wondered based on PEP 20, would it be better to have a clean and simple while loop to test if the user wanted to keep adding to the roster or be done. I'm still new to this, it's my first night here so any tips would be very helpful. I feel like I'll really be a strong coder after this track.
1 Answer
ado
1,719 PointsHi Phillip, you are correct, using while loop is better. While response variable is yes, you can keep adding players. You can change the value of response variable inside the loop to control it with another input function. Good luck!