Skip to content

Instantly share code, notes, and snippets.

View odubno's full-sized avatar
🤘
do work.

Oleh Dubno odubno

🤘
do work.
View GitHub Profile
@odubno
odubno / fizz buzz - oleh
Created July 29, 2014 16:14
Thinkful - fizz buzz - oleh
user_guess = range(101)
while True:
user_answer = int(raw_input("Your answer: "))
if user_answer % 3 == 0 and user_answer % 5 == 0:
print "Fizz Buzz"
elif user_answer % 3 == 0:
print "Fizz"
elif user_answer % 5 == 0:
print "Buzz"
@odubno
odubno / Fizz Buzz 1
Created July 29, 2014 20:00
Fizz Buzz - loops over the user suggested integer the fizz buzz answers
import sys
#list of strings
# assume that a person will only put 1 additional argument
# ignore the rest
# python Desktop/example_2.py 300
if len(sys.argv) > 1:
# user supplied value
user_input = sys.argv[1]
@odubno
odubno / LESSON 5 - FUNCTIONS ASSIGNMENT 1
Created July 30, 2014 18:44
Overview of Functions in Python - LESSON 5 - FUNCTIONS ASSIGNMENT 1
"""Both codes below provide the same output"""
def subtractor(a, b):
print "I'm a function. My name is {}".format(subtractor.__name__)
print "I'm about to subtract {} and {}\n\n".format(a,b)
if __name__ == '__main__' # Why is this necessary to have in the code if the output is still the same?
subtractor(3, 2)
@odubno
odubno / Decorators - lesson 5
Created August 3, 2014 20:14
Decorators LESSON 5 - FUNCTIONSASSIGNMENT 1
#I don't understand the need for classes or use of classes. What's __repr__? Why do we have to use the double underscore before the term both for __init__ and __repr__.
class coordinate(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "coord: " + str(self.__dict__)
def add(a, b):
return coordinate(a.x + b.x, a.y + b.y)
@odubno
odubno / Fizz Buzz Refactor
Created August 3, 2014 23:53
Fizz Buzz Refactor LESSON 5 - FUNCTIONSASSIGNMENT 3
#Write one function that determines if one number is evenly divisible by another and returns true or false
def divisible_by(x, y):
if x % y == 0:
return True
else:
return False
import sys
if len(sys.argv) > 1:
# user supplied value
@odubno
odubno / bike_cls
Last active August 29, 2015 14:05
Bicycle Industry Draft 1
class Wheels():
def __init__(self, name, weight, cost):
self.name = name
self.weight = weight
self.cost = cost
class Frames():
def __init__(self, composition, weight, cost):
self.composition = composition
self.weight = weight
@odubno
odubno / bike_obj
Last active August 29, 2015 14:05
Bicycle Industry - Objects
import bike_cls
wheel1 = bike_cls.Wheels("wheel1", 10, 30)
wheel2 = bike_cls.Wheels("wheel2", 8, 25)
wheel3 = bike_cls.Wheels("wheel3", 6, 20)
frame1 = bike_cls.Frames("frame1", 15, 40)
frame2 = bike_cls.Frames("frame2", 10, 50)
frame3 = bike_cls.Frames("frame3", 13, 45)
@odubno
odubno / gist:c037d909a4b93c13c277
Last active August 29, 2015 14:05
Oleh Dubno - Advanced Python
from collections import Counter
food_order = ["burger", "fries", "burger", "tenders", "apple pie"]
print Counter(food_order)
@odubno
odubno / Oleh_Dubno_Project Idea Submission
Created September 16, 2014 22:32
Oleh_Dubno_Project Idea Submission
What is the topic you'd like to explore?
Bike sharring in cities
Why is this topic personally important to you? What is it about the topic that most fascinates you?
I personally bike everywhere. The social factor of sharing bikes, what gets ppl to use bike share vs buying their own bike and the amount of data the could be gathered using bike share.
What is the question, or what are the main questions, that you'd like to answer about this topic?
The hot destinations people travel from/to most. The time it takes people to travel those destinations. I would eventually encourage safer bike paths and relevant advertising placed along the popular routes.
What are the types of available data relevant to your questions?
@odubno
odubno / gist:150ce2788205b7276638
Created September 22, 2014 23:02
Oleh_Bike_Share_Chicago
{
"metadata": {
"name": "",
"signature": "sha256:2b0057624a44e2af60888a42742bbe762418cead2ab2d9482634c9fb2d081d28"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [