• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 12 pages
Exam (elaborations)

WGU D335 Practice Test 2

Document preview thumbnail
Preview 2 out of 12 pages

WGU D335 Practice Test 2

Content preview

WGUpiD335piPracticepiTestpi2
Studypionlinepiatpihttps://quizlet.com/
_eziszg
1. Createpiapisolutionpithatpiacceptspithreepiintegerpiinputspirepresentingpithepinumb
erpiofpitimespianpiemployeepitravelspitopiapijobpisite.piOutputpithepitotalpidistancepitr
aveledpitopitwopidecimalpiplacespigivenpithepifollowingpimilespiperpiemployeepicom
mutepitopithepijobpisite.piOutputpithepitotalpidistancepitraveledpitopitwopidecimalpipl
acespigivenpithepifollowingpimilespiperpiemployeepicommutepitopithepijobpisite:
EmployeepiA:pi15.62pimile
spiEmployeepiB:pi41.85pimi
les
EmployeepiC:pi32.67pimiles:pitimes_traveledApi=piint(input())pitim
es_traveledBpi=piint(input())
times_traveledCpi=piint(input())piem
ployeeApi=pi15.62pi#milespiemployeeBp
i=pi41.85pi#milespiemployeeCpi=pi32.67

pi#miles

distance_traveledApi=pitimes_traveledApi*piemploye
eApidistance_traveledBpi=pitimes_traveledBpi*piempl
oyeeBpidistance_traveledCpi=pitimes_traveledCpi*pie
mployeeC
total_miles_traveledpi=pidistance_traveledApi+pidistance_traveledBpi+pidistanc
e_trav-pieledC
print('Distance:pi{:.2f}pimiles'.format(total_miles_traveled))
2. Createpiapisolutionpithatpiacceptspianpiinputpiidentifyingpithepinamepiofpiapitextpifile,p
forpiexample,pi"WordTextFile1.txt".piEachpitextpifilepicontainspithreepirowspiwithpione
piwordpiperpirow.piUsingpithepiopen()pifunctionpiandpiwrite()piandpiread()pimethods,

piinteractpiwithpithepiinputpitextpifilepitopiwritepiapinewpisentencepistringpicomposed

piofpithepithreepiexistingpiwordspitopithepiendpiofpithepifilepicontentspionpiapinew pilin

e.piOutputpithepinewpifilepicontents.:pifile_namepi=piinput()
withpiopen(file_name,pi'r')piaspif:
word1pi=pistr(f.readline()).s
trip()piword2pi=pistr(f.readli
ne()).strip()piword3pi=pistr(
f.readline()).strip()

fpi=piopen(file_name,pi'r'
)pilinespi=pif.read().spli
tlines()pilinespi=pi'pi'.jo
in(lines)pif.close()
1pi/
pi12

, WGUpiD335piPracticepiTestpi2
Studypionlinepiatpihttps://quizlet.com/
print(f'{word1}\n{word2}\n{word3}\n{lines}')
_eziszg
3. Createpiapisolutionpithatpiacceptspianpiintegerpiinputpirepresentingpianypinumbe
rpiofpiounces.piOutputpithepiconvertedpitotalpinumberpiofpitons,pipounds,piandpire
mainingpiouncespibasedpionpithepiinputpiouncespivalue.pT i herepiarepi16piouncespiinpi

apipoundpiandpi2,000pipoundspiinpiapiton.:piounces_per_poundpi=pi16




2pi/
pi12

Document information

Uploaded on
December 26, 2024
Number of pages
12
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$13.49

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

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
favouredone
4.4
(352)
Sold
404
Followers
36
Items
10313
Last sold
1 day 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