Enter the exam password to continue
Introduction to Programming - Practice Assessment
Review each code block and select the choice that accurately explains what it does.
Review the code block and select the choice that accurately explains what it does.
price1 and a float value to price2. It then adds these prices and performs integer division by 2. The total variable stores an integer value and then this value is displayed.
price1 and a float value to price2. It then adds these prices and divides by 2 to calculate total. The total variable stores a float value and then this value is cast to an integer before being displayed.
price1 and price2. It then adds these prices and divides them by 2. The total variable stores a float value that is cast to an integer before being displayed.
price1 and price2. It then adds these prices and divides them by 2. The total variable stores an integer value and this value is displayed.
Review the code block and select the choice that accurately explains what the function does.
Review the code block and select the choice that accurately explains what the function does.
Review the code block and select the choice that accurately explains what it does.
cards variable stores a list of strings. The card variable stores an integer equal to the number of elements in cards. The diamonds variable stores a Boolean value.
cards variable stores a string. The variable card stores each character in cards as the loop iterates. The diamonds variable is a counter incremented when card equals "D".
cards variable stores a list of strings. The card variable stores an integer equal to the number of characters in cards. The diamonds variable stores a Boolean value.
cards variable stores a list of strings. The variable card stores each element in the list as the loop iterates. The diamonds variable is a counter, initialized to 0 and incremented when the element contains "D".
Which of the following statements is true about this code?
room_assignments dictionary and displays all of the keys.
room_assignments dictionary and displays all of the values.
Review each code block and type exactly what the interpreter would print out.
Review the code block and select the choice that shows the correct output.
true
false
True
False
Review the following code. For your answer, type what this prints when run.
Review the following code. For your answer, type what this prints when run.
Given the file pet_registry.txt with contents:
Review the following code.
What does this code print when it is run?
Review the following code. For your answer, type what this prints when run.
Fix the bugs in each code block. Press Run to test your code.
The function count_vowels is intended to count the total number of vowels (a, e, i, o, u) in a given string. It should iterate through each character in the string and increment a counter when a vowel is found. The function should return the total count.
Read a file named temperatures.txt (which contains one temperature per line, possibly including empty lines or non-numeric lines like "N/A") and safely calculate the average of all valid float temperatures. If a value is blank, it should be skipped. If the value cannot be parsed into a float, use a default value of 72.0. The given file should result in an average of 74.0.
Modify the code to meet the new requirements.
The original purpose of the following code was to remove the first task from a to-do list, print a message that it was completed, and return the updated list.
However, there is a bug: when the list is empty, an exception occurs.
Modify the complete_task function so:
True."No tasks remaining." and return False.The following program was originally written to double a number that the user inputs. Modify the program so:
run_doubler()run_doubler() should return the number of times the user doubled a numberrun_doubler() and prints what was returnedExample output for inputs "5" then "quit":
Drag the code blocks to the solution area and arrange them in the correct order.
Once rearranged, the function should print a "Rolling the dice..." message, pause for between 1 and 2 seconds (inclusive) and print the result of rolling two dice (each 1-6) added together.
Once rearranged, the code should prompt a user to first input a movie genre and then a rating (G, PG, PG-13, R).
Evaluate the AI tool's output and select the most accurate assessment.
You enter this prompt into an AI tool:
This is the output from the AI tool:
4 and not 3.
You enter this prompt into an AI tool:
This is the output from the AI tool:
KeyError.
You enter this prompt into an AI tool:
The AI correctly identifies the issue and provides this corrected code:
You enter this prompt into an AI tool:
This is the output from the AI tool: