Python Tuples and Lists
tuple with a single item
If a tuple has just one item in it, it has to be followed by a comma or python won't recognize it as a tuple. example: number =(1,)
Reverse() method
Reverses the order of the items in the list.
Lists
a heterogenous, MUTABLE, data type that stores an ordered sequence of things, lists are indicated by square brackets numbers=[1,2,3,4,5]
Tuple
a heterogenous, immutable data type that stores an ordered sequence of thing. The parts for a tuple are name of tuple, followed by an = and parenthesis with your info separated by commas. example: numbers=(1,2,3,4)
heterogenous
a single tuple can store multiple different types of things
append method
adds a single item to the end of a list example: my_list.append(2)
extend method
allows us to add multiple items to a list at once my_list.extend(["a", "b", "c"])
List function
allows us to convert a string into a list variable = list(name of string)
enumerate () function
allows us to number the positions of the items in our list
sort method
arranges items in "Python" order
split method
copies the strings, breaks it into smaller strings based on where it finds white space, puts those smaller strings into a list, and then returns the list
join() method
of a list can be used to combine the items in the list into a string that's separated by delimiters variable = "".join()
python methods
similar to functions, except they get "called" on something format: variable = name(this is the variable you're calling it on).method name
Data Structures
techniques for organizing and storing data in computer memory
immutable
unchangeable - can't be changed
remove method
will remove the "first" instance of an item in a list