This is the section's true capstone: you'll combine string methods, splitting, a counting function, a loop, sets, and f-strings to analyze a piece of text — the kind of mini tool you could really use.
You're given a sentence. Break it apart and report some stats about it.
Your tasks
Given this starting value:
sentence = "the quick brown fox jumps over the lazy dog the end"
1. Use .split() to break sentence into a list of words, stored in words
2. Use len() to count the words, stored in word_count
3. Write a function count_word(word_list, target) that loops through word_list and returns how many times target appears
4. Call your function to count how many times "the" appears, stored in the_count
5. Print three lines with f-strings: the word count, the number of unique words (use len(set(words))), and how many times "the" appears
Expected output
Words: 11
Unique: 9
'the' appears 3 times
Constraints
- Use
.split() to break the sentence apart — do not hard-code the word list
- Define and use the
count_word() function with a loop inside it
- Use
len(set(words)) for the unique count
- Use f-strings for all three printed lines