Question: Create a function that takes in a list representing a cards deck and returns the value of the Primiera. For establishing the value of the
- Create a function that takes in a list representing a cards deck and returns the value of the Primiera. For establishing the value of the Primiera, a separate point scale is used for selecting the best cards in the player's deck, in each of the four suits and totaling those four cards point values. A Primiera requires at least one card for each suit, otherwise, it can't be calculated. If one or more seeds are missing from the deck the value of the Primiera is equal to 0.
The function is a given a list of string where each string represents a card. A card is represented by two characters. First character shows the number of the card (A for Ace, 2-9, J for Jack, Q for Queen, and K for King) and second character shows the suite (d for diamonds, h for hearts, c for club, and s for spread).
def Primiera (a_list):
// your code goes here
Example: # In the diamonds set 7 is higher than Ace (21 > 16).
print(Primiera(["Ad", "7d", "5h", "2c", "Ks"]))
# In the diamonds set 2 is higher than Jack (12 > 10), while in
# the spades set Ace is higher than 5 (16 > 15 ).
print(Primiera(["2d", "Jd", "7h", "Qc", "5s", "As"]))
#There aren't cards in the hearts set, so Primiera can't be calculated.
print(Primiera(["2d", "Jd", "Qc", "5s", "As"]))
#the function should return
58
59
0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
