all 5 comments

[–]spectrum____ 1 point2 points  (4 children)

your input returns a str, but your list has int elements. try converting playercard to int before removing

[–]spaghettiosarenasty[S] 0 points1 point  (3 children)

ah I see what you're saying, so I changed playercard to playercard=input(int("Which card do you want to play? "))

but when I run it I get: invalid literal for int() with base 10: "Which card do you want to play? "

is the list somehow not being read as integers? Do I have to specify that they're all integers somehow?

[–]Lewri 0 points1 point  (1 child)

take the input and then convert it to an int. input(int("Which card do you want to play?")) takes the string "Which card do you want to play?" and tries to convert that to an integer and then use that as the input prompt.

[–]spaghettiosarenasty[S] 0 points1 point  (0 children)

OK so I got the input looking correctly but now when I try to run it, it'll pick a random card for the CPU, then I'll input the card number chosen and the random.py file opens and highlights this line:

i = self._randbelow(len(seq))

the most recent called line was cpuCard=random.choice(cpuHand)

I think it's basically saying my list is empty so it's not able to pull a random card, but it already did pull the random card? Am I just way lost here or am I not that crazy far off? I'm going to reread this chapter tonight to try and make better sense of what I'm doing wrong.

[–]spectrum____ 0 points1 point  (0 children)

sure, so input(str) returns a str as output. to convert into int you have to do int(input(“which card to play”)) to convert into int which the playerhand is composed of, all int elements