P2 Programming Fundamentals Flashcards

(21 cards)

1
Q

What is a variable

A

A location in memory used to store a value (can change)

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

What is a constant

A

A location in memory used to store a value that cannot change

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

When is == used

A

To compare values ( check is value is in a variable)

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

When is = used

A

To set a value for a variable

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

What are the Boolean operators

A

And or not true false

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

What is a sequence

A

Lines of code are executed one after the other in the order they occur

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

What is selection

A

A condition is used to decide whether code should be executed

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

What is iteration

A

Code is executed repeatedly for a set number of times or while I condition is met

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

What is mod or %

A

Remainder

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

What is div or //

A

Whole number division

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

What is the code for length

A

Len()

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

What is the difference between + and ,

A

, leaves a space and + does not

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

How to convert ascii to a number

A

Chr() - takes number returns letter
Ord() - takes letter returns number

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

When using substrings what number does the string start at

A

0

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

Is the second number in substrings inclusive

A

No

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

How to code substings

A

Variable[1:4]

17
Q

How to make somthing upper case or lower case

A

Variable.upper()
Variable.lower()

18
Q

How to do random in python

A

Import random
Num = random.randint(0,100)

19
Q

How to select a specific value in a list

20
Q

What is a 2d array

A

A collection of data of the same data type under one identifier, uses two index numbers, represented in a table

21
Q

What are the three parts of sql

A

Select from where