Write a program that takes user input describing a playing card in the following short-hand notation:А Ace
2... 10 Card values
J Jack
Q Queen
K King
D Diamonds
H Hearts
S Spades
C Clubs

Your program should print the full description of the card. For example, Enter the card notation: QS Queen of Spades
Implement a class Card whose constructor takes the card notation string and whose getDescription method returns a description of the card. If the notation string is not in the correct format, the getDescription method should return the string "Unknown".

Answers

Answer 1
Answer:

Answer:

In python Language:

cardNotation = raw_input("Enter card notation: ")

 

# Create a dict for values

 

cardColors = {"D": "Diamonds",

             "H": "Hearts",

             "S": "Spades",

             "C": "Clubs"}

 

cardNumberValues = {"A": "Ace",

                   "J": "Jack",

                   "Q": "Queen",

                   "K": "King",

                   "2": "Two",

                   "3": "Three",

                   "4": "Four",

                   "5": "Five",

                   "6": "Six",

                   "7": "Seven",

                   "8": "Eight",

                   "9": "Nine",

                   "10": "Ten"}

 

# Handle cases when 10 comes in input

if len(cardNotation) == 3:

 

   number = cardNotation[:2]

   color = cardNotation[2:]

   print cardNumberValues.get(number) + " of " + cardColors.get(color)

 

elif len(cardNotation) == 2:

 

   number = cardNotation[:1]

   color = cardNotation[1:]

   print cardNumberValues.get(number) + " of " + cardColors.get(color)

 

else:

   print "INVALID VALUE"


Related Questions

codes with three characters are included in the icd-10-cm as the heading of a of codes that may be further subdivided by the use of 4th, 5th, or 6th characters, which provide greater detail.
Which quantity measures the rate at which a machine performs work?
Design an algorithm to find all the common elements in two sorted lists of numbers. For example, for the lists (2, 5, 5, 5) and (2, 2, 3, 5, 5, 7), the output should be (2, 5, 5).
Is e commerce a challenge or opportunity to the freight forwarder
Which orientation is wider than it is tall?PortraitMacroShutterLandscape

Briefly explain 5 software which is either free or fee​

Answers

Answer:

65

Explanation:

Answer:

65

Explanation:

Which of the following people was a member of FFA?O Kenny Chesney
O Tim McGraw
O Alan Jackson
O Billy Currington

Answers

Answer: Tim McGraw

Explanation:

The National FFA Organization is a youth organization that originally aimed to encourage the youth to venture into agriculture by offering agriculture education to youth in high schools and middle schools. In recent years they started offering education in other areas such as business and technology.

The FFA is quite famous and has had and still has a lot of members. It is of no surprise therefore that some of their alumni are now stars. Famous Country musician Tim McGraw is one such alumni and he was a member of the FFA in his hometown of Start, Louisiana.

Other stars who were part of the FFA include; Taylor Swift and Sterling Martin.

A ________ infrastructure is a framework that consists of programs, procedures,and security policies and employs public key cryptography and the X.509 standard (digital certificates) for secure communications.

Answers

Answer:

The answer is "Public Key".

Explanation:

PKI stands for public key infrastructure. It is a collection of functions, protocols, equipment, code, and procedures that require to create, maintain, transmit, store and cancel encrypted certs and handle the authentication of a public key.  

  • It is used to sign documents digitally.
  • It works for propagating with Trojans and other malware.

What is this car first to awnser is the brianliest

Answers

Answer: Lamborghini

Explanation: Is it yours

Lamborghini ?????????????

What is the center of mass of the assembly? a) X=‐11.05 Y=24.08 Z=‐40.19 b) X=‐11.05 Y=‐24.08 Z=40.19 c) X= 40.24 Y=24.33 Z=20.75 d) X= 20.75 Y=24.33 Z=40.24

Answers

Answer:

C) X=40.24 Y=24.33 Z=20.75

Explanation:

Which of the following statements is true of recombinant batteries? A. They recombine oxygen.
B. They're able to produce a higher voltage.
C. They're vented to release gassing.
D. They recombine sulfuric acid.

Answers

I’d go for (A) as the right choice.

The basic principles of Oxygen-recombination chemistry hasbeen combined to traditional lead batteries technology to produceValve-regulated lead-acid battery (VRLA), also called recombinant batteries. The applicationof oxygen cycle to VRLA, at first, is much more difficult. However, if correctprinciples are followed, it becomes easy.

Other Questions