Created
May 28, 2017 19:04
-
-
Save anonymous/498a2e4ceba4eedd298140001557305e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = (int(input('pick a number')) | |
while True: | |
print('Running collatz function') | |
loopingcollatz = collatz(bacon) | |
if loopingcollatz == 1: | |
break | |
else: | |
loopingcollatz = (collatz(loopingcollatz)) | |
print('1 - we got there!') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment