Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task: To complete this assignment, you should write a Python program that allows users to input a number of cards to be dealt from a

Task: To complete this assignment, you should write a Python program that allows users to input a number of cards to be dealt from a deck of cards. The cards should be randomly shuffled before dealing.

  1. Shuffle the deck of cards after the instructions and description are output to the user HINT: Research importing and utilizing modules (Links to an external site.)Links to an external site. in your code, specifically examining the random (Links to an external site.)Links to an external site. module
  2. Output a welcome message describing the application for the user and any/all instructions
  3. Output a description of the deck of cards (e.g., this deck contains X number of cards and Y number of suits); do this programmatically and professionally.
  4. Ask the user for the number of cards to be dealt to them from the deck
  5. Check to ensure they've given you a valid number that can be dealt (if you want, you can limit it to a set of numbers -- but be sure to tell the user in the instructions if this is the case)
  6. If the number is valid, store their request in a variable and name the variable appropriately
  7. Output a few blank lines using the special code to insert a new line
  8. Output the results from the user's request, displaying each card number and suit in a list-like fashion.
  9. Ask them if they want to be dealt another hand or if they would like to quit
  10. Upon quitting, thank them for playing in a professional manner

Criteria for success: You will receive a perfect score if you:

  • Provide comments for each section of your code describing what the code is doing
  • Follow the rules relating to variable naming
  • Programmatically check to ensure they've given you a valid number of cards to be dealt
  • Output all instructions and appropriate information at the appropriate time
  • Import and utilize the random module
  • Utilize the list and/or tuple sequence type to store your deck of card information
  • Utilize the for control flow statement to iterate through your list and/or tuple
  • Utilize the try:except for error control and to exit the program gracefully
  • Utilize at least one user-defined function (you can use one you've already written if it fits!)
  • Have a complete, working script

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Big Data Interview 751 Comprehensive Questions And Expert Answers

Authors: Mr Bhanu Pratap Mahato

1st Edition

B0CLNT3NVD, 979-8865047216

More Books

Students also viewed these Databases questions