import math def displacementWithHeight (U, A, H): v2 = math.cos(math.radians(A)) v123 = (U*v2) / 9.81 v45 = U * math.sin(math.radians(A)) v67= U ** 2 * (math.sin(math.radians(A)))**2 v678= v67+ (9.81*H*2) v45678 = v45 + math.sqrt(v678) Hd = v123 * v45678 print v2 print v123 print v45 print v67 print v678 print v45678 print "The total horizontal displacement of the projectile would be: ", Hd, " meters." angle = raw_input("What is the angle? ") initialSpeed = raw_input("What is the initial speed? ") height = raw_input("What is the initial height? ") displacementWithHeight (int(initialSpeed),int(angle), float(height))
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question