coding dont know Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

len / for / counting python vs pseudocode

A

python
- for loop stops before final i eg 0,10 runs 10 times
pseudocode
- for loop stops at final i eg 0,9 runs 10 times

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

MOD

A

%
finds remainder

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

parameter vs argument

A

parameter
- put in when function is made - holder variables
eg def add(a,b)
argument
- called when the function is called - real data being put in
eg add (2,3)

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

DIV

A

whole no. division //

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

slicing strong

A
  • SUBSTRING (start, end, str)
  • print(word[3:7])
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

position of letter

A
  • POSITION(word, ‘r’)
  • word.index(‘r’)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

checks if character is lower

A

character.islower()

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

checks if it is a digit

A

character.isdigit()

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

add to list

A

list.append (7)

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

print items in list

A

for x in list:
print (x)

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

insert value inbetween 2 values in a list

A

list.insert(2,”A”)

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

data structure +

A
  • can assign lots of data to a single identifier
  • more efficient and readable- reduces code + organised data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly