Complete the code to send a POST request to create a new user.
response = requests.[1]('https://api.example.com/users', json=user_data)
POST is used to create new resources in REST APIs.
Complete the code to check if the response status code indicates success.
if response.status_code == [1]: print('Success')
Status code 200 means the request was successful.
Fix the error in the code to update a user's email using PUT method.
response = requests.[1]('https://api.example.com/users/123', json={'email': new_email})
PUT is used to update existing resources in REST APIs.
Fill both blanks to create a dictionary comprehension that maps user IDs to their names for users with active status.
active_users = {user['id']: user[1] for user in users if user['status'] [2] 'active'}The comprehension selects user IDs as keys and user names as values only if status is 'active'.
Fill all three blanks to filter and map user data: keys are uppercase user names, values are emails for users older than 30.
filtered_users = [1]({ [2]['name'].upper(): [3] for [2] in users if [2]['age'] > 30 })
This creates a dictionary with uppercase user names as keys and emails as values for users older than 30.