Python - Section 9 Practice Tasks

Task One

It is the national hockey championships and you need to write the program for the TV channel showing the live games.

  • Let the user enter the name of the first country that is playing.

  • Then let the user enter the name of the second country.

  • Shorten country 1 to the first two letters.

  • Shorten country 2 to the first two letters.

Example solution:



Task Two

In some places, the letter G is seen as an offensive letter.


The government want you to create a program to count how many times the letter G appears in a sentence.

  • Let the user input any sentence that they like.

  • You need to count how many g’s there are. 

  • Then print the number of g’s there are.

Example solution:


Task Three

A pet shop has just ordered in a batch of new dog collars with name tags.


However, there was a mistake with the order and the tags are too small to display names longer than 6 characters.


You need to create a program that checks the user’s dog name can fit.

  • Let the user enter their dog’s name.

  • Calculate the length of their name.

  • Use an if statement to see if it is greater than 6 characters.

  • If it is then print – Sorry but our dog tags are too small to fit that.

  • Otherwise print – Excellent, we will make this dog tag for you.

Example solution:


Task Four

It’s literacy week and the Head of English would like you to create a vowel checker program to ensure that year 7s are using plenty of vowels in their work.

  • Let the user enter any sentence they like.

  • For each letter in the sentence that they have just entered you need to use if statements to check if it is a vowel.

  • You will need to use the OR operator between each statement to separate them.

  • After the for loop you need to print the number of vowels they have used.

Example solution:

pnewbs4 (1).png

Task Five

Remember the national hockey championships? Well, the company that hired you just fired you…


Never mind though, a rival scoreboard company want to hire you right away.

  • You need to let the user enter two countries like last time.

  • But this time you don’t want to calculate the first two letters, you want to print the last three letters.

Example solution:

pnewbs5 (1).png

Task Six

Too many people are using inappropriate names on Instagram so they have decided to scrap the username and will give you a code instead.


The code is the 2nd and 3rd letters of your first name, your favourite colour and then the middle two numbers of the year you were born.

  • Let the user input their name, then their favourite colour and then the year they were born.

  • Using their data, calculate their new Instagram name!

Example solution:


Task Seven

Copy the text on the right and create a program that will split the text at each full stop.


Count the number of names in the list.

Print the longest name.

Example solution: