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
What does “default” refer to? the ability to be used as, or directly converted to, cash. the failure to pay back a loan. the amo
Vaselesa [24]
The answer is "the failure to pay back a loan".

In computer systems, we have a different meaning to the word default. It is referred to the setting or option in a computer upon opening a program or application. But according to the dictionary, default refers to the failure to make a payment such as a loan.
8 0
3 years ago
Wrtie a program in which we will pass a value N. N can be positive or negative. If N is positive then output all values from N d
Triss [41]

Answer:

Following are the answer to this question:

x=int(input("Enter number: "))#defining x variable that input value from user end

if x< 0:#defining if block that check x value is less then 0

   while x<0:#defining while loop print up to the value

       print(x)#print value

       x+= 1#add values by 1

elif x>0:#defining elif block to check value x is greater than 0

   while x>0:#defining while loop to print down to value

       print(x)#print value

       x-= 1#subtract value by 1

Output:

when input is a positive value

Enter number: 5

5

4

3

2

1

when input is a negative value

Enter number: -5

-5

-4

-3

-2

-1

Explanation:

  • In the given python code, x variable is declared that input the value from the user end, in the next step if and elseif block is declared that calculates and prints its value.
  • In the if block, it checks value is negative it uses the while loop to prints its values in the down to value form.
  • In the elif block, it checks the positive it uses the while loop to prints its values into the up to values form.  
5 0
4 years ago
if we had a set of 10 constraints and solver had to deterimine which 4 to enforce what would be the binary indicator varibales h
Inessa [10]

Answer:

if we had a set of 10 constraints and solver had to determine which 4 to enforce what would be the binary indicator variables have to  sum to make this happen

answer : 6

Explanation:

number of constraints = 10

solver has to determine which 4 to enforce

Hence the number the Binary indicator will have to sum to enforce 4

will be : (number of constraints) - 4

              = 10 - 4 = 6

5 0
3 years ago
The determination of the overall system architecture consisting of a set of physical processing components, hardware, software,
Masteriza [31]

Answer:

Systems engineering is the process of planning, designing, and implementing a system or systems.

7 0
2 years ago
How did mechanical clocks assist in completing work? How was work done previously?
lozanna [386]

Answer

Timekeeping has been a part of society since Ancient Egypt. The use of spring-powered mechanisms allowed clocks to be made smaller ... Essentially, the church bells and the mechanical clock now became the monitor of the working day.

Explanation:

4 0
3 years ago
Other questions:
  • Which is not the option applicable to the technology reference framework for advanced countries?
    11·1 answer
  • Dead state is the name of the time delay in a cpu caused by differences between the speed of the cpu and ram.
    15·1 answer
  • teve wants to use Google Display Ads to reach new customers who are looking to purchase products similar to his. Which audience
    14·1 answer
  • How can I collect tweets from different accounts concurrently and categorize the tweets in a corpus?
    15·1 answer
  • Does the brain play a role in smartphone addiction
    7·2 answers
  • PLEASE HELP ME ASAP!!! THIS IS DUE SOON!!
    9·1 answer
  • What do you expect the future trends of an operating system in terms of (a) cost (b) size (c) multitasking (d) portability (e) s
    12·1 answer
  • Consider the following code segment, where num is an integer variable.
    6·1 answer
  • What kinds of objects might benefit from the use of the Loop Cut and Slide tool, and why? In your own words, how does edge loop
    14·1 answer
  • Which window would show you bindings for local area connection 2?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!