Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
426 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
You can find other training resources for the subject of this exercise here:
You can also book hourly online consultancy for your time zone with one of our 7 expert trainers!
| Software ==> | Python (36 exercises) |
| Topic ==> | Functions (3 exercises) |
| Level ==> | Average difficulty |
| Subject ==> | Python training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
Open the file in the above folder to see some quotations. Your aim for this exercise is to print out some statistics about them:

For each quotation we want to show the number of words (as well as the longest one) to give the output shown above.
To help you do this, write these three functions:
Function | Arguments | Returns |
|---|---|---|
get_words | A string of text | A list of the words in the string of text, with new line characters removed. |
count_words | A list of words | The number of items in the list of words (this should be a single line of code!). |
longest_word | A list of words | The longest word in a list (see note below). |
To get the longest word in a list, use the max function with a key - for example:
# get the longest word in a list of words
return max(words, key=len).upper()
You should now be able to complete your code to print out the output shown at the start of the exercise, and as a bonus have some useful functions which you can call from other programs in the future!
You can find other training resources for the subject of this exercise here:
You can also book hourly online consultancy for your time zone with one of our 7 expert trainers!
| From: | mkhlz |
| When: | 19 Sep 25 at 09:50 |
Why are the quotes stored in the tuple with such oddly fashion? Was that intentional? Great exercises btw!
```
# some quotations
great_quotes = ( "And we danced, on the brink of an unknown future, to an echo from a vanished past. (John Wyndham) \n" + \ "Life is what happens to you while you're busy making other plans. (wrongly attributed to John Lennon)\n" + \ "You cannot overestimate the unimportance of practically everything. (John Maxwell)")
```
| From: | Andy B |
| When: | 19 Sep 25 at 13:01 |
Thank you!
Odd in what way?
| From: | Andy B |
| When: | 19 Sep 25 at 16:27 |
Yes, I see your point! I think some gremlin turned the comma , into a +.
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2026. All Rights Reserved.