Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python P3.14Write a program that takes user input describing a playing card in t

ID: 3881128 • Letter: P

Question

Python P3.14Write a program that takes user input describing a playing card in the following shorthand notation:
A Ace 2 ... 10    Card values J Jack Q Queen K King D Diamonds H Hearts S Spades C Clubs Your program should print the full description of the card. For example,
Enter the card notation: QS Queen of Spades Python P3.14Write a program that takes user input describing a playing card in the following shorthand notation:
A Ace 2 ... 10    Card values J Jack Q Queen K King D Diamonds H Hearts S Spades C Clubs Your program should print the full description of the card. For example,
Enter the card notation: QS Queen of Spades P3.14Write a program that takes user input describing a playing card in the following shorthand notation:
A Ace 2 ... 10    Card values J Jack Q Queen K King D Diamonds H Hearts S Spades C Clubs Your program should print the full description of the card. For example,
Enter the card notation: QS Queen of Spades P3.14Write a program that takes user input describing a playing card in the following shorthand notation:
A Ace 2 ... 10    Card values J Jack Q Queen K King D Diamonds H Hearts S Spades C Clubs Your program should print the full description of the card. For example,
Enter the card notation: QS Queen of Spades

Explanation / Answer

this code uses dictionary


cards={"A":"Ace","2":"Two","3":"Three","4":"Four","5":"Five","6":"Six","7":"Seven","8":"Eight","9":"Nine","10":"Ten","J":"Jack","Q":"Queen","K":"King"}
suit={"S":"Spades","C":"Clubs","D":"Diamond","H":"Hearts"}

s=input()
print(cards[s[0]]+" of "+suit[s[1]])

Do give a thumbs up