D. name = input()
You are creating a function that reads a data file and prints each line of the file.
You write the following code. Line numbers are included for reference only.
The code attempts to read the file even if the file does not exist.
You need to correct the code.
Which three lines have indentation problems? Each correct answer presents part of the solution. (Choose three.)
F G H
None
HOTSPOT
The ABC organics company needs a simple program that their call center will use to enter survey data for a new coffee
variety.
The program must accept input and return the average rating based on a five-star scale. The output must be rounded to two
decimal places.
You need to complete the code to meet the requirements.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:
Explanation:
References:
https://www.w3resource.com/python/python-format.php#num
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:
Explanation:
References:
https://www.w3resource.com/python/python-for-loop.php
HOTSPOT
You are designing a decision structure to convert a students 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:
Explanation:
References:
https://www.w3resource.com/python/python-if-else-statements.php
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.)
B C
Explanation:
References:
https://docs.python.org/3/library/random.html#
HOTSPOT
You are writing a Python program to validate employee numbers.
The employee number must have the format ddd-dd-dddd and consist only of numbers and dashes. The program must print
True if the format is correct and print False if the format is incorrect.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
HOTSPOT
You are designing a decision structure to convert a students 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:
Explanation:
References:
https://www.w3resource.com/python/python-if-else-statements.php
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:
Explanation:
References:
https://www.w3resource.com/python/python-operators.php https://www.w3resource.com/python/python-if-else-
statements.php
HOTSPOT
You are developing a Python application for an online product distribution company.
You need the program to iterate through a list of products and escape when a target product ID is found.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:
Explanation:
References:
https://www.w3resource.com/python/python-while-loop.php
DRAG DROP
You are writing a Python program. The program collects customer data and stores it in a database.
The program handles a wide variety of data.
You need to ensure that the program handles the data correctly so that it can be stored in the database correctly.
Match the data type to the code segment. To answer, drag the appropriate data type from the column on the left to its code
segment on the right. Each data type may be used once, more than once, or not at all.
Select and Place:
Explanation:
References:
https://www.w3resource.com/python/python-data-type.php
You develop a Python application for your company.
A list named employees contains 200 employee names, the last five being company management. You need to slice the list
to display all employees excluding management.
Which two code segments should you use? Each correct answer presents a complete solution. (Choose two.)
B E
Explanation:
References:
https://www.w3resource.com/python/python-list.php#slice
You develop a Python application for your company.
You need to accept input from the user and print that information to the user screen.
You have started with the following code. Line numbers are included for reference only.
Which code should you write at line 02?
B
None
D. name = input()
DRAG DROP
You are building a Python program that displays all of the prime numbers from 2 to 100.
How should you complete the code? To answer, drag the appropriate code segments to the correct location. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to
view content.
NOTE: Each correct selection is worth one point.
Select and Place:
Explanation:
References:
https://docs.python.org/3.1/tutorial/inputoutput.html https://stackoverflow.com/questions/11619942/print-series-of-prime-
numbers-in-python https://www.programiz.com/python-programming/examples/prime-number-intervals
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
Explanation:
References:
https://docs.python.org/2/library/exceptions.html
HOTSPOT
You are an intern for ABC electric cars company. You must create a function that calculates the average velocity of their
vehicles on a 1320 foot (1/4 mile) track. The output must be as precise as possible.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
Explanation:
References:
https://www.w3resource.com/python/python-data-type.php