1/12
Flashcards covering string methods and data validation techniques in Python.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What does string.strip()
do?
Removes leading and trailing whitespace from a string.
What does string.replace(old, new)
do?
Replaces all occurrences of 'old' with 'new' in a string.
What does string.isdigit()
check?
Checks if the string contains only digits and returns True
if it does, False
otherwise.
What does string.isalpha()
check?
Checks if the string contains only letters and returns True
if it does, False
otherwise.
What does string.isalnum()
check?
Checks if the string contains only letters and numbers and returns True
if it does, False
otherwise.
What does string.startswith(sub)
do?
Checks if the string starts with the substring 'sub' and returns True
if it does, False
otherwise.
What does string.endswith(sub)
do?
Checks if the string ends with the substring 'sub' and returns True
if it does, False
otherwise.
What is a length check in data validation?
Ensures the input meets a specific length requirement.
What is a range check in data validation?
Ensures the input is within a certain numeric range.
What is a type check in data validation?
Ensures the input is of a specific data type.
What is a presence check in data validation?
Ensures that a required field is not left blank.
What is a format check in data validation?
Ensures the input follows a specific pattern (e.g., email format).
What is a lookup check in data validation?
Ensures the input is one of a set of acceptable values.