# coding: utf-8 # # Secret Jolla shipment algorithm # # Changelog: # 20131211 Fixed technical problems with queue # from random import shuffle from time import sleep def get_secret_jolla_shipping_order_queue(preorders): """ This is the top secrect Jolla shipping alogrithm that takes care of your presales order number. """ shipping_order = range(0, preorders) shuffle(shipping_order) for in_picking in shipping_order: yield in_picking if __name__ == '__main__': PRESALES = 10000 SHIPMENTS_PER_DAY = 400 shipment_order = get_secret_jolla_shipping_order_queue(PRESALES) for order_no in shipment_order: print 'Picking order number %d ...' % order_no sleep(24*60*60/SHIPMENTS_PER_DAY) print 'Hurray, all Jollas left harbour!'