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 ***"
say=say(score0,score1)
when I delete the "*** YOUR CODE HERE ***"
(same indentation level of while) ,everything works fine.
I wonder why is that,and a interesting fact is that when the comment exists ,last line code say=say(score0,score1)
is not in the scope of while.
By the way ,I have never seen a comment with a set of double quote(" "
).Maybe common format of comment is like """ """
or #
CodePudding user response:
That isn't a comment, it's a string literal
CodePudding user response:
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.