Finish loops Project note: Default power cost Types review and expansion: Python is flexible with these, but does have them A few useful ones: int, float, string (str) - Convert like this: int("5") - Or str(5) The input function returns a string, always Conversions generate an exception if the conversion can't be done A couple more types: - list - tuple - function - classes What has to happen in memory? We can visualize memory in a linear manner - Because addresses are all in a line In Python, variables can expand! - Generally, this means allocating new memory somewhere else Shallow vs. Deep copy: - In general, Python will make a deep copy when you need one - Modifying a list inside a function... Scope: Global vs. Local Interlude: What is an exception? An error Propegates back up from wherever it happened You can catch it with try and except And look at it: except Exception as e: Exception handling is slow in most programming languages, but can be worth it Design pattern: Input with exception handling and "while" loop Evaluating strings (What can you do with a string?) You an store python code in a string and then run it An example: make_subdue_dataset in GNA Incidentally, we can read a file in as a string - And that file can be our program... - Statements and functions and print - system, getoutput - side note: BASH This sort of thing is common to interpreted languages - Not compiled languages. Although, any language can run a program Evaluating a string with BASH getoutput() and system() You can figure out the type of a variable! - type function - This can be used in a function, etc sys.getsizeof: How many bytes for an integer? Integers are objects in Python That's part of why it runs slow Garbage collection Java did this too