Concurrent sum and product

Report a typo

Write a Python function named calculate_results that takes a list of integers and performs two operations concurrently: calculating the sum and the product of the integers. The function should use asyncio and futures to perform these operations concurrently.

You must use the asyncio library and Futures to perform concurrent operations. A solution using regular synchronous Python code will not be considered correct.

Sample Input 1:

1 2 3 4 5

Sample Output 1:

15, 120
Write a program in Python 3
# Try to utilize the template given to solve the task.
import asyncio

async def calculate_sum(numbers, future):
pass

async def calculate_product(numbers, future):
pass

async def calculate_results(numbers):
pass

numbers = [int(i) for i in input().split()]
results = asyncio.run(calculate_results(numbers))
print(", ".join([str(i) for i in results]))
___

Create a free account to access the full topic