Check out List or use the built-in list
function, the syntax for using list
for typing looks like this: list[T]
.
Complete code following the instructions, so that lines followed by
# expect-type-error
(if any) fail type check, while others can pass.
Hit the "▶️ Run" button to see result.
"""
TODO:
foo should accept a list argument, whose elements are string.
"""
def foo(x):
pass
Stuck? Check out solution
xxxxxxxxxx
foo(["foo", "bar"])
foo(["foo", 1]) # expect-type-error