Python - random card
Question: I am trying to make a program in python in which the computer displays a
random card when the user presses enter. The same card can not be printed
twice. My code so far is:

    
    
    from random import *
    
    used = []
    
    number = randint(1,13)
    if number == 11:
        number = 'Jack'
    elif number == 12:
        number  = 'Queen'
    elif number == 13:
        number = 'King'
    
    suit = randint(1,4)
    if suit == 1:
        suit = 'Hearts'
    elif suit == 2:
       suit = 'Spades'
    elif suit == 3:
        suit = 'Diamonds'
    elif suit == 4:
        suit = 'Clubs'
    
    end = False
    
    while end == False :
        get = raw_input('Press enter to get a card')
        if get == 'end':
            end == True
            continue
        card = number , suit
        for i in (used):
            if card == i:
                continue
            used.append(card)
        print card
    

So far it only outputs the same card every time the user presses enter and the
program does not end when the user types 'end'. Can anybody find the mistakes?


Answer: The issue is that in the while loop you assign

    
    
    card = number, suit
    

But `number` and `suit` were picked once before you enter the loop and
therefore will never change. You need to reassign `number` and `suit` each
time you loop.

Additionally, you are iterating over the cards in `used`, but initially there
are no cards there, so that loop will never execute. And since the only place
you add `card` to `used` is inside that `for` loop it will never add anything
to `used`.

