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
Source code is one particular representation of a software system. It highlights some details and hides others. This is a good e
grigory [225]

Answer:

Abstraction

Explanation:

Under fundamental principles of software engineering, the term "abstraction" is simply defined as the act of highlighting some details and hiding other ones.

Thus, the correct answer among the options is Abstraction.

8 0
2 years ago
What is PCM system? essay
brilliants [131]

A PCM system consists of a PCM encoder (transmitter) and a PCM decoder (receiver). The essential operations in the PCM transmitter are sampling, quantizing and encoding. All the operations are usually performed in the same circuit called as analog-to digital convert Early electrical communications started to sample signals in order to multiplex samples from multiple telegraphy sources and to convey them over a single telegraph cable. The American inventor Moses G. Farmer conveyed telegraph time-division multiplexing (TDM) as early as 1853. Electrical engineer W. M. Miner, in 1903, used an electro-mechanical commutator for time-division multiplexing multiple telegraph signals; he also applied this technology to telephony.

7 0
3 years ago
Which of the following allows administrators to connect remotely into servers from their desktop computers? Terminal Services fo
Anna007 [38]

As it is a remote login to a 'server'; then TS for Administration

8 0
3 years ago
Which statement about Agile is true?
bonufazy [111]

Answer:

mention the statement dude

7 0
2 years ago
Read 2 more answers
Which two characters do you use to tell the command that you are finished providing options and that the remaining data on the c
sergiy2304 [10]

Answer:

Two hyphen-minus characters (- -)

Explanation:

Using two hyphen-minus characters only, tend to recommend that the rest of the data are arguments and should not be treated as alternatives.

Hence, in this situation, the two characters a user will use to tell the command that a user is complete giving options and that the rest of the data on the command line is arguments is known as "two hyphen-minus characters (- -)"

8 0
3 years ago
Other questions:
  • What do you remember about the difference between Canadian and US dollar (which one is greater)? Also, explain which online tool
    6·1 answer
  • A label is any word that appears in a cell of a spreadsheet.<br> True<br> False
    5·2 answers
  • Click/press _______ to remove the most recently typed text.
    13·1 answer
  • Write a calculate_sq_inches_of_good_pizza function that accepts the diameter of a pizza and returns the area of the pizza minus
    7·1 answer
  • Dante needs to query a table to find all the references to a particular product and apply a 10%
    7·2 answers
  • Holi alguien sabe como cambiar el gamertag en XBox App (para iOS)?
    9·1 answer
  • Write a paragraph about ICT in personal life?
    12·1 answer
  • Web designers use programming languages to write websites. A True <br> B False​
    15·2 answers
  • Your friend decides to create a spreadsheet containing vocabulary terms and their definitions to help prepare for the unit test
    5·1 answer
  • Consider the following implementation of a search method:
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!