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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 22.06.2019 22:30
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
question
Computers and Technology, 23.06.2019 00:20
Ihave been given the number of guns per 100, and the total firearm-related deaths per 100,000. i have to find the actual number of guns per country and actual number of gun-related deaths. if somebody could show me how to do 1 question, i can finish the rest, i am just confused. tia
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
You know the right answer?
PYTHON. Projectile Motion Write a program to provide information on the height of a ball thrown str...
Questions
question
Mathematics, 28.06.2019 09:30
question
Mathematics, 28.06.2019 09:30
question
Chemistry, 28.06.2019 09:30
question
Social Studies, 28.06.2019 09:30
question
Mathematics, 28.06.2019 09:30
Questions on the website: 13722367