Complete the code to make a GET request to the API endpoint.
response = requests.[1]('https://api.example.com/data')
The get method sends a GET request to the specified URL to retrieve data.
Complete the code to print the status code of the API response.
print(response.[1])
The status_code attribute shows the HTTP status code returned by the API.
Fix the error in the code to parse the JSON response correctly.
data = response.[1]()The json() method parses the response body as JSON and returns a Python dictionary.
Fill both blanks to check if the response status code is 200 and print success.
if response.[1] == [2]: print('Success!')
Check if response.status_code equals 200 which means the request was successful.
Fill both blanks to extract the 'name' field from the JSON response and print it.
data = response.[1]() name = data[[2]] print(name)
Use json() to parse the response, then access the 'name' key to get the value.
