Chapter 3 Flashcards

(38 cards)

1
Q

Comment

A

A line of code written in English preceded by #

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

Print

A

print(“”) or print(‘’)

Prints whatever character input between the parenthesis

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

Line

A

Programs are made up of lines of code.

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

Keywords

A

Words with special meaning.

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

Data Types

A

Python groups data into different categories.

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

Object

A

Each data value. ie. 2 or “Hello, world!”

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

3 Properties of an Object

A
  1. Identity
  2. Data Type
  3. Value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Object’s Identity

A

Location in your computer’s memory, which never changes.

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

Object’s Data Type

A

Category of data the object belongs to, which determines the properties of the object, which never changes.

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

Object’s Value

A

The data it represents ie. the number 2. Value of 2.

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

“Hello, world!” Object Properties

A
  1. Data Type: str == string
  2. Value: “Hello, world!”
    aka a string
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

string

A

A sequence of one or more characters surrounded by quotes.

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

character

A

A single symbol. ie. ‘a’ or ‘1’.

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

Integer

A

int;

represents whole numbers

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

int Properties

A

Able to multiply(*), divide(/), add(+), subtract(-).

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

float

A

float;

represents decimal numbers

17
Q

booleans

A

bool;

True or False statements.

18
Q

NoneType

A

value None;

Used to represent the absence of value.

19
Q

Constant

A

Value that never changes.

eg. 2 will always represent the value 2

20
Q

Variable

A

Value that can change.

eg. b = 100; b = 200

21
Q

Assignment Operator

A

(=);

Assign the variables name a value.

22
Q

Increment Value of a Variable

A

Increases the value of a variable.

eg. x = x + 1 or x = x += 1

23
Q

Decrement Value of a Variable

A

Decreases the value of a variable.

eg. x = x - 1 or x -= 1

24
Q

4 Rules for Naming a Variable

A
  1. Variables cannot have spaces.
  2. Letters, numbers, and underscore.
  3. Cannot start name with a number.
  4. Cannot use keywords as names.
25
Syntax
Set of rules, principles, and processes that govern the structure of sentences in a given language, specifically word order.
26
Syntax Error
Errors that are fatal and program will not run.
27
Exception
Any error that is not a syntax error. Not necessarily fatal.
28
Arithmetic Operators
Symbols that perform arithmetic.
29
Arithmetic Operators: Symbols
1. '+' addition 2. '-' subtraction 3. '*' multiplication 4. '/' division 5. '**' exponent 6. '%' remainder 7. '//' integer division/floored quotient
30
Operand
Value on either side of an operator. | eg. print(4/2) # '4' & '2' are the operands
31
Expression
An operator surrounded by two operands. | eg. print(4/2) #"4/2" is the expression
32
Order of Operations
``` Parenthesis Exponent Multiplication Division Addition Subtraction ```
33
Comparision Operator
Category of operators used in an expression that evaluate either true or false.
34
Comparison Operators: Symbols
1. '>' greater than 2. '=' greater than or equal to 4. '<=" less than or equal to 5. '==' equal 6. '!=' not equal
35
Logical Operators
Evaluate two expressions and return either True or False.
36
List the Logical Operators
1. and: Returns true if both statements are true. 2. or: Returns true if one of the statements are true. 3. not: Returns the opposite of the result.
37
Conditional Statements
Code that can execute additional code conditionally.
38
List the Conditional Statements
1. if: Firstly, define a condition for the code to meet and execute. 2. elif: Combines the two statements as an if-else statement. 3. else: Secondly, False "if-statement", define another condtion which the code will execute.