Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- vhtype = {'T1': 5, 'T2': 10, 'T3': 15, 'T4': 20}
- q = {'Alimentation FC': 0,
- 'Paris Grill': 1,
- 'Continental': 1,
- 'Paillard': 1,
- "L'Ostrea": 1,
- 'Lavieille': 1,
- "L'Omelette": 3,
- 'Le Café du Monde': 3,
- "Au Palet d'Or": 3,
- 'Le Saint-Amour': 3,
- 'Bistro St-Malo': 3,
- 'Au Petit Coin Breton Ltee': 5,
- 'France Benoit': 5,
- 'La Chic Shack': 5,
- 'Les délices de Candice ': 5,
- 'Restaurant Toast': 5}
- final = []
- for x in vhtype:
- a = []
- sum = 0
- while True:
- ran = random.choice(list(q))
- if sum + q[ran] <= vhtype[x]:
- a.append({ran: q[ran]})
- sum += int(q[ran])
- del q[ran]
- if sum >= vhtype[x]:
- break
- if len(q) == 0:
- break
- a.append({'Alimentation FC': 0})
- a.insert(0, {'Alimentation FC': 0})
- final.append(a)
- for i in range(len(final)):
- print(f'T{i+1} = ', final[i])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement