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.
Oplossing
Bedankt voor je feedback!
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Awesome!
Completion rate improved to 10
Challenge: Retrieve and Display Cat Facts
Veeg om het menu te tonen
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.
Oplossing
Bedankt voor je feedback!
single