Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON Design a function named get_thrust_from_user(altitude,speed,fuel,strength) with four parameters for values of altitude (float), speed (float), fuel (int), and strength (int). get_thrust_from_user() should ask the

PYTHON

Design a function named get_thrust_from_user(altitude,speed,fuel,strength) with four parameters for values of altitude (float),speed (float), fuel (int), and strength (int).

get_thrust_from_user() should ask the user to enter a thrust value. This function should not be permitted to return a negative value or a value greater than the remaining fuel or greater than the lander's strength. Keep asking the user for values until an acceptable one is entered.

You may assume that the user will only type numbers, but they may hit enter without typing anything at all.

This is the code I have so far but it is incorrect and I don't know why.

def get_thrust_from_user(altitude,speed,fuel,strength): """ Returns a valid thrust value Parameters: altitude:(float) a given value speed:(float) a given value fuel:(int) a given value strength:(int) a given value Returns: thrust:(int) a valid value that is positive and less that fuel and strength values """ thrust=input("Enter a thrust value:") if thrust=="": thrust=input("Enter a thrust value:") elif (int(thrust))>0 and (int(thrust))fuel or (int(thrust))>strength: thrust=input("Enter a thrust value:") return thrust

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

Step: 3

blur-text-image

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions