Paper 2 Programming Terms (Algorithmic Thinking) Flashcards

1
Q

Input statement - string

A

variableName = input(“Question: “)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Input statement - whole number

A

variableName = int(input(“Question: “))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Input statement - decimal number

A

variableName = float(input(“Question: “))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Output statement

A

print (“Displays the information”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Iteration - for loop (count controlled)

A

for loop in range (3):
print(“Repeats for set number”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Iteration - while loop (condition controlled)

A

count = 0
while count < 5:
print (count)
count +=1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Selection - if/else

A

if day == “Saturday”:
print (“Yay - I love the weekend”)
else:
print (“I wish it was Saturday”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Selection - if/elif/else

A

if day == “Saturday”:
print (“Yay - I love the weekend”)
elif day == “Monday”:
print(“ Yippee - a new week!”)
else:
print (“I wish it was Saturday”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

SWITCH Case

A

SWITCH day:
CASE ‘Saturday’:
print (“I love the weekend”)
CASE ‘Monday’:
print (“A new week!”)
default:
print(“I wish it was the Saturday”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

1-dimensional array/list

A

listName = [0,1,2,3,4,5]
listNames = [‘Array’, ‘Starts’, ‘At’, ‘Zero’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

2-dimensional array

A

ListOfLists = [[‘Sam’, ‘White’], [‘Alfie’, ‘Downing’], [‘Ivan’, ‘Williams’]]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Length of a string

A

length = len(variableName)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

String - uppercase

A

upper = variableName.upper()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

String - lowercase

A

lower = variableName.lower()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

First 3 letters of string

A

LEFT (variableName, 3)
or
firstThree = variableName [:3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Last 3 letters of string

A

RIGHT (variableName, 3)
or
lastThree = variableName [-3:]