DRAG DROP
You are creating a Python script to evaluate input and check for upper and lower case.
Which four code segments should you use to develop the solution? To answer, move the appropriate code segment from the list of code segments to the answer area and arrange them in the correct order.
Select and Place:
DRAG DROP
You are writing a Python program to perform arithmetic operations.
You create the following code:
What is the result of each arithmetic expression? To answer, drag the appropriate expression from the column on the left to its result on the right. Each expression may be used once, more than once, or not at all.
Select and Place:
HOTSPOT
You are designing a decision structure to convert a student's numeric grade to a letter grade. The program must assign a letter grade as specified in the following table:
For example, if the user enters a 90, the output should be, “Your letter grade is A”. Likewise, if a user enters an 89, the output should be “Your letter grade is B”. How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
HOTSPOT
The ABC company needs a way to find the count of particular letters in their publications to ensure that there is a good balance. It seems that there have been complaints about overuse of the letter e. You need to create a function to meet the
requirements.
How should you complete this code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:
HOTSPOT
The ABC Video company needs a way to determine the cost that a customer will pay for renting a DVD. The cost is dependent on the time of day the DVD is returned. However, there are also special rates on Thursdays and Sundays. The fee
structure is shown in the following list:
The cost is $1.59 per night.
If the DVD is returned after 8 PM, the customer will be charged an extra day.
If the video is rented on a Sunday, the customer gets 30% off for as long as they keep the video.
If the video is rented on a Thursday, the customer gets 50% off for as long as they keep the video.
You need to write code to meet the requirements.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
HOTSPOT
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:
Evaluate the following Python arithmetic expression:
What is the result?
A. 3
B. 13
C. 15
D. 69
You are writing code that generates a random integer with a minimum value of 5 and a maximum value of 11. Which two functions should you use? Each correct answer presents a complete solution. (Choose two.)
A. random.randint(5, 12)
B. random.randint(5, 11)
C. random.randrange(5, 12, 1)
D. random.randrange(5, 11, 1)
You are writing a Python program to automate inventory. Your first task is to read a file of inventory transactions. The file contains sales from the previous day, including the item id, price, and quantity. The following shows a sample of data from the file:
The code must meet the following requirements: Each line of the file must be read and printed If a blank line is encountered, it must be ignored When all lines have been read, the file must be closed
You create the following code. Line numbers are included for reference only.
Which code should you write for line 05 and line 06?
A. Option A
B. Option B
C. Option C
D. Option D
This question requires that you evaluate the underlined text to determine if it is correct.
You write the following code:
The out.txt file does not exist. You run the code. The code will execute without error.
Review the underlined text. If it makes the statement correct, select "No change is needed". If the statement is incorrect, select the answer choice that makes the statement correct.
A. No change is needed
B. The code runs, but generates a logic error
C. The code will generate a runtime error
D. The code will generate a syntax error