Unit A CS Gold

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

20 Terms

1
New cards

how are variables stored in the computer?

  • every value gets its own space

  • tracked via a type and ID address in memory


2
New cards

how to print the type of an object?

print(type(x))

3
New cards

mutable? Provide Examples

a variable that you can edit in place.

  • list, dict, set


4
New cards

immutable. examples?

a type that must be completely replaced to edit it

  • strings


5
New cards

how to index a string (general form)?

str[start:stop:step]

6
New cards

how to exclude x characters at the end of string?

[:-3]

7
New cards

List

a mutable type, defined with brackets

8
New cards

tuple

an immutable parentheses, immutable object

9
New cards

sets

unorderd collections of objects, mutable, makes things easy to look up

10
New cards

dictionaries

map a key to a value to look it up curly brackets {}, “a”: 4

11
New cards

the stack

where we keep track of our frame and the data that goes with them

12
New cards

stack frames

keep trak of the data associated with a particular frame cellhow

13
New cards

How do stack frames work with functions?

when a function is called, a new stackframe is opened. When the function returns, the stackframe closes

14
New cards

how are mutable objects passed into a function?

they are passed as references

15
New cards

idiom

values treated as false (empty list)

16
New cards

what is map

a way to create a new list by calling a function to transform each element

17
New cards

higher order function

a function takes at least one function as a n arguement or that returns a function as a result (or both)

18
New cards

what is ord(c )

turns a character into an ordinal (non-negative counting number) —> encoding

19
New cards

what is chr(n)

turns an integer into a character —> decodingW

20
New cards

what is the form for a blank matrix

[[x for x in sublist ] for sublist in matrix]

[[col for col in row] for row in matrix]