0% found this document useful (0 votes)
3 views3 pages

ECE Applied Python Practice Programs-11-13

The document provides Python programming examples for various data structures and operations, including finding the factorial of a number using recursion, summing an array, and performing matrix addition and multiplication. It explains lists and tuples, highlighting their characteristics and syntax. Additionally, it emphasizes that lists are dynamic arrays while tuples are immutable collections.

Uploaded by

Shanawaz Basha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

ECE Applied Python Practice Programs-11-13

The document provides Python programming examples for various data structures and operations, including finding the factorial of a number using recursion, summing an array, and performing matrix addition and multiplication. It explains lists and tuples, highlighting their characteristics and syntax. Additionally, it emphasizes that lists are dynamic arrays while tuples are immutable collections.

Uploaded by

Shanawaz Basha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Write a Python Program to Find Factorial of Number Using Recursion

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

Write a Python Program to find the Sum of Array Using sum()

Output

S. SHANAWAZ BASHA 11
Write a Python Program to find the Addition of Two Matrices

Output

Write a Python Program to find the Multiplication of Two Matrices

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:

mytuple = ("Hyderabad", "Banglore", "Chennai")

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

You might also like