Complete the code to import the task decorator from Celery.
from celery import [1]
The shared_task decorator is used to define tasks in Django with Celery without needing the app instance.
Complete the code to define a simple Celery task that adds two numbers.
@shared_task def add(x, y): return x [1] y
The task adds two numbers, so the operator must be +.
Fix the error in the task definition by completing the decorator correctly.
@[1]_task def multiply(x, y): return x * y
The correct decorator is @shared_task to define a reusable Celery task.
Fill both blanks to create a task that sends an email asynchronously.
from celery import [1] @[2] def send_email(to, subject, body): # email sending logic here pass
Import shared_task and use @shared_task decorator to define the asynchronous task.
Fill all three blanks to define a periodic task that runs every minute.
from celery import [1] from celery.schedules import [2] @[3]() def periodic_task(): print('Runs every minute')
Use shared_task to import and decorate the task, and crontab to schedule periodic tasks.
