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 trialvamosrope14
14,932 PointsWould having correctGuess=True written out twice count as reptitive code?
.
2 Answers
Steven Parker
231,236 PointsThis is not a case of unnecessarily repeating code. These lines occur inside conditional tests for different things, including testing answers from different questions.
The same job is needing to be done under different conditions, so these lines are not redundant.
Ar33ss Leon
4,621 PointsHe is just giving you an example how nesting works. I think the best way to deal with it is using a loop statement.
Steven Parker
231,236 PointsI might describe this example as being more about "branching" than "nesting". If it were "nesting", you'd be less likely to see the same variable being updated in several places.