[ create a new paste ] login | about

Link: http://codepad.org/Jz2DwNQy    [ 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,end=' ')
    print()
    
    
def main():
    n=int(input('how many cards? '))
    unique=pick_cards(n)
    print('your hand:')
    print_cards(unique)
main()
    
    


Output:
1
2
  Line 3
SyntaxError: Non-ASCII character '\xe2' in file t.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details


Create a new paste based on this one


Comments: