terms Flashcards
variable
a reference to an object
object
a real piece of information stored in memory that can be reached using the id() function, where the variable name is written in the parentheses
Dynamic Typing
means a variable can be changed later in the code and everything will be fine
Static Typing
means a variable cannot be changed later in the code, or an error will appear
Pros of Dynamic Typing
- Very easy to work with
- Faster Development time
Cons of Dynamic Typing
- May result in bugs for unexpected data types
- Need to be aware of type()
Indexing
Allows you to grab a single character from the string | starts at 0 | Ex: “hello” corresponds to index numbers 0 1 2 3 4
Reverse Indexing
First letter corresponds to 0, but the last letter is -1 and it moves down the negative #s from there until the first letter | Ex: “hello” corresponds to 0 -4 -3 -2 -1
Format of slicing
[start:stop:step]
“Start” section of a slice
A numerical index for the slice start
“Stop” section of the slice
The index you will go up to, but not include
“Step” section of the slice
the size of the jump you take
String Concatenation
Link things together | Ex:
x = ‘am’
‘P’ + x
‘Pam’