First, we define a function ball_height that calculates the height of the ball at a given time:

In [1]:
def ball_height(t, v_0=10):
    g = 9.81
    return v_0*t - 0.5*g*t**2

The function ball_velocity calculates the velocity of the ball:

In [6]:
def ball_velocity(t, v_0=10):
    g = 9.81
    return v_0 - g*t

Using the above functions we can plot height and velocity of the ball during its motion:

In [7]:
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import matplotlib.pyplot as plt
import numpy as np 
    
t = np.linspace(0,2)

plt.figure(figsize=(4,2))
plt.title('Height and velocity vs time (v$_0$ = 10 m/s)', fontsize=10)

#vertical line
plt.plot([1,1], [-10, 10], 'k:')

#velocity plot 
plt.plot(t, ball_velocity(t), 'r-')
plt.xlabel('time (sec)')   
plt.ylabel('velocity (m/s)', color='r') 

#height plot
ax2 = plt.gca().twinx()
plt.plot(t, ball_height(t))
plt.xlabel('time (sec)', fontsize=8)   
plt.ylabel('height (meters)', color='b') 

plt.show()

The plot shows that the ball reaches the highest point of about 5 meters approximately one second after being thrown up. At that time ball velocity changes from positive to negative. This observation is confirmed by numerical data that shows velocities and heights of the ball at various times:

In [8]:
print('{:>3}  {:>5}  {:>4}'.format('t', 'v', 'h'))
print('---  -----  ----')
for t in np.linspace(0,2, 11):
    v = ball_velocity(t)
    h = ball_height(t) 
    print('{:3.1f}  {:>5.2f}  {:4.2f}'.format(t, v, h))   
  t      v     h
---  -----  ----
0.0  10.00  0.00
0.2   8.04  1.80
0.4   6.08  3.22
0.6   4.11  4.23
0.8   2.15  4.86
1.0   0.19  5.09
1.2  -1.77  4.94
1.4  -3.73  4.39
1.6  -5.70  3.44
1.8  -7.66  2.11
2.0  -9.62  0.38