Skip to content

Instantly share code, notes, and snippets.

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)
#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?",
@jmsword
jmsword / Band
Created November 4, 2016 00:34
Band project
#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=" ")
#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):
#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
@jmsword
jmsword / tbay.py
Created November 21, 2016 21:47
Jeff's Tbay project
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()
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())
@jmsword
jmsword / prob_lending_club.py
Created December 11, 2016 18:27
Lending Club Data Project
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')
@jmsword
jmsword / chi_squared.py
Created December 12, 2016 19:38
Chi Squared Test
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'])
@jmsword
jmsword / linear_regression.py
Created December 20, 2016 15:47
Linear Regression
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