Array Methods in Python

Arrays are used to store multiple values in one single variable.

Array can be handled in Python by a module named array.

Type codes for different data types:

These codes are used while creating an array.

1 – Creating an Array

Array(data_type, value_list)

2 – Adding Element to Array

Insert() is used to insert one or more data element into an array.

3 – Accessing Element of Array

Use the index operator [ ] to access an item in a array.

4 – Removing Element of Array

Use the pop() to remove items from an array.

Popular Posts

Spread the knowledge
 
  

Leave a Reply

Your email address will not be published. Required fields are marked *