Challenge: Cat Fact Analyzer
In this challenge, you will deepen your skills with APIs and text processing in Python. You will use the Cat Facts API to fetch a list of 10 facts about cats. Your goal is to analyze these facts and determine how many of them contain the word "cat", regardless of case. This will help you practice both API requests and basic string searching in real-world data.
Swipe to start coding
Write a function that fetches 10 cat facts from the Cat Facts API and counts how many of these facts contain the word "cat", ignoring case. The function must loop through all facts in the list and check if the word "cat" appears anywhere in each fact, regardless of capitalization. The result must be printed as a single integer.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
How do I fetch data from the Cat Facts API in Python?
Can you show me how to count occurrences of the word "cat" in the facts?
What Python libraries do I need to complete this challenge?
Awesome!
Completion rate improved to 10
Challenge: Cat Fact Analyzer
Swipe to show menu
In this challenge, you will deepen your skills with APIs and text processing in Python. You will use the Cat Facts API to fetch a list of 10 facts about cats. Your goal is to analyze these facts and determine how many of them contain the word "cat", regardless of case. This will help you practice both API requests and basic string searching in real-world data.
Swipe to start coding
Write a function that fetches 10 cat facts from the Cat Facts API and counts how many of these facts contain the word "cat", ignoring case. The function must loop through all facts in the list and check if the word "cat" appears anywhere in each fact, regardless of capitalization. The result must be printed as a single integer.
Solution
Thanks for your feedback!
single