1/23
Looks like no tags are added yet.
What is sequence in programming?
Instructions execute one after another in order.
What is a variable?
A space in memory used to store data.
What is a constant, and how does it differ from a variable?
A constant should not change while a program runs, whereas a variable can change.
What is input, and which Python command allows users to enter data?
Input is data entered by a user. The command is input()
What is concatenation, and which operator is used?
Joining pieces of text together using the + operator.
What are the three main Python data types, and how is it typed in a code?
•String – str()
•Integer – int()
•Float – float()
What are arithmetic operators, and what are their Python symbols?
•Addition +
•Subtraction -
•Multiplication *
•Division /
•Exponentiation **
•Modulus %
•Floor division //
What is the difference between modulus (%) and floor division (//)?
Modulus returns the remainder; floor division returns the whole-number result rounded down.
What is casting, and why is it used?
Converting data from one data type to another so it can be used correctly.
What is selection?
Allowing a program to make decisions based on conditions / where a section of code is run only if a condition is met.
What are the purposes of if, elif and else?
•if – Checks the first condition.
•elif – Checks another condition.
•else – Runs if none of the conditions are true.
What is a loop in programming?
A structure that repeats a section of code.
What does range(5) produce?
0, 1, 2, 3, 4
What is a while loop, and when does it stop?
A condition-controlled loop that repeats whilst a condition is true. It stops when the condition becomes false.
What is the difference between a for loop and a while loop?
A for loop repeats a known number of times; a while loop repeats whilst a condition is true.
What is a list, and how is one written in Python?
A collection that stores multiple values in one variable, using square brackets [].
What is an index position, and what number does indexing start at?
The numbered position of an item. Indexing starts at 0.
What do .append() and .remove() do?
.append() adds an item to a list, .remove() removes an item.
What is string manipulation?
Accessing or changing parts of text using index positions.
What is a function (subroutine)
A reusable section of code that reduces repetition
Which Python keyword defines a function, and how do you call it?
Use def to define it and its name followed by brackets to call it.
What is a parameter in a function?
A value or variable passed into a function.
What does def shapeArea(length, width): define?
A function with two parameters: length and width.
What does area = length * width calculate?
The area of a rectangle / square.