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]
3 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]3 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
Why do networks need standards?
svetoff [14.1K]

Answer:

4. Standards are what guarantee that the different pieces of network are configured to communicate with one another

Explanation:

Networking standards ensure the interoperability of networking technologies by defining the rules of communication among networked devices. Networking standards exist to help ensure products of different vendors are able to work together in a network without risk of incompatibility

Hope it will help you...

3 0
3 years ago
What can help prevent bullying?
hjlf

Sure why are u getting bullied?

7 0
3 years ago
Read 2 more answers
List 5 different programming languages calls to print
Irina18 [472]
Print
echo
<p></p>
put
These call prints
5 0
4 years ago
Read 2 more answers
DO YOU EVER FEEL LIKE A PLASTIC<br> DRIFTING THROUGH THE WIND, WANTING TO START AGAIN
Anna35 [415]

Answer:

what exactly is the question because I don't see anything

4 0
3 years ago
Read 2 more answers
A simulation model includes: a. a description of the components of the system. b. a simulation clock. c. a definition of the sta
zloy xaker [14]

Answer: all of the above

Explanation:

8 0
3 years ago
Other questions:
  • If you were optimizing for performance and wanted to support potentially adding many new elements to an adt, then:
    12·1 answer
  • Abram was asked to explain to one of his coworkers the XOR cipher. He showed his coworker an example of adding two bits, 1 and 1
    5·1 answer
  • Using ______, a smartphone can connect to an automobile audio/control system
    6·1 answer
  • _____ supplement operating system software in ways that increase the security or capabilities of the computer system. firewalls,
    15·1 answer
  • How does kinetic energy affect the stopping distance of a small vehicle compared to a large vehicle?
    14·2 answers
  • What type of simple machine is a steel bolt?
    9·1 answer
  • What information and options can be found on the File tab?
    8·1 answer
  • I need your help with the following homework assignment:
    9·1 answer
  • Based on what you know about the Sort and Find functions, return to the database file to determine the answers to the following
    7·2 answers
  • How many times is the second for loop going to loop in this block of code? Write your answer in numeric form in the box provided
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!