def get_start_input():
    return eval(input(
        """For sum of squares, type 'squares'. For sum of cubes, type 'cubes'. 
If you would like to raise a number to something other than 'squares' or 'cubes', type 'power'. 
If you would like to exit, type 'exit':"""
        ))

def main_function():
    while True:
        start = get_start_input()
How to recall a function until invalid input?