Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer 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.

Taak

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

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 3
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

bookChallenge: 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.

Taak

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

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 3
single

single

some-alt