├── Lesson8 ├── scraper.py └── Solutions │ ├── a_print_to_txt │ ├── scraper.py │ └── countries.txt │ ├── b_print_to_csv │ ├── scraper.py │ └── countries.csv │ ├── c_more_data │ ├── scraper.py │ └── countries.csv │ └── d_refactored │ └── scraper.py ├── Lesson5 ├── package │ ├── __init__.py │ ├── package_module.py │ └── subpackage │ │ ├── sub_module.py │ │ └── __init__.py ├── _1_imports.py ├── _2_init.py └── _3_scope.py ├── .gitignore ├── Lesson2 ├── data │ ├── read_example.csv │ ├── read_example.txt │ ├── countries.txt │ └── continents.csv ├── _3a_csv_read_example.py ├── _1a_read_file_example.py ├── _1c_countries.py ├── _1b_read_file_example_with_with.py ├── _3b_csv_write_example.py ├── _2a_write_file_example.py ├── _3c_countries.py ├── _2b_countries.py └── Solutions │ ├── _1c_countries.py │ ├── _2b_v1_countries.py │ ├── _2b_v2_countries_dict.py │ ├── _2b_v3_countries_defaultdict.py │ └── _3c_countries.py ├── docs ├── installer_1.png ├── installer_2.png ├── installer_3.png ├── WININSTALL.md ├── WINSETPATH.md └── PATH_LOCATIONS.md ├── Lesson7 ├── data │ ├── requests.png │ ├── google.html │ └── wikipedia.html ├── _1b_download_image.py ├── _3_beautiful_soup.py ├── _1a_requests.py ├── _2_example.html ├── _4_authentication.py ├── _5a_rest_api.py └── _5b_graphql_api.py ├── Lesson1 ├── _4a_exceptions_example.py ├── _4c_handle_user_input.py ├── Solutions │ ├── _4c_handle_user_input.py │ ├── _3b_encoded_message.py │ ├── _2b_factorial.py │ └── _2a_fizz_buzz.py ├── _3b_encode_message.py ├── _2b_factorial.py ├── _4b_more_exceptions_example.py ├── _2a_fizz_buzz.py ├── _6_regex_examples.py ├── _3a_dictionary_examples.py └── _5_datetime_examples.py ├── Lesson4 ├── _2_highlighting.py ├── _3_configuration.py ├── _1b_spyder.py └── data │ └── tips.csv ├── Lesson6 ├── Solutions │ ├── _3_practice.py │ ├── format_number.py │ └── format_number_advanced.py ├── _3_practice.py ├── _2d_pytest_parameterized.py ├── _2c_pytest.py ├── _2b_unittest.py ├── _2a_assert.py ├── rock_paper_scissors_buggy.py └── rock_paper_scissors_fixed.py └── README.md /Lesson8/scraper.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lesson5/package/__init__.py: -------------------------------------------------------------------------------- 1 | print('package __init__ loaded') 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | venv/ 3 | *.py[cod] 4 | */.ipynb_checkpoints/ 5 | -------------------------------------------------------------------------------- /Lesson2/data/read_example.csv: -------------------------------------------------------------------------------- 1 | Name,Age 2 | Minh,23 3 | Kiran,85 4 | Robert,5 5 | Gabriella,62 6 | -------------------------------------------------------------------------------- /Lesson2/data/read_example.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 1 3 | 3 4 | 4 5 | 9 6 | 1 7 | 2 8 | 7 9 | 8 10 | 1 11 | -------------------------------------------------------------------------------- /Lesson5/package/package_module.py: -------------------------------------------------------------------------------- 1 | def module_func(): 2 | print('package module: ' + __name__) 3 | -------------------------------------------------------------------------------- /Lesson5/package/subpackage/sub_module.py: -------------------------------------------------------------------------------- 1 | def sub_module_func(): 2 | print('sub-package module: ' + __name__) 3 | -------------------------------------------------------------------------------- /docs/installer_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ariannedee/next-level-python-livelessons/HEAD/docs/installer_1.png -------------------------------------------------------------------------------- /docs/installer_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ariannedee/next-level-python-livelessons/HEAD/docs/installer_2.png -------------------------------------------------------------------------------- /docs/installer_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ariannedee/next-level-python-livelessons/HEAD/docs/installer_3.png -------------------------------------------------------------------------------- /Lesson7/data/requests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ariannedee/next-level-python-livelessons/HEAD/Lesson7/data/requests.png -------------------------------------------------------------------------------- /Lesson1/_4a_exceptions_example.py: -------------------------------------------------------------------------------- 1 | try: 2 | int(input("Enter a number: ")) 3 | print('Good number!') 4 | except ValueError as e: 5 | print("Not a valid number") 6 | print(e) 7 | 8 | 9 | print('Got here') 10 | -------------------------------------------------------------------------------- /Lesson2/_3a_csv_read_example.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | with open('data/read_example.csv', 'r') as file: 4 | reader = csv.DictReader(file) 5 | 6 | for person in reader: 7 | print(f'{person["Name"]} is {person["Age"]}') 8 | -------------------------------------------------------------------------------- /Lesson4/_2_highlighting.py: -------------------------------------------------------------------------------- 1 | import math 2 | from random import does_not_exist 3 | 4 | print(a_new_variable) 5 | 6 | def my_function(arg1, arg2): 7 | print(arg1) 8 | print(arg2) 9 | def another_function(): 10 | return 11 | -------------------------------------------------------------------------------- /Lesson5/_1_imports.py: -------------------------------------------------------------------------------- 1 | import math 2 | import unittest.mock 3 | import datetime as dt 4 | 5 | from random import randint, choice 6 | from package.subpackage.sub_module import sub_module_func 7 | 8 | 9 | import sys 10 | 11 | print(sys.path) # Python searches for modules here (in-order) 12 | -------------------------------------------------------------------------------- /Lesson5/_2_init.py: -------------------------------------------------------------------------------- 1 | from package.package_module import module_func 2 | from package.subpackage.sub_module import sub_module_func 3 | 4 | 5 | def func(): 6 | print('_2_init: ' + __name__) 7 | 8 | 9 | if __name__ == '__main__': 10 | func() 11 | module_func() 12 | sub_module_func() 13 | -------------------------------------------------------------------------------- /Lesson4/_3_configuration.py: -------------------------------------------------------------------------------- 1 | """ 2 | This file requires an argument. 3 | 4 | In the terminal: 5 | $ python3 _3_configuration.py 6 | 7 | In PyCharm: 8 | Edit run configurations to include in the parameters 9 | """ 10 | import sys 11 | 12 | name = sys.argv[1] 13 | 14 | print(f'Hello {name}') 15 | -------------------------------------------------------------------------------- /Lesson1/_4c_handle_user_input.py: -------------------------------------------------------------------------------- 1 | """ 2 | Given a temperature (in Celsius), print the state of water at that temperature 3 | """ 4 | 5 | # Todo: Handle invalid inputs 6 | temp = float(input("What's the H20 temperature? ")) 7 | 8 | if temp <= 0: 9 | print(" It’s ice") 10 | elif temp >= 100: 11 | print(" It’s steam") 12 | else: 13 | print(" It's water") 14 | -------------------------------------------------------------------------------- /Lesson2/_1a_read_file_example.py: -------------------------------------------------------------------------------- 1 | """ 2 | Read a file with a number on each line. Print the sum of those numbers. 3 | """ 4 | 5 | # Open file 6 | file = open('data/read_example.txt', 'r') 7 | 8 | sum = 0 9 | # Read each line 10 | for line in file.readlines(): 11 | num = int(line) 12 | sum += num 13 | 14 | print(f'Sum is {sum}') 15 | 16 | # Close the file 17 | file.close() 18 | -------------------------------------------------------------------------------- /Lesson7/_1b_download_image.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import shutil 3 | 4 | URL = "https://upload.wikimedia.org/wikipedia/commons/a/aa/Requests_Python_Logo.png" 5 | response = requests.get(URL, stream=True) 6 | if response.status_code == 200: 7 | with open('data/requests.png', 'wb') as f: 8 | response.raw.decode_content = True 9 | shutil.copyfileobj(response.raw, f) 10 | -------------------------------------------------------------------------------- /Lesson5/package/subpackage/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Anything imported in __init__.py can be imported from the package 3 | 4 | e.g. You can do: 5 | from package.subpackage import sub_module_func 6 | 7 | As well as the standard: 8 | from package.subpackage.sub_module import sub_module_func 9 | """ 10 | 11 | from .sub_module import sub_module_func # relative import 12 | 13 | print('sub-package __init__ loaded') 14 | -------------------------------------------------------------------------------- /Lesson6/Solutions/_3_practice.py: -------------------------------------------------------------------------------- 1 | """ 2 | This program takes a number and returns it as a string with commas as the 3 | thousands separators 4 | 5 | Basic practice: add tests and fix the code to handle positive whole numbers 6 | Extra practice: extend it to handle negative numbers and numbers with decimal places 7 | """ 8 | from format_number import format_number 9 | 10 | 11 | user_num = input("Enter a number: ") 12 | print(format_number(user_num)) 13 | -------------------------------------------------------------------------------- /Lesson7/_3_beautiful_soup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Documentation: https://www.crummy.com/software/BeautifulSoup/bs4/doc/ 3 | """ 4 | from bs4 import BeautifulSoup 5 | 6 | with open('data/google.html', 'r') as file: 7 | html_doc = '' 8 | for line in file: 9 | html_doc += line 10 | 11 | soup = BeautifulSoup(html_doc, 'html.parser') 12 | buttons = soup.find_all('input', attrs={'type': 'submit'}) 13 | for button in buttons: 14 | print(button.get('value')) 15 | -------------------------------------------------------------------------------- /Lesson1/Solutions/_4c_handle_user_input.py: -------------------------------------------------------------------------------- 1 | """ 2 | Given a temperature (in Celsius), print the state of water at that temperature 3 | """ 4 | 5 | while True: 6 | try: 7 | temp = float(input("What's the H20 temperature? ")) 8 | break 9 | except ValueError: 10 | print("Invalid number") 11 | 12 | if temp <= 0: 13 | print(" It’s ice") 14 | elif temp >= 100: 15 | print(" It’s steam") 16 | else: 17 | print(" It's water") 18 | -------------------------------------------------------------------------------- /Lesson2/_1c_countries.py: -------------------------------------------------------------------------------- 1 | """ 2 | A program that takes a letter and prints 3 | all of the countries that start with that letter 4 | """ 5 | 6 | # Todo: Read data/countries.txt and save all countries 7 | 8 | # Get user to provide a letter 9 | letter = input('Number of countries that start with letter: ') 10 | letter = letter.capitalize() 11 | 12 | # Todo: Print the number of countries that start with the letter 13 | 14 | # Todo: Print the countries that start with the letter 15 | -------------------------------------------------------------------------------- /Lesson2/_1b_read_file_example_with_with.py: -------------------------------------------------------------------------------- 1 | """ 2 | Read a file with a number on each line. Print the sum of those numbers. 3 | """ 4 | 5 | # Open the file and save it to variable "file" 6 | with open('data/read_example.txt', 'r') as file: 7 | sum = 0 8 | # Read each line 9 | for line in file.readlines(): 10 | num = int(line) 11 | sum += num 12 | print(f'Sum is {sum}') 13 | 14 | 15 | # File is automatically closed when exiting the with block 16 | 17 | -------------------------------------------------------------------------------- /Lesson1/_3b_encode_message.py: -------------------------------------------------------------------------------- 1 | """ 2 | Translate a message from the user into a numeric code 3 | """ 4 | 5 | code = { 6 | 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 7 | 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 8 | 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26 9 | } 10 | 11 | # Get a message from the user 12 | message = input("What is your message? ") 13 | 14 | # Todo: Translate user input into code of numbers 15 | -------------------------------------------------------------------------------- /Lesson6/_3_practice.py: -------------------------------------------------------------------------------- 1 | """ 2 | This program takes a number and returns it as a string with commas as the 3 | thousands separators 4 | 5 | Basic practice: add tests and fix the code to handle positive whole numbers 6 | Extra practice: extend it to handle negative numbers and numbers with decimal places 7 | """ 8 | 9 | num = input("Enter a number: ") 10 | 11 | 12 | as_string = "" 13 | i = 0 14 | for char in str(num): 15 | if i % 3 == 1: 16 | as_string += ',' 17 | as_string += char 18 | i += 1 19 | 20 | print(as_string) 21 | -------------------------------------------------------------------------------- /Lesson2/_3b_csv_write_example.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | book_1 = {"title": "To Kill a Mockingbird", "author": "Harper Lee", "published_year": 1960} 4 | book_2 = {"title": "Jane Eyre", "author": "Charlotte Brontë", "published_year": 1847} 5 | book_3 = {"title": "1984", "author": "George Orwell", "published_year": 1949} 6 | 7 | books = [book_1, book_2, book_3] 8 | 9 | 10 | with open('data/write_example.csv', 'w') as file: 11 | writer = csv.DictWriter(file, ('title', 'author', 'published_year')) 12 | writer.writeheader() 13 | writer.writerows(books) 14 | -------------------------------------------------------------------------------- /Lesson1/_2b_factorial.py: -------------------------------------------------------------------------------- 1 | """ 2 | Given a user's input of n, return a list of factorials from 0! to n! 3 | 4 | Test cases: 5 | 0! = 1 6 | 1! = 1 7 | 2! = 1 x 2 = 2 8 | 4! = 1 x 2 x 3 x 4 = 24 9 | """ 10 | 11 | 12 | # Helper method to test equality 13 | def equals(actual, expected): 14 | assert actual == expected, f'Expected {expected}, got {actual}' 15 | 16 | # Todo: Create a function that produces the factorial of a number 17 | 18 | 19 | # Todo: Test factorial function 20 | 21 | 22 | # Todo: Request a number from the user 23 | 24 | 25 | # Todo: Print a list of factorials from 0 to the given number 26 | -------------------------------------------------------------------------------- /Lesson7/_1a_requests.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | URL = "https://google.com" 4 | 5 | # Dictionary of HTTP headers 6 | headers = {'User-Agent': f'Your name (your@email.com)'} 7 | response = requests.get(URL, headers=headers) 8 | 9 | # Full list of HTTP status codes: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes 10 | # Common status codes: 11 | # - 200 OK 12 | # - 401 Unauthorized 13 | # - 404 Not found 14 | # - 502 Bad gateway 15 | print(response.status_code) 16 | 17 | # Get text contents 18 | print(response.text) 19 | 20 | with open('data/google.html', 'w') as file: 21 | file.write(response.text) 22 | -------------------------------------------------------------------------------- /Lesson1/Solutions/_3b_encoded_message.py: -------------------------------------------------------------------------------- 1 | """ 2 | Translate a message from the user into a numeric code 3 | """ 4 | 5 | code = { 6 | 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 7 | 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 8 | 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26 9 | } 10 | 11 | # Get a message from the user 12 | message = input("What is your message? ") 13 | 14 | coded_message = "" 15 | for char in message.lower(): 16 | coded_message += str(code.get(char, char)) 17 | coded_message += " " 18 | 19 | print(coded_message) 20 | -------------------------------------------------------------------------------- /Lesson2/_2a_write_file_example.py: -------------------------------------------------------------------------------- 1 | """ 2 | Write a poem to a file 3 | """ 4 | 5 | poem = """I have eaten 6 | the plums 7 | that were in 8 | the icebox 9 | 10 | and which 11 | you were probably 12 | saving 13 | for breakfast 14 | 15 | Forgive me 16 | they were delicious 17 | so sweet 18 | and so cold 19 | """ 20 | 21 | author = 'William Carlos Williams' 22 | 23 | with open('data/write_example.txt', 'w') as file: 24 | file.write(poem) # Multi-line strings include newlines 25 | file.write('\n') # Manually insert a new line 26 | file.write(f'- ') # Writes without newlines will be on the same line 27 | file.write(author) 28 | -------------------------------------------------------------------------------- /Lesson2/_3c_countries.py: -------------------------------------------------------------------------------- 1 | """ 2 | A program that takes a continent and prints 3 | all of the countries on that continent 4 | """ 5 | 6 | # todo: Read data/continents.csv and save all countries by continent 7 | 8 | continents = [ 9 | 'Africa', 10 | 'Asia', 11 | 'Europe', 12 | 'North America', 13 | 'Oceania', 14 | 'South America' 15 | ] 16 | 17 | # Todo: Get user to provide a continent by inputting a number 18 | print('Choose a continent:') 19 | print('1: Africa, 2: Asia, 3: Europe, 4: North America, 5: Oceania, 6: South America') 20 | 21 | # Todo: Print the number of countries on that continent 22 | 23 | # Todo: Print each of the countries on that continent to the console 24 | -------------------------------------------------------------------------------- /Lesson5/_3_scope.py: -------------------------------------------------------------------------------- 1 | """ 2 | There are 4 types of namespaces: 3 | - built-in 4 | - global 5 | - enclosing 6 | - local 7 | """ 8 | import math 9 | from random import * 10 | 11 | a = 1 12 | 13 | print(f'Built-ins\n{dir(__builtins__)}\n') 14 | print(f'Globals\n{globals()}\n') 15 | 16 | 17 | def outer_function(b, c): 18 | def inner_function(d): 19 | global a 20 | a = 10 21 | b = 100 # Creates a new local variable (b) that is destroyed once out of inner_function 22 | print(f'Inner function locals\n{locals()}\n') 23 | 24 | inner_function(4) 25 | print(f'a = {a}') 26 | print(f'Outer function locals\n{locals()}\n') 27 | 28 | 29 | outer_function(2, 3) 30 | print(f'Main locals\n{locals()}\n') 31 | -------------------------------------------------------------------------------- /Lesson1/_4b_more_exceptions_example.py: -------------------------------------------------------------------------------- 1 | try: 2 | int('5') 3 | print('Success!') 4 | print(hi) 5 | except (ValueError, NameError) as e: # Catch multiple error types 6 | print("Fail!") 7 | print(e) 8 | 9 | 10 | try: 11 | int('5') 12 | print('Success!') 13 | print(hi) 14 | except ValueError: # Catch multiple error types with different behaviour 15 | print("Failure: Value error") 16 | except NameError: 17 | print("Failure: Name error") 18 | 19 | 20 | try: 21 | int('5') 22 | print('Success!') 23 | except ValueError: 24 | print("Fail!") 25 | else: 26 | print('Everything worked') # Runs after try block finishes without errors 27 | finally: 28 | print('This always happens') # Runs after everything, even if there was an error 29 | -------------------------------------------------------------------------------- /Lesson6/Solutions/format_number.py: -------------------------------------------------------------------------------- 1 | def format_number(num): 2 | as_string = "" 3 | for i, char in enumerate(str(num)[::-1]): 4 | if i >= 3 and i % 3 == 0: 5 | as_string += ',' 6 | as_string += char 7 | return as_string[::-1] 8 | 9 | 10 | if __name__ == "__main__": 11 | def assert_equals(actual, expected): 12 | assert actual == expected, f"Expected {expected} but got {actual}" 13 | 14 | 15 | assert_equals(format_number(1), "1") 16 | assert_equals(format_number(100), "100") 17 | assert_equals(format_number(1000), "1,000") 18 | assert_equals(format_number(10000), "10,000") 19 | assert_equals(format_number(1000000), "1,000,000") 20 | assert_equals(format_number(100000000), "100,000,000") 21 | 22 | print("All tests passed") 23 | -------------------------------------------------------------------------------- /Lesson7/_2_example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A title 4 | 5 | 6 |
7 | 8 |

