Skip to content

Instantly share code, notes, and snippets.

@AgnieszkaUcinska
Created May 10, 2019 06:38
Show Gist options
  • Select an option

  • Save AgnieszkaUcinska/23b963cf287cd7e416f37367dd3a85c0 to your computer and use it in GitHub Desktop.

Select an option

Save AgnieszkaUcinska/23b963cf287cd7e416f37367dd3a85c0 to your computer and use it in GitHub Desktop.
druga wersja
def collatz(number):
if number % 2 == 0:
print(number // 2)
return number // 2
elif number % 2 == 1:
result = 3 * number + 1
print(result)
return result
n = input("Give me a number: ")
while n != 1:
n = collatz(int(n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment