Computers and Technology
Computers and Technology, 15.07.2020 01:01, rfultz27

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()

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:00, carealee
How should you set the ohms adjust control on a multitester of analog vom, for resistance measurements?
Answers: 1
image
Computers and Technology, 23.06.2019 16:00, lokaranjan5736
Write a grading program for a class with the following grading policies: a. there are two quizzes, each graded on the basis of 10 points. b. there is one midterm exam and one final exam, each graded on the basis of 100 points. c. the final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a total of 25%. (do not forget to normalize the quiz scores. they should be converted to a percentage before they are averaged in.) any grade of 90 or more is an a, any grade of 80 or more (but less than 90) is a b, any grade of 70 or more (but less than 80) is a c, any grade of 60 or more (but less than 70) is a d, and any grade below 60 is an f. the program will read in the student’s scores and output the student’s record, which consists of two quiz and two exam scores as well as the student’s average numeric score for the entire course and final letter grade. define and use a structure for the student reco
Answers: 2
image
Computers and Technology, 24.06.2019 12:00, log40
Jack is assisting his younger sibling mary with her mathematics assignment, which includes a study of the number system. jack explains to mary that whole numbers are counting numbers that could be used to record the number of fruits in a basket. which data type represents whole numbers? a. integers. b.floating-point numbers. c. strings. d.boolean
Answers: 1
image
Computers and Technology, 24.06.2019 17:00, mrsrobinson1014
What are some examples of what can be changed through options available in the font dialog box? check all that apply. font family italicizing bolding pasting drop shadow cutting character spacing special symbols
Answers: 2
Do you know the correct answer?
PYTHON. Projectile Motion Write a program to provide information on the height of a ball thrown str...

Questions in other subjects:

Konu
Mathematics, 22.02.2021 04:50