Complete the code to push data from one task to XCom in Airflow.
def push_function(ti): ti.[1](key='sample_key', value='Hello from task')
The xcom_push method is used to send data from a task to XCom in Airflow.
Complete the code to pull data from XCom in Airflow.
def pull_function(ti): value = ti.[1](key='sample_key', task_ids='push_task') print(value)
The xcom_pull method is used to retrieve data from XCom in Airflow.
Complete the code to push data to XCom in Airflow.
def push_function(ti): ti.[1]('sample_key', 'Data to share')
The xcom_push method is used to send data from a task to XCom in Airflow.
Fill both blanks to create a dictionary comprehension that shares only even numbers via XCom.
result = {num: num[1]2 for num in range(1, 6) if num [2] 2 == 0}The expression num**2 squares the number, and num % 2 == 0 filters even numbers.
Fill all three blanks to create a dictionary comprehension that shares uppercase keys with values greater than zero via XCom.
result = { [1]: [2] for [3], v in data.items() if v > 0}v.upper() which is invalid if values are not strings.The key is converted to uppercase with k.upper(), the value is v, and the loop variable is k.