<jupyter_start><jupyter_text>Data Constructs Python EnvironmentsThere are a few different ways that you can interact with python:    CLI = command line interface- Type "python" from your command line- You are now in a python interpreter- This is great for testing out code- Does not persist after you close this session       Python IDE's = integrated development environment- Self-contained development environments- A stand-alone program/envirnoment- Save code to work on between sessions- Test and run code- Syntax/error checking- Learning curve for setting up and using- Recommended IDE's include: Spyder, PyCharm, Eclipse  Python scripts- You can distribute these as programs that perform a task - Can gather user input- Can be re-run- Standalone, run using exe or command line interface- Usually the final product  Jupyter Notebook- Document your code with text as you go along- Test and view output as you develop- Great for analysis, scientific research- View graphs and tables inline- Not great for larger datasets  VariablesThink of variables as containers. You create them, you name them, and you determine what value they will store. Naming variables<jupyter_code>steven= 17
steven
my_var = 5
my_var<jupyter_output><empty_output><jupyter_text>my_var is a made up name for your variable. You can call it whatever you want.<jupyter_code>rando_var = 5  
steve = 5 
rando_var
steve<jupyter_output><empty_output><jupyter_text>Reserved WordsWords used to trigger an action cannot be used as variable names:- and- as- break- del- true- false- int- str<jupyter_code>break = 'test'<jupyter_output><empty_output><jupyter_text>Statements and Commands StatementA complete instruction, like a sentence in English:<jupyter_code>print("Go fish!")<jupyter_output>Go fish!<jupyter_text>Command (aka Executing a Function)Think of a command as a verb; you are telling python to do something.<jupyter_code>print()
round()
sum()<jupyter_output><empty_output><jupyter_text>- Always lowercase- Always followed by a parenthesis- Called a function, or method  ExpressionsExpressions don't have any action to them, but they contain values."Go fish!"  27 + 12  Line ContinuationLine Continuation CharactersTo make things pretty, or to continue a long function on the next line, use "\":<jupyter_code>def my_long_function():
    print("My string \
    is really long \
    and has to be continued \
    on another line")<jupyter_output><empty_output><jupyter_text>Documenting your codeIt's always good coding practice to make notes that help people use and understand your code. There are two ways to let the python interpreter know that you want to it to ignore something:  DocstringsDocstrings are used for longer comments, often at the beginning of a script, to let people know: - how to run your script- dependencies- versions<jupyter_code>'''
Docstrings are enclosed between a series of three single quotes. 
Anything entered here is a comment and is skipped over by the 
python interpreter. 
'''<jupyter_output><empty_output><jupyter_text>CommentsFor leaving quick notes within your code itself, start a a comment with a hash sign.<jupyter_code># this is me designing a silly variable
bob = "steve"<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05966438781852082, 'fraction_numerical': 0.0027967681789931634, 'mean_word_length': 5.214285714285714, 'pattern_counts': {'":': 1, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '192308', 'license': 'MIT', 'n_tokens_mistral': 897, 'n_tokens_neox': 860, 'n_words': 414, 'path': 'notebooks/python/Data Constructs.ipynb', 'repo_name': 'ramaprashanth/ai4all', 'size': '3218'}