Question
Python Help: I'm not getting the expected outcome. What should I fix? Here is the code and a pic of my results below: import sys
Python Help: I'm not getting the expected outcome. What should I fix? Here is the code and a pic of my results below:
import sys ''' Section 1: Collect customer input '''
rentalCode = input('(B)udget, (D)aily, or (W)eekly rental? ')
if rentalCode == 'B':
rentalPeriod = input('Number of Days Rented: ')
elif rentalCode == 'D':
rentalPeriod = input('Number of Days Rented: ')
else:
rentalPeriod = input('Number of Weeks Rented: ')
odoStart = input('Starting Odometer Reading: ') odoEnd = input('Ending Odometer Reading: ')
daysRented = int(rentalPeriod)
budget_charge = int(40.00)
daily_charge = int(60.00)
weekly_charge = int(190.00)
if rentalCode == 'B':
baseCharge = daysRented * budget_charge
elif rentalCode == 'D':
baseCharge = daysRented * daily_charge
elif rentalCode == 'W':
baseCharge = daysRented * weekly_charge
''' Section 2: Calculate the costs from the customer input '''
totalMiles = int(odoEnd) - int(odoStart)
averageDayMiles = int(totalMiles) / int(daysRented)
weeksRented = rentalPeriod
averageMiles = int(totalMiles) / int(weeksRented)
print('Avg', averageDayMiles)
if rentalCode == 'B':
mileCharge = 0.25 * totalMiles
elif rentalCode == 'D' and averageDayMiles
mileCharge = 0
elif rentalCode == 'D' and averageDayMiles > 100:
extraMiles = averageDayMiles - 100
mileCharge = extraMiles * 0.25
if rentalCode == 'W' and averageMiles > 900:
mileCharge = weeksRented * 100.00
else:
mileCharge = 0
amtDue = baseCharge + mileCharge
''' Section 3: Display the results to the customer '''
print("Rental Summary ")
print('Rental Code: ' + rentalCode)
print('Rental Period: ' + rentalPeriod)
print("Starting Odometer: " + odoStart)
print("Ending Odometer: " + odoEnd)
print('Miles Driven: ' + str(totalMiles))
print('Amount Due: ' + '${:,.2f}'.format(amtDue))
i safari File Edit View History Bookmarks Window Help ???, 60% C%), Mon 4:55 PM a?? ? codio.com How to Give ing Hand-Job Character De....s Workshap Shop our fan.... Bad Dragon Junior Plus Si...thing rue21 Fiction Writi...ters Warkshop Moroccan Caf...ibaba Group Abaya in Dub ibaba Group Eectronics, Cars, Fashion, Collectibles, Co. Home | Scribophile Classlist-IT-140-T4596 Introduction to 5 Codio it-140 praject-1-draft-rental-ca Project 1: Rental Car ( In Python) introd?u. sh HD Codio Project File Edit Find View Tools Education Help , Run Current? Google ? ?Configure ? LAPONTEG rental-car.?? Rental Surn." import sys Collapse Section 1: Collect customer input Rental Summary rentalcodeinput( (B) udget, (D)aily, or ()eekly rental? ) LAST RUN on 3262018, 4:55:04 PM Check 1 failed Output Starting odometer Reading: Ending Odometer Reading: Avg 197.6 Rental Summary Rental Code: D Rental Period: 5 Starting Odometer: 1234 Ending Odometer: 2222 Miles Driven: 988 Amount Due: $300.00 10 rentalPeriodinput('Number of Days Rented: ) 12elif rentalCodeD: 13 14 15 16 17 18 19 20 21 rentalPeriodinput( Number of Days Rented: ) 349672b else: deas.jpg rentalPeriodinput( Number of Weeks Rented:n) odoStart-input( Starting Odomete g:n') odoEndinput('Ending Odometer Readingn') daysRentedint (rentalPeriod) budget_charge int (40.0) daily_chargeint (60.00) weekly_charge int (190.00) n-01.jpg 23 24 25 26 27 28 29 30 31if rentalCodeB 32 Number of Days R nted: Starting Odometer Reading Ending odometer Reading: Rental SummaryY Rental Code: Rental Periad: Starting odometer: 1234 Ending odometer: Miles Driven: Amount Due: baseChargedaysRented budget_charge 34 988 36 3 T baseChargedaysRented daily_charge $422 PythonStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started