Python Forum

Full Version: list and operator *
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi
I saw the below snippet cod in a quiz on the net:
my_list=[1,2,3]
print(my_list*3)
print(3*my_list)
in that quiz, the output of line 2 had been required.
my question:
how can I know that an operator such as(+,*,- or /) can be used with a type( as string, list, tuple,...) and what is the result of it?
thanks
Here: https://docs.python.org/3/library/stdtyp...uple-range

How I navigate through the Docs to find this information:
Python 3.12.2 documentation » Library Reference » Built-in Types » Sequence Types — list, tuple, range