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 is 0.3333333333333333 the output of print(1/6 + 1/6) in python?
Alisiya [41]

Answer:

because 1/6 + 1/6 is 2/6 which is 1/3 and 1/3 is 0.333...

Explanation:

5 0
3 years ago
3.3 Code Practice: Question 1
NeX [460]

Answer:

Question1:

day = int(input("Enter in Numeric Today's day:"))

if (x == 15 or x == 30):

  print("You have a payday today!")

if (x != 15 and x != 30):

  print("Its is not certainly a payday today but dont feel bad.")

Question 2:

red = int(input("Enter the value for red: "))

green = int(input("Enter the value for green: "))

blue = int(input("Enter the value for blue: "))

if (red > 255 or red < 0):

  print("The value of Red is not correct.")

if (green > 255 or green < 0):

  print("The value of Green is not correct.")

if (blue > 255 or blue < 0):

  print("The value of Blue is not correct.")

Explanation:

Please check the answer section.

6 0
3 years ago
I need some help-
Lisa [10]
My guess would be mesosphere

8 0
3 years ago
1- How should an operating system support communication between applications? explain your reasoning?
Luba_88 [7]

<u>Explanation:</u>

An operating system support communication between applications through regions of memory shared between the applications. For example, a computer's RAM (random access memory) allows each running application to use a portion of the computer's memory.

7 0
3 years ago
Writing a function that implements a loop to collect a set amount of data. The function should use the serial object, the record
Assoli18 [71]
You can still go on a date with you if I get a text from my friend that is in a relationship and you don’t know why
4 0
3 years ago
Other questions:
  • Which of the following savings vehicles usually requires a high minimum balance? ASimple savings account BCertificate of Deposit
    7·1 answer
  • Write a function to add two large integers of any length, say up to 200 digits. A suggested approach is as follows: treat each n
    12·1 answer
  • The company currently runs 60 autonomous APs and has plans to increase wireless density by 50% in the near future
    13·1 answer
  • Select the correct answer.
    11·1 answer
  • How do optical discs store data? select one:
    15·1 answer
  • What movie would be greatly improved if it was made into a musical?
    6·1 answer
  • What is the function of a breadcrumb trail in a website?
    13·1 answer
  • HELP ME PLEASE ASAP
    6·1 answer
  • Which is the correct option?
    6·1 answer
  • What is the console.log function for?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!