coding dont know 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
2
Q
MOD
A
%
finds remainder
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)
4
Q
DIV
A
whole no. division //
5
Q
slicing strong
A
- SUBSTRING (start, end, str)
- print(word[3:7])
6
Q
position of letter
A
- POSITION(word, ‘r’)
- word.index(‘r’)
7
Q
checks if character is lower
A
character.islower()
8
Q
checks if it is a digit
A
character.isdigit()
9
Q
add to list
A
list.append (7)
10
Q
print items in list
A
for x in list:
print (x)
11
Q
insert value inbetween 2 values in a list
A
list.insert(2,”A”)
12
Q
data structure +
A
- can assign lots of data to a single identifier
- more efficient and readable- reduces code + organised data