Question

ANACONDA PYTHON 3 NOTEBOOK. In this assignment you will calculate how far a ball will travel....

ANACONDA PYTHON 3 NOTEBOOK.

In this assignment you will calculate how far a ball will travel. The distance travel by a ball as it bounces can be measured as a percentage of the height form which the ball was dropped. We will call this the bounceIndex.  For example a ball dropped from a height of 10 feet that bounces 6 feet high has an index of 60% (.60).  A ball with a bounceIndex of .6 that is dropped from a height of 10 feet will have traveled 25.6 feet in two bounced (10 + 6 + 6 + 2.6).

Write a program that will ask the user to input the height for which the ball is dropped, the number of bounces and the bounceIndex.  Test that the values entered are >= 0, trap the user until they enter values >= 0. Output the total distance traveled by the ball.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
height = int(input("Enter the height from which the ball is dropped: "))
bounces = int(input("Enter the number of bounces: "))
bounceIndex = float(input("Enter the bounce index: "))
distance = 0
for i in range(bounces): # here i am iterating a loop for every bounce
    distance+= height+(height*bounceIndex) # and in every iteration adding 
    #  the height and its distance covered
    height = height*bounceIndex # finally decreasing the height o its 60 percent 
print(distance)

SL3.py test 2.py testz.py EUuldur.XL height = int(input(Enter the height from which the ball is dropped: )) bounces = int(i

Enter the height from which the ball is dropped: 101 Enter the number of bounces: 2 Enter the bounce index: 6 25.6 Process fi

FOR ANY OTHER QUERY PLEASE COMMENT

Add a comment
Know the answer?
Add Answer to:
ANACONDA PYTHON 3 NOTEBOOK. In this assignment you will calculate how far a ball will travel....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (3 points) A ball is dropped from a height of 10 feet and bounces. Suppose that...

    (3 points) A ball is dropped from a height of 10 feet and bounces. Suppose that each bounce is 5/8 of the height of the bounce before. Thus, after the ball hits the floor for the first time, it rises to a height of 10 ) = 6.25 feet, etc. (Assume no air resistance.) A. Find an expression for the height, in feet, to which the ball rises after it hits the floor for the nth time: hn = 10(5/8)^n...

  • (3 points) A ball is dropped from a height of 14 feet and bounces. Suppose that...

    (3 points) A ball is dropped from a height of 14 feet and bounces. Suppose that each bounce is 6/8 of the height of the bounce before. Thus, after the ball hits the floor for the first time, it rises to a height of 14 ) = 8.75 feet, etc. (Assume no air resistance.) A. Find an expression for the height, in feet, to which the ball rises after it hits the floor for the nth time: hm = 14(5/8^n...

  • CODE GIVEN % Create a program to plot the motion of the ping pong ball with...

    CODE GIVEN % Create a program to plot the motion of the ping pong ball with drag. % The program will take inputs for velocity in m/s and angle of launch. % note that with a high speed camera I estmated a launch speed for a ping % pong ball could be 30 m/s. vel=30; %m/s angle=60; % convert the degrees into radians so MATLAB likes it angle=angle*pi/180; % set initial values (time, distance, mass, gravity, drag) x(1)=0; % meters...

  • Use the link in the Jupyter Notebook activity to access your Python script. Once you have...

    Use the link in the Jupyter Notebook activity to access your Python script. Once you have made your calculations, complete this discussion. The script will output answers to the questions given below. You must attach your Python script output as an HTML file and respond to the questions below. In this discussion, you will apply the statistical concepts and techniques covered in this week's reading about hypothesis testing for the difference between two population proportions. In the previous week’s discussion,...

  • You stand two feet away from a planer mirror. How far is it from you to...

    You stand two feet away from a planer mirror. How far is it from you to your image? a. 2.0 ft b. 3.0 ft C. 4.0 ft. d. 5.0 ft. 10. A concave mirror forms a real image 25.0 cm from the mirror surface along the principal axis. If the corresponding object is at a 10.0-cm distance, what is the mirror's focal length? a. 1.43 cm b. 16.7 cm c. 12.4 cm d. 7.14 cm 11. If a virtual image...

  • Python 3: Please follow the respective rubric for the following function definition. Rubric: Rectangle Shape You...

    Python 3: Please follow the respective rubric for the following function definition. Rubric: Rectangle Shape You should implement the following functions to print a rectangle shape. • print_rectangle(length, width, fillChar, hollow). This function will use draw_shape_line() function to print a rectangle shape with the given length and width, If the hollow is true, the shape will be hollow rectangle, otherwise a filled rectangle. This function must not interact with the user. For example, the call print_rectangle(5, 10, '*', False) should...

  • Assignment 9 If you run around a half-mile track twice in 20 minutes a. What is...

    Assignment 9 If you run around a half-mile track twice in 20 minutes a. What is the total distance traveled? b. What is the speed in mi/hr (show work)? c. What is the total displacement? d. What is the velocity in mi/hr? You travel east 2 miles and then turn to the north and walk another 3 miles. What is your displacement (show work, make sure to show the direction as well)? You travel 6 miles at 40 degrees. How...

  • Solve exactly if possible. Express all decimals to 4 significant figures. 1) 2) 3) 4) 5)...

    Solve exactly if possible. Express all decimals to 4 significant figures. 1) 2) 3) 4) 5) 6) 7) What are Newton's Laws of motion? What is a "frame of reference"? What is a coordinate system? Express the point x-3, y-4 using polar coordinates. What is the SI unit for force? How is it defined using SI base units? What are the four fundamental forces in the universe? What is the approximate gravitational acceleration, g, near the Earth's surface? If this...

  • Programming language: PYTHON Prompt: You will be creating a program to show final investment amounts from...

    Programming language: PYTHON Prompt: You will be creating a program to show final investment amounts from a principal using simple or compound interest. First, get a principal amount from the user. Next, ask the user if simple or compound interest should be used. If the user types in anything other than these options, ask again until a correct option is chosen. Ask the user to type in the interest rate as a percentage from 0 to 100%. Finally, ask the...

  • Hi Guys, Need help on python questions Question 3. At the Singapore Zoo, each adult ticket...

    Hi Guys, Need help on python questions Question 3. At the Singapore Zoo, each adult ticket costs $ 39, each child (>= 3 years old, <= 12 years old) ticket costs $26.50 and each young child (< 3 years old) ticket is free. Write a program to ask the user to enter the number of tickets for each type and then display the ticket information. Your code must work exactly like the following example (the text in bold indicates the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT