May 2019
Beginner
528 pages
29h 51m
English
Characters (digits, letters and symbols such as $, @, % and *) are the fundamental building blocks of programs. Every program is composed of characters that, when grouped meaningfully, represent instructions and data that the interpreter uses to perform tasks. Many programming languages have separate string and character types. In Python, a character is simply a one-character string.
Python provides string methods for testing whether a string matches certain characteristics. For example, string method isdigit returns True if the string on which you call the method contains only the digit characters (0–9). You might use this when validating user input that must contain only digits:
In [1]: '-27' ...Read now
Unlock full access