Question
Into to Python Instructions: In this lab you are to debug the code found at the end of these instructions: Find and correct all problems
Into to Python
Instructions: In this lab you are to debug the code found at the end of these instructions: Find and correct all problems found in the code. Create comments in the code explaining what you found and how you corrected it The purpose of this program is to calculate car insurance rates using the following rules: The base rate of insurance is $50 a month, Males pay a 25% premium over the base rate, Drivers in Michigan and Florida pay a 10% premium over the base rate, and Individuals under the age of 21 or over the 70 pay a 5% premium over the base rate
Grading: 2 General, compiles, comments, proper indentation, etc 4
Problem 1 found and corrected 4
Problem 2 found and corrected 4
Problem 3 found and corrected 4
Problem 4 found and corrected
Source Code:
# Lab 3.2 #
BASE_RATE = 50
print('Car Insurance Rate Estimator/n')
age = int(input('Enter your current age: '))
sex = input('Enter your sex: ')
state = input('Enter your state of residence: ')
cost = BASE_RATE
if(sex = 'M'):
cost = BASE_RATE + (BASE_RATE * .25)
if(state == 'MI' or state == 'FL'):
cost = BASE_RATE + (BASE_RATE * .25)
if(age < 21 or age > 70):
cost = BASE_RATE + (BASE_RATE * .25)
print(' You are a', age, 'year old ' + sex, 'and you live in ' + stateOfResidence)
print('Your insurance will cost $', format(cost, '.2f'), sep='')
Step 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