Do I need “”“/”“”? What do they do? [duplicate]










0
















This question already has an answer here:



  • String literal with triple quotes in function definitions

    6 answers



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?










share|improve this question















marked as duplicate by Amy, Andrea Corbellini, usr2564301, Patrick Haugh, JJJ Nov 14 '18 at 19:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • That's a docstring. It documents what the function does: python.org/dev/peps/pep-0257

    – divibisan
    Nov 14 '18 at 18:23











  • Python basic: comments

    – Kevin He
    Nov 14 '18 at 18:23















0
















This question already has an answer here:



  • String literal with triple quotes in function definitions

    6 answers



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?










share|improve this question















marked as duplicate by Amy, Andrea Corbellini, usr2564301, Patrick Haugh, JJJ Nov 14 '18 at 19:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • That's a docstring. It documents what the function does: python.org/dev/peps/pep-0257

    – divibisan
    Nov 14 '18 at 18:23











  • Python basic: comments

    – Kevin He
    Nov 14 '18 at 18:23













0












0








0









This question already has an answer here:



  • String literal with triple quotes in function definitions

    6 answers



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?










share|improve this question

















This question already has an answer here:



  • String literal with triple quotes in function definitions

    6 answers



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?





This question already has an answer here:



  • String literal with triple quotes in function definitions

    6 answers







python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 18:23









rassar

2,39711129




2,39711129










asked Nov 14 '18 at 18:21









ian tippettian tippett

31




31




marked as duplicate by Amy, Andrea Corbellini, usr2564301, Patrick Haugh, JJJ Nov 14 '18 at 19:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Amy, Andrea Corbellini, usr2564301, Patrick Haugh, JJJ Nov 14 '18 at 19:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • That's a docstring. It documents what the function does: python.org/dev/peps/pep-0257

    – divibisan
    Nov 14 '18 at 18:23











  • Python basic: comments

    – Kevin He
    Nov 14 '18 at 18:23

















  • That's a docstring. It documents what the function does: python.org/dev/peps/pep-0257

    – divibisan
    Nov 14 '18 at 18:23











  • Python basic: comments

    – Kevin He
    Nov 14 '18 at 18:23
















That's a docstring. It documents what the function does: python.org/dev/peps/pep-0257

– divibisan
Nov 14 '18 at 18:23





That's a docstring. It documents what the function does: python.org/dev/peps/pep-0257

– divibisan
Nov 14 '18 at 18:23













Python basic: comments

– Kevin He
Nov 14 '18 at 18:23





Python basic: comments

– Kevin He
Nov 14 '18 at 18:23












1 Answer
1






active

oldest

votes


















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.






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    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.






    share|improve this answer



























      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.






      share|improve this answer

























        0












        0








        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '18 at 18:32









        TeeKeaTeeKea

        3,20851730




        3,20851730















            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            ReactJS Fetched API data displays live - need Data displayed static

            Evgeni Malkin