Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

WGU – Introduction to Python (D335) – Practice Test 2 – Latest Update with Correct Answers – Complete Exam & Concept Review Material

Beoordeling
-
Verkocht
-
Pagina's
26
Cijfer
A+
Geüpload op
16-11-2025
Geschreven in
2025/2026

WGU – Introduction to Python (D335) – Practice Test 2 – Latest Update with Correct Answers – Complete Exam & Concept Review Material Introduction: This document contains the complete set of Practice Test 2 questions for WGU’s Introduction to Python (D335) course, including coding exercises, concept questions, and their verified correct answers. It covers topics such as data types, functions, file handling, modules, control flow, classes, loops, exceptions, comprehensions, and common Python operations. It reflects the latest update of the practice materials and provides clear, structured solutions aligned with course expectations. Exam Questions and Answers 1. Create a solution that accepts a string input representing a grocery store item and an integer input identifying the number of items purchased on a recent visit. The following dictionary purchase lists available items as the key with the cost per item as the value. purchase = {"bananas": 1.85, "steak": 19.99, "cookies": 4.52, "celery": 2.81, "milk": 4.34} Additionally, If fewer than ten items are purchased, the price is the full cost per item. If between ten and twenty items (inclusive) are purchased, the purchase gets a 5% discount. If twenty-one or more items are purchased, the purchase gets a 10% discount. Output the chosen item and total cost of the purchase to two decimal places.- --- correct precise answer --- store_item = input() num_items = int(input()) total_cost = purchase[store_item] * num_items if num_items 10: print(store_item, "${:.2f}".format(total_cost)) if num_items in range(10,21): discount = total_cost * 0.05 total_cost = total_cost - discountprint(store_item, '${:.2f}'.format(total_cost)) if num_items = 21: discount = total_cost * 0.10 total_cost = total_cost - discount print(store_item, '${:.2f}'.format(total_cost))

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

WGU – Introduction to Python (D335) – Practice Test 2 –
Latest Update with Correct Answers – Complete Exam &
Concept Review Material


Introduction:
This document contains the complete set of Practice Test 2 questions for
WGU’s Introduction to Python (D335) course, including coding exercises,
concept questions, and their verified correct answers. It covers topics such as
data types, functions, file handling, modules, control flow, classes, loops,
exceptions, comprehensions, and common Python operations.
It reflects the latest update of the practice materials and provides clear,
structured solutions aligned with course expectations.


Exam Questions and Answers


1. Create a solution that accepts a string input representing a grocery
store item and an integer input identifying the number of items
purchased on a recent visit. The following dictionary purchase lists
available items as the key with the cost per item as the value.

purchase = {"bananas": 1.85, "steak": 19.99, "cookies": 4.52, "celery":

2.81,


"milk": 4.34} Additionally,


If fewer than ten items are purchased, the price is the full cost per item.

,If between ten and twenty items (inclusive) are purchased, the purchase
gets a 5% discount.

If twenty-one or more items are purchased, the purchase gets a 10%
discount. Output the chosen item and total cost of the purchase to two
decimal places.-

--- correct precise answer --- store_item = input() num_items =
int(input()) total_cost = purchase[store_item] * num_items if num_items <
10:
print(store_item, "${:.2f}".format(total_cost)) if num_items in
range(10,21):

discount = total_cost * 0.05 total_cost = total_cost -
discountprint(store_item, '${:.2f}'.format(total_cost)) if num_items >= 21:
discount = total_cost * 0.10 total_cost = total_cost - discount
print(store_item, '${:.2f}'.format(total_cost))



2. Create a solution that accepts an integer input representing a 9- digit
unformatted student identification number. Output the identification
number as a string with no spaces. --- correct answer --
- student_id = int(input())


student_id_string = str(student_id) first3 = student_id_string[0:3]
second2 = student_id_string[3:5] third4 = student_id_string[5:]
print(f'{first3}-{second2}-{third4}')

3. Create a solution that accepts an integer input identifying how
many shares of stock are to be purchased from the Old Town Stock

, Exchange,

followed by an equivalent number of string inputs representing the stock
selections. The following dictionary stock lists available stock selections
as the key with the cost per selection as the value.

stocks = {'TSLA': 912.86 , 'BBBY': 24.84, 'AAPL': 174.26, 'SOFI': 6.92,
'KIRK':

8.72, 'AURA': 22.12, 'AMZN': 141.28, 'EMBK': 12.29, 'LVLU': 2.33}


Output the total cost of the purchased shares of stock to two decimal
places.-

--- correct precise answer --- num_stock = int(input()) total_cost =
0 for i in range(num_stock):
stock_selection = input()


if stock_selection in stocks:


total_cost += stocks[stock_selection] print('Total price:

${:.2f}'.format(total_cost))


4. Create a solution that accepts an integer input to compare
against the following list:

predef_list = [4, -27, 15, 33, -10]


Output a Boolean value indicating whether the input value is greater than
the maximum value from predef_list--- correct precise answer --- num =

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
16 november 2025
Aantal pagina's
26
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

€11,42
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
PASSINGMASTER01 Chamberlain College Of Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
501
Lid sinds
4 jaar
Aantal volgers
336
Documenten
2943
Laatst verkocht
15 uur geleden
TIGHT DEADLINE? I CAN HELP Many students don't have the time to work on their academic papers due to balancing with other responsibilities, for example, part-time work. I can relate. kindly don't hesitate to contact me, my study guides, notes and exams

QUALITY DOCUMENTS FOR BEST RESULTS. In my page you will find latest Exams ,Assignments, Test Banks, Exam Elaboration, test with Questions and Answers, Discussions, Case Studies, package deals, etc. I upload quality. Instant delivery.

3,8

45 beoordelingen

5
23
4
7
3
5
2
3
1
7

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen