Python:Strings Tutorial, Simple Filtering
These questions use the simple text file
http://progzoo.net/greeks.txt - this file includes
around three hundred characters from Greek legends.
You will need to use string methods such as:
length equal substring contains indexOf
Io was a beautiful maiden who had an unfortunate run-in with Zeus and Hera. Io was turned into a heifer plagued by a gadfly.
Print the only two character name.
Odysseus, Perseus and Theseus all traveled widely and slew monsters in their travels.
Identify the three characters who include the string "seus" in their names.
The Amazons were a fearsome race of warrior women. Their name has an "m" as the second character.
Print the names with "m" as the second character.
Ixion murdered his father-in-law and got on the wrong side of Zeus - two mistakes.
The name Ixion includes an "x", but it does not end in "x" so he included in our list. The "x" in Ajax is at the end - so he is excluded.
Print the names with an "x", where the name does not end with x.
Several folk have a name ending in "o". We only want them if that is the only "o" in their name.
The sun god Apollo represents order, harmony and civilization; but he does not make our list as he has an "o" before the end of his name.
Print where the first "o" is the last character.