def ChooseCard(ValInput): CardsChosen = [] if (ValInput 30): return -1 #Value is not in range if UserCardAttempt == 0: return -2 #User has used up all his attempts for i in range(30): if ValInput == My_1D_Array[i]: print("Your value has been found") CardsChosen.append(ValInput) return i #Value has been found UserCardAttempt = UserCardAttempt - 1 ValGuess = input("Your attempt was wrong try again.") return ChooseCard(ValGuess)
I think you should declare a var that stores the cards selected outside of the `ChooseCard` and then modify the ValInput to verify if it is already in the list of the selected cards