WGU D522 PYTHON FOR IT AUTOMATION OA
PA UPDATED EXAM SCRIPT WITH COMPLETE
ANSWERS
◉ input(prompt).
Answer: Prompts and retrieves user input as a string.
◉ len(x).
Answer: Returns the number of items in a sequence or collection.
◉ type(x).
Answer: Returns the data type of the specified object.
◉ range(start, stop, step).
Answer: Generates a sequence of numbers, commonly used in loops.
◉ enumerate(iterable).
Answer: Returns index and value pairs during iteration.
◉ zip(a, b).
Answer: Combines multiple iterables element-wise into tuples.
, ◉ sorted(iterable).
Answer: Returns a new sorted list from the items in an iterable.
◉ sum(list).
Answer: Adds all numerical items in an iterable.
◉ min() and max().
Answer: Return the smallest and largest values in an iterable.
◉ abs(x).
Answer: Returns the absolute value of a number.
◉ round(x, n).
Answer: Rounds a number to n decimal places.
◉ isinstance(x, type).
Answer: Checks if an object is an instance of a specified class.
◉ hasattr(obj, name).
Answer: Checks if an object has a specified attribute or method.
PA UPDATED EXAM SCRIPT WITH COMPLETE
ANSWERS
◉ input(prompt).
Answer: Prompts and retrieves user input as a string.
◉ len(x).
Answer: Returns the number of items in a sequence or collection.
◉ type(x).
Answer: Returns the data type of the specified object.
◉ range(start, stop, step).
Answer: Generates a sequence of numbers, commonly used in loops.
◉ enumerate(iterable).
Answer: Returns index and value pairs during iteration.
◉ zip(a, b).
Answer: Combines multiple iterables element-wise into tuples.
, ◉ sorted(iterable).
Answer: Returns a new sorted list from the items in an iterable.
◉ sum(list).
Answer: Adds all numerical items in an iterable.
◉ min() and max().
Answer: Return the smallest and largest values in an iterable.
◉ abs(x).
Answer: Returns the absolute value of a number.
◉ round(x, n).
Answer: Rounds a number to n decimal places.
◉ isinstance(x, type).
Answer: Checks if an object is an instance of a specified class.
◉ hasattr(obj, name).
Answer: Checks if an object has a specified attribute or method.