Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 6 pages
Exam (elaborations)

WGU D335 Practice Test 2 | Full Questions, Correct Answers, and Worked Solutions | 2026 Update | 100% Correct.

Document preview thumbnail
Preview 2 out of 6 pages

WGU D335 Practice Test 2 | Full Questions, Correct Answers, and Worked Solutions | 2026 Update | 100% Correct.

Content preview

Western Governors University D 333




WGU D335 Practice Test 2 | Full
Questions, Correct Answers, and
Worked Solutions | 2026 Update |
100% Correct.

C




Terms in this set (15)



Create a solution that accepts three integer times_traveledA =
int(input()) inputs representing the number of times an
times_traveledB =
int(input()) employee travels to a job site. Output the
times_traveledC =
int(input()) total distance traveled to two decimal employeeA =
15.62 #miles places given the following miles per employeeB =
41.85 #miles employee commute to the job site. Output
employeeC = 32.67
#miles
the total distance traveled to two decimal distance_traveledA = times_traveledA *
employeeA places given the following miles per distance_traveledB = times_traveledB
* employeeB employee commute to the job site: distance_traveledC = times_traveledC
* employeeC
Employee A: 15.62 miles total_miles_traveled = distance_traveledA +
distance_traveledB
Employee B: 41.85 miles + distance_traveledC
Employee C: 32.67 miles print('Distance: {:.2f} miles'.format(total_miles_traveled))

, Create a solution that accepts an input file_name = input()
identifying the name of a text file, for with open(file_name, 'r')
as f: example, "WordTextFile1.txt". Each text file word1 =
str(f.readline()).strip()
contains three rows with one word per row. word2 =
str(f.readline()).strip() Using the open() function and write() and
word3 =
str(f.readline()).strip() read() methods, interact with the input text
file to write a new sentence string f = open(file_name,
'r') composed of the three existing words to the lines =
f.read().splitlines() end of the file contents on a new line. lines
= ' '.join(lines) Output the new file contents. f.close()
print(f'{word1}\n{word2}\n{word3}\n{lines}')

Create a solution that accepts an integer ounces_per_pound = 16
input representing any number of ounces. pounds_per_ton = 2000
Output the converted total number of tons, number_ounces =
int(input())
pounds, and remaining ounces based on the tons = number_ounces //
(ounces_per_pound * input ounces value. There are 16 ounces in a
pounds_per_ton)
pound and 2,000 pounds in a ton. remaining_ounces = number_ounces %
(ounces_per_pound *
pounds_per_ton)
pounds = remaining_ounces // ounces_per_pound
remaining_ounces = remaining_ounces %
ounces_per_pound print('Tons: {}'.format(tons))
print('Pounds: {}'.format(pounds))
print('Ounces:
{}'.format(remaining_ounces))

Create a solution that accepts an input import csv
identifying the name of a CSV file, for input1 =
input()
example, "input1.csv". Each file contains two with open(input1, "r") as f:
rows of comma-separated values. Import data = [row for row in
csv.reader(f)] the built-in module csv and use its open() for row in
data:
function and reader() method to create a even = [row[i].strip() for i in range(0,
len(row), 2)] dictionary of key:value pairs for each row of odd = [row[i].strip() for i
in range(1, len(row), 2)] comma-separated values in the specified pair =
dict(zip(even, odd))
file. Output the file contents as two


print(pair) dictionaries.

Create a solution that accepts an integer index_value = int(input())
input representing the index value for any name =
various_data_types[index_value] any of the five elements in the following list:
data_type = type(name).__name__
various_data_types = [516, 112.49, True, print(f"Element {index_value}:
{data_type}") "meow", ("Western", "Governors",
"University"), {"apple": 1, "pear": 5}]
Using the built-in function type() and
getting its name by using the .name
attribute, output data type (e.g., int”,
“float”, “bool”, “str”) based on the input
index value of the list element.

Document information

Uploaded on
August 5, 2026
Number of pages
6
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$12.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
3
Followers
0
Items
1226
Last sold
2 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions