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.

Python Python Basics Functions and Looping While Loops

Amy Tomey
Amy Tomey
11,732 Points

even the right password is wrong...

here is my code... is there is a difference, I can't see it.

import sys


password = input("Please enter the super secret password:  ")
attempt_count = 1
while password != 'openseseme':
    if attempt_count > 3:
        sys.exit("Too many invalid password attempts")
    pasword = input("Invalid password, try again:  ")
    attempt_count += 1
print("Welcome to Secret Town")

what I got was: treehouse:~/workspace$ python password_checker.py
Please enter the super secret password: 1234567
Invalid password, try again: 234567
Invalid password, try again: openseseme
Invalid password, try again: 1234567
Too many invalid password attempts

What am I missing?

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 67,893 Points

Hey Amy Tomey, there is a typo.

The inner input is assigned to pasword instead of password

Post back if you need more help. Good luck!!!

Amy Tomey
Amy Tomey
11,732 Points

THANKS! I couldn't see the forest for the trees.