Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A Python program simulates the flight of a cannonball. The program asks the user to press Enter to fire the projectile The cannonball is then

A Python program  simulates the flight of a cannonball. The program asks the user to press "Enter" to fire the projectile

 

The cannonball is then drawn, frame by frame, as it moves through a ballistic path. Once a frame has been drawn do not erase it, we want an 'onionskin' drawing of the animation 

The animation stops when the cannonball gets to a position where y is less than the starting y coordinate of the cannonball

 

You can choose the factors that control the trajectory (velocity vector, gravity strength, and initial position of the ball), but you need to balance them so the ball starts near the lower-left corner of the screen. reaches almost to the top of the screen, and is still on the screen when it stops.

 

Here is the code I have so far.

 

-------Code-------

from turtle import *
speed(0)
hideturtle()
penup()

vel = [8,25]
charge = 10
position = (-250, -200)
gravity = -1
input("Press enter to fire.")
goto(position)
dot(10,"black")

goto(xcor()+vel[0],ycor()+vel[1])

Step by Step Solution

3.37 Rating (153 Votes )

There are 3 Steps involved in it

Step: 1

from turtle import Set up the turtle screen Speed D hidet... 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

Cost management a strategic approach

Authors: Edward J. Blocher, David E. Stout, Gary Cokins

5th edition

73526940, 978-0073526942

More Books

Students also viewed these Programming questions

Question

describe the activity sectors in the services industry

Answered: 1 week ago

Question

What about psychology has surprised you the most so far?

Answered: 1 week ago