<jupyter_start><jupyter_text>Welcome to Python 3! In this [Jupyter Notebook](https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter.html) we will cover some [Python 3](https://en.wikipedia.org/wiki/Python_(programming_language)) basics.I recommed you take this one step at a time and try to practice along the way. Every explaination will contain an example that you can run within the notebook.  Here are the things we will be covering: - [Jupyter Notebook:](jupyter)    - What is Jupyer?    - What can I use Jupyter Notebooks for?        - [GitHub:](github)    - What is version control?    - What is Git?    - What is GitHub?    - What are we going to use GitHub for?        - [Python 3:](python3)    - What is Python 3?    - Why Python 3?    - [Syntax:](syntax)    - Comments    - Print    - Variables        - [Strings](section-syntax-strings)        - [Intergers and Floats](section-variables-numbers)        - [Mathematical Operations](variables-math)        - [String Math](section-variables-stringmath)      - [Loops:](loops)    - What are loops?    - Types of loops:        - For        - While- [Conditionals:](conditionals)    - What are conditionals?    - Types of conditionals:        - If        - Elif         - Else- [Functions:](functions)	- What are functions?		         ------  1. Jupyter Notebooks:  - What are Jupyter Notebooks?Jupyter Notebooks is an online notebook that allows developers to weave together computational information (code, data, statistics) with a narrative, multimedia or graphs.  - What can I use Jupyter Notebooks for?In this case, we are goig to be using it to set up an interactive textbook, full of explanations and examples which you can test out right from your browser. You could use it to explain the reasoning behind one of your programs, show your work, etc.Scientists, journalists, and researchers often use it to open up their data to the public, share the stories behind their computations, and enable future collaboration and innovation.In short, there are endless uses for Jupyter Notebooks. ------  2. GitHub: In broad, GitHub is a website and cloud-based service that helps developers store and manage their code, as well as track and control changes to it. To understand exactly what GitHub is, you need to understand two principles, version control and git. - What is version control?Version control helps developers track and manage changes to a project’s code. As a software project grows, version control becomes essential. It lets developers safely work through branching and merging.   - **Branching:** With branching, a developer clones part of the source code to a safe location. Where the developer can then make changes without affecting the rest of the project.    - **Merging:** Once the developer gets their version of the code working properly, they can merge that code back into the main source code to make it official.   All of these changes are then tracked and can be undone if anything breaks or a feature's implementation is deemed unnecessary. - What is Git?Git is a specific open-source version control system created by <NAME> (the creator of the Linux kernel) in 2005.Specifically, Git is a distributed version control system, which means that the entire codebase and history is available on every developer’s computer, which allows for seamless branching and merging by everyone in the project. - What is GitHub?GitHub is a company that offers a cloud-based Git repository hosting service. Basically, it makes it a lot easier for individuals and teams to use Git for version control and collaboration.GitHub’s interface is so user-friendly that beginner developers can take advantage of Git. Without GitHub, using Git generally requires a bit more technical knowledge and use of the command line.Additionally, anyone can sign up and host a public code repository for free, which makes GitHub especially popular with open-source projects. What are we going to use GitHub for?We will mainly use GitHub to store project files that will be covered during each session of the Coding Club.That will allow us to keep track of the file's history and provide you, the user, a place to conveniently access all project files. ------  3. Python 3:  Python is one of the most widely used languages out there. Be it web development, machine learning and AI, or even micro-controller programming, Python has found its place just about everywhere. - What is Python 3?Python is an extremely powerful, yet beginner friendly, programming language. It was created by <NAME>, and released in 1991. Python 3 is ideal for scripting and rapid application development. It is used in areas such as web development (Django, Bottle...), scientific and mathematical computing (Orange, SymPy, NumPy...) or desktop graphical user Interfaces (Pygame, Panda3D, Processing.py...).Python also supports an extremely wide range of modules, sets of pre-made code that you can easily include in your own projects, which speed up your code building sessions significantly, and help make it be even more beginner friendly.Python has consistently been one of the most used programming languages since the early 2000s. - Why Python 3?There are many things that make Python 3 stand out from other languages. For example:    - Python is seamlessly integrated into may different platforms such as MacOS, Windows or most Linux distributions   - Python's syntax is fairly similar to the English language, which allows for easy readability and understanding of the code.      - Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.   - Python can be treated in a procedural way or an object-orientated way. [Extra Resources](https://www.youtube.com/watch?v=pTB0EiLXUC8)    Extra information:Python was designed for readability, and has some similarities to the English language with influence from mathematics.Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses, it also relies on indentation, using whitespace, to define [scope](word-scope). ------  4. Syntax: We tell the computer what we want it to do by writing commands inside a text file using a programming language. These files are called programs. Running a program means telling a computer to read the text file, translate it to the set of operations that it understands, and perform those actions.Complete the next example by writing what your favorite food is whithin the quotes ("") and hitting run.<jupyter_code>fav_food = " "
print("My favorite food is " + fav_food + "!")<jupyter_output><empty_output><jupyter_text>- Comments:The first thing we’re going to do is learn how to tell a computer to ignore a part of a program. Text within a program but not run by the computer is called a comment. Python interprets anything after a `` as a comment.-  ***Some uses for comments are:***   - Provide context for why something is written the way it is:```python           This variable will be used to count the number of times anyone steps on a banana peel         slip_n_slide_count = 0```   - Improve the readibility of your code so that future you or someone else can easily understand what it does:```python           This function stores all the times I have said XD into a text file         xd_to_textfile()```   - Ignore a line of code that is proving to be buggy or unnecessary:```python           superstar_name = get_superstar_name_old()         superstar_name = get_superstar_name_new()```Complete the following example by writing the description of a realy cool superhero within a comment.<jupyter_code># Write you comment bellow this one...<jupyter_output><empty_output><jupyter_text>- Print:  Now what we’re going to do is teach our computer to share information. Getting information from the computer is very important, as it can answer questions about “how” or “why” or “what” it is doing. In Python, the `print()` function is used to get some information from the computer. The message to be printed should be surrounded by quotes (""):```python          from Karen circa 2020        print(""Live, laugh, love."")```In the example above, we get our program to `print()` a quote from an entitled person. The printed words that appear as a result of the `print()` function are referred to as *output*. The output of this example program would be:⠀⠀⠀⠀⠀⠀⠀⠀⠀`Live, laugh, love.`For this example, you will need to print out your favorite quote, remember to put it between the quotes:<jupyter_code># Print your favorite quote below:
print("")<jupyter_output><empty_output><jupyter_text>- Strings:   In programming, blocks of text are called strings. In our last exercise, we created the string `"Hello world!"`. To tell Python a group of letters is a string, we surround it in either double quotes `("Hello world")` or single quotes `('Hello world')`. They both do the same, so it doesn't matter which ones you use, just make sure to be consistent.To complete the following example exercise print your name:  - Variables: All programming languages offer a way to store data and reuse it later. If, for example, there is a greeting we want to say, a date we need to reuse, or a username we need to save we can create a variable which will store that value. In Python, we assign variables by using the equals sign `=`. Look at the following example:```python        user_name = "jarredthejellyfish"         Prints "jarredthejellyfish"        print(user_name)```In the last example, we stored my username into a variable called `user_name`. Variables can’t have spaces or symbols in their names other than an underscore `_`. They can’t begin with numbers but they can have numbers after the first letter (e.g., `cool_variable_5` is OK).We call these objects `variables` because the values they can hold can vary throughout the program we are running. If you look at the following example, you will see how the value stored within `favorite_song` is changed.```python         Favorite song        favorite_song = "Eventually, Tame Impala"        print(message_string)         Change of mind        favorite_song = "New Person, Same Old Mistakes, Tame Impala"        print(message_string)```In the example above, we create a variable, `favorite_song`, and assign the string `"Eventually, Tame Impala"` to it and after that, we use `print()` to output it to the console. In the second part, we assign a new value to `favorite_song`, `New Person, Same Old Mistakes, Tame Impala`. Finally we print the last value using `print()`.Complete the following practice exercisse:<jupyter_code># Below you have the varibale 'movie_title'
movie_title = 'Interstellar'

# Printing out movie_title
print("Gerard's favorite movie is:")
print(movie_title)

# Reassign the title of another movie to movie title below (remember to use quotes)
movie_title = 

# Printing out movie_title
print('A good movie to watch is:')
print(movie_title)

# And now do it again but with a horror movie!


# Printing out 'movie_title'
print('Hey, you should watch the following movie:')
print(movie_title)<jupyter_output><empty_output><jupyter_text>Up to this point we have been working with strings, but there are other types of variables such as:- **Integer (or int):** Used for whole numbers, numbers that have no decimal points.- **Float (or Real):** Used for numbers that contain decimal points, or for fractions.- **Boolean (or bool):** Used where data is restricted to binary options (True/False, yes/no).We will work with these types of variales throughout the following sections.  - Varibales: Intergers and Floats:   A computer is capable of handling much more than a group of letters. Python has a few numeric [data types](word-data-type), it has multiple ways of storing numbers. Which one you use depends on your intended purpose for the number you are saving.Intergers, or `ints`, are numbers without a decimal point, whole numbers. Intergers contain all natural numbers (`0, 1, 2 ,3...`) and their negative counterparts (`-1, -2, -3...`). As a practical example of how to use an interger, lets take counting the number of people in a room. If you try to do that, you should always get a whole number, if you don't, please make sure you didn't split Jonny in half, he doesn't deserve it.Floating-point numbers, or `floats`, are a decimal numbers (`420.69`). Floats can be used for a wide range of things such as holding a fractional number or a measurement. If you were measuring the length of your leg, storing a chess player’s average time between moves, or the average score of your friend group's rice purity test, you would likely use a float.Numbers can be assigned to variables or used for mathematical operations in a program:```python        an_interger = 4        a_float = 20.6        print(an_interger + 3)  There is a mathematical operation within the print!         prints 5```Above we defined an `integer` and a `float` as the variables `an_interger` and `a_float`. We printed out the sum of the variable `an_interger` with the number `3`. `We call the number 3 here a literal`, meaning it’s actually the number 3 and not a variable with the number 3 assigned to it.There are some limitations that floating point numbers face, they can affect their functioning which can lead to some unexpected behaviour. If you'd like to read more about their limitations visit [Python’s documentation on their limitations](https://docs.python.org/3/tutorial/floatingpoint.html).Complete the next exercise by followin the instructions within it:<jupyter_code># Create a new variable bewlow that stores your phone number (without any formatting or country code eg. 605660522)


# Create a new variable below that holds any decimal number you want



# Print both of your variables using the print() function below<jupyter_output><empty_output><jupyter_text>- Variables: Mathematical Operations   Computers are absolutely amazing at doing math. Their name literally comes from "compute", which means to calculate.  Python can perform most basic operations; addition, subtraction, multiplication, and division by using +, -, *, and /.```python         Prints "420"        print(430 - 124 + 1)         Prints "666"        print(333 * 2)         Prints "69.0"        print(345 / 5)```If you look at the output from `print(345/5)` you will see that it has a decimal place. That happens because python converts interger numbers to floats before performing a division so that it can store decimals, in case that your division results in any.Division can throw its own special error: `ZeroDivisionError`. Python will raise this error when attempting to divide by 0. Quick reminder, dividing by zero has no definite answer because you can't split something in 0 parts.Mathematical operations in Python follow the standard mathematical order of operations. Here is a [Wikipedia article](https://en.wikipedia.org/wiki/Order_of_operations) in case you need a refresher.Complete the following exercise by followin the instructions within it:<jupyter_code># Print out the result of: 64500/150 - 10.31 + 1<jupyter_output><empty_output><jupyter_text>Python offers an easier way to update variables. When you have a number saved in a variable and want to add to the current value of the variable, you can use the `+=` (plus-equals) operator. ```python         First we have a variable with a number saved        number_of_headshots = 120         Then we need to update that variable         Let's say we headshot another 2 players        number_of_headshots += 2         The new value is the old value         Plus the number after the plus-equals        print(number_of_miles_hiked)         Prints 122```Above, we keep a running count of the number of miles a person has gone hiking over time. Instead of recalculating from the start, we keep a grand total and update it when we’ve gone hiking further. Variables with numbers assigned to them can be treated as [literals](word-literal). Basically, we can perform any arithmetic operation on variables and Python will not be able to tell the difference between them and a literal. Performing arithmetic on variables does not change their value. You can only update a variable using the `=` sign.```python        concer_ticket_price = 231.50        number_of_people = 2000         Prints "463000"        print(concer_ticket_price * number_of_people)         Prints "231.5"        print(concer_ticket_price)         Prints "2000"        print(number_of_people)         We haven't sold any, so we update the price to make it more competitive        concer_ticket_price = 104         Prints "208000"        print(concer_ticket_price * number_of_people)         Prints "104"        print(concer_ticket_price)         Prints "2000"        print(number_of_people)```We asign numeric values to 2 variables,`concer_ticket_price` and `number_of_people`. After that, we use them to perform a mathematical operation. This doesn’t affect thir values. When we update the `concer_ticket_price` variable and perform the calculations again, they use the updated values for the variable!Complete the following exercise:<jupyter_code># You are a professional stutns-person, your hourly rate is $250.4, and you usually do 15h of work per day. 
# Define a variable that holds your usual hourly rate (omit the $ sign)



# Define another variable that holds the usual amount of hours you work in a day



# Print out how much money you make in a day (rember to use the print() function)<jupyter_output><empty_output><jupyter_text>Python can also raise numbers to any power. When doing math on paper you usulally write your exponents in superscript (`2²`), typing superscript numbers isn’t always easy on modern keyboards since youhave to do some wierd key combinations. Seeing ad this operation is so closely related to multiplication, we use the notation **.```python         3 to the 4th power, or 81        print(3 ** 4)         2 squared, or 4        print(2 ** 2)         9 * 9 * 9, 9 cubed, or 729        print(9 ** 3)         We can even perform fractional exponents using floating-point numbers         16 to the half power, or 4        print(16 ** 0.5)```In the obove example we can see how we calculated some simple exponents. We calculate 3 to the 4th power, 2 to the 2nd power, 9 to the 3rd power, and 16 to the 0.5th power.Complete the next exercise:<jupyter_code># You have decided to refloor your kitchen, it is a perfectly square room which measures 6x6 meters
# Each of the tiles you have is 1 by 1 meter
# Print how many tiles you will need to refloor your kitchen<jupyter_output><empty_output><jupyter_text>When you devide two numbers that are coprime, you will always get a remainder. Python makes the job of getting that remainder easy by allowing you to use the modulo operator `%`. The modulo operator gives the remainder of a division calculation. If the numbers are not coprime (they are divisible by eachother), the result of the modulo operator will be 0.```python         Prints 1 because 5/2 equals 2 with a remainder of 1        print(5%2)         Prints 2 because 12/5 equals 2 with a remainder of 2        print(12%5)```In the obove example we used the modulo operator to get the remainder of two divisions.The modulo operator is useful in programming when we want to perform an action every nth-time the code is run.<jupyter_code># You have 529 grains of rice and you want to feed 5 children. 
# You decide to divide them evenly and take the remainder for yourself.
# Calculate how many grains of rice you would get using the modulo operator and print the value out<jupyter_output><empty_output><jupyter_text>- Variables: String Math   The `+` operator isn't only used for numbers, it can also be used for strings. Addig two strings together is called `string concatenation`. When you concatenate two strings you create a new string, that string contains the first string’s contents followed by the second string’s contents (without any added space in-between).```python        danny_phantom_quote = "If somebody catches me, I go from geek to freak around here!"        quote_date = "Circa April 3, 2004"        full_quote = danny_phantom_quote + quote_date         Prints "If somebody catches me, I go from geek to freak around here!Circa April 3, 2004"        print(full_quote)````In the example above we create two variables that hold strings, which we then concatenate. If you look at the output you will see that there is no space between the strings we added together. That is because concatenation does not add spaces. Let's fix that issue by concatenating a space between our variables.```python        full_quote = danny_phantom_quote + " " + quote_date         Prints "If somebody catches me, I go from geek to freak around here! Circa April 3, 2004"        print(full_quote)```After that little addition, the code prints the message we wanted it to print.In Python you can only concatenate strings with other strings. In the event that you want to concatenate a string with anything other than a string, you will need to turn that non-string object intro a string. To do that you can use the `str()` function. If you’re trying to `print()` a numeric variable you can use commas to pass it as a different argument rather than converting it to a string.```python        eating_competition = "I have eaten "        hotdogs_eaten = 32        eating_competition_2 = " hotdogs in 60 seconds!"         Concatenating an integer with strings is possible if we turn the integer into a string first        full_competition_string = eating_competition + str(hotdogs_eaten) + eating_competition_2         Prints "I have eaten 32 hotdogs in 60 seconds!"        print(full_competition_string)         If we just want to print an integer          we can pass a variable as an argument to          print() regardless of whether          it is a string.         This also prints "I have eaten 32 hotdogs in 60 seconds!"        print(eating_competition, hotdogs_eaten, eating_competition_2)```Using `str()` we can convert variables that are not strings to strings and then concatenate them. But we don’t need to convert a number to a string for it to be an argument to a print statement.The [plus-equals operator](section-plus-equals) also can be used for string concatenation, like so:```python        quirky_caption = "I licked it, so it's mine."         Almost forgot the hashtags! (notice the use of spacing)        quirky_caption += " not_like_other_girls "        quirky_caption += " quirky"         This prints "I licked it, so it's mine. not_like_other_girls quirky"        print(quirky_caption)```In the above example we created a cpation for a photograph of me licking an orange I found on the street. But then we added some hashtags for me to get instafamous.Complete the following exercise please:<jupyter_code># Our close friends are trying to hide from the coding mafia and have decided to skip country
# They taked us with making thier fake passport. We initially quoted them 3200€

quoted_price = 3200

# Last minute he decided to add some stuff to the deal. A fake ID, some food for the trip, and plant tickers
fake_id = 150
food = 50
plane_tickets = 2309

# Update the quoted price using the += operator



# We need to send them a message to tell them the new price
# Use the next sentence bits and the += operator to build the message
message_part_1 = "Hi Heathers, we know we quoted you 3200€ but the extra stuff has made the price go up to "
message_part_2 = "sorry if that complicates things a little... hugs, totally not the coding mafia."

# Print the message.
# Make sure that the spacing between words is correct! 
print()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05880622110130307, 'fraction_numerical': 0.011769651113913409, 'mean_word_length': 3.949240690659455, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, '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': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '495008', 'license': 'MIT', 'n_tokens_mistral': 6239, 'n_tokens_neox': 5777, 'n_words': 3387, 'path': 'Jupyter Notebook/Coding Workshop.ipynb', 'repo_name': 'jarredthejellyfish/coding_workshop', 'size': '23808'}