Complete the code to declare a temporary reply queue in RabbitMQ.
channel.queue_declare(queue=[1], exclusive=True)
Using an empty string "" tells RabbitMQ to create a unique, exclusive, and temporary queue for replies.
Complete the code to set the reply_to property in the message properties.
channel.basic_publish(exchange='', routing_key='task_queue', properties=pika.BasicProperties(reply_to=[1]), body='Hello')
The reply_to property should reference the callback_queue variable containing the reply queue name. No quotes are needed as it is already a string variable.
Fix the error in the callback function to correctly acknowledge the message.
def on_response(ch, method, props, body): if props.correlation_id == corr_id: response = body ch.basic_ack([1])
The basic_ack method requires the delivery tag from the method parameter to acknowledge the message.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.
{word: [1] for word in words if [2] > 3}The dictionary comprehension maps each word to its length using len(word) and filters words with length greater than 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase keys to values only if value is positive.
result = { [1]: [2] for k, v in data.items() if v [3] 0 }The comprehension uses k.upper() as keys, v as values, and filters values greater than zero.