Challenge: 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.
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.
Solución
¡Gracias por tus comentarios!
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Awesome!
Completion rate improved to 10
Challenge: Retrieve and Display Cat Facts
Desliza para mostrar el menú
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.
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.
Solución
¡Gracias por tus comentarios!
single