Python coding out put screen needed A pile of cards contains 5 red cards and 5 black cards. Write a program to simulate removing one card from the pile at a time at random until you remove at least two red cards and three black cards. Show the card that was picked and the contents of the pile of cards at each step. Report the number of total number of cards drawn. Use a list to represent the pile of cards.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Python coding out put screen needed

A pile of cards contains 5 red cards and 5 black cards.

Write a program to simulate removing one card from the pile at a time at random until you remove at least two red cards and three black cards.

Show the card that was picked and the contents of the pile of cards at each step.

Report the number of total number of cards drawn.

Use a list to represent the pile of cards.

Sample Output 1:

Chose: B Pile contains: ['R', 'R', 'R', 'R', 'R', 'B', 'B', 'B', 'B']
Chose: B Pile contains: ['R', 'R', 'R', 'R', 'R', 'B', 'B', 'B']
Chose: R Pile contains: ['R', 'R', 'R', 'R', 'B', 'B', 'B']
Chose: R Pile contains: ['R', 'R', 'R', 'B', 'B', 'B]
Chose: R Pile contains: ['R', 'R', 'B', 'B', 'B']
Chose: B Pile contains: ['R', 'R', 'B', 'B']
Removed 3 red and 3 black cards.
Total number of cards drawn: 6

Sample Output 2:

Chose: B Pile contains: ['R', 'R', 'R', 'R', 'R', 'B', 'B', 'B', 'B']
Chose: R Pile contains: ['R', 'R', 'R', 'R', 'B', 'B', 'B', 'B']
Chose: B Pile contains: ['R', 'R', 'R', 'R', 'B', 'B', 'B']
Chose: R Pile contains: ['R', 'R', 'R', 'B', 'B', 'B']
Chose: B Pile contains: ['R', 'R', 'R', 'B', 'B']
Removed 2 red and 3 black cards.
Total number of cards drawn: 5

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning