ECE Applied Python Practice Programs-11-13
ECE Applied Python Practice Programs-11-13
Output
Python Arrays
In Python, an array is a data structure used to store a collection of elements, each identified by an index
or a key.
Unlike some other programming languages, Python does not have a built-in array type. Instead, the
most commonly used array-like data structure is the list.
Lists
Lists are used to store multiple items in a single variable. A list in Python is a dynamic array, which
means it can change in size during runtime. Elements in a list can be of different data types, and you can
perform various operations such as adding, removing, or modifying elements. Lists are defined using
square brackets [] and can be indexed and sliced to access specific elements or sublists.
Syntax:
My_list=[1,2,3,4,5]
Example: Output
Output
S. SHANAWAZ BASHA 11
Write a Python Program to find the Addition of Two Matrices
Output
S. SHANAWAZ BASHA 12
Output
Tuple
Tuples are used to store multiple items in a single variable. Tuples are written with round brackets.
Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set,
and Dictionary.
Syntax:
Example
Output
Tuple items are ordered, unchangeable, and allow duplicate values. Tuple items are indexed, the first
item has index [0], the second item has index [1] etc.
To determine how many items a tuple has, use the len() function
Example
Output
S. SHANAWAZ BASHA 13