Skip to content

Instantly share code, notes, and snippets.

@aliaramli
Created March 22, 2020 16:52
Show Gist options
  • Save aliaramli/4a8319a47e342c6973ad152bd778228f to your computer and use it in GitHub Desktop.
Save aliaramli/4a8319a47e342c6973ad152bd778228f to your computer and use it in GitHub Desktop.
Python data stucture simple array Ice Cream Machine
class IceCreamMachine:
def __init__(self, ingredients, toppings):
self.ingredients = ingredients
self.toppings = toppings
def scoops(self):
final_scoops = []
for ingredient in self.ingredients:
for topping in self.toppings:
final_scoops.append([ingredient,topping])
if(final_scoops):
return final_scoops
else:
return []
machine = IceCreamMachine(["vanilla", "chocolate"], ["chocolate sauce"])
print(machine.scoops()) #should print[['vanilla', 'chocolate sauce'], ['chocolate', 'chocolate sauce']]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment