Microsoft Exam Questions

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 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.

References: https://www.dotnetperls.com/readline-python