Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  1. 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.

This is the Primiera points scale:

  • 7 is worth 21 points.
  • 6 is worth 18 points.
  • Ace is worth 16 points.
  • Cards from 2 to 5 are worth 10 points plus the card value.
  • Face cards (Jack, Queen and King) are worth 10 points.

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

Question How are IRAs treated for state tax law purposes?

Answered: 1 week ago