WGU E010 Python Programming Foundations Practice Workbook - Comprehensive Answer Key
WGU E010 Python Programming Foundations Practice Workbook - Comprehensive Answer Key Which symbol begins a single-line comment in Python? // (double forward slash) # (pound symbol) * (asterisk) % (percent symbol) - answer - # (pound symbol) Which data type is the value 3.14 in Python? Integer Float String Boolean - answer - Float In Python, what must follow the in keyword in a for loop? A condition An iterable object A number A variable name - answer - An iterable object Which type of loop is designed for iterating a specific number of times? while loop for loop infinite loop do-while loop - answer - for loop Which components are required in every Python while loop? A condition and an indented code block A variable and a return statement A counter and a break statement An iterator and a list - answer - A condition and an indented code block Which keyword is used to exit a loop prematurely in Python? return break stop end - answer - break In the code for item in my_list:, what does item represent? The index of the current element The current element being processed The length of the list The entire list - answer - The current element being processed Which Python data structure automatically prevents duplicate values from being stored? List Tuple Dictionary Set - answer - Set Which Python data structure cannot be modified after creation? List Dictionary Tuple Set - answer - Tuple What must a developer do to run Python code written in a text editor? Save the file and use a Python interpreter. Press a run button within the editor. Upload the code to a web server. Convert the code to machine language first. - answer - Save the file and use a Python interpreter. What advantage does an integrated terminal provide compared to using a separate terminal application? Faster code execution speed Access to additional Python libraries Eliminates need to switch between applications Automatic syntax error detection - answer - Eliminates need to switch between applications Which action allows a Python script located in a different folder to be executed in the terminal? Use the edit command to open the script first Move the script to your desktop Use the cd command to navigate to the script's directory Rename the script to match the terminal's path - answer - Use the cd command to navigate to the script's directory Which terminal command is used to navigate to a different directory before running a Python script? move goto cd nav - answer - cd Which tool is used to execute Python code line-by-line interactively within a terminal? Python shell Text editor File explorer Debugger - answer - Python shell A program processes file names and extracts the last 3 characters representing the file extension. For example, files '' and '' would return 'pdf' and 'png', respectively. Which slicing approach would work for either of the provided files? filename[:9] filename[9:] filename[-3:] filename[:-3] - answer - filename[-3:] Which index position is returned when the string method .find('python') is applied to the string 'learning python programming'? 8 9 1 2 - answer - 9 Complete the function add_item(numeric_list, new_number) that takes a list of numbers and a new number, and returns a new list that appends the new number to the end of the list. For example, add_item([1, 2, 3], 4) should return [1, 2, 3, 4]. def add_item(numeric_list, new_number): # TODO: Add new_number to the end of the list and return the list # Example: add_item([1, 2, 3], 4) should return [1, 2, 3, 4] pass - answer - def add_item(numeric_list, new_number): numeric_d(new_number) return numeric_list Complete the function update_grade(grades, student, new_grade) that takes a grades dictionary, a student name, and a new grade, then updates that student's grade and returns the dictionary. For example, update_grade({"Alice": 85, "Bob": 90}, "Alice", 95) should return {"Alice": 95, "Bob": 90}. def update_grade(grades,
Document information
- Uploaded on
- November 12, 2026
- Number of pages
- 8
- Written in
- 2026/2027
- Type
- Exam (elaborations)
- Contains
- Questions & answers