''' Purpose: deepen variable manipulation understanding. Problem: track the number of rabbits over five generations, where the number of rabbits doubles each generation. at the start there are two rabbits ''' # first generation generation = 1 nbr_rabbits = 2 print( 'Generation: ', generation ) print( 'Rabbits: ', nbr_rabbits ) reply = input( 'Enter when ready: ' ) # waits until user enters something # next generation # The value of generation was already assigned a value so # we can modify the value of the variable by saying # hey take the old value and modify it by adding 1 (var = var + 1) generation = generation + 1 # old value(1) + 1 nbr_rabbits = nbr_rabbits * 2 # old value(2) of nbr_rabbits * 2 print( 'Generation: ', generation ) print( 'Rabbits: ', nbr_rabbits ) reply = input( 'Enter when ready: ' ) # waits until user enters something # next generation generation = generation + 1 # old value (2) + 1 nbr_rabbits = nbr_rabbits * 2 # old value of nbr_rabbits (4) * 2 print( 'Generation: ', generation ) print( 'Rabbits: ', nbr_rabbits ) reply = input( 'Enter when ready: ' ) # waits until user enters something # We will cover input a bit later! # next generation generation = generation + 1 # old value (3) + 1 nbr_rabbits = nbr_rabbits * 2 # old value of nbr_rabbits (8) * 2 print( 'Generation: ', generation ) print( 'Rabbits: ', nbr_rabbits ) reply = input( 'Enter when ready: ' ) # waits until user enters something # input statement prints whatever is in the parentheses in the screen # and the user reply is stored as a string in the variable # the input statement is assigned to (reply) # so reply is assigned the string of what the user typed into the # input in the console! # More on this later! # next generation generation = generation + 1 # old value (4) + 1 nbr_rabbits = nbr_rabbits * 2 # old value of nbr_rabbits (16) * 2 print( 'Generation: ', generation ) print( 'Rabbits: ', nbr_rabbits ) print('reply =', reply) # Variables can be anything! You just can't start with a number. # 1variable = 2 # nope! # variable2 = 3 # variable_3 = 4 # andrew = 5 # Remember that snake case is using underscores in long variable # names. this_is_snake_case = 4