Python Summer 2013


Due: Tuesday, July 23rd

Write a program that deals random cards, printing the "rank" of the card and its "suit" (both randomly generated) until you have dealt 4 aces.

To select a card, you will first choose a random number from 1 - 13 which will represent the "rank" of the card. Numbers from 2 through 10 can be printed just as they are. However, the number 1 should print "Ace", the number 11 should print "Jack", the number 12 should print "Queen" and the number 13 should print "King".

You will also have to select a second random number from 1 to 4 which represents the "suit". This is completely independent of the "rank" described above.

(Notice that each time you draw a card, it is as if it were from a fresh (undealt) deck. Thus, it is possible to draw two or more "Aces of Spades", or two or more "3 of Clubs".)

At the end of the program, you should print out the number of face cards (Jack, Queen or King) that you dealt.


A possible output might look like:

You dealt:
Card #1: A 2 of Hearts
Card #2: A Queen of Spades
Card #3: A 10 of Diamonds
Card #4: A Queen of Spades
Card #5: A 5 Card of Clubs
Card #50: An Ace of Hearts
There were 12 Face Cards dealt!

As usual, when you are done and have tested it, post your source file to "NYU Classes".

(As a reminder, you can reach your grader Emily Lin at: su200202 [at] cs [dot] nyu [dot] edu)