Python code for n-body problem