Python3 list


  Translation results:

The 3.0 version of Python is often called Python 3000, or Py3k for short. This is a major upgrade compared to earlier versions of Python. In order not to bring too much burden, Python 3.0 was not designed with backward compatibility in mind.

Python3 listsyntax

Sequences are the most basic data structure in Python. Each element in the sequence is assigned a number - its position, or index, with the first index being 0, the second index being 1, and so on.

Python has 6 built-in types for sequences, but the most common are lists and tuples.

Operations that can be performed on sequences include indexing, slicing, adding, multiplying, and checking members.

In addition, Python has built-in methods for determining the length of a sequence and determining the largest and smallest elements.

A list is the most commonly used Python data type, and it can appear as a comma-separated value within square brackets.

The data items of the list do not need to be of the same type

Python3 listexample

#!/usr/bin/python3
 list1 = ['Google', 'Runoob', 1997, 2000];
list2 = [1, 2, 3, 4, 5, 6, 7 ]; 
print ("list1[0]: ", list1[0])
print ("list2[1:5]: ", list2[1:5])

Popular Recommendations

Home

Videos

Q&A