What does Sequence[str] do in this program?

Hi. I uploaded arithmetic_arranger.py to my github repository. It’s for a freecodecamp test. I see Sequence[str] at line 54. Pycharm says they are both classes. I googled for info, found nothing. So, Sequence is acting as a function working on str? How does it work? Thanks :slight_smile:

You didn’t provide a link to your code, but Sequence[str] in Python is usually a type hint, also called an annotation. It may be used like this:

def some_function(x: Sequence[str]):
    ...

and it means that you’re supposed to pass a sequence of strings as the x parameter to that function. For instance, Python lists are a type of sequence, so you might want to call that function like some_function(["abc", "xyz"]), but not like some_function([123, 789]).

You may want to take a look at some Python typing guides/tutorials to learn more.

That helps a lot. Thanks :slight_smile: