<jupyter_start><jupyter_text>Introduction to ProgrammingTopics for today will include:- Codecademy- Markdown- Hackerrank- Reviewing Our Tools- Importance of Logic- Learning About Our Strengths- Interpreted vs Compiled- Keeping Our Code Dry- Learning About Dictionaries- Back To The Terminal  [Codecademy](https://www.codecademy.com/catalog/language/bash)---Codecademy is an amazing resource that allows new and seasoned developers take courses. Formerly a primarily free platform there is some paid content out there. Some of which is still free!  [Markdown](https://www.markdownguide.org)---Markdown is an industry standard way to beautifully document our work. This is going to be helpful for you lab later.   [HackerRank](https://www.hackerrank.com)---We're going to continue our discussion on useful resources with HackerRank. HackerRank is a site that has practice problems revolving around a bunch of languages. This similar to last week isn't something that's required to play around with but may prove useful in the future. This can be used to improve your understanding of logic or possibly learn new things and get badges on the site. Companies often use sites like this for interviews so getting used to answering questions in a medium such as this one is a worth while endeavor for most.  Learning About Our Strengths---So, we have talked a little about why we chose Python as our language but we want to build on that. How can we be sure that we're using the language properly? What what it intended to do? How do others percieve Python? These are questions that often need to be asked to determine what our approach towards things should be. As someone new to programming it should be used as a basis for when you venture into other languages.  Interpreted Language (Kinda)---Python is a language that is mostly interpreted we'll touch on exactly what that means below. For the purposes of discussing the language it makes it more accessible. Not having to interface with a compiler and just going through an interpreter is often viewed as more developer friendly. Especially for newer developers.> Python is an interpreted, high-level and general-purpose programming language. -WikipediaAlthough Wikipedia says this python has strayed from that definition. While it's still mostly interpreted that's become a little controversial as a topic. There are compiled python files that allow for quicker access to commonly used python files. Meaning that it's kinda both!![Python interpreter](https://gableroux.com/images/python-interpreter.png) Simple to Understand---Python wants to be easy to understand as one of the basic tenets of the language. We want to be pythonic meaning that we want to be able to read Python as if it was english. It's important that we adhere to this because most nowadays are learning python as a first language or to explain and code up complex things. If the tools that we're using a complex thing are themselves complex then out solution is complex^2 and that will scare users. KISS (KEEP IT SIMPLE STUPID) and DOTS (DON'T OVER THINK SH!T) Flexible---Python is use in several places and in many scenarios. From web development to data science Python is the primary chosen language due to it's flexibility. This is something that's easier to witness than to imagine. So we have an image to demonstrate. ![Python Uses](https://qph.fs.quoracdn.net/main-qimg-0613adfdf47a4691e947539c31be0247) Dynamic vs Static Typing---Python is a Dynamically typed language. This often comes with being interpreted. All that this means for us is that the interpreter is responsible for determining the typing of all of the things that we make. From variables to functions and what they might return. In a static typed language like Java, which is also a complied language. We have to explicitly say what type of variables that we're declaring. Dynamic typing means the interpreter will figure out types. Static typing means that we declare the types upon initialization. Shell, PowerShell, Bash (Bourne Again Shell), and zsh---Shells are something that you can technically circumnavate for a long time in Computer Science. Though many lessons and different methods of doing things come through working in the shell. I wouldn't recommend straying away.Shells are a way to interact with your computer on an more interactive and heightened level. We can also run things like our python files without a text editor. In fact your text editor is just using your built in terminal. What's A Terminal Then?---A terminal is the vessel that holds a shell. Some are more customizable, have better highlighting, better functionality, etc. than others. Here are the ones that I use for each platform Windows- [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab) Mac- [ITerm2](https://iterm2.com) Command Line Driven Applications---Python is used to write command line driven applications often. This is solely a product that is run from the command line using a shell. Command line applications are prevelant in places that we don't need a GUI.GUI (Graphical User Interface)- [Cement](https://builtoncement.com) Back End Processing---So now after speaking about Command Line Driven applications we see that we can make apps that handle processing in the back end. Whether this is a website, a process to bring up and automate systems, a process to do calculus homework.We often don't need a GUI and it takes time to build out GUIs. For us we're more concerned about the logic in the back end. - [Django](https://www.djangoproject.com)- [Flask](https://flask.palletsprojects.com/en/1.1.x/)  Compiled vs Interpreted---Programming languages typically get converted into machine code using one of two methods. The code can either be interpreted and/or compiled. The and/or is important! Being Compiled---Compliled languages are languages that are compiled and that process changes the code that you've written into machine code directly and ahead of time. These languages tend to be the lower level languages. These are usually faster and more efficent. These have a compile step that's required to be manually run whenever something changes.  Being Interpreted---Interpreted languages are languages that decide what's happening at run time. These languages are read in and exexuted by some program on the system. This means that things are changed into machine code in real time often. So if something were to change in real time you don't need to worry about the complilation step cause the program is going to deal with it as it comes up.  What's a Compiler---A compiler is just something that can directly translate the chosen language into machine code.  Which One is Better?---[You can decide!](https://www.freecodecamp.org/news/compiled-versus-interpreted-languages/) What is Python?---Well it can be both...  Keeping Our Code Dry--- What does this even mean??? ---If we want code to be dry then it can be wet?  WET (Write Every Time)Ok so what is dry? DRY (Don't Repeat Yourself)  Is Our Code WET?---So we look to see if we're repeating ourselves in our code and look to minimize and generalize where we can. Modularity is key here. Not only does it mean we have fewer lines of code. This is then easier to use. Easier to follow. Then finally easier to testSo we should be looking for areas where blocks of code are similar and looking to make them into functions.   How Do We DRY Off?---- We look to reduce repeated code- We get rid of magic numbers    - A magic number is a number just floating out there.    - `age * 7` What is 7? Why are we multiplying age by it?     - `DOG_YEARS_MULTIPLIER = 7` gives the number meaning.         - When a variable is written in all caps that typically means that it's a constant.        - Constants aren't supposed to be changed.    - `age * DOG_YEARS_MULTIPLIER`- We use functions and classes whereever applicable   The Importance of DRY Code---Dry code is important for a ton of reasons. [Read this article about DRY code for more!](https://www.softwareyoga.com/is-your-code-dry-or-wet/)  Learning About Dictionaries---<jupyter_code>dummy_dict = {
    "key1" : "value4",
    "key2" : "value3",
    "key3" : "value2",
    "key4" : "value1",
}

dummy_dict["hey1"] = "value5"
dummy_dict["key1"] = "value6"

print(dummy_dict["hey1"])
print(dummy_dict["key1"])<jupyter_output>value5
value6
{'fraction_non_alphanumeric': 0.05596570612050488, 'fraction_numerical': 0.006311026434865444, 'mean_word_length': 4.312460468058191, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 12, 'lorem ipsum': 0, 'www.': 7, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '92496', 'license': 'MIT', 'n_tokens_mistral': 2122, 'n_tokens_neox': 1996, 'n_words': 1240, 'path': 'JupyterNotebooks/Lessons/Lesson 5.ipynb', 'repo_name': 'B-cabrera/CMPT-120L-201-22S', 'size': '8398'}