擅长:python、mysql、java
<pre><code># you do not have to write all the names of cards. you can use loop method.
# first create a list of suit and rank names and an empty list for cards.
# then use for loop and append all cards to a list.
suit_names = ['Clubs', 'Diamonds', 'Hearts', 'Spades']
rank_names = ['Ace', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King']
cards=[]
for rank in rank_names:
for suit in suit_names:
cards.append(rank+' of '+suit)
print cards
# import random. random has a built in method which chooses elements from list randomly; you can use it instead of ranint.
import random
removed_cards=[]
# create ans empty list for removed cards and append randomly chosen cards to that list.
removed_cards.append(random.choice(cards))
</code></pre>