Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have this python code I've been working on and for some reason in the customerInfo() function when getting user input for classCode, no matter

I have this python code I've been working on and for some reason in the customerInfo() function when getting user input for classCode, no matter what I enter I get an infinite loop where it keeps asking for the correct classification code. I've designed it that if the input entered isn't B, D, or W, that it keeps asking the user for the correct input. But even when I do enter the correct input it just continues to ask for it again. I'm pretty sure my while loop is set up correctly but now I'm not sure. If anyone can help me with this I would appreciate it. Thanks.

image text in transcribed

#main function def main(): #needed information print(" Welcome to car rentals. At the prompts, please enter the following: ") print("\tCustomer's classification code (a character: BDW) \tNumber of days the vehicle was rented (int)") print("\todometer reading at the start of the rental period (int) \todometer reading at the end of the rental period (int)") #user input answer = input(" Use Y for yes and N for no. Do you want to conitnue (Y/N)?") print("Thank you for your loyalty.") #while loop to get user info while cont Program (answer): #calling customer Info function customerInfo() #asking user if they want to process another request another Process = input(" Enter 0 if no. Do you want to process another request? ") if anotherProcess != '0': customerInfo() else: print(" You chose to not enter anymore requests.") #asking user if they want to continue again if cont Program(): customerInfo() else: break #getting user input if they want to continue program def contProgram(userIn): #parameter answerin = userIn #if statement to determine of the program continues if answer In == 'Y' or answer In == 'Y' or answer In == 'yes': print(" You chose to continue.") return True else: print(" you chose not to continue. Goodbye.") return false #getting user info def customerInfo(): #asking user for info input classCode = str(input(" Use upper-case letters only. Please enter your classification code: ")) print("Classification code ontered was: ", classCode) while classCode != 'B' or classCode != 'D! or classCode != '': print(" The classification code entered was not recognized. Please try again.") classCode = str(input("Use upper-case letters only. Please enter your classification code: ")) print("Classification code ontered was: ", classCode) daysRented = int(input(" Use integeres only. InPlease enter the number of days the vehicle was rented: ")) print("The amount entered was: ", daysRented) startodometer int (input(" Use integers only. Please enter the odometer reading of the car at the start of the rental period: ")) print("The odometer reading entered was: ", startodometer) endodometer = int(input(" Use integers only. Please enter the odometer reading of the car at the end of the rental period: ")) print("The odometer reading entered was: ", endodometer) while startodometer > endodometer: print(" The odometer reading of the car at the end of the rental period is lower than the start odometer." " Please enter a number higher than ", startodometer) endodometer = int(input (" Use integers only. Please enter the odometer reading of the car at the end of the rental period: ")) print("The odometer reading entered was: ", endodometer) return classCode, daysRented, startodmeter, endometer #def billComputed (customer Info): main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions