Question: Using Python: Name your program define_cards.py Define (using variables) the rank and string values. Call the rank variable rank_string. Call the suit variable suit_string. Name

Using Python: Name your program define_cards.py Define (using variables) the rank and string values. Call the rank variable rank_string. Call the suit variable suit_string. Name the ranks ace, two, three, etc., in that order. Name the suits clubs, diamonds, hearts, and spades. Create a list called cards. Initialize it to null. Using a set of two for-loops (one inside the other), build the strings for all the cards in the deck. Make the outer loop the suit-loop (for example, for suit in range(4)) and the inner loop the rank-loop. In the inner loop, assign the value of the card string (that is, rank_string[rank] + " of " + suit_string[suit]) to the variable card_string. Still within the inner loop, append (using the append() built-in function) each card_string in turn to the end of the list of cards using the statement cards.append(card_string). Print an output label something like this: The cards are: Create another for-loop to print the cards. Call the counter n. Print all 52 card numbers and values. You will need to print both n and cards[n]. Print them on the same output line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!