WGU D522 Python for IT Automation Cram Sheet
Questions With Correct Answers A+ Graded 2026-2027
print(x) - CORRECT ANSWER -Outputs text or variables to the console.
input(prompt) - CORRECT ANSWER -Prompts and retrieves user input as a string.
len(x) - CORRECT ANSWER -Returns the number of items in a sequence or collection.
type(x) - CORRECT ANSWER -Returns the data type of the specified object.
range(start, stop, step) - CORRECT ANSWER -Generates a sequence of numbers, commonly used
in loops.
enumerate(iterable) - CORRECT ANSWER -Returns index and value pairs during iteration.
zip(a, b) - CORRECT ANSWER -Combines multiple iterables element-wise into tuples.
sorted(iterable) - CORRECT ANSWER -Returns a new sorted list from the items in an iterable.
sum(list) - CORRECT ANSWER -Adds all numerical items in an iterable.
min() and max() - CORRECT ANSWER -Return the smallest and largest values in an iterable.
abs(x) - CORRECT ANSWER -Returns the absolute value of a number.
round(x, n) - CORRECT ANSWER -Rounds a number to n decimal places.
, isinstance(x, type) - CORRECT ANSWER -Checks if an object is an instance of a specified class.
hasattr(obj, name) - CORRECT ANSWER -Checks if an object has a specified attribute or method.
str(), int(), float(), bool() - CORRECT ANSWER -Functions used for explicit data type conversion.
dict(), list(), tuple(), set() - CORRECT ANSWER -Constructor functions used to build or convert
data structures.
.strip() - CORRECT ANSWER -Removes whitespace from both ends of a string.
.lstrip() and .rstrip() - CORRECT ANSWER -Remove whitespace from the left or right side of a
string.
.lower() and .upper() - CORRECT ANSWER -Convert a string to all lowercase or all uppercase.
.title() and .capitalize() - CORRECT ANSWER -Convert string to titlecase or capitalize only the first
character.
.find(sub) - CORRECT ANSWER -Returns the lowest index of a substring, or -1 if not found.
.rfind(sub) - CORRECT ANSWER -Returns the highest index of a substring, or -1 if not found.
.startswith(prefix) - CORRECT ANSWER -Returns True if the string starts with the specified prefix.
.endswith(suffix) - CORRECT ANSWER -Returns True if the string ends with the specified suffix.
Questions With Correct Answers A+ Graded 2026-2027
print(x) - CORRECT ANSWER -Outputs text or variables to the console.
input(prompt) - CORRECT ANSWER -Prompts and retrieves user input as a string.
len(x) - CORRECT ANSWER -Returns the number of items in a sequence or collection.
type(x) - CORRECT ANSWER -Returns the data type of the specified object.
range(start, stop, step) - CORRECT ANSWER -Generates a sequence of numbers, commonly used
in loops.
enumerate(iterable) - CORRECT ANSWER -Returns index and value pairs during iteration.
zip(a, b) - CORRECT ANSWER -Combines multiple iterables element-wise into tuples.
sorted(iterable) - CORRECT ANSWER -Returns a new sorted list from the items in an iterable.
sum(list) - CORRECT ANSWER -Adds all numerical items in an iterable.
min() and max() - CORRECT ANSWER -Return the smallest and largest values in an iterable.
abs(x) - CORRECT ANSWER -Returns the absolute value of a number.
round(x, n) - CORRECT ANSWER -Rounds a number to n decimal places.
, isinstance(x, type) - CORRECT ANSWER -Checks if an object is an instance of a specified class.
hasattr(obj, name) - CORRECT ANSWER -Checks if an object has a specified attribute or method.
str(), int(), float(), bool() - CORRECT ANSWER -Functions used for explicit data type conversion.
dict(), list(), tuple(), set() - CORRECT ANSWER -Constructor functions used to build or convert
data structures.
.strip() - CORRECT ANSWER -Removes whitespace from both ends of a string.
.lstrip() and .rstrip() - CORRECT ANSWER -Remove whitespace from the left or right side of a
string.
.lower() and .upper() - CORRECT ANSWER -Convert a string to all lowercase or all uppercase.
.title() and .capitalize() - CORRECT ANSWER -Convert string to titlecase or capitalize only the first
character.
.find(sub) - CORRECT ANSWER -Returns the lowest index of a substring, or -1 if not found.
.rfind(sub) - CORRECT ANSWER -Returns the highest index of a substring, or -1 if not found.
.startswith(prefix) - CORRECT ANSWER -Returns True if the string starts with the specified prefix.
.endswith(suffix) - CORRECT ANSWER -Returns True if the string ends with the specified suffix.