1 Commits

2 changed files with 0 additions and 263 deletions

View File

@ -1,47 +0,0 @@
24 58 36 91 57 23 83 34 56 70 84 92 65 78 11 16 92 28 42 10 37 92 75 63 14 68 71 58 41 49 87 4 99 85 5 91 54 79 69 98
83 56 20 46 28 66 71 44 85 87 6 80 13 43 40 56 66 34 72 79 80 35 53 1 31 31 90 32 13 7 91 23 86 8 42 94 65 46 53 63
75 11 76 10 39 90 33 51 44 44 61 17 59 26 70 84 32 42 24 59 85 75 80 81 23 83 25 14 16 28 59 61 99 97 97 79 23 33 13 9
54 50 86 49 33 12 22 35 96 87 41 38 42 58 77 21 16 67 9 89 16 24 67 77 91 54 53 87 45 59 93 55 33 57 86 23 13 75 2 37
14 18 97 75 40 53 84 57 83 12 85 87 20 31 86 84 85 100 29 45 14 48 23 7 59 54 42 7 13 70 78 94 82 29 45 2 12 79 66 86
31 61 24 51 25 11 45 12 12 77 71 31 20 63 16 45 25 25 12 96 23 99 59 54 10 25 87 8 64 49 6 20 3 45 37 27 51 62 38 20
69 73 56 50 89 66 68 31 49 95 5 86 87 28 28 62 36 72 94 38 48 40 59 61 37 34 92 77 69 43 57 32 33 27 98 81 86 37 91 72
29 58 100 13 22 66 97 16 100 26 3 71 66 70 50 7 33 80 96 60 71 39 13 76 25 11 42 74 71 65 94 71 6 36 24 96 85 20 24 63
23 19 80 96 22 15 68 26 5 42 81 22 27 1 33 95 88 25 21 9 89 100 11 19 65 93 57 10 60 94 64 92 1 10 69 16 90 77 69 48
23 25 90 26 67 32 17 11 61 18 8 7 90 16 12 81 62 11 84 40 11 72 34 11 71 5 33 29 76 2 45 59 38 86 60 22 32 39 30 91
17 96 86 25 37 86 3 9 16 16 97 1 86 28 3 29 18 4 63 74 83 88 35 90 62 37 100 59 84 2 35 78 68 8 84 65 40 31 26 42
82 72 36 37 29 23 83 56 41 4 65 98 91 66 89 66 46 50 91 50 61 97 87 46 46 56 85 49 20 87 21 61 7 38 79 94 91 38 31 5
25 97 78 7 66 69 80 18 19 41 21 81 29 43 89 24 67 23 68 97 24 43 35 77 4 39 33 53 1 92 64 96 24 37 17 44 4 91 50 41
31 6 58 25 34 58 51 72 25 69 75 100 88 14 21 62 90 2 61 88 46 47 16 92 100 100 96 14 29 77 5 24 20 54 74 11 56 98 3 38
11 46 85 77 74 59 6 23 97 29 68 2 87 49 9 18 85 24 97 78 75 1 27 28 32 31 45 33 15 77 34 74 66 79 20 23 33 100 99 88
34 48 81 40 85 17 1 70 44 84 69 28 99 59 76 36 51 42 23 76 83 6 5 93 50 22 56 67 18 81 55 31 1 72 1 31 66 83 50 80
83 8 46 18 35 47 9 28 50 83 54 68 97 87 34 76 63 26 75 39 15 9 2 84 37 57 14 52 55 8 25 25 31 92 44 20 90 49 75 38
80 99 93 15 78 89 10 85 3 87 23 2 24 4 66 36 2 57 78 85 5 55 74 94 28 31 31 91 23 33 70 52 69 84 82 59 95 78 30 97
70 49 57 47 78 33 93 82 40 22 2 36 33 97 37 99 34 79 78 33 64 75 76 19 37 82 48 67 7 99 91 12 87 5 73 85 19 64 7 15
66 33 89 1 50 93 80 65 40 18 15 52 11 27 99 78 78 26 60 65 78 41 98 93 8 69 76 10 41 23 48 27 34 73 99 55 95 88 1 99
1 3 61 44 42 92 13 42 36 20 14 82 62 83 31 67 92 72 41 10 85 92 12 78 8 16 85 48 45 50 62 54 6 82 26 28 44 87 45 70
48 12 73 9 73 9 6 95 61 5 27 4 61 35 92 53 25 59 22 89 89 63 84 74 53 6 60 14 21 20 6 87 60 32 85 11 26 48 95 52
8 16 13 68 11 40 58 44 95 57 26 12 98 78 82 56 59 57 10 46 11 62 20 41 37 17 35 73 29 60 57 24 94 40 76 94 61 45 87 29
59 68 52 84 44 47 66 74 90 13 73 27 16 65 5 11 44 47 14 95 68 21 94 63 87 82 35 92 32 35 78 97 71 60 48 82 6 34 59 19
63 2 62 50 26 50 79 100 93 87 43 98 62 76 70 35 97 97 19 41 30 55 45 13 82 31 44 91 90 87 71 99 57 52 3 27 37 88 9 28
12 17 29 52 79 55 21 47 39 56 67 60 81 43 37 41 17 14 8 31 59 25 62 20 33 48 35 92 58 57 44 75 26 68 27 47 90 45 35 43
71 2 97 68 34 17 17 12 87 12 94 17 56 14 18 3 16 81 78 11 79 14 75 41 95 72 20 63 5 79 44 28 83 54 50 48 51 63 43 32
56 44 31 27 5 85 7 68 70 11 87 29 48 32 13 59 80 41 60 46 31 82 72 21 43 81 5 47 48 29 33 29 94 28 80 72 25 90 14 23
61 37 94 15 83 39 95 82 38 31 96 71 26 30 42 99 69 75 86 99 92 84 49 47 3 63 44 47 48 2 12 9 53 63 73 96 92 49 100 40
19 91 56 37 48 20 98 38 70 19 86 58 100 21 24 35 41 46 87 7 34 11 18 13 4 43 40 4 33 39 29 17 59 18 54 92 27 20 17 10
19 86 64 90 66 86 61 80 69 68 79 65 49 80 15 59 6 60 53 28 26 89 87 89 98 8 83 73 1 67 22 24 20 16 65 63 20 26 20 49
90 87 51 84 52 92 89 55 50 67 30 25 47 43 48 9 73 89 39 60 67 60 78 58 30 43 37 28 17 67 92 39 60 91 99 14 87 16 7 99
87 4 8 30 100 53 32 39 38 86 68 61 36 28 86 25 84 31 99 87 28 74 29 88 91 52 98 44 70 24 36 88 62 21 91 41 88 26 52 6
47 23 36 40 87 26 7 65 50 62 83 23 80 96 41 63 41 22 85 25 36 88 76 42 12 68 65 94 29 45 88 2 84 70 8 89 73 5 40 51
8 83 54 82 91 15 35 87 58 60 2 24 40 58 59 91 31 23 78 70 91 75 41 64 57 87 12 52 28 40 77 87 55 10 13 81 97 69 50 4
67 54 59 18 36 84 72 37 50 14 77 89 31 27 62 83 36 64 28 86 35 59 52 56 78 90 97 8 5 45 23 80 97 6 23 49 51 97 11 89
34 9 21 15 60 83 20 47 90 56 22 98 82 44 45 98 100 89 52 13 26 9 34 29 1 74 50 100 20 13 16 37 97 65 80 17 48 92 2 6
51 82 98 67 58 64 18 67 43 74 8 4 54 68 23 24 56 19 69 75 78 55 24 11 58 39 65 4 20 53 49 97 57 85 81 53 68 30 28 47
43 37 35 64 40 57 48 67 30 60 54 64 94 38 95 63 69 64 3 50 24 39 98 15 54 67 55 31 13 10 48 40 53 57 63 74 25 60 33 80
33 79 47 22 62 42 74 82 40 73 77 27 55 34 14 54 33 94 7 16 38 35 94 75 26 100 33 26 85 56 15 56 37 4 10 50 22 98 82 2
18 73 97 58 100 60 44 45 7 1 80 80 38 30 34 14 56 74 97 75 98 26 97 57 79 24 63 64 31 94 30 64 53 23 37 40 79 6 1 5
77 90 2 17 52 39 59 53 30 57 98 77 26 60 62 89 11 5 8 62 65 64 43 48 87 2 84 62 69 94 11 43 21 53 44 90 33 19 23 77
64 61 77 59 88 18 64 52 70 39 65 55 93 61 18 80 77 5 69 6 8 36 61 37 84 40 5 61 52 70 65 82 46 34 99 94 6 51 34 14
5 45 72 76 77 94 41 97 82 25 48 5 41 55 43 39 95 37 93 72 97 32 15 77 46 80 37 99 30 97 14 9 2 27 60 100 77 41 17 1
8 68 24 61 54 19 6 66 43 80 92 10 19 2 13 15 47 69 81 41 23 95 62 39 52 91 28 59 6 71 12 12 74 67 90 86 29 26 66 60
46 17 45 82 59 3 98 41 19 76 100 83 58 80 81 4 6 50 24 75 97 23 7 100 72 74 84 49 10 62 29 38 8 69 13 71 7 63 1 73
85 72 57 81 15 48 60 51 92 66 46 93 87 83 67 61 74 64 64 64 93 93 65 77 77 79 73 42 80 23 50 36 72 2 24 76 28 44 65 61

