Skip to content

Instantly share code, notes, and snippets.

Created May 28, 2017 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/56680238465bd7e54caca5ebe802c1d6 to your computer and use it in GitHub Desktop.
Save anonymous/56680238465bd7e54caca5ebe802c1d6 to your computer and use it in GitHub Desktop.
def collatz(number):
if number % 2 == 0:
print((number // 2))
return number // 2
if number % 2 == 1:
print(3 * number + 1)
return 3 * number + 1
bacon = (input('Please pick a number'))
try:
vBacon = int(bacon)
except ValueError:
print('Please pick a god damn NUMBER')
loopingcollatz = collatz(bacon)
while loopingcollatz !=1:
print('running function again')
loopingcollatz = (collatz(loopingcollatz))
print('We got there!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment