Advertisement
biswasrohit20

d4

Mar 21st, 2021
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import random
  2.  
  3. vhtype = {'T1': 5, 'T2': 10, 'T3': 15, 'T4': 20}
  4. q = {'Alimentation FC': 0,
  5. 'Paris Grill': 1,
  6. 'Continental': 1,
  7. 'Paillard': 1,
  8. "L'Ostrea": 1,
  9. 'Lavieille': 1,
  10. "L'Omelette": 3,
  11. 'Le Café du Monde': 3,
  12. "Au Palet d'Or": 3,
  13. 'Le Saint-Amour': 3,
  14. 'Bistro St-Malo': 3,
  15. 'Au Petit Coin Breton Ltee': 5,
  16. 'France Benoit': 5,
  17. 'La Chic Shack': 5,
  18. 'Les délices de Candice ': 5,
  19. 'Restaurant Toast': 5}
  20.  
  21. for x in vhtype:
  22. a = []
  23. sum = 0
  24. while True:
  25. ran = random.choice(list(q))
  26. if sum + q[ran] <= vhtype[x]:
  27. a.append({ran: q[ran]})
  28. sum += int(q[ran])
  29. del q[ran]
  30.  
  31. if sum >= vhtype[x]:
  32. break
  33. if len(q) == 0:
  34. break
  35. a.append({'Alimentation FC': 0})
  36. a.insert(0, {'Alimentation FC': 0})
  37. print(x, "=", a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement