D335 – PYTHON LABS: TIME CONVERSION, PIZZA PARTY, HYPOTENUSE, TRIANGLE AREA, Exams of Computer Programming

Master the D335 Python programming labs with this comprehensive guide covering all essential lab exercises. Includes solutions for: time conversion (seconds to hours/minutes/seconds and vice versa), pizza party calculator (2 slices per person, 12 slices per pizza at $14.95), hypotenuse calculation (Pythagorean theorem with 2 decimal places), triangle area using Heron's formula (square root of s(s-a)(s-b)(s-c)), pizza order with subtotal and 6% sales tax, square root of floating-point numbers, cylinder volume (πr²h) and surface area (2πrh + 2πr²), warm-up lab (variables, input, type conversion, chr() function, reverse output), and cooking measurement converter. Perfect for WGU D335 Introduction to Programming in Python lab practical exam preparation. Each lab includes problem specifications, input/output examples, and Python code solutions.

Typology: Exams

2025/2026

Available from 04/29/2026

Highgradeshub
Highgradeshub 🇿🇦

5

(1)

3.1K documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Pagei 1i ofi 5i
i
D335/i WGUi D335:i INTRODUCTIONi TOi
PROGRAMMINGi INi PYTHONi NEWESTi 2026i
ACTUALi EXAMi QUESTIONSi ANDi CORRECTi
ANSWERS
i
i
22.1i Lab:i Converti toi Secondsi
i
Writei ai programi thati readsi ini hours,i minutes,i andi secondsi asi input,i
andi outputsi thei timei ini secondsi only.i
i
22.2i Lab:i Converti fromi Secondsi
i
Peoplei findi iti easieri toi readi timei ini hours,i minutes,i andi secondsi
ratheri thani justi seconds.i
Writei ai programi thati readsi ini secondsi asi inputi andi outputsi thei timei
ini hours,i minutes,i andi seconds.i
i
22.3i Lab:i Pizzai Partyi
i
pf3
pf4
pf5

Partial preview of the text

Download D335 – PYTHON LABS: TIME CONVERSION, PIZZA PARTY, HYPOTENUSE, TRIANGLE AREA and more Exams Computer Programming in PDF only on Docsity!

i

D335/i WGUi D335:i INTRODUCTIONi TOi

PROGRAMMINGi INi PYTHONi NEWESTi 2026 i

ACTUALi EXAMi QUESTIONSi ANDi CORRECTi

ANSWERS

i i

22.1i Lab:i Converti toi Secondsi

i

Writei ai programi thati readsi ini hours,i minutes,i andi secondsi asi input,i

andi outputsi thei timei ini secondsi only.i

i

22.2i Lab:i Converti fromi Secondsi

i

Peoplei findi iti easieri toi readi timei ini hours,i minutes,i andi secondsi

ratheri thani justi seconds.i

Writei ai programi thati readsi ini secondsi asi inputi andi outputsi thei timei

ini hours,i minutes,i andi seconds.i

i

22.3i Lab:i Pizzai Partyi

i

i

Giveni thei numberi ofi peoplei attendingi ai pizzai party,i outputi thei

numberi ofi neededi pizzasi andi totali cost.i Fori thei calculation,i

assumei thati peoplei eati 2 i slicesi oni averagei andi eachi pizzai hasi 12 i

slicesi andi costsi $14.95.i

i

22.4i Lab:i Hypotenusei

i

Giveni twoi numbersi thati representi thei lengthsi ofi ai righti triangle'si

legsi (sidesi adjacenti toi thei righti angle),i outputi thei lengthi ofi thei thirdi

sidei (i.e.i hypotenuse)i withi twoi digitsi afteri thei decimali point.i

i

22.5i Lab:i Areai ofi ai Trianglei

i

Usingi Heron'si formula,i youi cani calculatei thei areai ofi ai trianglei ifi youi

knowi thei lengthsi ofi alli threei sides.i Giveni thei lengthi ofi eachi sidei ofi ai

trianglei asi input,i calculatei thei areai ofi thei trianglei usingi Heron'si

formulai asi follows:i

si =i halfi ofi thei triangle'si perimeteri areai =i thei squarei rooti ofi s(s-

a)(s-b)(s-c),i wherei a,i b,i andi ci arei eachi sidesi ofi thei triangle.i

i

Thei volumei andi areai ofi ai cylinderi arei calculatedi as:i

Volumei =i πr2hi

Areai =i 2 πrhi +i 2 πr2i

i

Giveni thei radiusi andi heighti ofi ai cylinderi asi floating-pointi numbers,i

outputi thei volumei andi areai ofi thei cylinder.i

i

22.9i LAB:i Warmi up:i Variables,i input,i andi typei conversioni

i

(1) Prompti thei useri toi inputi ani integeri betweeni 32 i andi 126,i ai float,i

ai character,i andi ai string,i storingi eachi intoi separatei variables.i

Then,i outputi thosei fouri valuesi oni ai singlei linei separatedi byi ai

space.i

(2) Extendi toi alsoi outputi ini reverse.i

(3) Extendi toi converti thei integeri toi ai characteri byi usingi thei 'chr()'i

function,i andi outputi thati character.i

i

22.10i LAB:i Cookingi Mesurementi Converteri

i i i