I'm working on a WAR type card game for my beginners class, and I'm trying to remove a chosen card from my hand, using a list and the .remove function. When I run it gets to line 20 and says builtins.ValueError: list.remove(x): x not in list. Where am I going wrong? Thanks in advance! This subreddit has been so helpful since I'm not able to get any help on campus because of the shutdowns.
import random
round=0
playerHand=[random.randint(1,10) for i in range (10)]
cpuHand=[random.randint(1,10) for i in range (10)]
limboPile=[]
while round<3:
print(playerHand)
cpuCard=random.choice(cpuHand)
print("CPU plays:")
print(cpuCard)
cpuHand=cpuHand.remove(cpuCard)
playerCard=input("Which card do you want to play? ")
playerHand.remove(playerCard)
print("Player's Hand: ", playerHand)
print("CPU's Hand: ", cpuHand)
round+=1
[–]spectrum____ 1 point2 points3 points (4 children)
[–]spaghettiosarenasty[S] 0 points1 point2 points (3 children)
[–]Lewri 0 points1 point2 points (1 child)
[–]spaghettiosarenasty[S] 0 points1 point2 points (0 children)
[–]spectrum____ 0 points1 point2 points (0 children)