On Tue, Dec 12, 2017 at 5:46 AM, Peter Otten <__pete...@web.de> wrote: > You can test for a collision and exit if an asteroid is close to a spaceship > with > > for s in spaceship: > for a in asteroid: > if calculate_distance(s, a) < 62.5: > print("One of your ships was hit by an asteroid") > exit() > > There are two loops because you want to test every asteroid for every > spaceship (although you only have one at the moment).
Then shouldn't they be "spaceships" and "asteroids" in the plural? It looks wrong to iterate over a singular asteroid. (And I'd prefer to iterate over a collection of spaceships in the plural even if I know it's a list of one, though I can understand that a list of one is a tricky case for some people.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list