
def get_answer(prompt: str) -> str:
    """Use prompt to ask the user for 'yes' or 'no' answer,
    and continue asking until the user gives a valid response.
    Return the answer.
    
    <no examples because this function involves user input>
    """
    
    # Get some user input with a prompt
    answer = input(prompt)
    
    ### Repeated code below ###
    #if not (answer == 'yes' or answer == 'no'):
        #answer = input(prompt)
        #if not (answer == 'yes' or answer == 'no'):
            #answer = input(prompt)
            #if not (answer == 'yes' or answer == 'no'):
                #answer = input(prompt)
    # ^ Repeated code - bad.  We can put the condition in 
    # a while loop:
    
    while not (answer == 'yes' or answer == 'no'):
        answer = input(prompt)
        
    return answer
    
    
    
    
print(get_answer('Is csc120 your favourite class? '))
print(get_answer('Do you like ice cream? '))
