Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help and explain a tiny bit. Part 2 - Function Main (the game) In function Main you will need three variables to represent the

please help and explain a tiny bit.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Part 2 - Function Main (the game) In function Main you will need three variables to represent the current altitude, the current velocity, and the amount of remaining fuel. You will be graded on appropriateness of your variable names (that is, do not use AV, and F, or X, Y, and z, bt pick something that would allow you/me/us to understand at a glance what your variables represent). Initially, assign 1000.0 to the altitude, 40.0 to the velocity, and 25.0 to the fuel. Print out these values. Next, do a loop that runs as long as the altitude is greater than zero. Inside the loop, if you still have fuel remaining in the tank ask for the amount of fuel to burn (that is, call Get Fuel); otherwise the amount of fuel to burn is automatically set to zero. If the amount requested is more than what it available, set the fuel to burn to the available amount. Subtract the amount of fuel to burn from your remaining fuel. Subtract 4 times the fuel to burn om the velocity, but add 2 for the acceleration due to gravity. Subtract the velocity from the altitude. Finally, print out the altitude, velocity, and remaining fuel. After the loop, you've either landed or crashed. A crash is when the velocity as you hit the surface is greater than 5 m/second. Otherwise, you landed safely. Print out the result: did you land or crash? Test your program by typing Main() at the command line. I've included a number of sample runs at the end of this document for you to use as reference and to test your program. Correct any errors until it works correctly NOTE: My version of Main is around 20-22 Python statements long, including the def and return. def GetFuel(message): while True: # try: answer float(input(message)) if answer >> GetFuel ("Enter Fuel --- ") Enter Fuel Enter Fuel Frog Enter Fuel 5.0 The value returned in Answer >>> GetFuel ("I like Frogs ") I like Frogs 6.7 The value returned in Answer - 5 --- 6.7

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions