Skip to content
OtisamLMS
Computing

Computing · Quick practice · answer shown after each question

Python: strings, lists and dictionaries

Question 1 of 10

Question 1 of 10

Write a program that reads a sentence and prints how many times each word appears, using a dictionary.

Question 2 of 10

Question 2 of 10

What does list(range(3)) return?

Question 3 of 10

Question 3 of 10

Write a Python program that counts the number of vowels in a sentence typed by the user.

Question 4 of 10

Question 4 of 10

Explain the difference between a list, a tuple and a dictionary in Python, with an example of each.

Question 5 of 10

Question 5 of 10

A Python structure that stores key–value pairs is a ___.

Question 6 of 10

Question 6 of 10

Given scores = {"Ama": 78, "Kofi": 65}, what is scores["Kofi"]?

Question 7 of 10

Question 7 of 10

split() turns a string into a list.

Question 8 of 10

Question 8 of 10

What is nums after nums = [3, 1, 2]; nums.sort()?

Question 9 of 10

Question 9 of 10

What does "a,b,c".split(",") return?

Question 10 of 10

Question 10 of 10

sort() returns a new sorted list and leaves the original unchanged.

Questions written by OtisamLMS in the style of the WASSCE. They are not WAEC past questions.