Last active
April 29, 2016 22:21
-
-
Save hovissimo/3051080c83412fed8775ea8324b0de46 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 get_number() | |
while (!num): # We'll keep trying until num has a value in it | |
try: | |
num = int(input()) # Prompt for a number | |
except ValueError: # If we couldn't make it an int... | |
print("enter an integer") # ... complain | |
return num | |
def collatz_next(n): | |
# return next number after n in the collatz sequence | |
pass | |
def print_collatz_sequence(n): | |
# keep reducing n until you get to 1, printing along the way | |
# this will call collatz_next in a loop of some kind | |
pass | |
def main(): | |
number = get_number() | |
print_collatz_sequence(number) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment