I picked up these lines of code from a model answer to a textbook question
if self._initialSum == 0:
initialSum = v1 + v2
if initialSum in (2, 3, 12):
return "LOSE"
elif initialSum in (7, 11):
return "WIN"
else:
return "CONTINUE"
else:
sum = v1 + v2
if sum == 7:
return "LOSE"
elif sum == initialSum:
return "WIN"
else:
return "CONTINUE"
I am trying to figure out of self.initialSum and initialSum are referencing the same variable. My beginner understanding is the main if block and else block each have a initialSum however the else block is referencing it before it is set. Or is it set by self._initialSum.
I hope I am making sense guys. Thanks in advance
Kimmy
Aucun commentaire:
Enregistrer un commentaire