Question: Create a Python file named logic _ errors.py and copy the following code. Each line that contains an error, add a hash ( # )
Create a Python file named logicerrors.py and copy the following code.
Each line that contains an error, add a hash # at the beginning of each line that contains an error to mark it as a comment and add another comment above it
explaining what the error is and then another line below that with the corrected code if possible as you did in Ex
Note: copy the code as written first. The code will run without any changes to it
In this example, do not change anything below line
This is an embedded test. This file could be imported into another file for use, after it is fixed. If it is run by itself, it will only test the functions, but if imported into
another program, the functions could be called independently and the tests would not run separately. This is a good way to testing that your functions are working
when they are being used in other programs.
#usrbinenv python
# Palomar College CSIT
# Your Name Here
# find the errors in the sample code.
# constants supplied in project specification.
MIPERKM # Do not change.
LBSPERKG # Do not change.
# convert miles to kilometers
def mitokmmiles:
miles MIPERKM
return miles
# convert kilometers to miles
def kmtomikm:
miles km MIPERKM
return miles
# convert kilograms to pounds
def kgtolbs :
LBSPERKG
return LBSPERKG
# convert pounds to kilograms
def lbstokglbs:
lbs LBSPERKG
return lbs
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
