98-381 Dumps

98-381 Free Practice Test

Microsoft 98-381: Introduction to Programming Using Python

QUESTION 11

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:
98-381 dumps exhibit
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.
98-381 dumps exhibit
Which code should you write for line 05 and line 06?
98-381 dumps exhibit

Correct Answer: B

QUESTION 12

HOTSPOT
The ABC company is building a basketball court for its employees to improve company morale.
You are creating a Python program that employees can use to keep track of their average score.
The program must allow users to enter their name and current scores. The program will output the user name and the user’s average score. The output must meet the following requirements:
✑ The user name must be left-aligned.
✑ If the user name has fewer than 20 characters, additional space must be added to the right.
✑ The average score must have three places to the left of the decimal point and one place to the right of the decimal (XXX.X).
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.
98-381 dumps exhibit
Solution:
References: https://www.python-course.eu/python3_formatted_output.php

Does this meet the goal?

Correct Answer: A