Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Analyze the Python code written below. There are 3 errors. In the space below identify the line that contains the error, the type of
Analyze the Python code written below. There are 3 errors. In the space below identify the line that contains the error, the type of error and how to fix it. In order to receive credit for this question you need to identify the line where the error occurs, the type of error and how you would fix it. When running correctly this code is supposed to ask the user for the name of their dog, their purchase options and the number of days, nights or sessions they wish to purchase. The program will then calculate the total cost and print out the name of the dog and the total. If the user enters D when prompted for their choice of options, Spot for the name of their dog and 3 for the number of days, the program will print the following: Dog Name: Total is: Spot $ 60 Your grade will be based on the following: What is causing the bug = 0.5 points What kind of bug is it? (logical, syntax, run-time) = 0.5 points How would you fix this bug? = 1 points UserChoice = str() numitems = int() CostPerDay = 35 DayCare 20 Training = 65 Total = float() cost = float() UserChoice = input("Enter your choice of day care options B = Boarding, D = Daycare o r T = Training: ") name = input("Enter the name of your dog: ") if UserChoice == "B": numitems = (input("How many nights will your dog be staying with us? ==> ")) cost = CostPerDay elif UserChoice == "D" numitems = int(input("How many days of daycare is your dog attending? ==> ")). else: cost = Day Care numitems = int(input("How many training sessions do you wish to researve? ==> ")) cost = Training #end if Total = numitems + cost print("Dog Name: name) print("Total is: $", Total)
Step by Step Solution
★★★★★
3.38 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
SureI can help you analyze the Python code The prompt asks you to identify three errors in the code ...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