LearnFrenzy
Sign in Take a free test

Strings · Strings MCQ · Question 8

isdigit() on "-5" Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 8 Back to Exercise

What does "-5".isdigit() return?

  • A True
  • B False, because "-" is not a digit Correct
  • C ValueError
  • D -5
Correct Answer: Option B

Every character must be a digit. To accept negatives or decimals, try int() or float() inside try/except.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links