Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. import random
  2.  
  3. def writeToFile(s, path):
  4.     file = open(path, 'w+', encoding='utf-8')
  5.     file.write(s)
  6.     file.close()
  7.  
  8. products = ["ГАЙКИ", "БОЛТЫ", "ШУРУПЫ", "ДРЕЛЬ", "ШУРУПОВЕРТ", "СТРОИТЕЛЬНАЯ ЛИНЕЙКА", "ОТВЕРТКА", "КЛЕЙ-ПИСТОЛЕТ"]
  9. orders = [] # [[id, [products]], ...]
  10. for i in range(10000, 15000):
  11.     productsToBuy = []
  12.     for k in products:
  13.         if random.uniform(0, 100) > 20:
  14.             productsToBuy.append(k)
  15.  
  16.     if len(productsToBuy) == 0:
  17.         productsToBuy = [products[0]]
  18.    
  19.     orders.append((i, productsToBuy))
  20.  
  21. print("Чек Товар")
  22. for pair in orders:
  23.     id = pair[0]
  24.     orderProducts = pair[1]
  25.  
  26.     toPrint = str(id) + ' ' + ','.join(orderProducts)
  27.     print(toPrint)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement