<jupyter_start><jupyter_text>ErrorsSome students thought a quick walkthrough of errors and fixing them would be helpful. Below, I try to fix a two line program, and you'll see the most common error types. There are more error types in python, and for more info, I'll refer you to - [this website-tutorialsteacher](https://www.tutorialsteacher.com/python/error-types-in-python) for a short description of them, - [the official python documentation](https://docs.python.org/3/tutorial/errors.html) for more through coverage- and Google/StackOverflow. Tough to beat copy/pasting the error code into google to find fixes or pointers. When you get to more advanced programming, you'll sometimes want code running even when it produces an error! [The last section](handling-errors) below has some pointers on that.  Most common error types```{tip}[This website-tutorialsteacher](https://www.tutorialsteacher.com/python/error-types-in-python) has a nice page listing the most common error types. If you get an error and aren't sure what it means, refer to this link as a starting point.``` `SyntaxError` Means there is something wrong with the way your program is written. This often means you included or excluded punctuation that does/does not belong.<jupyter_code>if True
print("hi""+2+name)<jupyter_output><empty_output><jupyter_text>Let's fix that by adding a colon.<jupyter_code>if True: # <-- fix
print("hi ""+2+name)<jupyter_output><empty_output><jupyter_text>`IndentationError` Is pretty self explanatory but common, especially when you're writing code with multiple layers of `for`, `if`, `def`, `try`, etc...Let's fix that by adding an indent inside the `if` statement:<jupyter_code>if True: 
    print("hi ""+2+name)<jupyter_output><empty_output><jupyter_text>Drats! Another `SyntaxError`! Something is wrong with this line. I'm going to work from left to right. First, the quotation marks are unbalanced. We can fix that.<jupyter_code>if True: 
    print("hi "+2+name)<jupyter_output><empty_output><jupyter_text>`TypeError`I tried to add a number (int) to a string. Python doesn't allow that.<jupyter_code>if True: 
    print("hi "+name)<jupyter_output><empty_output><jupyter_text>`NameError`Python interpreter sees a word it does not recognize. You need to define it before it is used!<jupyter_code>name = "Jack"
if True: 
    print("hi "+name)<jupyter_output>hi Jack
{'fraction_non_alphanumeric': 0.09604043807919124, 'fraction_numerical': 0.0021061499578770007, 'mean_word_length': 5.597222222222222, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 24, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '375612', 'license': 'MIT', 'n_tokens_mistral': 717, 'n_tokens_neox': 677, 'n_words': 277, 'path': 'content/01/07a_errors.ipynb', 'repo_name': 'mom222/ledatascifi-2021', 'size': '2374'}