Skip to content
Learnearn.uk » IGCSE Computer Science Course » Python lists/strings/loops challenges

Python lists/strings/loops challenges

Challenge 1

Challenge 1

Take this list of items:

animals = [‘cat’,’dog’,’mouse”,’hamster’]

print out each item in the list using a for loop.

 

Challenge 2

Print out the first letter of each animal.

 

Challenge 3

Print out the last letter of each animal.

 

Challenge 4 

Print out the length of each animal.

 

Challenge 5

Print out all animals that are great in length of more than 3.

 

Challenge 6

Print out a reversed string for each animal.

 

Challenge 7

Print out the first letter of the first animal, second letter of the second, third letter of the third etc…

 

Challenge 8

Print out the middle letter of each animal.

 

Challenge 9

Print out each letter of each animal on a separate line.

 

Challenge 10

For each letter in each animal print out ‘consonant’ or ‘vowel’ depending on the letter type.

 

Challenge 11

Print out a list of all unique characters in the animal list

 

Challenge 12

Print out a frequency table of all letters in the animal list

Challenge 3