Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Programming, Help please Run C Code Problem Description: Consider that you and your friend are visiting a building that has 15 floors. Assume that

Python Programming, Help please image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Run C Code Problem Description: Consider that you and your friend are visiting a building that has 15 floors. Assume that you both are going to play a game where your friend will drop a bat from different floors of that building and you have to catch it by staying on the ground You find that everytime your friend goes to a higher floor and drops the ball, the ball travels with a much higher velocity (hence, dificult to catch the ball on the ground) when compared to the ball being dropped from the lower floors. This spikes your curiosity and thus, your task is now to find the velocity of the ball when your friend drops the ball from different floors Each foor is at a different height from the ground and the velocity with which the ball comes down will depend on the heights from which the ball is dropped Below you can find the table that entists the height of different foors from the ground in the units of foot (plural form feet) Floor number Height from the ground (foot) 3 9 5 15 5 18 9 27 11 33 12 36 14 You would have learned in high school that there are two forms of energy Potential energy and kinetic energy. And, you also know that Earth has gravity and is because of Earth's gravity that any object in this case, ball) must come down when it is dropped from a particular height, Potential energy is the energy that the object possesses because of its position in a gravitational space in this case. Earth's gravity) and hence it depends on the mass of the ball Earth gravity, and the height from which the ball is dropped Simply put, Potential energy = maxs x gravity x height Insert 3 View Cel Kernel Widgets Help Trusted Python Run C Code Potential energy = mass X gravity x height (1) Further, kinetic energy is the energy of the object while in motion and hence it depends on the mass of the ball and the velocity of the ball when it is moving downwards towards the ground Simply put. Kinetic energy Xmass x velocity Wnen the ball is dropped from a certain height, the potential energy of the ball that is initially at rest before dropping it is converted into kinetic energy in is in motion 0.e moving towards towards the ground) So. In order to get the velocity of the ball you have to simply equate the formulas for potential energy and kinetic energy based on the concept of conservation of energy Potential energy = Kinetic energy (3) maxs X gravity x height= Xmass x velocity Assume that the mass of the ball that your friend drops from different floors (le different heights from the ground) is (1000 + last two digits of your number) grams. The gravity of the Earth is 9.8 meter second? You have to now use Equation (4) to find the velocity of the ball in the units of meter second that is dropped from different heights as given in the table above Specific tasks for this problem are given below Task 1 (5 points): Convert the values of height (in feet) that is given in the table to the unit of meters. To do this, define a list which will contain all the height values in feet and Store it in a vanable name heights feet. Following this loop over each height value in feet) in the list heights feet and convert it to meters (conversion from feet to meters is given below). Append the converted height values in meters to a new list and store it in a new variable name heights meters. Pint heights_meters to the output 1 feet = 0,3048 meters Edit View Insert Cell Kernel Widgets Help Trusted Python 3 O x Run Code 1 feet 0.3048 meters Note: In order to use the values of height in meters for the other tasks in this problem, create an empty ist and store in a variable rame heights_meters to which you will append the height values in meters after conversion Also, refer to Problem 1 to know how to define an empty list and to append values to an empty list (10013 MMGIVE THE SOLUTION FOR TASK? IN THIS CELL: Out(100): 12.742000000000003, 4.572 5.486400000000001, 7.315200000000001, 8.2298, 10.0534 10.972800000000001, 12.8016) Task 2 (5 points) Calculate the velocity of the ball dropped from different neighis in meter second. To do this task write a loop again and use the values of mass of the ball gravity, and the list heights_meters that contains the heignt values in meters in Equation (4) Make sure you store the values of mass and gravity in variable names mass and gravity, respectively. Append the calculated Velocity values based on different heght values to a new list and stories at new variablere velocity values. Print velocity values to the output Note: Create an empty list and store it in a variable name velocity values to which you will append the velocity values that you wit Calculate based on Equation (4) inside the loop Also refer to Problem-1 to know how to define an empty list and to append values to an emply list View Insert Cell Kernel Widgets Help Thested Python o Run Code 12.2011 Task-2 (5 points): Calculate the velocity of the ball dropped from different heights in meter/second. To do this task, write a loop again and use the values of mass of the ball, gravity, and the list heights meters that contains the height values in meters in Equation (4). Make sure you store the values of mass and gravity in variabile names mass and gravity, respectively. Append the calculated velocity values based on different height values to a new list and store it in a new variable nam velocity values Print velocity values to the output Note: Create an empty list and store it in a variable name velocity values to which you will append the velocity values that you will calculate based on Equation (4) inside the loop. Also refer to Problem-1 to know how to denne an empty list and to append values to an empty ist. Task-3 (5 points) Perform the same task as above but in this case, you have to do it inside a function Specifically, you have to write a function velocity func that will take the values of mass, gravity, and the list heights_meters as inputs and then calculate the velocity values based on different heights inside the function using Equation (4). When you call the function, give it a new variable name ball velocity Paintball velocity and the type of ball_Velocity to the output Note: Make sure that the function that you write returns a list which could be done by creating an empty list with a variable name velocity values inside the function to which you will append the velocity values that you will calculate based on Equation (4). Also, refer to Problem-1 to know how to define an empty list and to append values to an empty list GIVE THE SOLUTION FOR TASK-3 IN THIS CELLS Edit View Insert Cell Komel Widgets Help X Run Code Task 4 (6 points): Perform the same task as above but in this case, you have to pass a Numpy array with a variable name heights meters array that consists of values of heights in meters to the user-defined function Specifically, you have to write a function velocity func array that will take the value of massgravity, and the numpy array heights meters array as inputs and calculate the velocity values based on different heights inside the function using Equation (4) When you call the function, give it a new vartable name ball_Velocity array Print ball_Velocity_array and the type of ball_velocity_array to the output Note-1: You have to convert the list heights_meters to a Numpy array heights meters_array which you will pass to the function and also make sure that the function that you write returns a Numpy array Note-2: When you use the values in Numpy array heights_meters array in Equation (4) along with the mass and the gravity values to get the Velocity values, think what should be done differently when compared to the previous task. In other words, you would have to write a loop in the previous task to get the velocity values for each value of height in meters is that necessary here? Remember one of the main advantages of using Numpy arrays over lists [ : MGIVE THE SOLUTION FOR TASK-4 IN THIS CELL: Task-5 (2 points): You somehow find that when the ball travels greater then 11 meter second, it becomes difficult to catch the ball on the ground. Now, in this task you would to know how many velocity values are greater than 11 meter/second in other words, you would like to find how many floors contribute to velocities greater than 11 meter second. For this, do a conditional selection on ball_Velocity array such that you pick velocity values that are greater than 11 metersecond and store it in a new variable name ball velocity selection. Use ball velocity_selection to find the number of velocity values that satisfied the condition and store it in a new variable name ball_velocity_Size Print ball_Velocity_selection and ball velocity size to the output DEN GIVE THE SOLUTION FOR TASK-5 IN THIS CELL: Task 6 points): You would now like to find the kinetic energy of the ball in Joules (3) when it travels at a maximum velocity. The conversion for other is given below 1 Joule = 1 To finish this task, first get the maximum velocity value from ball_Velocity selection and store it in a new variable name ball velocity maximum Use ball_Velocity_maximum to calculate the kinetic energy in Joules based on Equation (2) Store the kinetic energy value that you get in a new variable name kinetic energy Print ball_velocity maximum and kinetic energy to the output Note: Be careful with the unit conversions to get the kinetic energy value in Joutes n 1: PGIVE THE SOLUTION FOR TASK-6 IN THIS CELL: --END OF PROBLEM-3

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

Microsoft Office 365 For Beginners 2022 8 In 1

Authors: James Holler

1st Edition

B0B2WRC1RX, 979-8833565759

More Books

Students also viewed these Databases questions

Question

46. Explain how holographic storage works.

Answered: 1 week ago