A test page

9 | 10 | 11 |

Some content with a link.

12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
NameAge
Minh23
Kiran85
Robert5
Gabriella62
39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/WININSTALL.md: -------------------------------------------------------------------------------- 1 | ## Installing Python on Windows 2 | The Python installer for Windows doesn't use the optimal default settings. 3 | Follow these instructions when running the installer. 4 | If you have already installed Python with the default settings, 5 | follow the instructions here instead: [add Python to the PATH variable](WINSETPATH.md) 6 | 7 | 1. Check the *Add Python to PATH* box 8 | 2. Choose the *Customize installation* option 9 | 10 | 11 | 3. Keep the default settings and click *Next* 12 | 13 | 14 | 4. Check the *Install for all users* box if you want Python accessible by all users. 15 | 5. Customize the install location: **C:\Python39** or whatever version number you're installing 16 | 6. Click *Install* 17 | 18 | -------------------------------------------------------------------------------- /Lesson2/_2b_countries.py: -------------------------------------------------------------------------------- 1 | """ 2 | A program that takes a letter and outputs a text file of 3 | all of the countries that start with that letter 4 | """ 5 | 6 | countries = [] 7 | 8 | # Read data/countries.txt and save all countries by starting letter 9 | with open("data/countries.txt") as file: 10 | for line in file.readlines(): 11 | countries.append(line.strip()) 12 | 13 | # Get user to provide a letter 14 | letter = input('Number of countries that start with letter: ') 15 | letter = letter.capitalize() 16 | 17 | letter_countries = [] 18 | for country in countries: 19 | if country[0].upper() == letter: 20 | letter_countries.append(country) 21 | 22 | # Print the number of countries that start with the letter 23 | print(f'{len(letter_countries)} countries start with an {letter}') 24 | 25 | # Todo: Create text file that lists the countries starting with the letter 26 | -------------------------------------------------------------------------------- /Lesson1/_2a_fizz_buzz.py: -------------------------------------------------------------------------------- 1 | """ 2 | FizzBuzz is a classic programming challenge. 3 | 4 | For every number from 1 to n, 5 | print Fizz if the number is divisible by 3, 6 | print Buzz if the number is divisible by 5, 7 | print FizzBuzz if the number is divisible by 3 and 5, 8 | otherwise, print the original number otherwise 9 | """ 10 | 11 | 12 | # Simple test helper function 13 | def assert_equals(actual, expected): 14 | assert actual == expected, f'Expected {expected}, got {actual}' 15 | 16 | 17 | # Todo: Write a function that returns: 18 | # "Fizz" if the number is divisible by 3 19 | # "Buzz" if the number is divisible by 5 20 | # "FizzBuzz" if the number is divisible by 3 and 5 21 | # the number otherwise 22 | 23 | 24 | # Todo: Test the function 25 | 26 | 27 | # Todo: Request a number from the user 28 | 29 | 30 | # Todo: Print a list of fizz-buzzed numbers from 1 to the given number 31 | 32 | -------------------------------------------------------------------------------- /Lesson8/Solutions/a_print_to_txt/scraper.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | 4 | URL = "http://ariannedee.pythonanywhere.com/Member_states_of_the_United_Nations" 5 | 6 | # Todo: Update with your info 7 | name = None 8 | email = None 9 | assert name and email 10 | 11 | headers = {'User-Agent': f'{name} ({email})'} 12 | response = requests.get(URL, headers=headers) 13 | 14 | assert response.status_code == 200, f"Response was {response.status_code}" 15 | 16 | html_doc = response.text 17 | 18 | soup = BeautifulSoup(html_doc, 'html.parser') 19 | 20 | table = soup.find('table', class_='wikitable') 21 | 22 | countries = [] 23 | for row in table.find_all('tr'): 24 | if row.td: 25 | links = row.td.find_all('a') 26 | country_name = links[1].string 27 | countries.append(country_name) 28 | 29 | with open("countries.txt", "w") as file: 30 | for country in countries: 31 | file.write(country) 32 | file.write('\n') 33 | -------------------------------------------------------------------------------- /docs/WINSETPATH.md: -------------------------------------------------------------------------------- 1 | ## Windows set up instruction 2 | If you installed Python with the default options, 3 | you will probably need to add Python to the PATH variable. 4 | This let's your operating system know where to look for the Python executable 5 | when you try running it. 6 | 7 | To add Python to your PATH variable: 8 | 1. Find the path of **python.exe** on your system. 9 | [Look in these directories](PATH_LOCATIONS.md) or search for it. 10 | 11 | 1. Open *System Properties* and click on the *Advanced* tab 12 | 13 | 1. Click on *Environment Variables* 14 | 15 | 1. Under *System variables* find and click on the *Path* variable 16 | 17 | 1. In edit mode, go to the end of the line and add **;C:\Python36** or whatever folder *python.exe* is in. 18 | Note the semicolon before the path; this will separate it from the previous path. 19 | 20 | If you are having problems: 21 | 22 | Search the internet for "**Add python to path on Windows *10 / Vista / XP / etc***" 23 | to find instructions for your version of Windows. 24 | -------------------------------------------------------------------------------- /Lesson6/_2d_pytest_parameterized.py: -------------------------------------------------------------------------------- 1 | """ 2 | import pytest 3 | In terminal, run $ pytest 4 | """ 5 | import pytest 6 | 7 | from rock_paper_scissors_buggy import determine_winner, game_over, YOU, COMP 8 | 9 | 10 | @pytest.mark.parametrize("you, comp, expected_winner", [ 11 | ('r', 'r', None), 12 | ('r', 'p', COMP), 13 | ('r', 's', YOU), 14 | ('p', 'r', YOU), 15 | ('p', 'p', None), 16 | ('p', 's', COMP), 17 | ('s', 'r', COMP), 18 | ('s', 'p', YOU), 19 | ('s', 's', None), 20 | ]) 21 | def test_determine_winner(you, comp, expected_winner): 22 | assert determine_winner(you, comp) == expected_winner 23 | 24 | 25 | @pytest.mark.parametrize("best_of, score, expected_winner", [ 26 | (3, [0, 0], None), 27 | (3, [1, 1], None), 28 | (3, [2, 1], YOU), 29 | (3, [1, 2], COMP), 30 | (5, [2, 2], None), 31 | (5, [3, 0], YOU), 32 | (5, [1, 3], COMP) 33 | ]) 34 | def test_game_over(best_of, score, expected_winner): 35 | assert game_over(best_of, score) == expected_winner 36 | -------------------------------------------------------------------------------- /Lesson2/Solutions/_1c_countries.py: -------------------------------------------------------------------------------- 1 | """ 2 | A program that takes a letter and prints 3 | all of the countries that start with that letter 4 | """ 5 | 6 | countries = [] 7 | 8 | # Read data/countries.txt and save all countries by starting letter 9 | with open("../data/countries.txt") as file: # Remove the ../ if the data folder is a sibling of this file 10 | for line in file.readlines(): 11 | countries.append(line.strip()) 12 | 13 | # Get user to provide a letter 14 | letter = input('Number of countries that start with letter: ') 15 | letter = letter.capitalize() 16 | 17 | # Print the number of countries that start with the letter 18 | letter_countries = [] 19 | for country in countries: 20 | if country[0].upper() == letter: 21 | letter_countries.append(country) 22 | 23 | # Print the number of countries that start with the letter 24 | print(f"There are {len(letter_countries)} countries that start with the letter {letter}") 25 | 26 | # Print the countries that start with the letter 27 | print(letter_countries) 28 | -------------------------------------------------------------------------------- /Lesson1/Solutions/_2b_factorial.py: -------------------------------------------------------------------------------- 1 | """ 2 | Given a user's input of n, return a list of factorials from 0! to n! 3 | 4 | Test cases: 5 | 0! = 1 6 | 1! = 1 7 | 2! = 1 x 2 = 2 8 | 4! = 1 x 2 x 3 x 4 = 24 9 | """ 10 | 11 | 12 | # Helper method to test equality 13 | def assert_equals(actual, expected): 14 | assert actual == expected, f'Expected {expected}, got {actual}' 15 | 16 | 17 | # Create a function that produces the factorial of a number 18 | def factorial(n): 19 | total = 1 20 | for i in range(n): 21 | total *= (i + 1) 22 | return total 23 | 24 | 25 | # Test factorial function 26 | assert_equals(factorial(0), 1) 27 | assert_equals(factorial(1), 1) 28 | assert_equals(factorial(2), 2) 29 | assert_equals(factorial(4), 24) 30 | 31 | # Request a number from the user 32 | number = int(input("Enter a positive whole number: ")) 33 | 34 | # Print a list of factorials from 0 to the given number 35 | factorials = [] 36 | for i in range(number + 1): 37 | factorials.append(factorial(i)) 38 | 39 | print(factorials) 40 | -------------------------------------------------------------------------------- /Lesson6/_2c_pytest.py: -------------------------------------------------------------------------------- 1 | """ 2 | In terminal, run $ pytest 3 | """ 4 | from rock_paper_scissors_buggy import determine_winner, game_over, YOU, COMP 5 | 6 | 7 | def test_determine_winner(): 8 | test_cases = ( 9 | ('r', 'r', None), 10 | ('r', 'p', COMP), 11 | ('r', 's', YOU), 12 | ('p', 'r', YOU), 13 | ('p', 'p', None), 14 | ('p', 's', COMP), 15 | ('s', 'r', COMP), 16 | ('s', 'p', YOU), 17 | ('s', 's', None), 18 | ) 19 | 20 | for case in test_cases: 21 | you, comp, winner = case 22 | assert determine_winner(you, comp) == winner 23 | 24 | 25 | def test_game_over(): 26 | test_cases = ( 27 | (3, [0, 0], None), 28 | (3, [1, 1], None), 29 | (3, [2, 1], YOU), 30 | (3, [1, 2], COMP), 31 | (5, [2, 2], None), 32 | (5, [3, 0], YOU), 33 | (5, [1, 3], COMP), 34 | ) 35 | 36 | for case in test_cases: 37 | best_of, score, winner = case 38 | assert game_over(best_of, score) == winner 39 | -------------------------------------------------------------------------------- /Lesson2/Solutions/_2b_v1_countries.py: -------------------------------------------------------------------------------- 1 | """ 2 | A program that takes a letter and outputs a text file of 3 | all of the countries that start with that letter 4 | """ 5 | 6 | countries = [] 7 | 8 | # Read data/countries.txt and save all countries by starting letter 9 | with open("../data/countries.txt") as file: # Remove the ../ if the data folder is a sibling of this file 10 | for line in file.readlines(): 11 | countries.append(line.strip()) 12 | 13 | # Get user to provide a letter 14 | letter = input('Number of countries that start with letter: ') 15 | letter = letter.capitalize() 16 | 17 | letter_countries = [] 18 | for country in countries: 19 | if country[0].upper() == letter: 20 | letter_countries.append(country) 21 | 22 | # Print the number of countries that start with the letter 23 | print(f'{len(letter_countries)} countries start with an {letter}') 24 | 25 | # Create text file that lists the countries starting with the letter 26 | with open(f'data/{letter}_countries.txt', 'w') as file: 27 | for country in letter_countries: 28 | file.write(country) 29 | file.write('\n') 30 | -------------------------------------------------------------------------------- /docs/PATH_LOCATIONS.md: -------------------------------------------------------------------------------- 1 | # Locating Python on your computer 2 | If you are trying to find the location of Python3 on your computer, 3 | try these locations first. 4 | The exact location and filename will depend 5 | on the method you used to install Python 6 | and which version is installed. 7 | 8 | ## Windows 9 | Look for `python.exe` 10 | - C:\Python36 11 | - C:\Program Files\Python36 12 | - C:\Users\\*username*\AppData\Local\Programs\Python\Python36-XX 13 | 14 | ## Mac 15 | Look for `python3.6` or `python3` 16 | 17 | - /usr/local/bin 18 | - /Library/Frameworks/Python.framework/Versions/3.6/bin/ 19 | - /usr/local/Cellar/python/3.6.X_X/bin/ 20 | - /Users/*username*/anaconda/bin/ 21 | - /anaconda3/bin/ 22 | 23 | ## Linux 24 | Look for `python3.6` or `python3` 25 | - /usr/bin/ 26 | - /usr/local/bin 27 | 28 | ### Finally 29 | If you didn't find it at any of these locations, 30 | try searching google more specifically based on 31 | your Python version, operating system, and method of download. 32 | 33 | If you found it at another location, please email me at 34 | **arianne.dee.studios at gmail dot com** so I can update this list. 35 | -------------------------------------------------------------------------------- /Lesson2/Solutions/_2b_v2_countries_dict.py: -------------------------------------------------------------------------------- 1 | """ 2 | A program that takes a letter and outputs a text file of 3 | all of the countries that start with that letter 4 | """ 5 | 6 | # Read data/countries.txt and save all countries by starting letter 7 | countries = {} 8 | with open('../data/countries.txt', 'r') as file: # Remove the ../ if the data folder is a sibling of this file 9 | for line in file.readlines(): 10 | starting_letter = line[0] 11 | country = line.strip() 12 | if starting_letter not in countries: 13 | countries[starting_letter] = [] 14 | countries[starting_letter].append(country) 15 | 16 | # Get user to provide a letter 17 | letter = input('Number of countries that start with letter: ') 18 | letter = letter.capitalize() 19 | 20 | # Print the number of countries that start with the letter 21 | letter_countries = countries.get(letter, []) 22 | print(f'{len(letter_countries)} countries start with an {letter}') 23 | 24 | # Create text file that lists the countries starting with the letter 25 | with open(f'data/{letter}_countries.txt', 'w') as file: 26 | for country in letter_countries: 27 | file.write(country) 28 | file.write('\n') 29 | -------------------------------------------------------------------------------- /Lesson1/Solutions/_2a_fizz_buzz.py: -------------------------------------------------------------------------------- 1 | """ 2 | FizzBuzz is a classic programming challenge. 3 | 4 | For every number from 1 to n, 5 | print Fizz if the number is divisible by 3, 6 | print Buzz if the number is divisible by 5, 7 | print FizzBuzz if the number is divisible by 3 and 5, 8 | otherwise, print the original number otherwise 9 | """ 10 | 11 | 12 | # Simple test helper function 13 | def assert_equals(actual, expected): 14 | assert actual == expected, f'Expected {expected}, got {actual}' 15 | 16 | 17 | def fizz_buzz(n): 18 | if n % 15 == 0: 19 | return "FizzBuzz" 20 | elif n % 3 == 0: 21 | return "Fizz" 22 | elif n % 5 == 0: 23 | return "Buzz" 24 | return n 25 | 26 | 27 | assert_equals(fizz_buzz(1), 1) 28 | assert_equals(fizz_buzz(7), 7) 29 | assert_equals(fizz_buzz(3), "Fizz") 30 | assert_equals(fizz_buzz(5), "Buzz") 31 | assert_equals(fizz_buzz(6), "Fizz") 32 | assert_equals(fizz_buzz(10), "Buzz") 33 | assert_equals(fizz_buzz(15), "FizzBuzz") 34 | assert_equals(fizz_buzz(30), "FizzBuzz") 35 | 36 | number = int(input("Enter a number: ")) 37 | 38 | fizz_buzz_list = [] 39 | for i in range(number): 40 | fizz_buzz_list.append(fizz_buzz(i + 1)) 41 | 42 | print(fizz_buzz_list) 43 | -------------------------------------------------------------------------------- /Lesson2/Solutions/_2b_v3_countries_defaultdict.py: -------------------------------------------------------------------------------- 1 | """ 2 | A program that takes a letter and outputs a text file of 3 | all of the countries that start with that letter 4 | """ 5 | from collections import defaultdict 6 | 7 | 8 | # Read data/countries.txt and save all countries by starting letter 9 | countries = defaultdict(list) 10 | with open('../data/countries.txt', 'r') as file: # Remove the ../ if the data folder is a sibling of this file 11 | for line in file.readlines(): 12 | starting_letter = line[0] 13 | country = line.strip() 14 | countries[starting_letter].append(country) 15 | 16 | # Get user to provide a letter 17 | letter = input('Number of countries that start with letter: ') 18 | letter = letter.capitalize() 19 | 20 | # Print the number of countries that start with the letter 21 | letter_countries = countries[letter] 22 | print(f'{len(letter_countries)} countries start with an {letter}') 23 | 24 | # Create text file that lists the countries starting with the letter 25 | with open(f'../data/{letter}_countries.txt', 'w') as file: # Remove the ../ if the data folder is a sibling of this file 26 | for country in letter_countries: 27 | file.write(country) 28 | file.write('\n') 29 | -------------------------------------------------------------------------------- /Lesson6/_2b_unittest.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from rock_paper_scissors_buggy import determine_winner, game_over, YOU, COMP 4 | 5 | 6 | class TestRPSGame(unittest.TestCase): 7 | def test_determine_winner(self): 8 | self.assertEqual(determine_winner('r', 'r'), None) 9 | self.assertEqual(determine_winner('r', 'p'), COMP) 10 | self.assertEqual(determine_winner('r', 's'), YOU) 11 | self.assertEqual(determine_winner('p', 'r'), YOU) 12 | self.assertEqual(determine_winner('p', 'p'), None) 13 | self.assertEqual(determine_winner('p', 's'), COMP) 14 | self.assertEqual(determine_winner('s', 'r'), COMP) 15 | self.assertEqual(determine_winner('s', 'p'), YOU) 16 | self.assertEqual(determine_winner('s', 's'), None) 17 | 18 | def test_game_over(self): 19 | self.assertEqual(game_over(3, [0, 0]), None) 20 | self.assertEqual(game_over(3, [1, 1]), None) 21 | self.assertEqual(game_over(3, [2, 1]), YOU) 22 | self.assertEqual(game_over(3, [1, 2]), COMP) 23 | self.assertEqual(game_over(5, [2, 2]), None) 24 | self.assertEqual(game_over(5, [3, 0]), YOU) 25 | self.assertEqual(game_over(5, [1, 3]), COMP) 26 | 27 | 28 | if __name__ == '__main__': 29 | unittest.main() 30 | -------------------------------------------------------------------------------- /Lesson2/Solutions/_3c_countries.py: -------------------------------------------------------------------------------- 1 | """ 2 | A program that takes a continent and prints 3 | all of the countries on that continent 4 | """ 5 | import csv 6 | 7 | continent_dict = {} 8 | 9 | # Read data/continents.csv and save all countries by continent 10 | with open("../data/continents.csv") as file: 11 | reader = csv.DictReader(file) 12 | for country in reader: 13 | continent = country["Continent"] 14 | if continent not in continent_dict: 15 | continent_dict[continent] = [] 16 | 17 | continent_dict[continent].append(country["Country"]) 18 | 19 | continents = [ 20 | 'Africa', 21 | 'Asia', 22 | 'Europe', 23 | 'North America', 24 | 'Oceania', 25 | 'South America' 26 | ] 27 | 28 | # Get user to provide a continent by inputting a number 29 | print('Choose a continent:') 30 | print('1: Africa, 2: Asia, 3: Europe, 4: North America, 5: Oceania, 6: South America') 31 | user_number = int(input()) 32 | 33 | continent = continents[user_number - 1] 34 | continent_countries = continent_dict[continent] 35 | 36 | # Print the number of countries on that continent 37 | print(f"There are {len(continent_countries)} countries in {continent}") 38 | 39 | # Print each of the countries on that continent to the console 40 | print(continent_countries) 41 | -------------------------------------------------------------------------------- /Lesson6/_2a_assert.py: -------------------------------------------------------------------------------- 1 | from rock_paper_scissors_buggy import determine_winner, game_over, YOU, COMP 2 | 3 | 4 | def assert_equals(actual, expected): 5 | assert actual == expected, f"Expected {expected}, got {actual}" 6 | 7 | 8 | def test_determine_winner(): 9 | assert_equals(determine_winner('r', 'r'), None) 10 | assert_equals(determine_winner('r', 'p'), COMP) 11 | assert_equals(determine_winner('r', 's'), YOU) 12 | assert_equals(determine_winner('p', 'r'), YOU) 13 | assert_equals(determine_winner('p', 'p'), None) 14 | assert_equals(determine_winner('p', 's'), COMP) 15 | assert_equals(determine_winner('s', 'r'), COMP) 16 | assert_equals(determine_winner('s', 'p'), YOU) 17 | assert_equals(determine_winner('s', 's'), None) 18 | 19 | print('determine_winner tests passed') 20 | 21 | 22 | def test_game_over(): 23 | assert_equals(game_over(3, [0, 0]), None) 24 | assert_equals(game_over(3, [1, 1]), None) 25 | assert_equals(game_over(3, [2, 1]), YOU) 26 | assert_equals(game_over(3, [1, 2]), COMP) 27 | assert_equals(game_over(5, [2, 2]), None) 28 | assert_equals(game_over(5, [3, 0]), YOU) 29 | assert_equals(game_over(5, [1, 3]), COMP) 30 | 31 | print('game_over tests passed') 32 | 33 | 34 | test_determine_winner() 35 | test_game_over() 36 | -------------------------------------------------------------------------------- /Lesson8/Solutions/b_print_to_csv/scraper.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | import requests 4 | from bs4 import BeautifulSoup 5 | 6 | URL = "http://ariannedee.pythonanywhere.com/Member_states_of_the_United_Nations" 7 | 8 | # Todo: Update with your info 9 | name = None 10 | email = None 11 | assert name and email 12 | 13 | headers = {'User-Agent': f'{name} ({email})'} 14 | response = requests.get(URL, headers=headers) 15 | 16 | assert response.status_code == 200, f"Response was {response.status_code}" 17 | 18 | html_doc = response.text 19 | 20 | soup = BeautifulSoup(html_doc, 'html.parser') 21 | 22 | table = soup.find('table', class_='wikitable') 23 | 24 | countries = [] 25 | for row in table.find_all('tr'): 26 | if row.td: 27 | tds = row.find_all('td') 28 | 29 | # Get the name 30 | links = tds[0].find_all('a') 31 | country_name = links[1].string 32 | 33 | # Get the date joined 34 | date_joined = tds[1].span.string 35 | 36 | country_dict = { 37 | 'Name': country_name, 38 | 'Date Joined': date_joined 39 | } 40 | 41 | countries.append(country_dict) 42 | 43 | with open("countries.csv", "w") as file: 44 | writer = csv.DictWriter(file, ('Name', 'Date Joined')) 45 | writer.writeheader() 46 | writer.writerows(countries) 47 | -------------------------------------------------------------------------------- /Lesson7/_4_authentication.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | 4 | LOGIN_URL = "https://github.com/login" 5 | USERNAME = "***" 6 | PASSWORD = "***" 7 | 8 | URL = "https://github.com" 9 | headers = {'User-Agent': f'Your name (your@email.com)'} 10 | 11 | # Create new session so that cookies are saved between requests 12 | session_requests = requests.session() 13 | 14 | # Get the authenticity token from the login page 15 | login_page = session_requests.get(LOGIN_URL, headers=headers) 16 | soup = BeautifulSoup(login_page.text, 'html.parser') 17 | 18 | # The input name might be different depending on the site. Inspect the form and look for a hidden input with "authenticity" or "csrf". 19 | authenticity_token = soup.find('input', attrs={'name': 'authenticity_token'}).get('value') 20 | print(authenticity_token) 21 | 22 | # Send login request 23 | data = { 24 | 'login': USERNAME, 25 | 'password': PASSWORD, 26 | 'authenticity_token': authenticity_token, 27 | } 28 | response = session_requests.post(LOGIN_URL, headers=headers, data=data) 29 | print(response.status_code) 30 | 31 | # Now you are authenticated and can start scraping the URL you want 32 | response = session_requests.get(URL, headers=headers) 33 | 34 | with open('data/logged_in.html', 'w') as file: # Open this to verify that your login worked 35 | file.write(response.text) 36 | 37 | # ... Do some scraping with the result 38 | -------------------------------------------------------------------------------- /Lesson4/_1b_spyder.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | #%% Import dataset 4 | 5 | import pandas 6 | 7 | tips = pandas.read_csv('data/tips.csv') 8 | tips.head(3) 9 | 10 | #%% Show some stats 11 | 12 | print(tips.describe()) 13 | 14 | #%% Show count of sex values 15 | 16 | print(tips['sex'].value_counts()) 17 | 18 | #%% Clean some data 19 | 20 | tips['sex'] = tips['sex'].str.title() 21 | tips.loc[tips['sex'].str.contains("F"), 'sex'] = "Female" 22 | tips.loc[tips['sex'].str.contains("M"), 'sex'] = "Male" 23 | 24 | #%% Show count of smoker values 25 | 26 | print(tips['smoker'].value_counts()) 27 | 28 | #%% 29 | 30 | tips['smoker'] = tips['smoker'].str.replace('"', '') 31 | tips['smoker'] = tips['smoker'].str.replace('”', '') 32 | 33 | #%% Plot the data 34 | 35 | import seaborn 36 | 37 | plot = seaborn.scatterplot(x='total_bill', y='tip', data=tips) 38 | 39 | #%% Scatter plot of Sex vs Tip % 40 | 41 | tips['tip_percent'] = tips['tip'] / tips['total_bill'] 42 | tips['bill_per_person'] = tips['total_bill'] / tips['size'] 43 | plot = seaborn.scatterplot(x='total_bill', y='tip_percent', hue='sex', data=tips) 44 | 45 | #%% Violin plot of Day vs Tip % 46 | 47 | plot = seaborn.violinplot(x='day', y='tip_percent', data=tips) 48 | 49 | #%% Find some stats 50 | 51 | print(tips[['day', 'tip_percent']].groupby('day').describe()) 52 | 53 | print(tips[['smoker', 'tip_percent']].groupby('smoker').describe()) 54 | 55 | print(tips[['sex', 'tip_percent']].groupby('sex').describe()) 56 | 57 | print(tips[['time', 'tip_percent']].groupby('time').describe()) 58 | 59 | #%% 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /Lesson7/_5a_rest_api.py: -------------------------------------------------------------------------------- 1 | """ 2 | Get repository data from Github's REST API. 3 | V3 REST API documentation: https://developer.github.com/v3/ 4 | To generate an authentication token for your user, follow: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line 5 | """ 6 | 7 | import json 8 | import requests 9 | import sys 10 | 11 | BASE_URL = "https://api.github.com" # The root of all of our api requests 12 | URL = BASE_URL + '/user/repos' # The specific data we want 13 | headers = { 14 | 'Accept': 'application/vnd.github.v3+json', 15 | 'Content-Type': 'application/json', 16 | 'Authorization': 'bearer {Your token here}', # See https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line 17 | } 18 | 19 | # Make API request 20 | response = requests.get(URL, headers=headers) 21 | 22 | # Handle bad requests 23 | if response.status_code != 200: 24 | print(response.status_code) 25 | print(response.text) 26 | sys.exit() 27 | 28 | # Turn the response string into JSON data. Data is now a list of dictionaries representing repositories 29 | data = json.loads(response.text) 30 | 31 | # Now do what you want with the data 32 | if len(data) > 0: 33 | # I want to list all of the attributes we can get from each repository 34 | print("Keys") 35 | for key in data[0].keys(): 36 | print(' ' + key) 37 | 38 | # I also want to list each repository name 39 | print("\nRepository names") 40 | for repo in data: 41 | print(' ' + repo['full_name']) 42 | -------------------------------------------------------------------------------- /Lesson1/_6_regex_examples.py: -------------------------------------------------------------------------------- 1 | """ 2 | General regex tutorial: https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285 3 | Python: https://www.w3schools.com/python/python_regex.asp 4 | PyCharm: https://www.jetbrains.com/help/pycharm/regular-expression-syntax-reference.html 5 | """ 6 | import re 7 | 8 | 9 | # The match object holds information about the result 10 | match = re.search(r"world", "Hello world") 11 | assert match.start() == 6 # Start index of where the result was found 12 | 13 | 14 | # Search looks anywhere inside the string and only returns a match for the first instance 15 | assert re.search(r"world", "Hello world") 16 | assert re.search(r"l", "Hello world").start() == 2 17 | 18 | 19 | # Match only looks at the start of the string 20 | assert not re.match(r"world", "Hello world") 21 | assert re.match(r"Hello", "Hello world") 22 | 23 | 24 | # You can ignore case 25 | assert not re.search('hello', 'Hello world') 26 | assert re.search('hello', 'Hello world', re.IGNORECASE) 27 | 28 | 29 | # Validation example 30 | valid_zip_code = r'[0-9]{5}' 31 | assert re.fullmatch(valid_zip_code, '90210') 32 | assert not re.fullmatch(valid_zip_code, '9021') 33 | assert not re.fullmatch(valid_zip_code, '902100') # Full match checks that the entire string matches (e.g. no extra characters) 34 | assert not re.fullmatch(valid_zip_code, '9021a') 35 | 36 | 37 | # Note: \w+ finds all of the words (set of 1 or more alpha characters) 38 | list_of_matches = re.findall(r'\w+', "The quick brown fox jumped over the lazy dog") 39 | print(list_of_matches) 40 | 41 | 42 | print(re.sub(r'[aeiou]', '_', 'Hello world')) # Replace with a static string 43 | print(re.sub(r'(\w+)', '~*\\1*~', 'Hello world')) # Replace with the matched pattern; \\1 refers to what was matched in the () 44 | -------------------------------------------------------------------------------- /Lesson6/Solutions/format_number_advanced.py: -------------------------------------------------------------------------------- 1 | """ 2 | Extra practice: handle negative numbers and numbers with decimal places 3 | """ 4 | 5 | 6 | def format_number(num): 7 | return _handle_negatives(num) 8 | 9 | 10 | def _handle_negatives(num): # Note: function names that start with an underscore make it "semi-private" 11 | negative = num != abs(num) 12 | as_string = _handle_decimals(abs(num)) 13 | if negative: 14 | return '-' + as_string 15 | return as_string 16 | 17 | 18 | def _handle_decimals(num): 19 | number_parts = str(num).split('.') 20 | 21 | as_string = _handle_positive_integer(number_parts[0]) 22 | 23 | if len(number_parts) == 2: 24 | return as_string + '.' + number_parts[1] 25 | return as_string 26 | 27 | 28 | def _handle_positive_integer(num): 29 | as_string = "" 30 | for i, char in enumerate(str(num)[::-1]): 31 | if i >= 3 and i % 3 == 0: 32 | as_string += ',' 33 | as_string += char 34 | return as_string[::-1] 35 | 36 | 37 | if __name__ == "__main__": 38 | def assert_equals(actual, expected): 39 | assert actual == expected, f"Expected {expected} but got {actual}" 40 | 41 | assert_equals(format_number(10), '10') 42 | assert_equals(format_number(100), '100') 43 | assert_equals(format_number(1000), '1,000') 44 | assert_equals(format_number(100000), '100,000') 45 | assert_equals(format_number(1000000), '1,000,000') 46 | 47 | assert_equals(format_number(-100), '-100') 48 | assert_equals(format_number(-1000000), '-1,000,000') 49 | 50 | assert_equals(format_number(1000.123), '1,000.123') 51 | assert_equals(format_number(-100.0), '-100.0') 52 | assert_equals(format_number(-1000000.0001), '-1,000,000.0001') 53 | 54 | print("All tests passed") 55 | -------------------------------------------------------------------------------- /Lesson1/_3a_dictionary_examples.py: -------------------------------------------------------------------------------- 1 | # Dictionaries as objects 2 | book_1 = {"title": "To Kill a Mockingbird", "author": "Harper Lee", "published_year": 1960} 3 | book_2 = {"title": "Jane Eyre", "author": "Charlotte Brontë", "published_year": 1847} 4 | book_3 = {"title": "1984", "author": "George Orwell", "published_year": 1949} 5 | 6 | books = [book_1, book_2, book_3] 7 | 8 | for book in books: 9 | print(f"{book['title']} was written by {book['author']} in {book['published_year']}") 10 | 11 | 12 | # Dictionaries as maps 13 | canadian_capitals = { 14 | 'AB': 'Edmonton', 15 | 'BC': 'Victoria', 16 | 'MB': 'Winnipeg', 17 | 'NB': 'Fredericton', 18 | 'NL': 'St. John\'s', 19 | 'NS': 'Halifax', 20 | 'NT': 'Yellowknife', 21 | 'NU': 'Iqaluit', 22 | 'ON': 'Toronto', 23 | 'PE': 'Charlottetown', 24 | 'QC': 'Quebec City', 25 | 'SK': 'Regina', 26 | 'YT': 'Whitehorse' 27 | } 28 | 29 | canadian_capitals.keys() # ['AB', 'BC', ...] 30 | canadian_capitals.values() # ['Edmonton', 'Victoria', ...] 31 | 32 | print(canadian_capitals['ON']) # Get an item 33 | del canadian_capitals['AB'] # Delete an item 34 | canadian_capitals['NU'] = 'Bob' # Update an item 35 | canadian_capitals['XX'] = 'New capital' # Add a new item 36 | 37 | # Get value if the key exists, else return None 38 | print(canadian_capitals.get('AA')) 39 | 40 | # Get value if the key exists, else return a default value 41 | print(canadian_capitals.get('AA', 'N/A')) 42 | 43 | for code in canadian_capitals: 44 | print(f'The capital of {code} is {canadian_capitals[code]}') 45 | 46 | for capital in canadian_capitals.values(): 47 | print(capital) 48 | 49 | for province, capital in canadian_capitals.items(): 50 | print(f'The capital of {province} is {capital}') 51 | 52 | if 'AA' in canadian_capitals: 53 | print('Found key') 54 | -------------------------------------------------------------------------------- /Lesson7/_5b_graphql_api.py: -------------------------------------------------------------------------------- 1 | """ 2 | Get repository data from Github's GraphQL API. 3 | V4 GraphQL API documentation: https://developer.github.com/v4/ 4 | To generate an authentication token for your user, follow: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line 5 | """ 6 | 7 | import json 8 | import requests 9 | import sys 10 | 11 | API_URL = "https://api.github.com/graphql" 12 | headers = { 13 | 'Content-Type': 'application/json', 14 | 'Authorization': 'bearer {Your token here}', # See https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line 15 | } 16 | 17 | # Specify the data you want from the API, test at https://developer.github.com/v4/explorer 18 | query = """ 19 | query { 20 | viewer { 21 | repositories(first:100) { 22 | totalCount 23 | nodes { 24 | nameWithOwner 25 | } 26 | } 27 | } 28 | } 29 | """ 30 | # Send the query in the right format for GraphQL 31 | data = json.dumps({"query": query}) 32 | response = requests.post(API_URL, headers=headers, data=data) 33 | 34 | # Handle bad requests (e.g. not authenticated) 35 | if response.status_code != 200: 36 | print(response.status_code) 37 | print(response.text) 38 | sys.exit() 39 | 40 | # Turn the response string into JSON data. Data is now a list of dictionaries representing repositories 41 | response = json.loads(response.text) 42 | 43 | # Handle bad queries (e.g. improperly formatted query string) 44 | if 'errors' in response: 45 | print(response['errors']) 46 | sys.exit() 47 | 48 | data = response['data'] 49 | print(data) 50 | 51 | # Now do what you want with the data 52 | repos = data['viewer']['repositories']['nodes'] 53 | if len(repos) > 0: 54 | # I want to list each repository name 55 | print("\nRepository names") 56 | for repo in repos: 57 | print(' ' + repo['nameWithOwner']) 58 | -------------------------------------------------------------------------------- /Lesson1/_5_datetime_examples.py: -------------------------------------------------------------------------------- 1 | """ 2 | Python's built-in datetime module 3 | https://docs.python.org/3/library/datetime.html 4 | 5 | Doesn't include timezone aware examples 6 | """ 7 | import datetime 8 | 9 | # ------ DATE ------ 10 | print("DATE") 11 | 12 | # Create a date object 13 | date = datetime.date(2000, 1, 23) 14 | print(date) 15 | 16 | # Format a date 17 | print(date.strftime("%B %d, %Y")) # https://strftime.org/ 18 | 19 | # Get date fields 20 | print(date.day) 21 | print(date.month) 22 | print(date.year) 23 | print(date.weekday()) 24 | 25 | 26 | # ------ TIME ------ 27 | print("\nTIME") 28 | 29 | # Create a time object 30 | time = datetime.time(1, 23, 45, 678) 31 | print(time) 32 | 33 | # Format a time 34 | print(time.strftime("%-I:%M %p")) # https://strftime.org/ 35 | 36 | # Get time fields 37 | print(time.hour) 38 | print(time.minute) 39 | print(time.second) 40 | print(time.microsecond) 41 | 42 | 43 | # ------ DATETIME ------ 44 | print("\nDATETIME") 45 | 46 | # Create a datetime object 47 | dt = datetime.datetime(2000, 1, 23, 4, 5, 6) 48 | print(dt) 49 | 50 | # Format a datetime 51 | print(dt.strftime("%B %d, %Y %-I:%M %p")) # https://strftime.org/ 52 | 53 | # Create a datetime from a parsed string 54 | dt2 = datetime.datetime.strptime("March 14, 2001 1:59 AM", "%B %d, %Y %I:%M %p") 55 | print(f"{dt2.month}.{dt2.day}{dt2.hour}{dt2.minute}") # PI day! 56 | 57 | 58 | # ------ CURRENT DAY/TIME ------ 59 | print('\nNOW') 60 | now = datetime.datetime.now() 61 | print(now) 62 | print(now.date()) 63 | print(now.time()) 64 | 65 | 66 | # ------ TIME DELTAS ------ 67 | # Timedeltas only have days, seconds, and microseconds 68 | print('\nTIME DELTAS') 69 | 70 | # You can compare year/month/day as ints 71 | print(dt2.year - dt.year) 72 | 73 | # Comparing datetimes returns a timedelta 74 | time_diff = dt2 - dt 75 | print(time_diff.days) 76 | print(f'Diff in years: {round(time_diff.days/365.25, 2)}') 77 | print(time_diff.seconds) 78 | 79 | # Using timedeltas to get a new date 80 | next_week = datetime.datetime.now() + datetime.timedelta(days=7) 81 | print(next_week) 82 | 83 | # ------ TIMING ------ 84 | import time 85 | 86 | start = time.time() 87 | time.sleep(1.2) # Do some stuff here 88 | end = time.time() 89 | 90 | print(f"Function took {end - start}s") 91 | -------------------------------------------------------------------------------- /Lesson8/Solutions/c_more_data/scraper.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import re 3 | import time 4 | 5 | import requests 6 | from bs4 import BeautifulSoup 7 | 8 | BASE_URL = "http://ariannedee.pythonanywhere.com" 9 | URL = BASE_URL + "/Member_states_of_the_United_Nations" 10 | 11 | # Todo: Update with your info 12 | name = None 13 | email = None 14 | assert name and email 15 | 16 | headers = {'User-Agent': f'{name} ({email})'} 17 | response = requests.get(URL, headers=headers) 18 | 19 | assert response.status_code == 200, f"Response was {response.status_code}" 20 | 21 | html_doc = response.text 22 | 23 | soup = BeautifulSoup(html_doc, 'html.parser') 24 | 25 | table = soup.find('table', class_='wikitable') 26 | 27 | countries = [] 28 | for row in table.find_all('tr'): 29 | if row.td: 30 | tds = row.find_all('td') 31 | 32 | links = tds[0].find_all('a') 33 | country_name = links[1].string 34 | url = BASE_URL + links[1]['href'] 35 | 36 | date_joined = tds[1].span.string 37 | 38 | country_dict = { 39 | 'Name': country_name, 40 | 'Date Joined': date_joined, 41 | 'URL': url 42 | } 43 | 44 | countries.append(country_dict) 45 | 46 | for country_dict in countries[:3]: 47 | url = country_dict['URL'] 48 | response = requests.get(url, headers=headers) 49 | if response.status_code != 200: 50 | continue 51 | 52 | html_doc = response.text 53 | soup = BeautifulSoup(html_doc, 'html.parser') 54 | table = soup.find('table', class_='geography') 55 | 56 | tr_header = table.find('tr', string=re.compile("Area")) 57 | area_text = tr_header.next_sibling.td.text 58 | area = area_text.split()[0].split('[')[0] 59 | country_dict["Area"] = area 60 | 61 | tr_header = table.find('tr', string=re.compile("Population")) 62 | population_text = tr_header.next_sibling.td.text 63 | population = population_text.split()[0].split('[')[0] 64 | country_dict["Population"] = population 65 | 66 | time.sleep(1) 67 | 68 | with open("countries.csv", "w") as file: 69 | # extrasaction=ignore ignores the URL field 70 | writer = csv.DictWriter(file, ('Name', 'Date Joined', 'Area', 'Population'), extrasaction="ignore") 71 | writer.writeheader() 72 | writer.writerows(countries) 73 | -------------------------------------------------------------------------------- /Lesson6/rock_paper_scissors_buggy.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | YOU = 0 4 | COMP = 1 5 | 6 | CHOICES = ['r', 'p', 's'] 7 | CHOICE_MAP = {'r': 'Rock', 'p': 'Paper', 's': 'Scissors'} 8 | 9 | 10 | def play_game(best_of=3): 11 | """ 12 | Play a game of rock, paper, scissors 13 | """ 14 | score = [0, 0] 15 | 16 | print(f'Rock, paper, scissors - best of {best_of}') 17 | 18 | while True: 19 | winner = run_round() 20 | update_score(score, winner) 21 | game_winner = game_over(best_of, score) 22 | 23 | if game_winner is not None: 24 | break 25 | 26 | won_or_lost = 'won' if game_winner == YOU else 'lost' 27 | print(f"You {won_or_lost} {score[YOU]} games to {score[COMP]}") 28 | 29 | 30 | def update_score(score, winner): 31 | if winner is not None: 32 | score[winner] += 1 33 | print(f'{score[YOU]} - {score[COMP]}') 34 | 35 | 36 | def run_round(): 37 | your_choice = get_user_choice() 38 | computer_choice = random.choice(CHOICES) 39 | 40 | winner = determine_winner(your_choice, computer_choice) 41 | print_outcome(winner, your_choice, computer_choice) 42 | return winner 43 | 44 | 45 | def determine_winner(choice, computer_choice): 46 | """ 47 | Returns: 48 | YOU if you won 49 | COMP if computer won 50 | None if it was a tie 51 | """ 52 | if choice == 'r': 53 | return YOU if computer_choice == 's' else COMP 54 | elif choice == 'p': 55 | return YOU if computer_choice == 'r' else COMP 56 | elif choice == 's': 57 | return YOU if computer_choice == 'p' else COMP 58 | else: 59 | return None 60 | 61 | 62 | def print_outcome(winner, you, computer): 63 | if winner == YOU: 64 | result = 'WINS against' 65 | elif winner == COMP: 66 | result = 'LOSES to' 67 | else: 68 | result = "TIES with" 69 | print(f'{CHOICE_MAP[you]} {result} {CHOICE_MAP[computer]}') 70 | 71 | 72 | def game_over(best_of, score): 73 | num_wins_needed = best_of / 2 74 | if score[YOU] == num_wins_needed: 75 | return YOU 76 | elif score[COMP] == num_wins_needed: 77 | return COMP 78 | return None 79 | 80 | 81 | def get_user_choice(): 82 | return input("\nRock (r), paper (p), or scissors (s)?: ").lower().strip() 83 | 84 | 85 | if __name__ == '__main__': 86 | play_game() 87 | -------------------------------------------------------------------------------- /Lesson6/rock_paper_scissors_fixed.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | YOU = 0 4 | COMP = 1 5 | NOBODY = -1 6 | 7 | CHOICES = ['r', 'p', 's'] 8 | CHOICE_MAP = {'r': 'Rock', 'p': 'Paper', 's': 'Scissors'} 9 | 10 | 11 | def play_game(best_of=3): 12 | """ 13 | Play a game of rock, paper, scissors 14 | """ 15 | score = [0, 0] 16 | 17 | print(f'Rock, paper, scissors - best of {best_of}') 18 | 19 | while True: 20 | winner = run_round() 21 | update_score(score, winner) 22 | game_winner = game_over(best_of, score) 23 | 24 | if game_winner is not None: 25 | break 26 | 27 | won_or_lost = 'won' if game_winner == YOU else 'lost' 28 | print(f"You {won_or_lost} {score[YOU]} games to {score[COMP]}") 29 | 30 | 31 | def update_score(score, winner): 32 | if winner is not None: 33 | score[winner] += 1 34 | print(f'{score[YOU]} - {score[COMP]}') 35 | 36 | 37 | def run_round(): 38 | your_choice = get_user_choice() 39 | computer_choice = random.choice(CHOICES) 40 | 41 | winner = determine_winner(your_choice, computer_choice) 42 | print_outcome(winner, your_choice, computer_choice) 43 | return winner 44 | 45 | 46 | def determine_winner(choice, computer_choice): 47 | """ 48 | Returns: 49 | YOU if you won 50 | COMP if computer won 51 | None if it was a tie 52 | """ 53 | if choice == computer_choice: 54 | return None 55 | elif choice == 'r': 56 | return YOU if computer_choice == 's' else COMP 57 | elif choice == 'p': 58 | return YOU if computer_choice == 'r' else COMP 59 | else: 60 | return YOU if computer_choice == 'p' else COMP 61 | 62 | 63 | def print_outcome(winner, you, computer): 64 | if winner == YOU: 65 | result = 'WINS against' 66 | elif winner == COMP: 67 | result = 'LOSES to' 68 | else: 69 | result = "TIES with" 70 | print(f'{CHOICE_MAP[you]} {result} {CHOICE_MAP[computer]}') 71 | 72 | 73 | def game_over(best_of, score): 74 | num_wins_needed = (best_of + 1) / 2 75 | 76 | if score[YOU] >= num_wins_needed: 77 | return YOU 78 | elif score[COMP] >= num_wins_needed: 79 | return COMP 80 | return None 81 | 82 | 83 | def get_user_choice(): 84 | choice = input("\nRock (r), paper (p), or scissors (s)?: ").lower().strip() 85 | if choice not in CHOICES: 86 | print("Invalid choice!") 87 | return get_user_choice() 88 | return choice 89 | 90 | 91 | if __name__ == '__main__': 92 | play_game() 93 | -------------------------------------------------------------------------------- /Lesson8/Solutions/d_refactored/scraper.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import re 3 | import time 4 | 5 | import requests 6 | from bs4 import BeautifulSoup 7 | 8 | SLEEP_SECONDS = 1 9 | 10 | # Todo: Update with your info 11 | NAME = None 12 | EMAIL = None 13 | assert NAME and EMAIL 14 | 15 | HEADERS = {'User-Agent': f'{NAME} ({EMAIL})'} 16 | 17 | BASE_URL = "http://ariannedee.pythonanywhere.com" 18 | URL = BASE_URL + "/Member_states_of_the_United_Nations" 19 | 20 | 21 | def run_scraper(): 22 | soup = get_soup_from_url(URL) 23 | countries = get_country_dicts(soup) 24 | 25 | for country_dict in countries[:3]: 26 | get_country_detail_data(country_dict) 27 | time.sleep(SLEEP_SECONDS) 28 | 29 | write_to_csv(countries) 30 | 31 | 32 | def get_soup_from_url(url): 33 | response = requests.get(url, headers=HEADERS) 34 | assert response.status_code == 200, f"Response was {response.status_code} for url {url}" 35 | html_doc = response.text 36 | return BeautifulSoup(html_doc, 'html.parser') 37 | 38 | 39 | def get_country_dicts(soup): 40 | table = soup.find('table', class_='wikitable') 41 | countries = [] 42 | for row in table.find_all('tr'): 43 | if row.td: 44 | tds = row.find_all('td') 45 | 46 | links = tds[0].find_all('a') 47 | country_name = links[1].string 48 | url = BASE_URL + links[1]['href'] 49 | 50 | date_joined = tds[1].span.string 51 | 52 | country_dict = { 53 | 'Name': country_name, 54 | 'Date Joined': date_joined, 55 | 'URL': url 56 | } 57 | 58 | countries.append(country_dict) 59 | return countries 60 | 61 | 62 | def get_country_detail_data(country_dict): 63 | soup = get_soup_from_url(country_dict['URL']) 64 | table = soup.find('table', class_='geography') 65 | 66 | def get_detail_data(name): 67 | tr_header = table.find('tr', string=re.compile(name)) 68 | data_text = tr_header.next_sibling.td.text 69 | return data_text.split()[0].split('[')[0] 70 | 71 | country_dict["Area"] = get_detail_data("Area") 72 | country_dict["Population"] = get_detail_data("Population") 73 | 74 | 75 | def write_to_csv(country_dicts): 76 | with open("countries.csv", "w") as file: 77 | writer = csv.DictWriter(file, ('Name', 'Date Joined', 'Area', 'Population'), extrasaction="ignore") 78 | writer.writeheader() 79 | writer.writerows(country_dicts) 80 | 81 | 82 | if __name__ == "__main__": 83 | run_scraper() 84 | -------------------------------------------------------------------------------- /Lesson2/data/countries.txt: -------------------------------------------------------------------------------- 1 | Afghanistan 2 | Albania 3 | Algeria 4 | Andorra 5 | Angola 6 | Antigua & Deps 7 | Argentina 8 | Armenia 9 | Australia 10 | Austria 11 | Azerbaijan 12 | Bahamas 13 | Bahrain 14 | Bangladesh 15 | Barbados 16 | Belarus 17 | Belgium 18 | Belize 19 | Benin 20 | Bhutan 21 | Bolivia 22 | Bosnia Herzegovina 23 | Botswana 24 | Brazil 25 | Brunei 26 | Bulgaria 27 | Burkina Faso 28 | Burundi 29 | Cambodia 30 | Cameroon 31 | Canada 32 | Cape Verde 33 | Central African Rep 34 | Chad 35 | Chile 36 | China 37 | Colombia 38 | Comoros 39 | Congo 40 | Congo {Democratic Rep} 41 | Costa Rica 42 | Croatia 43 | Cuba 44 | Cyprus 45 | Czech Republic 46 | Denmark 47 | Djibouti 48 | Dominica 49 | Dominican Republic 50 | East Timor 51 | Ecuador 52 | Egypt 53 | El Salvador 54 | Equatorial Guinea 55 | Eritrea 56 | Estonia 57 | Ethiopia 58 | Fiji 59 | Finland 60 | France 61 | Gabon 62 | Gambia 63 | Georgia 64 | Germany 65 | Ghana 66 | Greece 67 | Grenada 68 | Guatemala 69 | Guinea 70 | Guinea-Bissau 71 | Guyana 72 | Haiti 73 | Honduras 74 | Hungary 75 | Iceland 76 | India 77 | Indonesia 78 | Iran 79 | Iraq 80 | Ireland {Republic} 81 | Israel 82 | Italy 83 | Ivory Coast 84 | Jamaica 85 | Japan 86 | Jordan 87 | Kazakhstan 88 | Kenya 89 | Kiribati 90 | Korea North 91 | Korea South 92 | Kosovo 93 | Kuwait 94 | Kyrgyzstan 95 | Laos 96 | Latvia 97 | Lebanon 98 | Lesotho 99 | Liberia 100 | Libya 101 | Liechtenstein 102 | Lithuania 103 | Luxembourg 104 | Macedonia 105 | Madagascar 106 | Malawi 107 | Malaysia 108 | Maldives 109 | Mali 110 | Malta 111 | Marshall Islands 112 | Mauritania 113 | Mauritius 114 | Mexico 115 | Micronesia 116 | Moldova 117 | Monaco 118 | Mongolia 119 | Montenegro 120 | Morocco 121 | Mozambique 122 | Myanmar, {Burma} 123 | Namibia 124 | Nauru 125 | Nepal 126 | Netherlands 127 | New Zealand 128 | Nicaragua 129 | Niger 130 | Nigeria 131 | Norway 132 | Oman 133 | Pakistan 134 | Palau 135 | Panama 136 | Papua New Guinea 137 | Paraguay 138 | Peru 139 | Philippines 140 | Poland 141 | Portugal 142 | Qatar 143 | Romania 144 | Russian Federation 145 | Rwanda 146 | St Kitts & Nevis 147 | St Lucia 148 | Saint Vincent & the Grenadines 149 | Samoa 150 | San Marino 151 | Sao Tome & Principe 152 | Saudi Arabia 153 | Senegal 154 | Serbia 155 | Seychelles 156 | Sierra Leone 157 | Singapore 158 | Slovakia 159 | Slovenia 160 | Solomon Islands 161 | Somalia 162 | South Africa 163 | South Sudan 164 | Spain 165 | Sri Lanka 166 | Sudan 167 | Suriname 168 | Swaziland 169 | Sweden 170 | Switzerland 171 | Syria 172 | Taiwan 173 | Tajikistan 174 | Tanzania 175 | Thailand 176 | Togo 177 | Tonga 178 | Trinidad & Tobago 179 | Tunisia 180 | Turkey 181 | Turkmenistan 182 | Tuvalu 183 | Uganda 184 | Ukraine 185 | United Arab Emirates 186 | United Kingdom 187 | United States 188 | Uruguay 189 | Uzbekistan 190 | Vanuatu 191 | Vatican City 192 | Venezuela 193 | Vietnam 194 | Yemen 195 | Zambia 196 | Zimbabwe 197 | -------------------------------------------------------------------------------- /Lesson8/Solutions/a_print_to_txt/countries.txt: -------------------------------------------------------------------------------- 1 | Afghanistan 2 | Albania 3 | Algeria 4 | Andorra 5 | Angola 6 | Antigua and Barbuda 7 | Argentina 8 | Armenia 9 | Australia 10 | Austria 11 | Azerbaijan 12 | Bahamas 13 | Bahrain 14 | Bangladesh 15 | Barbados 16 | Belarus 17 | Belgium 18 | Belize 19 | Benin 20 | Bhutan 21 | Bolivia (Plurinational State of) 22 | Bosnia and Herzegovina 23 | Botswana 24 | Brazil 25 | Brunei Darussalam 26 | Bulgaria 27 | Burkina Faso 28 | Burundi 29 | Cabo Verde 30 | Cambodia 31 | Cameroon 32 | Canada 33 | Central African Republic 34 | Chad 35 | Chile 36 | China 37 | Colombia 38 | Comoros 39 | Congo 40 | Costa Rica 41 | Côte d'Ivoire 42 | Croatia 43 | Cuba 44 | Cyprus 45 | Czech Republic 46 | Democratic People's Republic of Korea 47 | Democratic Republic of the Congo 48 | Denmark 49 | Djibouti 50 | Dominica 51 | Dominican Republic 52 | Ecuador 53 | Egypt 54 | El Salvador 55 | Equatorial Guinea 56 | Eritrea 57 | Estonia 58 | Eswatini 59 | Ethiopia 60 | Fiji 61 | Finland 62 | France 63 | Gabon 64 | Gambia 65 | Georgia 66 | Germany 67 | Ghana 68 | Greece 69 | Grenada 70 | Guatemala 71 | Guinea 72 | Guinea-Bissau 73 | Guyana 74 | Haiti 75 | Honduras 76 | Hungary 77 | Iceland 78 | India 79 | Indonesia 80 | Iran (Islamic Republic of) 81 | Iraq 82 | Ireland 83 | Israel 84 | Italy 85 | Jamaica 86 | Japan 87 | Jordan 88 | Kazakhstan 89 | Kenya 90 | Kiribati 91 | Kuwait 92 | Kyrgyzstan 93 | Lao People's Democratic Republic 94 | Latvia 95 | Lebanon 96 | Lesotho 97 | Liberia 98 | Libya 99 | Liechtenstein 100 | Lithuania 101 | Luxembourg 102 | Madagascar 103 | Malawi 104 | Malaysia 105 | Maldives 106 | Mali 107 | Malta 108 | Marshall Islands 109 | Mauritania 110 | Mauritius 111 | Mexico 112 | Micronesia (Federated States of) 113 | Monaco 114 | Mongolia 115 | Montenegro 116 | Morocco 117 | Mozambique 118 | Myanmar 119 | Namibia 120 | Nauru 121 | Nepal 122 | Netherlands 123 | New Zealand 124 | Nicaragua 125 | Niger 126 | Nigeria 127 | North Macedonia 128 | Norway 129 | Oman 130 | Pakistan 131 | Palau 132 | Panama 133 | Papua New Guinea 134 | Paraguay 135 | Peru 136 | Philippines 137 | Poland 138 | Portugal 139 | Qatar 140 | Republic of Korea 141 | Republic of Moldova 142 | Romania 143 | Russian Federation 144 | Rwanda 145 | St. Kitts and Nevis 146 | St. Lucia 147 | St. Vincent and the Grenadines 148 | Samoa 149 | San Marino 150 | São Tomé and Príncipe 151 | Saudi Arabia 152 | Senegal 153 | Serbia 154 | Seychelles 155 | Sierra Leone 156 | Singapore 157 | Slovakia 158 | Slovenia 159 | Solomon Islands 160 | Somalia 161 | South Africa 162 | South Sudan 163 | Spain 164 | Sri Lanka 165 | Sudan 166 | Suriname 167 | Sweden 168 | Switzerland 169 | Syrian Arab Republic 170 | Tajikistan 171 | Thailand 172 | Timor-Leste 173 | Togo 174 | Tonga 175 | Trinidad and Tobago 176 | Tunisia 177 | Turkey 178 | Turkmenistan 179 | Tuvalu 180 | Uganda 181 | Ukraine 182 | United Arab Emirates 183 | United Kingdom of Great Britain and Northern Ireland 184 | United Republic of Tanzania 185 | United States of America 186 | Uruguay 187 | Uzbekistan 188 | Vanuatu 189 | Venezuela (Bolivarian Republic of) 190 | Viet Nam 191 | Yemen 192 | Zambia 193 | Zimbabwe 194 | -------------------------------------------------------------------------------- /Lesson2/data/continents.csv: -------------------------------------------------------------------------------- 1 | Continent,Country 2 | Africa,Algeria 3 | Africa,Angola 4 | Africa,Benin 5 | Africa,Botswana 6 | Africa,Burkina 7 | Africa,Burundi 8 | Africa,Cameroon 9 | Africa,Cape Verde 10 | Africa,Central African Republic 11 | Africa,Chad 12 | Africa,Comoros 13 | Africa,Congo 14 | Africa,"Congo, Democratic Republic of" 15 | Africa,Djibouti 16 | Africa,Egypt 17 | Africa,Equatorial Guinea 18 | Africa,Eritrea 19 | Africa,Ethiopia 20 | Africa,Gabon 21 | Africa,Gambia 22 | Africa,Ghana 23 | Africa,Guinea 24 | Africa,Guinea-Bissau 25 | Africa,Ivory Coast 26 | Africa,Kenya 27 | Africa,Lesotho 28 | Africa,Liberia 29 | Africa,Libya 30 | Africa,Madagascar 31 | Africa,Malawi 32 | Africa,Mali 33 | Africa,Mauritania 34 | Africa,Mauritius 35 | Africa,Morocco 36 | Africa,Mozambique 37 | Africa,Namibia 38 | Africa,Niger 39 | Africa,Nigeria 40 | Africa,Rwanda 41 | Africa,Sao Tome and Principe 42 | Africa,Senegal 43 | Africa,Seychelles 44 | Africa,Sierra Leone 45 | Africa,Somalia 46 | Africa,South Africa 47 | Africa,South Sudan 48 | Africa,Sudan 49 | Africa,Swaziland 50 | Africa,Tanzania 51 | Africa,Togo 52 | Africa,Tunisia 53 | Africa,Uganda 54 | Africa,Zambia 55 | Africa,Zimbabwe 56 | Asia,Afghanistan 57 | Asia,Bahrain 58 | Asia,Bangladesh 59 | Asia,Bhutan 60 | Asia,Brunei 61 | Asia,Burma (Myanmar) 62 | Asia,Cambodia 63 | Asia,China 64 | Asia,East Timor 65 | Asia,India 66 | Asia,Indonesia 67 | Asia,Iran 68 | Asia,Iraq 69 | Asia,Israel 70 | Asia,Japan 71 | Asia,Jordan 72 | Asia,Kazakhstan 73 | Asia,"Korea, North" 74 | Asia,"Korea, South" 75 | Asia,Kuwait 76 | Asia,Kyrgyzstan 77 | Asia,Laos 78 | Asia,Lebanon 79 | Asia,Malaysia 80 | Asia,Maldives 81 | Asia,Mongolia 82 | Asia,Nepal 83 | Asia,Oman 84 | Asia,Pakistan 85 | Asia,Philippines 86 | Asia,Qatar 87 | Asia,Russian Federation 88 | Asia,Saudi Arabia 89 | Asia,Singapore 90 | Asia,Sri Lanka 91 | Asia,Syria 92 | Asia,Tajikistan 93 | Asia,Thailand 94 | Asia,Turkey 95 | Asia,Turkmenistan 96 | Asia,United Arab Emirates 97 | Asia,Uzbekistan 98 | Asia,Vietnam 99 | Asia,Yemen 100 | Europe,Albania 101 | Europe,Andorra 102 | Europe,Armenia 103 | Europe,Austria 104 | Europe,Azerbaijan 105 | Europe,Belarus 106 | Europe,Belgium 107 | Europe,Bosnia and Herzegovina 108 | Europe,Bulgaria 109 | Europe,Croatia 110 | Europe,Cyprus 111 | Europe,CZ 112 | Europe,Denmark 113 | Europe,Estonia 114 | Europe,Finland 115 | Europe,France 116 | Europe,Georgia 117 | Europe,Germany 118 | Europe,Greece 119 | Europe,Hungary 120 | Europe,Iceland 121 | Europe,Ireland 122 | Europe,Italy 123 | Europe,Latvia 124 | Europe,Liechtenstein 125 | Europe,Lithuania 126 | Europe,Luxembourg 127 | Europe,Macedonia 128 | Europe,Malta 129 | Europe,Moldova 130 | Europe,Monaco 131 | Europe,Montenegro 132 | Europe,Netherlands 133 | Europe,Norway 134 | Europe,Poland 135 | Europe,Portugal 136 | Europe,Romania 137 | Europe,San Marino 138 | Europe,Serbia 139 | Europe,Slovakia 140 | Europe,Slovenia 141 | Europe,Spain 142 | Europe,Sweden 143 | Europe,Switzerland 144 | Europe,Ukraine 145 | Europe,United Kingdom 146 | Europe,Vatican City 147 | North America,Antigua and Barbuda 148 | North America,Bahamas 149 | North America,Barbados 150 | North America,Belize 151 | North America,Canada 152 | North America,Costa Rica 153 | North America,Cuba 154 | North America,Dominica 155 | North America,Dominican Republic 156 | North America,El Salvador 157 | North America,Grenada 158 | North America,Guatemala 159 | North America,Haiti 160 | North America,Honduras 161 | North America,Jamaica 162 | North America,Mexico 163 | North America,Nicaragua 164 | North America,Panama 165 | North America,Saint Kitts and Nevis 166 | North America,Saint Lucia 167 | North America,Saint Vincent and the Grenadines 168 | North America,Trinidad and Tobago 169 | North America,US 170 | Oceania,Australia 171 | Oceania,Fiji 172 | Oceania,Kiribati 173 | Oceania,Marshall Islands 174 | Oceania,Micronesia 175 | Oceania,Nauru 176 | Oceania,New Zealand 177 | Oceania,Palau 178 | Oceania,Papua New Guinea 179 | Oceania,Samoa 180 | Oceania,Solomon Islands 181 | Oceania,Tonga 182 | Oceania,Tuvalu 183 | Oceania,Vanuatu 184 | South America,Argentina 185 | South America,Bolivia 186 | South America,Brazil 187 | South America,Chile 188 | South America,Colombia 189 | South America,Ecuador 190 | South America,Guyana 191 | South America,Paraguay 192 | South America,Peru 193 | South America,Suriname 194 | South America,Uruguay 195 | South America,Venezuela 196 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Next Level Python LiveLessons 2 | This is the code for **Next Level Python LiveLessons** by Arianne Dee 3 | 4 | To get started with this course, please follow these instructions: 5 | 1. [Download the code](#1-download-the-code) 6 | 2. [Install Python 3.6+](#2-install-python-36-or-higher) 7 | 3. [Set up your IDE](#3-set-up-your-ide) 8 | 9 | ## Set up instructions 10 | ### 3. Download the code 11 | If you're viewing this on GitHub already, stay on this page. 12 | Otherwise, go to the GitHub repository: https://github.com/ariannedee/next-level-python-livelessons 13 | 14 | #### If you know git: 15 | Clone the repository. 16 | 17 | #### If you don't know git: 18 | 1. Click the green "Code" button on the top-right of the page 19 | 2. Click "Download ZIP" 20 | 3. Unzip it 21 | 4. Move the **next-level-python-livelessons-main** folder to a convenient location 22 | 23 | ### 2. Install Python 3.6 or higher 24 | Go to https://www.python.org/downloads/ 25 | 26 | Click the yellow button at the top to download the latest version of Python. 27 | 28 | #### On Mac or Linux 29 | Follow the prompts and install using the default settings. 30 | 31 | #### On Windows 32 | The default settings don't add Python to your PATH 33 | so your computer doesn't know where to look for it when Python runs 34 | (for some inexplicable reason). 35 | 36 | ##### If you're just installing Python now 37 | Follow the instructions here: [Windows Python installer instructions](docs/WININSTALL.md) 38 | 39 | ##### If you've already installed Python with the default settings 40 | Follow the instructions here: [Add Python to PATH variable in Windows](docs/WINSETPATH.md) 41 | 42 | ### 3. Set-up your IDE 43 | 44 | #### 3.1 Choose an IDE 45 | Throughout the course, I use the **PyCharm IDE** (*Community Edition*). 46 | If you would like to use the same set-up, download it here: 47 | https://www.jetbrains.com/pycharm/download/. 48 | **Note** that one section goes through using PyCharm and using its keyboard shortcuts. 49 | 50 | Install, open, and use the default settings. 51 | 52 | 53 | Another good option, if you're a more experienced developer, 54 | is [**Visual Studio Code**](https://code.visualstudio.com/Download). 55 | 56 | #### 3.2 Open up the code in your IDE 57 | Open the top-level folder (*next-level-python-livelessons* or *next-level-python-livelessons-main*) 58 | in your IDE of choice. 59 | 60 | #### 3.3 Make sure it's configured to run the proper Python version 61 | Try running `Lesson1/_3a_dictionary_examples.py` in your IDE. 62 | If it fails to execute properly, you will need to make sure it is running with Python 3.6 (or higher). 63 | 64 | ##### PyCharm 65 | On a Mac: 66 | - Go to **PyCharm** > **Preferences** 67 | 68 | On a PC: 69 | - Go to **File** > **Settings** 70 | 71 | Once in Settings: 72 | 1. Go to **Project: next-level-python-livelessons** > **Project Interpreter** 73 | 1. Look for your Python version in the Project Interpreter dropdown 74 | 1. If it's not there, click **gear icon** > **Add...** 75 | 1. In the new window, select **System Interpreter** on the left, and then look for the Python version in the dropdown 76 | 1. If it's not there, click the **...** button and navigate to your Python location 77 | - To find where Python is located, [look in these directories](docs/PATH_LOCATIONS.md) 78 | - You may have to search the internet for where Python gets installed by default on your operating system 79 | 80 | ##### VS Code 81 | 1. On the bottom left toolbar, select the Python version the terminal is using to run your file 82 | 1. In the pop-up, select the correct version, or enter the path for the desired Python version to run 83 | 84 | ## FAQs 85 | ### Can I use Python 2? 86 | No, Python 2 is out of date and any project you're working on should be written in Python 3 by now. 87 | 88 | ### Can I use a different code editor besides PyCharm? 89 | Yes, but it is only recommended if you are already know it and are comfortable navigating to different files and running commands in the command line. 90 | Make sure to install the most popular Python plugin(s) for syntax highlighting and code completions that are available for your IDE. 91 | 92 | **Note** that part of the course is configuring PyCharm and using its shortcuts, 93 | so that lesson will not help much if you are using a different IDE. 94 | 95 | ### Do you offer private Python help? 96 | Yes, email **arianne.dee.studios at gmail.com** if you have any questions 97 | or would like to set up some remote training. 98 | -------------------------------------------------------------------------------- /Lesson8/Solutions/b_print_to_csv/countries.csv: -------------------------------------------------------------------------------- 1 | Name,Date Joined 2 | Afghanistan,19 November 1946 3 | Albania,14 December 1955 4 | Algeria,8 October 1962 5 | Andorra,28 July 1993 6 | Angola,1 December 1976 7 | Antigua and Barbuda,11 November 1981 8 | Argentina,24 October 1945 9 | Armenia,2 March 1992 10 | Australia,1 November 1945 11 | Austria,14 December 1955 12 | Azerbaijan,2 March 1992 13 | Bahamas,18 September 1973 14 | Bahrain,21 September 1971 15 | Bangladesh,17 September 1974 16 | Barbados,9 December 1966 17 | Belarus,24 October 1945 18 | Belgium,27 December 1945 19 | Belize,25 September 1981 20 | Benin,20 September 1960 21 | Bhutan,21 September 1971 22 | Bolivia (Plurinational State of),14 November 1945 23 | Bosnia and Herzegovina,22 May 1992 24 | Botswana,17 October 1966 25 | Brazil,24 October 1945 26 | Brunei Darussalam,21 September 1984 27 | Bulgaria,14 December 1955 28 | Burkina Faso,20 September 1960 29 | Burundi,18 September 1962 30 | Cabo Verde,16 September 1975 31 | Cambodia,14 December 1955 32 | Cameroon,20 September 1960 33 | Canada,9 November 1945 34 | Central African Republic,20 September 1960 35 | Chad,20 September 1960 36 | Chile,24 October 1945 37 | China,24 October 1945 38 | Colombia,5 November 1945 39 | Comoros,12 November 1975 40 | Congo,20 September 1960 41 | Costa Rica,2 November 1945 42 | Côte d'Ivoire,20 September 1960 43 | Croatia,22 May 1992 44 | Cuba,24 October 1945 45 | Cyprus,20 September 1960 46 | Czech Republic,19 January 1993 47 | Democratic People's Republic of Korea,17 September 1991 48 | Democratic Republic of the Congo,20 September 1960 49 | Denmark,24 October 1945 50 | Djibouti,20 September 1977 51 | Dominica,18 December 1978 52 | Dominican Republic,24 October 1945 53 | Ecuador,21 December 1945 54 | Egypt,24 October 1945 55 | El Salvador,24 October 1945 56 | Equatorial Guinea,12 November 1968 57 | Eritrea,28 May 1993 58 | Estonia,17 September 1991 59 | Eswatini,24 September 1968 60 | Ethiopia,13 November 1945 61 | Fiji,13 October 1970 62 | Finland,14 December 1955 63 | France,24 October 1945 64 | Gabon,20 September 1960 65 | Gambia,21 September 1965 66 | Georgia,31 July 1992 67 | Germany,18 September 1973 68 | Ghana,8 March 1957 69 | Greece,25 October 1945 70 | Grenada,17 September 1974 71 | Guatemala,21 November 1945 72 | Guinea,12 December 1958 73 | Guinea-Bissau,17 September 1974 74 | Guyana,20 September 1966 75 | Haiti,24 October 1945 76 | Honduras,17 December 1945 77 | Hungary,14 December 1955 78 | Iceland,19 November 1946 79 | India,30 October 1945 80 | Indonesia,28 September 1950 81 | Iran (Islamic Republic of),24 October 1945 82 | Iraq,21 December 1945 83 | Ireland,14 December 1955 84 | Israel,11 May 1949 85 | Italy,14 December 1955 86 | Jamaica,18 September 1962 87 | Japan,18 December 1956 88 | Jordan,14 December 1955 89 | Kazakhstan,2 March 1992 90 | Kenya,16 December 1963 91 | Kiribati,14 September 1999 92 | Kuwait,14 May 1963 93 | Kyrgyzstan,2 March 1992 94 | Lao People's Democratic Republic,14 December 1955 95 | Latvia,17 September 1991 96 | Lebanon,24 October 1945 97 | Lesotho,17 October 1966 98 | Liberia,2 November 1945 99 | Libya,14 December 1955 100 | Liechtenstein,18 September 1990 101 | Lithuania,17 September 1991 102 | Luxembourg,24 October 1945 103 | Madagascar,20 September 1960 104 | Malawi,1 December 1964 105 | Malaysia,17 September 1957 106 | Maldives,21 September 1965 107 | Mali,28 September 1960 108 | Malta,1 December 1964 109 | Marshall Islands,17 September 1991 110 | Mauritania,27 October 1961 111 | Mauritius,24 April 1968 112 | Mexico,7 November 1945 113 | Micronesia (Federated States of),17 September 1991 114 | Monaco,28 May 1993 115 | Mongolia,27 October 1961 116 | Montenegro,28 June 2006 117 | Morocco,12 November 1956 118 | Mozambique,16 September 1975 119 | Myanmar,19 April 1948 120 | Namibia,23 April 1990 121 | Nauru,14 September 1999 122 | Nepal,14 December 1955 123 | Netherlands,10 December 1945 124 | New Zealand,24 October 1945 125 | Nicaragua,24 October 1945 126 | Niger,20 September 1960 127 | Nigeria,7 October 1960 128 | North Macedonia,8 April 1993 129 | Norway,27 November 1945 130 | Oman,7 October 1971 131 | Pakistan,30 September 1947 132 | Palau,15 December 1994 133 | Panama,13 November 1945 134 | Papua New Guinea,10 October 1975 135 | Paraguay,24 October 1945 136 | Peru,31 October 1945 137 | Philippines,24 October 1945 138 | Poland,24 October 1945 139 | Portugal,14 December 1955 140 | Qatar,21 September 1971 141 | Republic of Korea,17 September 1991 142 | Republic of Moldova,2 March 1992 143 | Romania,14 December 1955 144 | Russian Federation,24 October 1945 145 | Rwanda,18 September 1962 146 | St. Kitts and Nevis,23 September 1983 147 | St. Lucia,18 September 1979 148 | St. Vincent and the Grenadines,16 September 1980 149 | Samoa,15 December 1976 150 | San Marino,2 March 1992 151 | São Tomé and Príncipe,16 September 1975 152 | Saudi Arabia,24 October 1945 153 | Senegal,28 September 1960 154 | Serbia,1 November 2000 155 | Seychelles,21 September 1976 156 | Sierra Leone,27 September 1961 157 | Singapore,21 September 1965 158 | Slovakia,19 January 1993 159 | Slovenia,22 May 1992 160 | Solomon Islands,19 September 1978 161 | Somalia,20 September 1960 162 | South Africa,7 November 1945 163 | South Sudan,14 July 2011 164 | Spain,14 December 1955 165 | Sri Lanka,14 December 1955 166 | Sudan,12 November 1956 167 | Suriname,4 December 1975 168 | Sweden,19 November 1946 169 | Switzerland,10 September 2002 170 | Syrian Arab Republic,24 October 1945 171 | Tajikistan,2 March 1992 172 | Thailand,16 December 1946 173 | Timor-Leste,27 September 2002 174 | Togo,20 September 1960 175 | Tonga,14 September 1999 176 | Trinidad and Tobago,18 September 1962 177 | Tunisia,12 November 1956 178 | Turkey,24 October 1945 179 | Turkmenistan,2 March 1992 180 | Tuvalu,5 September 2000 181 | Uganda,25 October 1962 182 | Ukraine,24 October 1945 183 | United Arab Emirates,9 December 1971 184 | United Kingdom of Great Britain and Northern Ireland,24 October 1945 185 | United Republic of Tanzania,14 December 1961 186 | United States of America,24 October 1945 187 | Uruguay,18 December 1945 188 | Uzbekistan,2 March 1992 189 | Vanuatu,15 September 1981 190 | Venezuela (Bolivarian Republic of),15 November 1945 191 | Viet Nam,20 September 1977 192 | Yemen,30 September 1947 193 | Zambia,1 December 1964 194 | Zimbabwe,25 August 1980 195 | -------------------------------------------------------------------------------- /Lesson8/Solutions/c_more_data/countries.csv: -------------------------------------------------------------------------------- 1 | Name,Date Joined,Area,Population 2 | Afghanistan,19 November 1946,"652,230","32,225,560" 3 | Albania,14 December 1955,"28,748","2,845,955" 4 | Algeria,8 October 1962,"2,381,741","43,900,000" 5 | Andorra,28 July 1993,467.63,"77,543" 6 | Angola,1 December 1976,"1,246,700","31,127,674" 7 | Antigua and Barbuda,11 November 1981,, 8 | Argentina,24 October 1945,, 9 | Armenia,2 March 1992,, 10 | Australia,1 November 1945,, 11 | Austria,14 December 1955,, 12 | Azerbaijan,2 March 1992,, 13 | Bahamas,18 September 1973,, 14 | Bahrain,21 September 1971,, 15 | Bangladesh,17 September 1974,, 16 | Barbados,9 December 1966,, 17 | Belarus,24 October 1945,, 18 | Belgium,27 December 1945,, 19 | Belize,25 September 1981,, 20 | Benin,20 September 1960,, 21 | Bhutan,21 September 1971,, 22 | Bolivia (Plurinational State of),14 November 1945,, 23 | Bosnia and Herzegovina,22 May 1992,, 24 | Botswana,17 October 1966,, 25 | Brazil,24 October 1945,, 26 | Brunei Darussalam,21 September 1984,, 27 | Bulgaria,14 December 1955,, 28 | Burkina Faso,20 September 1960,, 29 | Burundi,18 September 1962,, 30 | Cabo Verde,16 September 1975,, 31 | Cambodia,14 December 1955,, 32 | Cameroon,20 September 1960,, 33 | Canada,9 November 1945,, 34 | Central African Republic,20 September 1960,, 35 | Chad,20 September 1960,, 36 | Chile,24 October 1945,, 37 | China,24 October 1945,, 38 | Colombia,5 November 1945,, 39 | Comoros,12 November 1975,, 40 | Congo,20 September 1960,, 41 | Costa Rica,2 November 1945,, 42 | Côte d'Ivoire,20 September 1960,, 43 | Croatia,22 May 1992,, 44 | Cuba,24 October 1945,, 45 | Cyprus,20 September 1960,, 46 | Czech Republic,19 January 1993,, 47 | Democratic People's Republic of Korea,17 September 1991,, 48 | Democratic Republic of the Congo,20 September 1960,, 49 | Denmark,24 October 1945,, 50 | Djibouti,20 September 1977,, 51 | Dominica,18 December 1978,, 52 | Dominican Republic,24 October 1945,, 53 | Ecuador,21 December 1945,, 54 | Egypt,24 October 1945,, 55 | El Salvador,24 October 1945,, 56 | Equatorial Guinea,12 November 1968,, 57 | Eritrea,28 May 1993,, 58 | Estonia,17 September 1991,, 59 | Eswatini,24 September 1968,, 60 | Ethiopia,13 November 1945,, 61 | Fiji,13 October 1970,, 62 | Finland,14 December 1955,, 63 | France,24 October 1945,, 64 | Gabon,20 September 1960,, 65 | Gambia,21 September 1965,, 66 | Georgia,31 July 1992,, 67 | Germany,18 September 1973,, 68 | Ghana,8 March 1957,, 69 | Greece,25 October 1945,, 70 | Grenada,17 September 1974,, 71 | Guatemala,21 November 1945,, 72 | Guinea,12 December 1958,, 73 | Guinea-Bissau,17 September 1974,, 74 | Guyana,20 September 1966,, 75 | Haiti,24 October 1945,, 76 | Honduras,17 December 1945,, 77 | Hungary,14 December 1955,, 78 | Iceland,19 November 1946,, 79 | India,30 October 1945,, 80 | Indonesia,28 September 1950,, 81 | Iran (Islamic Republic of),24 October 1945,, 82 | Iraq,21 December 1945,, 83 | Ireland,14 December 1955,, 84 | Israel,11 May 1949,, 85 | Italy,14 December 1955,, 86 | Jamaica,18 September 1962,, 87 | Japan,18 December 1956,, 88 | Jordan,14 December 1955,, 89 | Kazakhstan,2 March 1992,, 90 | Kenya,16 December 1963,, 91 | Kiribati,14 September 1999,, 92 | Kuwait,14 May 1963,, 93 | Kyrgyzstan,2 March 1992,, 94 | Lao People's Democratic Republic,14 December 1955,, 95 | Latvia,17 September 1991,, 96 | Lebanon,24 October 1945,, 97 | Lesotho,17 October 1966,, 98 | Liberia,2 November 1945,, 99 | Libya,14 December 1955,, 100 | Liechtenstein,18 September 1990,, 101 | Lithuania,17 September 1991,, 102 | Luxembourg,24 October 1945,, 103 | Madagascar,20 September 1960,, 104 | Malawi,1 December 1964,, 105 | Malaysia,17 September 1957,, 106 | Maldives,21 September 1965,, 107 | Mali,28 September 1960,, 108 | Malta,1 December 1964,, 109 | Marshall Islands,17 September 1991,, 110 | Mauritania,27 October 1961,, 111 | Mauritius,24 April 1968,, 112 | Mexico,7 November 1945,, 113 | Micronesia (Federated States of),17 September 1991,, 114 | Monaco,28 May 1993,, 115 | Mongolia,27 October 1961,, 116 | Montenegro,28 June 2006,, 117 | Morocco,12 November 1956,, 118 | Mozambique,16 September 1975,, 119 | Myanmar,19 April 1948,, 120 | Namibia,23 April 1990,, 121 | Nauru,14 September 1999,, 122 | Nepal,14 December 1955,, 123 | Netherlands,10 December 1945,, 124 | New Zealand,24 October 1945,, 125 | Nicaragua,24 October 1945,, 126 | Niger,20 September 1960,, 127 | Nigeria,7 October 1960,, 128 | North Macedonia,8 April 1993,, 129 | Norway,27 November 1945,, 130 | Oman,7 October 1971,, 131 | Pakistan,30 September 1947,, 132 | Palau,15 December 1994,, 133 | Panama,13 November 1945,, 134 | Papua New Guinea,10 October 1975,, 135 | Paraguay,24 October 1945,, 136 | Peru,31 October 1945,, 137 | Philippines,24 October 1945,, 138 | Poland,24 October 1945,, 139 | Portugal,14 December 1955,, 140 | Qatar,21 September 1971,, 141 | Republic of Korea,17 September 1991,, 142 | Republic of Moldova,2 March 1992,, 143 | Romania,14 December 1955,, 144 | Russian Federation,24 October 1945,, 145 | Rwanda,18 September 1962,, 146 | St. Kitts and Nevis,23 September 1983,, 147 | St. Lucia,18 September 1979,, 148 | St. Vincent and the Grenadines,16 September 1980,, 149 | Samoa,15 December 1976,, 150 | San Marino,2 March 1992,, 151 | São Tomé and Príncipe,16 September 1975,, 152 | Saudi Arabia,24 October 1945,, 153 | Senegal,28 September 1960,, 154 | Serbia,1 November 2000,, 155 | Seychelles,21 September 1976,, 156 | Sierra Leone,27 September 1961,, 157 | Singapore,21 September 1965,, 158 | Slovakia,19 January 1993,, 159 | Slovenia,22 May 1992,, 160 | Solomon Islands,19 September 1978,, 161 | Somalia,20 September 1960,, 162 | South Africa,7 November 1945,, 163 | South Sudan,14 July 2011,, 164 | Spain,14 December 1955,, 165 | Sri Lanka,14 December 1955,, 166 | Sudan,12 November 1956,, 167 | Suriname,4 December 1975,, 168 | Sweden,19 November 1946,, 169 | Switzerland,10 September 2002,, 170 | Syrian Arab Republic,24 October 1945,, 171 | Tajikistan,2 March 1992,, 172 | Thailand,16 December 1946,, 173 | Timor-Leste,27 September 2002,, 174 | Togo,20 September 1960,, 175 | Tonga,14 September 1999,, 176 | Trinidad and Tobago,18 September 1962,, 177 | Tunisia,12 November 1956,, 178 | Turkey,24 October 1945,, 179 | Turkmenistan,2 March 1992,, 180 | Tuvalu,5 September 2000,, 181 | Uganda,25 October 1962,, 182 | Ukraine,24 October 1945,, 183 | United Arab Emirates,9 December 1971,, 184 | United Kingdom of Great Britain and Northern Ireland,24 October 1945,, 185 | United Republic of Tanzania,14 December 1961,, 186 | United States of America,24 October 1945,, 187 | Uruguay,18 December 1945,, 188 | Uzbekistan,2 March 1992,, 189 | Vanuatu,15 September 1981,, 190 | Venezuela (Bolivarian Republic of),15 November 1945,, 191 | Viet Nam,20 September 1977,, 192 | Yemen,30 September 1947,, 193 | Zambia,1 December 1964,, 194 | Zimbabwe,25 August 1980,, 195 | -------------------------------------------------------------------------------- /Lesson4/data/tips.csv: -------------------------------------------------------------------------------- 1 | "total_bill","tip","sex","smoker","day","time","size" 2 | 16.99,1.01,"Female","No","Sun","Dinner",2 3 | 10.34,1.66,"Male","No","Sun","Dinner",3 4 | 21.01,3.5,"Male","No","Sun","Dinner",3 5 | 23.68,3.31,"Male","No","Sun","Dinner",2 6 | 24.59,3.61,"Female","No","Sun","Dinner",4 7 | 25.29,4.71,"Male","No","Sun","Dinner",4 8 | 8.77,2,"Male","No","Sun","Dinner",2 9 | 26.88,3.12,"Male","No","Sun","Dinner",4 10 | 15.04,1.96,"Male","No","Sun","Dinner",2 11 | 14.78,3.23,”male","No","Sun","Dinner",2 12 | 10.27,1.71,"Male","No","Sun","Dinner",2 13 | 35.26,5,"F","No","Sun","Dinner",4 14 | 15.42,1.57,"Male","No","Sun","Dinner",2 15 | 18.43,3,"Male","No","Sun","Dinner",4 16 | 14.83,3.02,"Female","No","Sun","Dinner",2 17 | 21.58,3.92,"Male","No","Sun","Dinner",2 18 | 10.33,1.67,"Female","No","Sun","Dinner",3 19 | 16.29,3.71,"Male","No","Sun","Dinner",3 20 | 16.97,3.5,"Female","No","Sun","Dinner",3 21 | 20.65,3.35,"Male","No","Sat","Dinner",3 22 | 17.92,4.08,”M”,”No","Sat","Dinner",2 23 | 20.29,2.75,”F”,”No","Sat","Dinner",2 24 | 15.77,2.23,”F”,”No","Sat","Dinner",2 25 | 39.42,7.58,"Male","No","Sat","Dinner",4 26 | 19.82,3.18,"Male","No","Sat","Dinner",2 27 | 17.81,2.34,"Male","No","Sat","Dinner",4 28 | 13.37,2,"Male","No","Sat","Dinner",2 29 | 12.69,2,"Male","No","Sat","Dinner",2 30 | 21.7,4.3,"Male","No","Sat","Dinner",2 31 | 19.65,3,"Female","No","Sat","Dinner",2 32 | 9.55,1.45,"Male","No","Sat","Dinner",2 33 | 18.35,2.5,"Male","No","Sat","Dinner",4 34 | 15.06,3,"Female","No","Sat","Dinner",2 35 | 20.69,2.45,"Female","No","Sat","Dinner",4 36 | 17.78,3.27,"Male","No","Sat","Dinner",2 37 | 24.06,3.6,"Male","No","Sat","Dinner",3 38 | 16.31,2,"Male","No","Sat","Dinner",3 39 | 16.93,3.07,"Female","No","Sat","Dinner",3 40 | 18.69,2.31,"Male","No","Sat","Dinner",3 41 | 31.27,5,"Male","No","Sat","Dinner",3 42 | 16.04,2.24,"Male","No","Sat","Dinner",3 43 | 17.46,2.54,"Male","No","Sun","Dinner",2 44 | 13.94,3.06,"Male","No","Sun","Dinner",2 45 | 9.68,1.32,"Male","No","Sun","Dinner",2 46 | 30.4,5.6,"Male","No","Sun","Dinner",4 47 | 18.29,3,"Male","No","Sun","Dinner",2 48 | 22.23,5,"Male","No","Sun",,2 49 | 32.4,6,"Male","No","Sun","Dinner",4 50 | 28.55,2.05,"Male","No","Sun","Dinner",3 51 | 18.04,3,"Male","No","Sun","Dinner",2 52 | 12.54,2.5,"Male","No","Sun","Dinner",2 53 | 10.29,2.6,"Female","No","Sun","Dinner",2 54 | 34.81,5.2,"Female","No","Sun",,4 55 | 9.94,1.56,"Male","No","Sun","Dinner",2 56 | 25.56,4.34,"Male","No","Sun","Dinner",4 57 | 19.49,3.51,"Male","No","Sun","Dinner",2 58 | 38.01,3,"Male","Yes","Sat","Dinner",4 59 | 26.41,1.5,"Female","No","Sat","Dinner",2 60 | 11.24,1.76,"Male","Yes","Sat","Dinner",2 61 | 48.27,6.73,"Male","No","Sat","Dinner",4 62 | 20.29,3.21,"Male","Yes","Sat","Dinner",2 63 | 13.81,2,"Male","Yes","Sat","Dinner",2 64 | 11.02,1.98,"Male","Yes","Sat","Dinner",2 65 | 18.29,3.76,"Male","Yes","Sat","Dinner",4 66 | 17.59,2.64,"Male","No","Sat","Dinner",3 67 | 20.08,3.15,"Male","No","Sat","Dinner",3 68 | 16.45,2.47,"Female","No","Sat","Dinner",2 69 | 3.07,1,"Female","Yes","Sat","Dinner",1 70 | 20.23,2.01,"Male","No","Sat","Dinner",2 71 | 15.01,2.09,"Male","Yes","Sat","Dinner",2 72 | 12.02,1.97,"Male","No","Sat","Dinner",2 73 | 17.07,3,"Female","No","Sat","Dinner",3 74 | 26.86,3.14,"Female","Yes","Sat","Dinner",2 75 | 25.28,5,"Female","Yes","Sat","Dinner",2 76 | 14.73,2.2,"Female","No","Sat","Dinner",2 77 | 10.51,1.25,"Male","No","Sat","Dinner",2 78 | 17.92,3.08,"Male","Yes","Sat","Dinner",2 79 | 27.2,4,"Male","No","Thur","Lunch",4 80 | 22.76,3,"Male","No","Thur","Lunch",2 81 | 17.29,2.71,"Male","No","Thur","Lunch",2 82 | 19.44,3,"Male","Yes","Thur","Lunch",2 83 | 16.66,3.4,"Male","No","Thur","Lunch",2 84 | 10.07,1.83,"Female","No","Thur","Lunch",1 85 | 32.68,5,"Male","Yes","Thur",,2 86 | 15.98,2.03,"Male","No","Thur","Lunch",2 87 | 34.83,5.17,"Female","No","Thur","Lunch",4 88 | 13.03,2,"Male","No","Thur","Lunch",2 89 | 18.28,4,"Male","No","Thur","Lunch",2 90 | 24.71,5.85,"Male","No","Thur","Lunch",2 91 | 21.16,3,"Male","No","Thur","Lunch",2 92 | 28.97,3,"Male","Yes","Fri","Dinner",2 93 | 22.49,3.5,"Male","No","Fri","Dinner",2 94 | 5.75,1,"Female","Yes","Fri","Dinner",2 95 | 16.32,4.3,"Female","Yes","Fri","Dinner",2 96 | 22.75,3.25,"Female","No","Fri","Dinner",2 97 | 40.17,4.73,"Male","Yes","Fri","Dinner",4 98 | 27.28,4,"Male","Yes","Fri","Dinner",2 99 | 12.03,1.5,"Male","Yes","Fri","Dinner",2 100 | 21.01,3,"Male","Yes","Fri","Dinner",2 101 | 12.46,1.5,"Male","No","Fri","Dinner",2 102 | 11.35,2.5,"Female","Yes","Fri","Dinner",2 103 | 15.38,3,"Female","Yes","Fri","Dinner",2 104 | 44.3,2.5,"Female","Yes","Sat","Dinner",3 105 | 22.42,3.48,"Female","Yes","Sat","Dinner",2 106 | 20.92,4.08,"Female","No","Sat","Dinner",2 107 | 15.36,1.64,"Male","Yes","Sat","Dinner",2 108 | 20.49,4.06,"Male","Yes","Sat","Dinner",2 109 | 25.21,4.29,"Male","Yes","Sat","Dinner",2 110 | 18.24,3.76,"Male","No","Sat","Dinner",2 111 | 14.31,4,"Female","Yes","Sat","Dinner",2 112 | 14,3,"Male","No","Sat","Dinner",2 113 | 7.25,1,"Female","No","Sat","Dinner",1 114 | 38.07,4,"Male","No","Sun","Dinner",3 115 | 23.95,2.55,"Male","No","Sun","Dinner",2 116 | 25.71,4,"Female","No","Sun",,3 117 | 17.31,3.5,"Female","No","Sun","Dinner",2 118 | 29.93,5.07,"Male","No","Sun","Dinner",4 119 | 10.65,1.5,"Female","No","Thur","Lunch",2 120 | 12.43,1.8,"Female","No","Thur","Lunch",2 121 | 24.08,2.92,"Female","No","Thur","Lunch",4 122 | 11.69,2.31,"Male","No","Thur","Lunch",2 123 | 13.42,1.68,"Female","No","Thur","Lunch",2 124 | 14.26,2.5,"Male","No","Thur","Lunch",2 125 | 15.95,2,"Male","No","Thur","Lunch",2 126 | 12.48,2.52,"Female","No","Thur","Lunch",2 127 | 29.8,4.2,"Female","No","Thur","Lunch",6 128 | 8.52,1.48,"Male","No","Thur","Lunch",2 129 | 14.52,2,"Female","No","Thur","Lunch",2 130 | 11.38,2,"Female","No","Thur","Lunch",2 131 | 22.82,2.18,"Male","No","Thur","Lunch",3 132 | 19.08,1.5,"Male","No","Thur","Lunch",2 133 | 20.27,2.83,"Female","No","Thur","Lunch",2 134 | 11.17,1.5,"Female","No","Thur","Lunch",2 135 | 12.26,2,"Female","No","Thur","Lunch",2 136 | 18.26,3.25,"Female","No","Thur","Lunch",2 137 | 8.51,1.25,"Female","No","Thur","Lunch",2 138 | 10.33,2,"Female","No","Thur","Lunch",2 139 | 14.15,2,"Female","No","Thur","Lunch",2 140 | 16,2,"Male","Yes","Thur","Lunch",2 141 | 13.16,2.75,"Female","No","Thur","Lunch",2 142 | 17.47,3.5,"Female","No","Thur","Lunch",2 143 | 34.3,6.7,"Male","No","Thur","Lunch",6 144 | 41.19,5,"Male","No","Thur","Lunch",5 145 | 27.05,5,"Female","No","Thur","Lunch",6 146 | 16.43,2.3,"Female","No","Thur","Lunch",2 147 | 8.35,1.5,"Female","No","Thur","Lunch",2 148 | 18.64,1.36,"Female","No","Thur","Lunch",3 149 | 11.87,1.63,"Female","No","Thur","Lunch",2 150 | 9.78,1.73,"Male","No","Thur","Lunch",2 151 | 7.51,2,"Male","No","Thur","Lunch",2 152 | 14.07,2.5,"Male","No","Sun","Dinner",2 153 | 13.13,2,"Male","No","Sun","Dinner",2 154 | 17.26,2.74,"Male","No","Sun","Dinner",3 155 | 24.55,2,"Male","No","Sun","Dinner",4 156 | 19.77,2,"Male","No","Sun","Dinner",4 157 | 29.85,5.14,"Female","No","Sun","Dinner",5 158 | 48.17,5,"Male","No","Sun","Dinner",6 159 | 25,3.75,"Female","No","Sun","Dinner",4 160 | 13.39,2.61,"Female","No","Sun","Dinner",2 161 | 16.49,2,"Male","No","Sun","Dinner",4 162 | 21.5,3.5,"Male","No","Sun","Dinner",4 163 | 12.66,2.5,"Male","No","Sun","Dinner",2 164 | 16.21,2,"Female","No","Sun","Dinner",3 165 | 13.81,2,"Male","No","Sun","Dinner",2 166 | 17.51,3,"Female","Yes","Sun","Dinner",2 167 | 24.52,3.48,"Male","No","Sun","Dinner",3 168 | 20.76,2.24,"Male","No","Sun","Dinner",2 169 | 31.71,4.5,"Male","No","Sun","Dinner",4 170 | 10.59,1.61,"Female","Yes","Sat","Dinner",2 171 | 10.63,2,"Female","Yes","Sat","Dinner",2 172 | 50.81,10,"Male","Yes","Sat","Dinner",3 173 | 15.81,3.16,"Male","Yes","Sat","Dinner",2 174 | 7.25,5.15,”male","Yes","Sun","Dinner",2 175 | 31.85,3.18,”male","Yes","Sun","Dinner",2 176 | 16.82,4,"M","Yes","Sun","Dinner",2 177 | 32.9,3.11,"Male","Yes","Sun","Dinner",2 178 | 17.89,2,"Male","Yes","Sun","Dinner",2 179 | 14.48,2,"Male","Yes","Sun","Dinner",2 180 | 9.6,4,"F","Yes","Sun","Dinner",2 181 | 34.63,3.55,"Male","Yes","Sun","Dinner",2 182 | 34.65,3.68,"Male","Yes","Sun","Dinner",4 183 | 23.33,5.65,"M","Yes","Sun","Dinner",2 184 | 45.35,3.5,"Male","Yes","Sun","Dinner",3 185 | 23.17,6.5,"Male","Yes","Sun","Dinner",4 186 | 40.55,3,"Male","Yes","Sun","Dinner",2 187 | 20.69,5,"Male","No","Sun","Dinner",5 188 | 20.9,3.5,"Female","Yes","Sun","Dinner",3 189 | 30.46,2,"Male","Yes","Sun","Dinner",5 190 | 18.15,3.5,"Female","Yes","Sun","Dinner",3 191 | 23.1,4,"Male","Yes","Sun","Dinner",3 192 | 15.69,1.5,"Male","Yes","Sun","Dinner",2 193 | 19.81,4.19,"Female","Yes","Thur","Lunch",2 194 | 28.44,2.56,"Male","Yes","Thur","Lunch",2 195 | 15.48,2.02,"Male","Yes","Thur","Lunch",2 196 | 16.58,4,"Male","Yes","Thur","Lunch",2 197 | 7.56,1.44,"Male","No","Thur","Lunch",2 198 | 10.34,2,"Male","Yes","Thur","Lunch",2 199 | 43.11,5,”female","Yes","Thur","Lunch",4 200 | 13,2,”female","Yes","Thur","Lunch",2 201 | 13.51,2,”male","Yes","Thur","Lunch",2 202 | 18.71,4,”male","Yes","Thur","Lunch",3 203 | 12.74,2.01,"Female","Yes","Thur","Lunch",2 204 | 13,2,"Female","Yes","Thur","Lunch",2 205 | 16.4,2.5,"Female","Yes","Thur","Lunch",2 206 | 20.53,4,"Male","Yes","Thur","Lunch",4 207 | 16.47,3.23,"Female","Yes","Thur","Lunch",3 208 | 26.59,3.41,"Male","Yes","Sat","Dinner",3 209 | 38.73,3,"Male","Yes","Sat","Dinner",4 210 | 24.27,2.03,"Male","Yes","Sat","Dinner",2 211 | 12.76,2.23,"Female","Yes","Sat","Dinner",2 212 | 30.06,2,"Male","Yes","Sat","Dinner",3 213 | 25.89,5.16,"Male","Yes","Sat","Dinner",4 214 | 48.33,9,"Male","No","Sat","Dinner",4 215 | 13.27,2.5,"Female","Yes","Sat","Dinner",2 216 | 28.17,6.5,"Female","Yes","Sat","Dinner",3 217 | 12.9,1.1,"Female","Yes","Sat","Dinner",2 218 | 28.15,3,"Male","Yes","Sat","Dinner",5 219 | 11.59,1.5,"Male","Yes","Sat","Dinner",2 220 | 7.74,1.44,"Male","Yes","Sat","Dinner",2 221 | 30.14,3.09,"Female","Yes","Sat","Dinner",4 222 | 12.16,2.2,"Male","Yes","Fri","Lunch",2 223 | 13.42,3.48,"Female","Yes","Fri","Lunch",2 224 | 8.58,1.92,"Male","Yes","Fri","Lunch",1 225 | 15.98,3,"Female","No","Fri","Lunch",3 226 | 13.42,1.58,"Male","Yes","Fri","Lunch",2 227 | 16.27,2.5,"Female","Yes","Fri","Lunch",2 228 | 10.09,2,"Female","Yes","Fri","Lunch",2 229 | 20.45,3,"Male","No","Sat","Dinner",4 230 | 13.28,2.72,"Male","No","Sat","Dinner",2 231 | 22.12,2.88,"Female","Yes","Sat","Dinner",2 232 | 24.01,2,"Male","Yes","Sat","Dinner",4 233 | 15.69,3,"Male","Yes","Sat","Dinner",3 234 | 11.61,3.39,"Male","No","Sat","Dinner",2 235 | 10.77,1.47,"Male","No","Sat","Dinner",2 236 | 15.53,3,"Male","Yes","Sat","Dinner",2 237 | 10.07,1.25,"Male","No","Sat","Dinner",2 238 | 12.6,1,"Male","Yes","Sat","Dinner",2 239 | 32.83,1.17,"Male","Yes","Sat","Dinner",2 240 | 35.83,4.67,"Female","No","Sat","Dinner",3 241 | 29.03,5.92,"Male","No","Sat","Dinner",3 242 | 27.18,2,"Female","Yes","Sat","Dinner",2 243 | 22.67,2,"Male","Yes","Sat","Dinner",2 244 | 17.82,1.75,"Male","No","Sat","Dinner",2 245 | 18.78,3,"Female","No","Thur","Dinner",2 246 | -------------------------------------------------------------------------------- /Lesson7/data/google.html: -------------------------------------------------------------------------------- 1 | Google



 

Advanced search

Google offered in: Français

© 2020 - Privacy - Terms

-------------------------------------------------------------------------------- /Lesson7/data/wikipedia.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Wikipedia 6 | 7 | 10 | 11 | 12 | 13 | 14 | 17 | 20 | 21 | 22 | 23 | 32 | 33 | 107 | 108 |
109 |
110 |
111 | 112 | 113 | 114 |
115 | 116 | 117 |
118 |
119 | 190 |
191 |
192 | 193 |
194 |
195 | 198 | 199 |
200 |
201 |
202 |
203 | 208 |
209 |
210 |
211 |
212 | 213 |

214 | 215 | 216 | 217 | 1 000 000+ 218 | 219 | 220 | articles 221 | 222 | 223 | 224 |

225 | 226 | 248 | 249 |

250 | 251 | 252 | 253 | 100 000+ 254 | 255 | 256 | articles 257 | 258 | 259 | 260 |

261 | 262 | 315 | 316 |

317 | 318 | 319 | 320 | 10 000+ 321 | 322 | 323 | articles 324 | 325 | 326 | 327 |

328 | 329 |
330 | 413 |
414 | 415 |

416 | 417 | 418 | 419 | 1 000+ 420 | 421 | 422 | articles 423 | 424 | 425 | 426 |

427 | 428 |
429 | 535 |
536 | 537 |

538 | 539 | 540 | 541 | 100+ 542 | 543 | 544 | articles 545 | 546 | 547 | 548 |

549 | 550 | 584 | 585 | 600 |
601 |
602 | 618 |
619 | 791 |

792 | This page is available under the Creative Commons Attribution-ShareAlike License 793 | Terms of Use 794 | Privacy Policy 795 |

796 | 817 | 818 | 819 | 820 | 821 | 822 | 827 | 828 | 839 | 840 | 841 | --------------------------------------------------------------------------------