Like @MegaIng says, when you encounter a syntax error that doesn’t make sense, check the previous lines. In this case, you have an unmatched square backet [
on the previous line (the line beginning with text += Verb[…
). Python doesn’t complain until the next line since a multiline expression inside of []
is perfectly ok (so the missing ]
is not an error), but an assignment operator like +=
inside of an expression is not ok (so encountering text += …
on line 9 is an error).
Note that you have a few other typos as well, like trailing commas that will create unexpected tuples.
In the future, it’s best to post code as formatted text instead of posting screenshots.
P.S. instead of generating list indices with random.randint
, consider using random.choice
.