216
README.md
View File

@ -1,216 +0,0 @@
# Python Fundamentals
### Learning Objectives
***Students Will Be Able To...***
* Create a variable in python
* Assign the different data structures to variables
* Write python statements using control flow
* Write python statements using loops and iteration
---
### Context
* The fundamentals of programming translate throughout every language
* Like learning any new language we're going to start with the basics and build up
* If you wanted to learn English you wouldn't start by reading a novel, but with the alphabet
### Variables
* Variables are a way to store and save data for use
* This is called `assignment`. You are assigning a value to a variable
* Declaring Variables
* Cannot start with a number
* Cannot declare with special characters
* Written in snake case
* Open up Python in the terminal
```python
name = "Jason"
fav_num = 8
turtles = ["Raph", "Leo", "Mickey", "Donny"]
```
### Data Types
* Now you may have noticed that variables can hold different `types` of values
* These are called `Data Types` and python3 has [many built-in types](https://docs.python.org/3/library/stdtypes.htm)
* [Strings](https://docs.python.org/3/library/stdtypes.html#str)
* Sequence of 0 or more characters(a-z, A-Z, 0-9, !,@,#, ect).
* python type `str()` or with the literal `''` or `""`
* [methods to know](https://docs.python.org/3/library/stdtypes.html#string-methods)
* `.format()` [https://pyformat.info/](More info)
* `.isdigit()`, `islower()`, `isupper()`, check to see if the string is a digit and so on. There are many more like these
* `.lower()`, `.upper()` changed the string to lower and up case
* `.split()` changes the string to a list based around the character[s] given
* [Numbers](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)
* [Floats](https://docs.python.org/3/library/functions.html#float)
* decimals
* python type `float()` or with the literal `23.3`
* methods to know
* `is_integer()` Return `True` if the float a whole number, and `False` otherwise
* [Integers](https://docs.python.org/3/library/functions.html#int)
* whole number
* python type `int()` or with the literal '4'
* [Lists](https://docs.python.org/3/library/stdtypes.html#lists)
* Ordered sequence of items
* python type `list()` or the literal `['a', 'b', 'c']`
* methods to know
* `.append()` adds a item to a list
* `.pop()` removes and returns the last item from the list
* [Dictionary](https://docs.python.org/3/library/stdtypes.html#dict)
* Collections of key, value pairs
* python type `dict()` or the literal `{'key':'value'}`
* methods to know
* `.get()` return the value of a give key, or a default value if its not found
* `.values()` returns a `list` of values in the Dictionary
* `.keys()` returns a `list` of keys in the Dictionary
* [Booleans](https://docs.python.org/3/library/stdtypes.html#boolean-values)
* Represents something that is `True` or `False`
* python type `bool()` or the literal `True` or `False`
* [Range](https://docs.python.org/3/library/stdtypes.html#range)
* `Range()` is a special type that represents range of numbers
* [None](https://docs.python.org/3/library/stdtypes.html#the-null-object)
* nothing, nothing at all
* python type ... there is one way, the literal way `None`
### Notable built in functions
* `len()` return the length of the given *sequence*
* `help()` shows help documentation of the given object
* `dir()` show the available methods of the give object
#### Math Operators
All math operators can be done on both floats and ints
Python comes with the following symbols for mathematical operators.
* `+` add
* `-` subtract
* `*` multiplication
* `\` division
* `\\` floor divided, always returns a whole number
* `%` modulo: finds the remainder after division
* The language also supports PEMDAS
* `5+(50+5)`
#### Comparison Operators
* `==` equality
* `!=` not equal
* `<` less then
* `<=` less then or equal to
* `>` greater then
* `>=` greater then or equal to
#### Control Flow
* Now we have reached `if/else` statements
* If an expression you passed in is `True` do something
* `else` do something `else`
```python
if expression == true:
run code
if name == "Jason":
print("That is an awesome name")
else:
print("You should get a different name")
if number > 100:
print("That's a big number")
elif number > 50 && number < 100:
print("That's a medium number")
else:
print("Your number is puny")
```
* Things to note
* Put a colon after the expression you want to evaluate to start the `if` body
* `if` to `elif` to `else`
* indents show what code is part of the body of the statement and where it ends
#### Lists and Indexing
* What if you wanted to store more data.
* Can be assigned to variables
* Can hold different data types at once
* The values are indexed for us starting at zero
```python
my_list = ["Jason", "Anna Kendrick", 2015, True]
my_list[0] == "Jason" # True
my_list[2] == 2016 # False
```
* Just a heads up indexing through a list is similar to indexing with strings.
* the value at index zero will be the first element in the list, or the first letter in a string
#### Functions and Statements
* We declare our functions with the word `def` for define
* Functions follow the same naming principles as declaring variables
* Snake case
* Do not start with numbers or special characters
* Remember how we used white space to organize our code with if/else statements. Well that idea holds true everywhere in Python
```python
def my_name():
return "My name is Jason"
```
* Functions allow us to build code that is reusable
* This follows the concept of **DRY - Don't Repeat Yourself**
* Functions can also take arguments. These allow our functions to be more dynamic
```python
def my_name(name):
return "My name is " + name
```
* When there is no `return` statement, the function *implicitly* returns `None`
### `for` loops
`for` loops *iterate* over a *sequence*. There are 2 parts to a `for` loop, the *statement* and the *body*. The *statement* tells the loop what to *iterate* over and *assigns* the loop variable. The body tells python what to do in each iteration. Before each iteration the loop variable is assigned to the next value in the *sequence*, in oder from the zero index to the last item.
```python
teachers = ['billy', 'tom', 'jason', 'jeff']
for teacher in teachers:
print( teacher.capitalize() )
```
In this loop we *iterate* over each teacher in the loop and print there name capitalized.
### `while` loops
Unlike `for` loops, `while` are not bound to a sequence and can continue for ever.
like a `for` loop, `while` loops have 2 parts, an *statement* and a body.
```python
num = input('Please enter a whole number: ')
while not num.isdigit():
print('Not a whole number!')
num = input('Please enter a whole number: ')
```
### loop control
There are 2 ways can control what loops. They both with `for` and `while` loops in the same way.
* [`break`](https://docs.python.org/3/reference/simple_stmts.html#break)
The `break` *statement* stops loop and allows python to move on to the rest of the script. If you are using a `while` loop, you should have a break *statement* to stop the loop.
```python
count = 1
while True:
count *= count
if count > 100: break
```
* [`continue`](https://docs.python.org/3/reference/simple_stmts.html#continue)
The `continue` *statement* skips to the next iteration of the loop. Generally, `continue` statement are at the top of the loop body.
```python
for num in range(100):
if num%10 != 0: continue
print(num)
```