Do I need “”“/”“”? What do they do? [duplicate]
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?
python-3.x
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.
add a comment |
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?
python-3.x
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
add a comment |
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?
python-3.x
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
python-3.x
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 14 '18 at 18:32
TeeKeaTeeKea
3,20851730
3,20851730
add a comment |
add a comment |
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