App 3: Password Generator & Checker / Build the password tool
Lesson 8 of 10
Hide what you type
getpass hides the password while the user types it, like a real login screen. Never print a password back to the screen.
Key points
- from getpass import getpass
- Typing is invisible
- Don't print the password
from getpass import getpass
pw = getpass("Password to check: ")
print(f"Score: {score(pw)}")Your turn
Switch the checker to getpass.
Quiz · +10 XP
What does getpass do?
Log in to save progress and earn XP.