Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python list operation

# Creating a List with
# the use of multiple values
List = ["Geeks", "For", "Geeks"]
print("
List containing multiple values: ")
print(List)
  
# Creating a Multi-Dimensional List
# (By Nesting a list inside a List)
List2 = [['Geeks', 'For'], ['Geeks']]
print("
Multi-Dimensional List: ")
print(List2)
  
# accessing a element from the
# list using index number
print("Accessing element from the list")
print(List[0])
print(List[2])
  
# accessing a element using
# negative indexing
print("Accessing element using negative indexing")
      
# print the last element of list
print(List[-1])
      
# print the third last element of list
print(List[-3])
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #list #operation
ADD COMMENT
Topic
Name
1+6 =