Created
January 18, 2020 17:01
-
-
Save mamiwinsfall93/43599b274616ed5917b48b469a96314a to your computer and use it in GitHub Desktop.
python and aws
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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