Answered step by step
Verified Expert Solution
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.
- 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
- Output a welcome message describing the application for the user and any/all instructions
- 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.
- Ask the user for the number of cards to be dealt to them from the deck
- 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)
- If the number is valid, store their request in a variable and name the variable appropriately
- Output a few blank lines using the special code to insert a new line
- Output the results from the user's request, displaying each card number and suit in a list-like fashion.
- Ask them if they want to be dealt another hand or if they would like to quit
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started