Cogs 18 UCSD midterm terms

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/36

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

37 Terms

1
New cards

name = value

Variables are defined with

2
New cards

=

refers to assignment.

3
New cards

==

refers to equality

4
New cards

Integers

store whole numbers

5
New cards

Floats

store signed, decimal-point numbers.

6
New cards

Strings

store characters, as text

7
New cards

Booleans

store True or False

8
New cards

None

used to denote a null or empty value.

9
New cards

+, -, *, /

addition, subtraction, multiplication, & division

10
New cards

**

exponentiation

11
New cards

%

modulus

12
New cards

//

for floor division (integer division)

13
New cards

!=

values are not equal

14
New cards

<

value on left is less than value or right

15
New cards

>

value on left is greater than value on right

16
New cards

<=

value on left is less than or equal to value on right

17
New cards

>=

value on left is greater than or equal to value on the right

18
New cards

is

True if both refer to the same object

19
New cards

is not

True if they do not refer to the same object

20
New cards

def( )

you are defining a function

21
New cards

Conditionals

statements that check for a condition, using the if statement, and then only execute a set of code if the condition evaluates as True

22
New cards

else

you can use after an if that will run if the conditional(s) above have not run.

23
New cards

elif

After an if statement, you can have any number of else if to check other conditions

24
New cards

list

a mutable collection of ordered items, that can be of mixed type. Created using square brackets. mutable

25
New cards

start:stop

A sequence of indices (called a slice) can be accessed using

26
New cards

start:stop:step

To skip values in a sequence use

27
New cards

tuple

an immutable collection of ordered items, that can be of mixed type. immutable

28
New cards

dictionary

mutable collection of items, that can be of mixed-type, that are stored as key-value pairs.

29
New cards

in

operator asks whether an element is present inside a collection, and returns a boolean answer.

30
New cards

ord

returns the unicode code point for a one-character string

31
New cards

chr

returns the character encoding of a code point.

32
New cards

Errors

problems with code definition or execution that interrupt running Python code.

33
New cards

ZeroDivisionError

occurs when you try to divide by zero.

34
New cards

NameError

occurs when you try to access a name that Python does not know.

35
New cards

IndexError

occurs when you try to access an index that doesn't exist.

36
New cards

ValueError

occurs when you try to use an illegal value for something.

37
New cards

TypeError

occurs when you try to do something with a variable type that python cannot interpret.