[ create a new paste ] login | about

Link: http://codepad.org/fQHdp76z    [ raw code | output | fork ]

Python, pasted on Nov 8:
import random
def pick_cards(n):
    cards=(A,A,A,A,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,J,J,J,J,Q,Q,Q,Q,K,K,K,K)
    unique_cards=set()
    for i in range(n):
        c=random.choice(cards)
        unique_cards.add(c)
    return unique_cards
def print_cards(h):
    for c in h:
        print(c)
    print()
    
    
def main():
    n=int(input('how many cards? '))
    unique=pick_cards(n)
    print('your hand:')
    print_cards(unique)
main()
    
    


Output:
1
2
3
4
5
6
how many cards? Traceback (most recent call last):
  Line 20, in <module>
    main()
  Line 16, in main
    n=int(input('how many cards? '))
EOFError


Create a new paste based on this one


Comments: