Python - Section 8 Practice Tasks
Task One
Write a program with a blank list.
​
Use the .append() command to add your three favourite ice-cream flavours to this list and then print the list.
Example solution:
Task Two
Write a program with a list of any 5 numbers.
​
Print the list.
​
Delete the first and third numbers. Print the list.
Example solution:
Task Three
Write a program with a list of three different animals.
​
Write an input line that lets the user type an animal.
​
Add what the user has written to the list and print the list.
Example solution:
Task Four
Sort your list from task two into order.
Then print the list.
Example solution:
Task Five
Copy the text on the right and put it into a list named countries.
​
Count the number of countries in the list.
​
Print the longest country.
​
Use a for loop to work out the length of each country.
"Egypt", "Angola", "Eritrea" , "Mozambique" , "Ghana" , "Chad" , "Somalia" , "Namibia" , "Sudan" , "Libya" , "Algeria", "Morocco" , "Cameroon"
Example solution:
Task Six
Create a dictionary (see 8c) that asks users questions about yourself, such as first name, favourite colour or birthday.
​
Let the user answer each question and display the answer if they get it correct. Use the 'Using a Dictionary to Make a Game' section of 8c to help you.
Example solution: