Beginner
Count the words
Start from text = "to be or not to be". Use text.split() to get the words.
Build a dictionary counts that says how many times each word appears, with a loop. Make a set unique of the different words.
Print Unique words: 4 using unique, and then to appears 2 times using counts.
What Check tests
countsis correctuniqueholds the 4 different words- The program prints
Unique words: 4 - The program prints
to appears 2 times
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.