A list is a sequence of objects, separated by commas, the whole enclosed within brackets. The objects can be identified within the list by location within the sequence, specified by an integer called an index. The first index is always zero.
► The objects can be, and often are, referred to as elements of the list; as you note, they are likewise referred to as items in the list.
Thanks - the terminology is really confusing. I’d appreciate if you know a resource or webpage I can read because I’m very confused…
(So items can be strings, are they also variables? Are arguments variables? If those things in dictionaries are keys, are the values attached to them also arguments?)
almost any group of symbols can be a variable (there are a few restrictions - a variable can’t begin with a number, for instance), and when the Python interpreter sees a sequence of symbols not surrounded by quotes, and not a known keyword such as def, it will assume that is a variable. If the variable has never been assigned a value, then an error will be raised:
a
print(a)
'''Output
Traceback (most recent call last):
File "C:\path\to\test.py", line 1, in <module>
a
NameError: name 'a' is not defined
'''
a = 7
print(a)
'''Output
7
'''
If the symbol is surrounded by single or double quotes, it will be interpreted as a string.
Argument is used everywhere in this topic.
In the chapter about functions we learned about arguments and parameters:
Not using the correct terminology only makes it more confusing.
I think this topic needs an update.
“items” here is a parameter not an argument
“numbers” is passed into the function as an argument