🔐
课程 12 · 年级 P1
Project: password checker
📖 课程
──▶
🎯 测验——选择翻译
──▶
✅ 本课已完成
Second project — a program that checks password strength. A good password: at least 8 characters, a digit, an uppercase letter. Our program checks all three rules.
- ●len(pw) >= 8 → length
- ●any(c.isdigit() for c in pw) → has a digit
- ●any(c.isupper() for c in pw) → uppercase
- ●if len(pw)>=8 and has_digit and has_upper: → "strong!"
This is no toy — such checks sit in every signup form! You just wrote the mechanism that protects millions of accounts.
💡 Try to break your checker: "password" is weak, "Qwerty123" is strong. How to make it stricter? Add special characters!