Advertisement
biswasrohit20

d

Mar 21st, 2021
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 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.  
  22. for x in vhtype:
  23. a = []
  24. sum = 0
  25. while True:
  26. ran = random.choice(list(q))
  27. if sum + q[ran] <= vhtype[x]:
  28. a.append({ran: q[ran]})
  29. sum += int(q[ran])
  30.  
  31. if sum >= vhtype[x]:
  32. break
  33. print(a)
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement