Python Syntax Flashcards

1
Q

Variable? Example?

A

A variable stores a piece of data and gives it a specific name.

Eg. “Spam - 5”; the variable spam now stores the number 5

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

Boolean? Example?

A

A boolean is like a light switch. It can only have two values, and can only be on (True) or off (False). It is an example of a data type

Eg. a = true, b = false

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

Whitespace?

A

Used to structure code in Python. It separates statements. If the Whitespace is wrong, errors may be returned

Eg. IndentationError

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

Interpreter

A

Runs code line by line and checks for any errors

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

Single Line Comments

A

Lines that start with a “#” or hash are IDed by Python as comments and are not run as code.

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

Multi-Line Comments

A

Multi-line comments are noted “”” comments go in here “”” - three quotation marks on each side. Everything in this block will be identified as comments

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

Exponentiation

A

Math combined with other types and commands in Python to create useful programs

eg. eight = 2 ** 3

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

Modulo

A

Returns the remainder from a division

eg. 3 % 2 will return 1 because 2 goes into 3 once and 1 remains

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

Data Type? Example?

A

A data type is a piece of information, such as a number or boolean.

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