Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Retrieve and Display Cat Facts | API Basics and Making Requests
Working with APIs in Python

bookChallenge: Retrieve and Display Cat Facts

In this challenge, you will put your skills to the test by working with a fun and straightforward public API. Your goal is to use the Cat Facts API to fetch and display three random cat facts. This exercise will give you hands-on practice making HTTP requests using the requests library and handling JSON data returned from an API. You will see how to extract specific information from the response and present it clearly to the user. By the end of this task, you will have reinforced your understanding of the basics of interacting with web APIs in Python.

Compito

Swipe to start coding

Write a function that retrieves and displays three random cat facts by making three separate requests to the Cat Facts API at "https://catfact.ninja/fact". For each request, extract the cat fact from the JSON response and print it on a new line.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 3
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

close

bookChallenge: Retrieve and Display Cat Facts

Scorri per mostrare il menu

In this challenge, you will put your skills to the test by working with a fun and straightforward public API. Your goal is to use the Cat Facts API to fetch and display three random cat facts. This exercise will give you hands-on practice making HTTP requests using the requests library and handling JSON data returned from an API. You will see how to extract specific information from the response and present it clearly to the user. By the end of this task, you will have reinforced your understanding of the basics of interacting with web APIs in Python.

Compito

Swipe to start coding

Write a function that retrieves and displays three random cat facts by making three separate requests to the Cat Facts API at "https://catfact.ninja/fact". For each request, extract the cat fact from the JSON response and print it on a new line.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 3
single

single

some-alt