1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Travka [436]
2 years ago
14

Write a program that takes user input describing a playing card in the following short-hand notation:

Computers and Technology
1 answer:
siniylev [52]2 years ago
6 0

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"

You might be interested in
Identify 3 distractions for young drivers and explain how you plan to minimize these distractions.
Rom4ik [11]
1 distraction is phones , texting and driving . They could have a system in their car which activated by a voice assistant who could do it al for them
4 0
3 years ago
Which of the following is something that would NOT appear in the Reviewing pane?
Sophie [7]

Answer:

A

Explanation:

7 0
2 years ago
Edward scissorhands Of course, Jim is the villain, but who or what is the antagonist in the film? Explain in detail.
Doss [256]
Jim is the main antagonist while Edward is the main protagonist of the movie.
8 0
2 years ago
A technician who is managing a secure B2B connection noticed the connection broke last night. All networking equipment and media
pashok25 [27]

Answer:

<u>d. CRL</u>

<u>e. OCSP</u>

Explanation:

Note, the term PKI stands for Public Key Infrastructure.

Among all the PKI components, the CRL (CERTIFICATE REVOCATION LISTS), which contains a list of issued certificates that were later revoked by a given Certification Authority, and the PFX format used for storing server certificates should be examined by the technician use to validate his assumption.

7 0
3 years ago
You enter the show ipv6 route command on an ospf device and the device displays a route. which conclusion can you draw about the
salantis [7]
<span>OSPFv3 is in use.......</span>
4 0
3 years ago
Other questions:
  • When seeking information on the internet about a variety of subjects, the most useful place to look would be
    8·2 answers
  • Suppose that a machine with a 5-stage pipeline uses branch prediction. 15% of the instructions for a given test program are bran
    13·1 answer
  • Which of the following is a preferable method to secure wireless access in a SOHO?
    12·1 answer
  • Who can help me with 50 varables on codeskulptor​
    8·1 answer
  • Four-pair UTP uses ________ connectors a)snap b)ST or SC c)None of these
    12·1 answer
  • Green Field county stadium is planning to conduct a cricket match between two teams A and B. A large crowd is expected in the st
    6·1 answer
  • Which of these is NOT a mathematical operator used in Python?
    12·1 answer
  • Select three advantages of cloud computing.
    12·1 answer
  • Most project files will contain:
    9·1 answer
  • Consider the following code:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!