Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 4.2: Finding maximum height Now you're going to take your code for finding the maximum snowball height and turn it into a function that

image text in transcribed
Part 4.2: Finding maximum height Now you're going to take your code for finding the maximum snowball height and turn it into a function that can determine the maximum height and the time it reaches that height for any initial height and initial speed. Your function, let's call it find max_height, should: 1. Take initial height, initial speed, time step size, and a time limit as input variables. The time limit should be used to control how long your loop runs for. 2. Compute and return the maximum height and the time when the snowball reaches that height. 3. Your function should not print anything in it's final form (but you can use print statements to test/debug your code) Once you have a function that you think works, try running it for the same values you used before to confirm that it's behaving as intended: Initial height of 1.75 Initial speed of 47 m/s Time step size of 0.5 seconds Total time span of 10 seconds You function should work so that you can just run the following command: max _height, time_of max - find max height (1.75, 47, 0.5, 10) Call your function and print the resulting values. Then, test it on some new values for all of your input parameters! [ ]: | # Put your code here Part 4.2: Finding maximum height Now you're going to take your code for finding the maximum snowball height and turn it into a function that can determine the maximum height and the time it reaches that height for any initial height and initial speed. Your function, let's call it find max_height, should: 1. Take initial height, initial speed, time step size, and a time limit as input variables. The time limit should be used to control how long your loop runs for. 2. Compute and return the maximum height and the time when the snowball reaches that height. 3. Your function should not print anything in it's final form (but you can use print statements to test/debug your code) Once you have a function that you think works, try running it for the same values you used before to confirm that it's behaving as intended: Initial height of 1.75 Initial speed of 47 m/s Time step size of 0.5 seconds Total time span of 10 seconds You function should work so that you can just run the following command: max _height, time_of max - find max height (1.75, 47, 0.5, 10) Call your function and print the resulting values. Then, test it on some new values for all of your input parameters! [ ]: | # Put your code here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions