Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> COURSE = []
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> COURSE = ['PYTHON', 'PERL','ORACLE','MYSQL','BASH']
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> COURSE = ['PYTHON', 'PERL','ORACLE','MYSQL','BASH']
>>> COURSE[2]
'ORACLE'
>>> course[2]
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
course[2]
NameError: name 'course' is not defined
>>> COURSE[-1]
'BASH'
>>> COURSE[-2]
'MYSQL'
>>> COURSE[-3]
'ORACLE'
>>> COURSE[-4]
'PERL'
>>> COURSE[-5]
'PYTHON'
>>>
>>> 'sloba' [4]
'a'
>>> 'sloba' [-4]
'l'
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (2)
Commented:
Although you can address list items numerically, I do not think that there are internal number assignments made. It is a wrong interpretation of "associated".
Author
Commented:Reference : https://docs.python.org/3/glossary.html#term-list
But yes there is a difference. Sequence are to get the items from the order list.