# -*- coding: utf-8 -*-
# Exercise 2.17
# Author: Little Horned Owl

v0 = 4.1
g = 9.81
n = 17
h = (2*v0/g)/n

t = [h*i for i in range(n+1)]
y = [v0*t - 0.5*g*t**2 for t in t]

# section a)
ty1 = [t, y]
for j in range(len(ty1[0])):
    print("{:6.2f} {:6.2f}".format(ty1[0][j], ty1[1][j]))

# section b)
ty2 = [[t, y] for t, y in zip(t, y)]
for row in ty2:
    for elem in row:
        print("{:6.2f}".format(elem), end=' ')
    print()

"""
Trial run
python3 ball-table-3.py
  0.00   0.00
  0.05   0.19
  0.10   0.36
  0.15   0.50
  0.20   0.62
  0.25   0.71
  0.30   0.78
  0.34   0.83
  0.39   0.85
  0.44   0.85
  0.49   0.83
  0.54   0.78
  0.59   0.71
  0.64   0.62
  0.69   0.50
  0.74   0.36
  0.79   0.19
  0.84  -0.00
  0.00   0.00 
  0.05   0.19 
  0.10   0.36 
  0.15   0.50 
  0.20   0.62 
  0.25   0.71 
  0.30   0.78 
  0.34   0.83 
  0.39   0.85 
  0.44   0.85 
  0.49   0.83 
  0.54   0.78 
  0.59   0.71 
  0.64   0.62 
  0.69   0.50 
  0.74   0.36 
  0.79   0.19 
  0.84  -0.00
"""
