Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
I didnt get that how the program understands that the object attempt_count is actually the number of attempts
I didnt get that how the program understands that the object 'attempt_count' is actually the number of attempts.I gave the object another name 'count' and it still worked.
Podrig Leoghain5,094 Points
attempt_count isn't the name of a previously defined function. It is the name of the variable which you specify in this code as starting at 1, and increasing by 1 (attempt_count += 1) every time the while loops (password invalid).
basically the repl doesn't recognize the keyword to mean the attempt count, but rather it uses the counter you designed to count up to three
The name of the variable doesn't matter. It just has to be a valid variable name.
Let me know if this helps here