subject

PYTHON. Projectile Motion Write a program to provide information on the height of a ball thrown straight up into the air. The program should request as input the initial height, h feet, and the initial velocity, v feet per second. The height of the ball after t seconds is h + vt - 16t 2 feet. The program should perform the following two calculations:
A) Determine the maximum height of the ball. Note: The ball will reach its maximum height after v/32 seconds.
B) Determine approximately when the ball will hit the ground. Hint: Calculate the height after every 1 second and determine when the height is no longer a positive number.
A function named getInput should be used to obtain the values of h and v and that function should call a function named isValid to ensure that the input values are positive numbers. Each of the tasks (a) and (b) should be carried out by functions.
This is what I have with errors:
def main():
h = getInput()
v = getInput()
maxH = maxHeight(h, v)
ballT = ballTime(h, v, t)
print("The maximum height of the ball is", maxH, "feet.")
print("The ball will hit the ground after approximately", ballT, "seconds.")
def getInput():
h = (input("Enter the initial height of the ball: "))
v = (input("Enter the initial velocity of the ball: "))
isValid(h, v)
def isValid(h, v):
if ((h<= 0) or (v <= 0)):
print("Please enter positive values")
getInput()
else:
maxHeight(h, v)
def maxHeight(h, v):
t = (v/32)
maxH = (h + (v*h) - (16*t*t))
return maxH
def ballTime(h, v, t):
t = 0
ballHeight = (h + (v*t) - (16*t*t))
while (ballHeight >= 0):
t += 0.1
return t
main()

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, lizz1228
Kto rozmawia z clamentain przez krótkofalówke w the walking dead w 4 epizodzie
Answers: 1
image
Computers and Technology, 23.06.2019 18:00, fordkenae
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
image
Computers and Technology, 23.06.2019 22:00, rocksquad9125
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
image
Computers and Technology, 24.06.2019 00:30, rustjallison9928
Asecurity policy is a a. set of guidlines b. set of transmission protocols c. written document d. set of rules based on standards and guidelines
Answers: 2
You know the right answer?
PYTHON. Projectile Motion Write a program to provide information on the height of a ball thrown str...

Questions in other subjects: