Python – Exercises

Links to Python editor // Variables & Lists // Collections // Conditions // Loops // Working with text files // Functions // Working with libraries

Here are a series of exercises to train what you previously learned.

Censuring

Create a phrase and censure some of its words respecting the length of the word, f.ex. He lives in a house. -> He lives in a *****.

Metro rhythm

Choose a text and replace specific words by names of metro stops.

Remixing

Choose a short poem or part of a poem. Rewrite it by randomly picking elements for the following structure: subject1 + adjective + verb + complement + subject2

Ex. Sa tige langoureux vibrant comme ton souvenir.

The P-language

The P-language is a language spoken among friends, traditionally in Dutch: ‘de P-Taal’. It has a character, ‘secret’, and is used between friends. After each vowel in each word a ‘p’ is added followed by the preceding vowel. Hard to understand when you don’t know it, but easy once you do. Perfect for hiding a message for third parties.

ex. This is an example -> Thipis ipis apan epexapamplepe

Unordering

Reverse all sentences of a text. Reverse all words of a sentence. Reverse all letters of a word.