<< Prev Question Next Question >>

Question 16/22

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:

B:

C:

D:

Recent Comments (The most recent comments are at the top.)

Tech-Act - Oct 25, 2021

The article is very interesting and effective, really explains everything in detail.Thanks you and good luck

LEAVE A REPLY

Your email address will not be published. Required fields are marked *

Question List (22q)
2 commentQuestion 1: You develop a Python application for your school. You need t...
Question 2: HOTSPOT You find errors while evaluating the following code....
1 commentQuestion 3: You are creating a function that manipulates a number. The f...
Question 4: Evaluate the following Python arithmetic expression: (Exhibi...
1 commentQuestion 5: HOTSPOT You are an intern for ABC electric cars company. You...
1 commentQuestion 6: You develop a Python application for your company. You need ...
Question 7: HOTSPOT The ABC organics company needs a simple program that...
Question 8: You are creating a function that reads a data file and print...
Question 9: HOTSPOT For each of the following statements, select Yes if ...
Question 10: HOTSPOT You create a function to calculate the power of a nu...
1 commentQuestion 11: The ABC company has hired you as an intern on the coding tea...
1 commentQuestion 12: This question requires that you evaluate the underlined text...
2 commentQuestion 13: You develop a Python application for your company. You want ...
1 commentQuestion 14: You are writing code that generates a random integer with a ...
1 commentQuestion 15: HOTSPOT The ABC company is building a basketball court for i...
1 commentQuestion 16: You are writing a Python program to automate inventory. Your...
Question 17: HOTSPOT You are developing a Python application for an onlin...
Question 18: You develop a Python application for your company. A list na...
2 commentQuestion 19: You are creating a Python program that shows a congratulatio...
Question 20: You are writing an application that uses the sqrtfunction. T...
Question 21: DRAG DROP You are writing a function that works with files. ...
Question 22: HOTSPOT You are developing a Python application for an onlin...