password_strength(password) that returns "Strong" if the password is at least 8 characters long AND contains at least one digit AND at least one uppercase letter; returns "Medium" if it is at least 8 characters but is missing a digit or an uppercase letter (but not both missing); and returns "Weak" otherwise.password_strength("Abcdef12")Strong
Length >= 8, has a digit (1,2) and an uppercase letter (A).
password_strength("abcdefgh")Weak
Length is fine but both digit and uppercase are missing, so it does not qualify as Medium.
password_strength("Abcdefgh")Medium
Length >= 8 and has uppercase, but no digit -- exactly one requirement missing.
Use any(ch.isdigit() for ch in password) and any(ch.isupper() for ch in password).
Count how many of the two extra conditions (digit, uppercase) are satisfied, then branch on length and that count.