0

One little part of my code is:

def check_bullet_alien_collisions(ai_settings, screen, ship, aliens, bullets):
    """Respond to bullet-alien collisions.""" # <-- this line
    collisions = pygame.sprite.groupcollide(bullets, aliens, False, True)
    if len(aliens) == 0:
        bullets.empty()
        create_fleet(ai_settings, screen, ship, aliens)

The second line, do I need those three sets of quotes? If so what are they used for?

rassar
  • 5,412
  • 3
  • 25
  • 41

1 Answers1

0

These triple quotes are used to write multiple-lines comments, like:

""" This variable represents collisions:
    it is used to respond to collisions
    between bullets and aliens.
"""

You can also use triple single quotes '''/''' for that. Otherwise, you would need to write # in each comment line, like this:

 # This variable represents collisions:
 # it is used to respond to collisions
 # between bullets and aliens.

In your case, since you have only one comment line, you can use the # approach instead, like this:

# Respond to bullet-alien collisions.

Hope this helps.

Taher A. Ghaleb
  • 5,120
  • 5
  • 31
  • 44