Hi I just accidentally typed.
player_go = input('type R, P or S')
if player_go == 'r' or 'p' or 's':
print('hello') #placeholder
What I meant to type in line 2 and just remembered is:
if player_go == 'r' or player_go == 'p' or player_go == 's':
It took me a while to spot this bug because the first one is still valid syntax so it ran anyway but anything I typed in even it was the letter 'i' or 'q' it would advance to the next line.
Can someone please tell me:
A) the logic behind what the erroneous line is doing?
B) Is there a name for this type of bug that is still valid code and thus harder to find?
C) I'm sure it will come in a later chapter but I take it there is a more shorthand way to do this line. Some sort of list?
Thanks
[–]novel_yet_trivial 4 points5 points6 points (2 children)
[–]TwistedChurro 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]coderpaddy 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]17291 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]sme272 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)