Why does a set of double quote comment have effect on real code

Question:

This is the code which be reported error unexpexted indentation(because of the comment YOUR CODE HERE double quoted)

    while score0 < goal and score1 < goal:
        if  who == 0:
            num_rolls = strategy0(score0, score1)
            score0 += take_turn(num_rolls, score1, dice)
            who = other(who) if extra_turn(score0, score1) == False else who
        else:
            num_rolls = strategy1(score1, score0)
            score1 += take_turn(num_rolls, score0, dice)
            who = other(who) if extra_turn(score1, score0) == False else who    
    "*** YOUR CODE HERE ***"    

when I delete the "*** YOUR CODE HERE ***" (same indentation level of while) ,everything works fine.

By the way ,I have never seen a comment with a set of double quote(" ").Maybe common format of comment is like """ """ or #

Answer: the "*** YOUR CODE HERE ***" is a string literal.

Asked By: Half Dream

||

Answers:

That isn’t a comment, it’s a string literal

Answered By: ndc85430

It still works because it is a string, or more specifically a string literal:

A string literal or anonymous string is a type of literal for the representation of a string value in the source code of a computer program. Source

Putting a string like so in the code does absolute nothing, unless put in a function or assignment.

Answered By: DialFrost
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.