2.2.1 Programming fundamentals Flashcards

1
Q

sequence =

A

= one line of code after the other

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

selection =

A

= IF, ELSE, ELIF - a way to control the flow of your program

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

iteration = (2 types)

A

= loops
count-loop stops when it has iterated a set number of times
condition loops - the loops stops when it has met a condition/decision

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

sequence example =

A

n1 = int (input(‘enter your 1st number ‘))
n2 = int (input(‘enter your 2nd number ‘))
answer = n1 * n2
print (‘The answer is’,answer)

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

selection example =

A

age = float(input(‘How old are you)
If age >= 18:
Print (‘adult’)
Else
Print(‘child’)

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

iteration - count

A

top = int(input(‘enter limit’))
for i in range (2, top+1,2):
print (i)

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

iteration - condition examples

A

name = ‘Mr carson’
while name != ‘Maeve’:
print (name,’is not a student)
name = input(“Enter a Students name”)
print (‘Maeve is definitely a student’)

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

+ =

A

= addition

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

— =

A

= subtraction

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

= multiplication

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

/ =

A

= division

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

% =

A

= modulus (MOD)
eg. 10 % 4 = 2

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

// =

A

= quotient (DIV)
eg. 18 // 5 = 3

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

** =
or
^ =

A

= exponent
eg. 2 ** 4 = 16

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

AND =

A

= 2 or more conditions are True

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

OR =

A

= at least 1 condition is True

17
Q

NOT =

A

= negating a condition

18
Q

== =

A

= equal to

19
Q

!= =

A

= not equal to

20
Q

< =

A

= less than

21
Q

<= =

A

= less than or equal to

22
Q

> =

A

= greater than

23
Q

> = =

A

= greater than or equal to