Help with a function please

Hello. This is my first Python app. This function works right through the first two if statements, but seems to return after that, and doesn’t do the other if statements. Thanks in advance!

""" Generate sentence type one """
def sentencetype1():
    rand = random.randint(1,2)
    if rand == 1:
        text = "I want to "
    if rand == 2:
        text = "I "
        verb_choices = random.sample(Verb, 12 + themevector1)
        text = text + random.choice(verb_choices)
        text + " the "
    if random.randint(1,2) == 1:
        adjective_choices = random.sample(Adjective, 12 + themevector1)
        text + random.choice(adjective_choices)
        noun_choices = random.sample(Noun, 12 + themevector1)
        text + random.choice(noun_choices)
    else:
        noun_choices = random.sample(Noun, 12 + themevector1)
        text + random.choice(noun_choices)
    return text

It does do the other ‘if’ statement, it just doesn’t change text because you have text + instead of text +=.

1 Like

that fixed it. Thanks!