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
for n in range (1,100): | |
if (n % 3 == 0 and n % 5 == 0): | |
print ("FizzBuzz") | |
elif n % 5 == 0: | |
print("Buzz") | |
elif n % 3 == 0: | |
print("Fizz") | |
else: | |
print(n) |
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
#bartender app | |
import random | |
questions = { | |
"stiff": "Do you like stiff drinks?", | |
"citrusy": "Do you like your drinks scurvy-free?", | |
"sweet": "Are you a sissy who likes fruity drinks?", | |
"bitter": "Do you like your drinks bitter?", | |
"classy": "Do you like your drinks with a twist of class?", |
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
#constructing classes and objects | |
class musician(object): | |
#defines the musician object and initiates a solo method for all musicians | |
def __init__(self, sounds): | |
self.sounds = sounds | |
def solo(self, length): | |
for i in range(length): | |
print(self.sounds[i % len(self.sounds)], end=" ") |
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
#modeling the bicycle industry | |
#create the customer class | |
class customer(object): | |
def __init__(self, name, fund): | |
self.name = name | |
self.fund = fund | |
#create the bicycle class so that each bike created has a model name, weight, and cost to produce | |
class bicycle(object): |
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
#modeling the bicycle industry | |
#classes | |
class bicycle(object): | |
#create the bicycle class so that each bike created has a model name, weight, and cost to produce | |
def __init__(self, model, weight, cost): | |
self.model = model | |
self.weight = weight | |
self.cost = cost |
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
from sqlalchemy import create_engine | |
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy.orm import relationship | |
from sqlalchemy.ext.declarative import declarative_base | |
engine = create_engine('postgresql://ubuntu:thinkful@localhost:5432/tbay') | |
Session = sessionmaker(bind=engine) | |
session = Session() | |
Base = declarative_base() |
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 numpy as np | |
import scipy.stats as stats | |
import collections | |
import matplotlib.pyplot as plt | |
x = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9] | |
c = collections.Counter(x) | |
count_sum = sum(c.values()) |
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 matplotlib.pyplot as plt | |
import pandas as pd | |
import scipy.stats as stats | |
loansData = pd.read_csv('https://github.com/Thinkful-Ed/curric-data-001-data-sets/raw/master/loans/loansData.csv') | |
loansData.dropna(inplace=True) | |
loansData.boxplot(column='Amount.Requested') | |
plt.savefig('Amount Requested Boxplot.png') |
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
from scipy import stats | |
import collections | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
loansData = pd.read_csv('https://github.com/Thinkful-Ed/curric-data-001-data-sets/raw/master/loans/loansData.csv') | |
loansData.dropna(inplace=True) | |
freq = collections.Counter(loansData['Open.CREDIT.Lines']) |
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 pandas as pd | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import statsmodels.api as sm | |
loansData = pd.read_csv('https://github.com/Thinkful-Ed/curric-data-001-data-sets/raw/master/loans/loansData.csv') | |
#Remove '%' from 'Interest.Rate' column and contert to number | |
loansData['Interest.Rate']=loansData['Interest.Rate'].map(lambda x: round(float(x.rstrip('%')) / 100, 4)) | |
#Remove 'months' from the 'Loan.Length' column |
OlderNewer