Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A contestant in ModaBuMudur TV show is going to buy a combination of cloths in a shop, they will buy a shirt, a pair of

A contestant in ModaBuMudur TV show is going to buy a combination of cloths in a shop, they will buy a shirt, a pair of trousers and a pair of shoes. But there are some rules: 1. They cannot wear red and pink together, 2. they cannot wear blue and green together, 3. they cannot wear three pieces of the same colour, except for black. Given the three availability lists, write a script that will choose them a random combination of three pieces that will not violate the rules. Report the colours of each piece they buy.""" # ** This part makes random lists, do not change *** import random all = ['white', 'yellow', 'orange', 'pink', 'red', 'purple', 'blue', 'green', 'black'] shirts = []; trousers = []; shoes = [] a = random.randint(2,6) for i in range(0,a): b = random.randint(0,8) shirts.append(all[b]) a = random.randint(2,6) for i in range(0,a): b = random.randint(0,8) trousers.append(all[b]) a = random.randint(2,6) for i in range(0,a): b = random.randint(0,8) shoes.append(all[b]) shirts=list(set(shirts)); trousers=list(set(trousers)); shoes=list(set(shoes)) print('List of available shirts in the shop', shirts) print('List of available trousers in the shop', trousers) print('List of available shoes in the shop', shoes)

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions