Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question # 2 dropdown complete the code to check whether a string conta…

Question

question # 2
dropdown
complete the code to check whether a string contains at least one lowercase letter.
valid = false
pw = input(\enter a password: \)
if (letter. () for letter in pw):
valid = true

Explanation:

Step1: Use any function

The any function in Python returns True if any element in an iterable is True. Here we want to check if any character in the password string meets the lowercase - letter condition.
any

Step2: Use islower method

The islower method of a string object returns True if the character is a lowercase letter.
islower

Answer:

any, islower