4
QuizMultiple Choice

How "Useless" Math Research Made the Internet Safer

Question 4 • Introduction to Computer Science B – 4-232

Which string method returns true if the character is a numeric charcter? letter = input("Enter a letter: ")

Answer
A
letter.isDigit()
B
letter.isdigit()
C
isDigit(letter)
D
isdigit(letter)

Explanation

In Python, `isdigit()` is a string method that returns `True` when the string contains digit characters. Since `letter` is a string, call the method on it as `letter.isdigit()`. The other choices use incorrect capitalization or call the method as a standalone function.

AI-written and checked against the verified answer.