Home Python Bash More Python

Link 4 (TBD)

More Python Learns

Also in the Lists and Dictionaries w/Python

Code Syntax Notes
List key = [value, value, …] Lists in python are sorta like arrays in Java. They are different because a list can have multiple different data types within it. Lists can also have multiple dictionary entries in which each dictionary has multiple key and value pairs within it. Entries can be added into a list using the .append() method or just use + and adding it.
Dictionary dictionary_key = {key: value, key: value …} Dictionaries are similar to lists, but instead of just holding values with one single key, each individual value is paired with its own key. That means you can call each value using its unique key. This is useful for a lot of things. You can also create a list of dictionaries, in which a list has multiple dictionary entries. Each dictionary can have multiple key and value pairs and is only considered one entry in the list.
Try, except try: code except error: code except: code This is an interesting code that I already knew about from previous experience, but I found it could be useful here. Essentially the try portion is what runs initially and it will keep running the code within it until it runs and returns an error. Then the except code runs after. You can change what the except code is depending on the error or you can leave it generic so it runs for any error.