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}
- for x in vhtype:
- a = []
- m = q.copy()
- sum = 0
- while True:
- ran = random.choice(list(m))
- if sum + m[ran] <= vhtype[x]:
- a.append({ran: m[ran]})
- sum += int(m[ran])
- del m[ran]
- if sum >= vhtype[x]:
- break
- a.append({'Alimentation FC': 0})
- a.insert(0,{'Alimentation FC': 0})
- print(x,"=",a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement