Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 Debug My Messy Code Create a python file called Messy.py . Copy and paste the following code in there and correct the errors so
Debug My Messy Code
Create a python file called
Messy.py Copy and paste the following code
in there and correct the errors so that it will run. Please also format it make
it readable. The code should output when is entered.
def main:
printIts time to go on a scavenger hunt!
print Youd be amazed how many things can go wrong!"
printPlease enter how long you want to travel for:
initialPos ;
time float input;
velocity ;
acceleration ;
# there is a math error in here causing
# an incorrect answer in the line below
position initialPos velocity time accelerationtime;
#if you are stuck on the math error, look at the footnote
printposition;
main Temperature
Write a program that converts a temperature from Celsius to Fahrenheit.
It should prompt the user for input, read a floating point value from
the keyboard, and calculate the result.
Here is the formula. Be careful not to use integer division!
Seconds to Hours
Write a program that converts a total number of seconds to hours, minutes,
and seconds. It should prompt the user for input, read an integer from
the keyboard, and calculate the result. For example, seconds
hours, minutes, and seconds".
Hint: Use the modulus operator.Cmplete each of the four following parts as separate Python programs.
Chocolate is All I Need
The HarrisBenedict equation estimates the number of calories your body
needs to maintain your weight if you do no exercise. This is called your basal
metabolic rate, or BMR The formula for the calories needed for a woman
to maintain her weight is:
weight height age
The formula for the calories needed for a man to maintain his weight is
weight height age
A typical chocolate bar contains calories. Write a program that
allows the user to input weight in pounds, height in inches, age in years.
The program should then output the number of chocolate bars that should
be consumed to maintain one's weight for person of the input height, weight,
and age for both a male and a female. You don't need to ask for the
user's gender, as we haven't learned if statements yet. Again, print out
the result of both equations and be sure to print which is which.
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