This file contains 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
# Scraping "The American Presidency Project" @ https://www.presidency.ucsb.edu/statistics/elections/ | |
from bs4 import BeautifulSoup as soupify | |
import requests | |
BASE_URL = "https://www.presidency.ucsb.edu/statistics/elections" | |
election_dict = {} # For each election year, contains --> KEY [year] : VALUE [dictionary of states mapped to chosen candidate] |
This file contains 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
# 2 years old | |
from requests import get | |
from bs4 import BeautifulSoup as soupify | |
flag = True | |
zip_code = input("Zip Code: ") | |
url = 'https://weather.com/weather/today/l/' + zip_code + ':4:US' | |
page_source = get(url) | |
content = soupify(page_source.content, "html.parser") |
We can't make this file beautiful and searchable because it's too large.
This file contains 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
Entity,Code,Year,Deaths - Unsafe water source - Sex: Both - Age: All Ages (Number),Deaths - Unsafe sanitation - Sex: Both - Age: All Ages (Number),Deaths - No access to handwashing facility - Sex: Both - Age: All Ages (Number),Deaths - Household air pollution from solid fuels - Sex: Both - Age: All Ages (Number),Deaths - Non-exclusive breastfeeding - Sex: Both - Age: All Ages (Number),Deaths - Discontinued breastfeeding - Sex: Both - Age: All Ages (Number),Deaths - Child wasting - Sex: Both - Age: All Ages (Number),Deaths - Child stunting - Sex: Both - Age: All Ages (Number),Deaths - Low birth weight for gestation - Sex: Both - Age: All Ages (Number),Deaths - Secondhand smoke - Sex: Both - Age: All Ages (Number),Deaths - Alcohol use - Sex: Both - Age: All Ages (Number),Deaths - Drug use - Sex: Both - Age: All Ages (Number),Deaths - Diet low in fruits - Sex: Both - Age: All Ages (Number),Deaths - Diet low in vegetables - Sex: Both - Age: All Ages (Number),Deaths - Unsafe sex - Sex: Both - Age: All Ages (Number |
This file contains 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 | |
with open('diseases.csv', mode='r') as csv_file: | |
csv_reader = csv.DictReader(csv_file) | |
line_count = 0 | |
for row in csv_reader: | |
if row["Entity"] == "United States": | |
if int(row["Year"]) < 1999: continue | |
print(row["Year"]) |
This file contains 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 requests | |
from bs4 import BeautifulSoup as soupify | |
import pandas | |
############ NOTE: ########### | |
################ | |
# DATA IS IN THE OUT.CSV FILE! | |
# RUNNING THE PROGRAM WILL TAKE AT LEAST 15 MINUTES TO SCAN 420 ENTRIES | |
# TO SCAN ALL 655 IT TOOK 23:12 MINUTES. | |
################ |
We can't make this file beautiful and searchable because it's too large.
This file contains 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
,Name,Rating,Potential,Age,Club,Position | |
0,Lionel Messi,94,94,33,FC Barcelona,RW | |
1,Cristiano Ronaldo,93,93,35,Juventus,ST | |
2,Neymar Jr,92,92,28,Paris Saint-Germain,LW | |
3,Virgil van Dijk,91,92,29,Liverpool,CB | |
4,Jan Oblak,91,93,27,Atlético Madrid,GK | |
5,Kevin De Bruyne,91,91,29,Manchester City,CAM | |
6,Robert Lewandowski,91,91,32,FC Bayern München,ST | |
7,Eden Hazard,91,91,29,Real Madrid,LW | |
8,Alisson,90,91,27,Liverpool,GK |
We can't make this file beautiful and searchable because it's too large.
This file contains 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
,Name,Rating,Potential,Age,Club,Position | |
0,Lionel Messi,94,94,33,FC Barcelona,RW | |
1,Cristiano Ronaldo,93,93,35,Juventus,ST | |
2,Neymar Jr,92,92,28,Paris Saint-Germain,LW | |
3,Virgil van Dijk,91,92,29,Liverpool,CB | |
4,Jan Oblak,91,93,27,Atlético Madrid,GK | |
5,Kevin De Bruyne,91,91,29,Manchester City,CAM | |
6,Robert Lewandowski,91,91,32,FC Bayern München,ST | |
7,Eden Hazard,91,91,29,Real Madrid,LW | |
8,Alisson,90,91,27,Liverpool,GK |
This file contains 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
# A Transcription and Translation Python Program | |
# DNA Strand Here | |
# Example: ATCGAATACAGATAAATT | |
dna = "" # contain only from ["A", "C", "G", "T"] | |
pairs = {"A": "U", "T": "A", "C": "G", "G": "C"} | |
transcribe = ''.join([pairs[a] for a in dna]) | |
# Finding Proteins | |
proteins = [] |
This file contains 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
# ISBN Check Digit Solution | |
import sys | |
import itertools | |
isbn = input("Type in your ISBN Code: ").strip().replace('-', '') | |
dig_count = len(isbn) | |
if dig_count != 12 and dig_count != 9: | |
print(f"Sorry but I can only evaluate 10-digit or 13-digit ISBN Codes, which need 9 digits or 12 digits respectively.\nYou gave me one with a length of {dig_count}.") |