Which code should you write for line 05 and line 06?
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 […]
Which two functions should you use? Each correct answer presents a complete solution. (Choose two.)
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) References: https://docs.python.org/3/library/random.html#
Which code segment should you use?
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 […]
Which two math functions should you use?
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 […]
Which two code segments should you use?
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.) A. employees [1:-4] B. employees […]
Which code should you use at line 03?
You are creating a Python program that shows a congratulation message to employees on their service anniversary. You need to calculate the number of years of service and print a congratulatory message. You have written the following code. Line numbers are included for reference only. You need to complete the program. Which code should you […]
Which code segment should you use?
The ABC company has hired you as an intern on the coding team that creates e-commerce applications. You must write a script that asks the user for a value. The value must be used as a whole number in a calculation, even if the user enters a decimal value. You need to write the code […]