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:
DRAG DROP
Match the data type to the type operations.
To answer, drag the appropriate data type to the correct type operation. Each data type may be used once, more than once, or not at all.
Select and Place:
DRAG DROP
You are writing a function that works with files.
You need to ensure that the function returns None if the file does not exist. If the file does exist, the function must return the first line.
You write the following code:
In which order should you arrange the code segments to complete the function? To answer, move all code segments from the list of code segments to the answer area and arrange them in the correct order.
Select and Place:
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 develop a Python application for your company.
You have the following code. Line numbers are included for reference only.
Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment.
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
You create a function to calculate the power of a number by using Python.
You need to ensure that the function is documented with comments.
You create the following code. Line numbers are included for reference only.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:
You are creating a function that manipulates a number. The function has the following requirements: A float is passed into the function The function must take the absolute value of the float Any decimal points after the integer must be removed
Which two math functions should you use? Each correct answer is part of the solution. (Choose two.)
A. math.fmod(x)
B. math.frexp(x)
C. math.floor(x)
D. math.ceil(x)
E. math.fabs(x)
You are writing an application that uses the sqrt function. The program must reference the function using the name squareRoot.
You need to import the function.
Which code segment should you use?
A. import math.sqrt as squareRoot
B. import sqrt from math as squareRoot
C. from math import sqrt as squareRoot
D. from math.sqrt as squareRoot
You develop a Python application for your company.
You want to add notes to your code so other team members will understand it.
What should you do?
A. Place the notes after the # sign on any line
B. Place the notes after the last line of code separated by a blank line
C. Place the notes before the first line of code separated by a blank line
D. Place the notes inside of parentheses on any time