Back to the full dot-point answer
SingaporeComputer ScienceQuick questions
Programming in Python
Quick questions on Python lists and strings explained: O-Level Computing
8short Q&A pairs drawn directly from our worked dot-point answer. For full context and worked exam questions, read the parent dot-point page.
What is creating a list?Show answer
A list stores several values in order, written in square brackets:
What is indexing starts at zero?Show answer
Each item has an index showing its position, starting at :
What are looping over items?Show answer
A for loop visits each item in turn:
What is strings are sequences too?Show answer
A string is a sequence of characters, indexed the same way:
What is slicing?Show answer
A slice takes part of a list or string with [start:stop]. The start is included, the stop is excluded:
What is q1?Show answer
For data = [10, 20, 30], state the value of data[1]. [1 mark]
What is q2?Show answer
Write a line that adds the number to the end of a list called nums. [2 marks]
What is q3?Show answer
State what len("HELLO") returns and why. [2 marks]