# Nested Loop Mini Project — Password Strength Checker
# while True + for — keep asking until the password is strong

# ─────────────────────────────────────────────
# Password Strength Checker — upgraded
# ─────────────────────────────────────────────

while True:
    password = input("Enter a password: ")

    has_upper   = False
    has_lower   = False
    has_digit   = False
    has_special = False

    for char in password:
        if char.isupper():
            has_upper = True
        elif char.islower():
            has_lower = True
        elif char.isdigit():
            has_digit = True
        elif not char.isalpha() and not char.isdigit():
            has_special = True

    print(f"Uppercase:         {'✓' if has_upper else '✗'}")
    print(f"Lowercase:         {'✓' if has_lower else '✗'}")
    print(f"Digit:             {'✓' if has_digit else '✗'}")
    print(f"Special character: {'✓' if has_special else '✗'}")

    if has_upper and has_lower and has_digit and has_special:
        print("Strong password. Access granted.")
        break
    else:
        print("Weak password. Try again.\n")

# ─────────────────────────────────────────────
# Test it
# ─────────────────────────────────────────────

# Enter a password: abc123
# Uppercase:         ✗
# Lowercase:         ✓
# Digit:             ✓
# Special character: ✗
# Weak password. Try again.

# Enter a password: P@ssw0rd!
# Uppercase:         ✓
# Lowercase:         ✓
# Digit:             ✓
# Special character: ✓
# Strong password. Access granted.

# ─────────────────────────────────────────────
# Key detail
# ─────────────────────────────────────────────

# flags reset inside while — not inside for
# fresh check on every attempt
# break ends the while — only when all conditions are met

# ─────────────────────────────────────────────
# Go further
# ─────────────────────────────────────────────

# Add minimum length check — at least 8 characters
# Count attempts — print "Got it in 3 attempts" at the end
# Add maximum attempts limit — lock out after 5 failed tries
