isdigit()

String methods that check what kind of characters a string contains, such as isdigit for only digits.

In more detail

"123".isdigit() is True but "-5".isdigit() and "".isdigit() are False, so checking whether input is a valid number needs more than one test. These checks are how the course validates input before converting it.

Related terms

Taught in

References

Certification courses