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 trial

Python Python Basics (2015) Number Game App Number Game Refinement

Ashikur Rahman
seal-mask
.a{fill-rule:evenodd;}techdegree
Ashikur Rahman
Python Web Development Techdegree Student 932 Points

Problem with the loop

Hi! My code not looping second time as like first time. Also the while loop iterating 6 time while my condition is less than or equal to 5.

My code is here. Visit the link

https://repl.it/JURB/0

1 Answer

Emmanuel C
Emmanuel C
10,636 Points

For the iteration part, you made guesses an array, which in most languages arrays are zero based. So when you have len(guesses) <= 5 it will go from 0 to 5, which is 6 iterations. Simply make it less than instead of less than OR EQUAL to 5.