Skip to content

Instantly share code, notes, and snippets.

@blueset

blueset/orders.py

Created Dec 23, 2015
Embed
What would you like to do?
To Bryan 201512230001
orders = []
for i in range(10):
purpose = raw_input("Would you like to buy or sell?")
if purpose not in ['buy', 'sell']:
print("You don't anyhow ah.")
exit()
try:
price = float(raw_input("At what price would you like to buy/sell?"))
quantity = float(raw_input("What is the quantity you would like to buy/sell?"))
except ValueError:
print("You don't anyhow ah.")
exit()
orders.append({'purpose': purpose, 'price': price, 'quantity': quantity})
for id, order in enumerate(orders):
print("Order No.", id)
print("Purpose: ", order['purpose'])
print("Price: ", order['purpose'])
print("Quantity: ", order['quantity'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment