from math import pi Cd = 0.2 # drag coefficient Q = 1.2 # denisity of air (in kg*mE-3) A = pi*0.11**2 # cross-sectional area (in m**2) V1 = 120/3.6 # velocity of ball, hard kick (in m/s) V2 = 10/3.6 # velocity of ball, soft kick (in m/s) m = 0.43 # mass of ball (in kg) g = 9.81 # gravitational constant (in m/s**2) Fd1 = 0.5*Cd*Q*A*V1**2 Fd2 = 0.5*Cd*Q*A*V2**2 Fg = m*g ratio1 = Fd1/Fg ratio2 = Fd2/Fg print '''A football that is kicked hard (at {V1:g} m/s) has a drag force of {Fd1:.1f}N, a gravity force of {Fg:.1f}N, and a ratio Fd:Fg of {ratio1:g}. A football that is kicked softly (at {V2:g} m/s) has a drag force of {Fd2:.1f}N, a gravity force of {Fg:.1f}N, and a ratio Fd:Fg of {ratio2:g}.'''.format(V1=V1, Fd1=Fd1, Fg=Fg, ratio1=ratio1, V2=V2, Fd2=Fd2, ratio2=ratio2) ''' Sample run: A football that is kicked hard (at 33.3333 m/s) has a drag force of 5.1N, a gravity force of 4.2N, and a ratio Fd:Fg of 1.20154. A football that is kicked softly (at 2.77778 m/s) has a drag force of 0.0N, a gravity force of 4.2N, and a ratio Fd:Fg of 0.00834399. '''
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