[Tutor] Hanging myself on substitution
Fri, 3 Aug 2001 17:25:25 +0100
> import random
> import string
> while counter <10:
move this outside the loop since you only need to do it once.
> '''here is where my pain begins...'''
> choose=random.randint(1,%i)% total_cards #<-grrr!
The % format operator only works on strings you should do:
choose=random.randint(1,total_cards) # or use random.choice maybe?
> del schmack[choose]
# now decrement total_cards coz youve removed one.
total_cards -= 1
> print chosen
You could use a "for counter in range(10):" to do the same job with