Skip to content

Instantly share code, notes, and snippets.

@mamiwinsfall93
Created January 18, 2020 17:01
Show Gist options
  • Save mamiwinsfall93/43599b274616ed5917b48b469a96314a to your computer and use it in GitHub Desktop.
Save mamiwinsfall93/43599b274616ed5917b48b469a96314a to your computer and use it in GitHub Desktop.
python and aws
def lambda_handler(event, context):
print_log(context)
area_of_triangle = get_area_of_triangle(event)
return {
'area_of_triangle' : area_of_triangle
}
def get_area_of_triangle(event):
b = int(event['base'])
h = int(event['height'])
area = (b * h) / 2
area_info = 'The area of the triangle is {}'.format(area)
return area_info
def print_log(context):
print('Function name:', context.function_name)
print('Version:', context.function_version)
print('Log stream name:', context.log_stream_name)
print('Log group name:', context.log_group_name)
print('Request ID:', context.aws_request_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment