Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: da5cb5343d
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (33 sloc) 0.909 kB
def get_input():
print "Enter in a number or 'exit' when done"
response = raw_input("> ")
return response
def input_check(response):
if response.isdigit():
number = int(response)
fizz_buzz(number)
return False
elif response.isalpha() and not response == "exit":
print "please enter a number, not a word"
return False
elif response == "exit":
print "thanks for playing"
return True
else:
print "WTF!?!"
return False
def fizz_buzz(number):
if number % 15 == 0:
print "fizzbuzz"
elif number % 3 == 0:
print "fizz"
elif number % 5 == 0:
print "buzz"
else:
print number
print "this number is not divisible by 3 and 5"
def run():
ready_to_exit = False
while (not ready_to_exit):
ready_to_exit = input_check(get_input())
run()
Jump to Line
Something went wrong with that request. Please try again.