Skip to content

Instantly share code, notes, and snippets.

@bennett39
Last active September 28, 2021 15:09
Show Gist options
  • Save bennett39/380441c8699376cd988a20897ba95801 to your computer and use it in GitHub Desktop.
Save bennett39/380441c8699376cd988a20897ba95801 to your computer and use it in GitHub Desktop.
import json
import random
def lambda_handler(event, context):
""" Build a random cold-cut sandwich """
meats = [
'ham', 'salami', 'turkey', 'chicken', 'meatball', 'tempeh'
]
cheeses = [
'cheddar', 'provolone', 'swiss', 'american', 'gruyere'
]
toppings = [
'lettuce', 'tomato', 'pickles', 'onions', 'peppers'
]
selected_meat = event.get('meat', random.choice(meats))
selected_cheese = event.get('cheese', random.choice(cheeses))
selected_topping = event.get('topping', random.choice(toppings))
sandwich = f'{selected_meat} & {selected_cheese} with {selected_topping}'
return {
'statusCode': 200,
'body': json.dumps(sandwich)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment