EDIT: The question isn't a duplicate as i'm asking how to shorten this task which is written out in full and the question that is said to be duplicate to mine asks why 'a == b or c or d' always evaluates to True which i know the answer of and that isn't what I'm stuck with.
I started making this function however i have no idea who to shorten this 'or' task as first of all it doesn't look good and second if the list was 100 elements long it would be ridiculous to be typing moves[n] all the way to moves[n+99].
Any suggestions of how to shorten this as i can't think of anything also side note they need to be integers i know i could have done
if playerMove == '1 2 3 4 5 6 7 8 9'.split():
however playerMove is a integer and the numbers are strings.
def getPlayerMove(playerMove):
while True:
n=0
moves = [1,2,3,4,5,6,7,8,9]
if playerMove == moves[n] or moves[n+1] or moves[n+2] or moves[+3] or moves[n+4] or moves[n+5] or moves[n+6] or moves[n+7] or moves[n+8] or moves[n+9]:
return playerMove
else:
playerMove = int(input("Enter Number 1-9"))