4
QuizMultiple Choice

Creating a Game

Question 4 • SC-Fundamentals of Computing - Content Recovery - Design & Development

How do you check to see if the user entered more than one character? Complete the code. letter = input("Enter a letter: ") if _____ > 1: print("\nPlease guess a single letter.\n")

Answer
A
length(letter)
B
letter.len()
C
len(letter)
D
letter.length()

Explanation

Use Python’s built-in len() function to find how many characters are in the string. So the condition is `len(letter) > 1`, which prints the warning when the user enters more than one character. The correct choice is `len(letter)`.

AI-written and checked against the verified answer.