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 / 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 / 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 / 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"