This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import string | |
| from time import sleep | |
| alphabet = string.ascii_lowercase # "abcdefghijklmnopqrstuvwxyz" | |
| def encrypt(): | |
| print("Welcome to Caesar Cipher Encryption.\n") | |
| message = input("Type a message you would like to encrypt: ").lower() | |
| print() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import string | |
| import random | |
| class Encryption(): | |
| def __init__(self,seed): | |
| # Sets a random seed and a self.seed attribute | |
| random.seed(seed) | |
| self.seed = seed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import os | |
| import re | |
| import send2trash | |
| def build_csv(): | |
| """iterate through CSV files in directory to create master enrollment_data.csv""" | |
| rows = [] | |
| for filename in os.listdir("C:\\Users\\aorr\\Desktop\\GenEdData"): | |
| if filename.endswith(".csv"): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import string | |
| def encrypt(text, shift): | |
| encrypted_text = list(range(len(text))) | |
| alphabet = string.ascii_lowercase # 'abcdefghijklmnopqrstuvwxyz' | |
| first_half = alphabet[:shift] | |
| second_half = alphabet[shift:] | |
| shifted_alphabet = second_half + first_half | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # AO8 | |
| # February 16, 2018 | |
| import csv | |
| import os | |
| import re | |
| def build_csv(): | |
| """iterates through CSV files in directory to create master gen_ed_data.csv""" | |
| rows = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # collections.Counter docs at: | |
| # https://docs.python.org/3/library/collections.html#collections.Counter | |
| from collections import Counter | |
| import re | |
| with open("txt_file.txt", "r") as f: | |
| words = re.findall(r"\w+", f.read().lower()) | |
| totals = Counter(words).most_common(50) # returns a list of tuples for the 50 most common words and their counts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -------- | |
| # Option 1 | |
| # -------- | |
| def create_theater_seats(num_rows, num_seats): | |
| rows = [r for r in range(1, num_rows + 1)] | |
| seats = [s for s in range(1, num_seats + 1)] | |
| theater_seats = [(r,s) for r in rows for s in seats] | |
| return theater_seats | |
| create_theater_seats(2,3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <!--Defines the web page's title--> | |
| <title></title> | |
| <!--Defines the character set used--> | |
| <meta charset="utf-8"> | |
| <!--Provides a description of your web page--> | |
| <meta name="description" content=""> | |
| <!--Defines keywords for search engines--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # with inspiration from Kojin @ Harvard | |
| class Stack: | |
| """for creating a LIFO data structure""" | |
| def __init__(self): | |
| self.items = [] | |
| def size(self): | |
| return len(self.items) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib.request | |
| import csv | |
| import re | |
| from bs4 import BeautifulSoup | |
| from datetime import datetime as dt | |
| dow_jones_page = "https://www.bloomberg.com/quote/INDU:IND" | |
| html = urllib.request.urlopen(dow_jones_page) | |
| soup = BeautifulSoup(html, "html.parser") |