SlideShare a Scribd company logo
Arrays In Python | Python Array Operations | Edureka
What is an Array?
How to Create an Array in Python?
Is Python List same as an Array?
Basic Array Operations
‱ Finding the length of an Array
‱ Addition
‱ Removal
‱ Concatenation
‱ Slicing
‱ Looping
Accessing Array Elements
www.edureka.co/python
What is an Array?
www.edureka.co/python
What is an Array?
www.edureka.co/python
→ a
a[0] a[1] a[2] a[3
98] a[99]
1 2 3 
 100
Var_Name
Values →
Index →
Basic structure
of an Array:
An array is basically a data structure which can hold more than one value at a
time. It is a collection or ordered series of elements of the same type.
Is Python List same as an Array?
www.edureka.co/python
Is Python List same as an Array?
Python Arrays and lists have the
same way of storing data.
Arrays take only a single data type
elements but lists can have any
type of data.
Therefore, other than a few
operations, the kind of operations
performed on them are different.
www.edureka.co/python
How to create Arrays in Python?
www.edureka.co/python
Arrays in Python can be created after importing the array module.
How to create Arrays in Python?
→ from array import *
USING *
3
→ import array → import array as arr
WITHOUT ALIAS
1 USING ALIAS
2
www.edureka.co/python
Accessing Array Elements www.edureka.co/python
❑ Access elements using index values.
❑ Indexing starts at 0 and not from 1. Hence, the index number is always 1 less than the length
of the array.
❑ Negative index values can be used as well. The point to remember is that negative indexing
starts from the reverse order of traversal i.e from right to left.
www.edureka.co/python
a[2]=3
Example: a[2]=3
Accessing Array Elements
Basic Array Operations www.edureka.co/python
Operations
Removing/ Deleting
elements of an array
Slicing
Looping through an Array
Basic Array Operations
Adding/ Changing
element of an Array
Finding the length of an
Array
Array ConcatenationArray Concatenation
www.edureka.co/python
Finding the length of an Array www.edureka.co/python
❑ Length of an array is the number of elements that are actually present in an array.
❑ You can make use of len() function to achieve this.
❑ The len() function returns an integer value that is equal to the number of elements present in that array.
Finding the length of an Array
www.edureka.co/python
Lengthofanarrayisdeterminedusingthelen()functionasfollows:
Finding the length of an Array
import array as arr
a=arr.array('d', [1.1 , 2.1 ,3.1] )
len(a)
len(array_name)
Output- 3
SYNTAX:
www.edureka.co/python
Adding elements to an Array
www.edureka.co/python
js
Insert()extend()append()
Used when you want to add
a single element at the end
of an array.
Used when you want to add
more than one element at
the end of an array.
Used when you want to add
an element at a specific
position in an array.
Functions used to add elements to an Array:
Adding elements to an Array
www.edureka.co/python
Thecodesnippetbelowimplementstheappend(),extend()andinsert() functions:
Adding elements to an Array
Array a= array('d', [1.1, 2.1, 3.1, 3.4])
Array b= array('d', [2.1, 3.2, 4.6, 4.5,
3.6, 7.2])
Array c=array('d', [1.1, 2.1,3.4, 3.1])
import array as arr
a=arr.array('d', [1.1 , 2.1 ,3.1] )
a.append(3.4)
print("Array a=",a)
b=arr.array('d',[2.1,3.2,4.6])
b.extend([4.5,3.6,7.2])
print("Array b=",b)
c=arr.array( 'd' , [1.1 , 2.1 ,3.1] )
c.insert(2,3.4)
print(“Arrays c=“,c)
OUTPUT-
www.edureka.co/python
Removing elements of an Array www.edureka.co/python
Removing elements of an Array
js
pop() remove()
Used when you want to
remove an element and
return it.
Used when you want to
remove an element with a
specific value without
returning it.
Functions used to remove elements of an Array:
www.edureka.co/python
Thecodesnippetbelowshowshowyoucanremoveelementsusingthesetwofunctions:
import array as arr
a=arr.array('d', [1.1, 2.2, 3.8, 3.1, 3.7])
print(“Popping last element”,a.pop())
print(“Popping 4th element”,a.pop(3))
a.remove(1.1)
print(a)
Popping last element 3.7
Popping 4th element 3.1
array('d', [2.2, 3.8])
OUTPUT-
Removing elements of an Array
www.edureka.co/python
Array Concatenation
www.edureka.co/python
Arrayconcatenation canbedoneasfollowsusingthe+symbol:
Array Concatenation
import array as arr
a=arr.array('d',[1.1 , 2.1 ,3.1,2.6,7.8])
b=arr.array('d',[3.7,8.6])
c=arr.array('d’)
c=a+b
print("Array c = ",c)
Array c= array(‘d’, [1.1, 2.1, 3.1, 2.6,
7.8, 3.7, 8.6])
OUTPUT-
www.edureka.co/python
Slicing an Array
www.edureka.co/python
Slicing an Array
import array as arr
a=arr.array('d',[1.1 , 2.1 ,3.1,2.6,7.8])
print(a[0:3])
OUTPUT -
array(‘d’, [1.1, 2.1, 3.1])
An array can be sliced using the : symbol. This returns a range of elements that we have
specified by the index numbers.
www.edureka.co/python
Looping through an Array
www.edureka.co/python
js
for while
Iterates over the items of an
array specified number of
times.
Iterates over the elements
until a certain condition is met.
We can loop through an array easily using the for and while loops.
Looping through an Array
www.edureka.co/python
Some of the for loop implementations are:
import array as arr
a=arr.array('d', [1.1, 2.2, 3.8, 3.1, 3.7])
print("All values")
for x in a:
print(x)
Allvalues
1.1
2.2
3.8
3.1
3.7
OUTPUT-
Looping through an Array using for loop
www.edureka.co/python
Example for while loop implementation
Looping through an Array using while loop
import array as arr
a=arr.array('d', [1.1, 2.2, 3.8, 3.1, 3.7])
b=0
while b<len(a):
print(a[b])
b=b+1
1.1
2.2
3.8
3.1
3.7
OUTPUT-
www.edureka.co/python
www.edureka.co/python

More Related Content

PDF
Arrays in python
moazamali28
 
PDF
Python programming : Arrays
Emertxe Information Technologies Pvt Ltd
 
PPTX
Python Dictionary.pptx
Sanad Bhowmik
 
PPTX
Basic data structures in python
Celine George
 
PPTX
Python Collections
sachingarg0
 
PDF
Arrays in python
Lifna C.S
 
PDF
List , tuples, dictionaries and regular expressions in python
channa basava
 
Arrays in python
moazamali28
 
Python programming : Arrays
Emertxe Information Technologies Pvt Ltd
 
Python Dictionary.pptx
Sanad Bhowmik
 
Basic data structures in python
Celine George
 
Python Collections
sachingarg0
 
Arrays in python
Lifna C.S
 
List , tuples, dictionaries and regular expressions in python
channa basava
 

What's hot (20)

PPTX
Python Data Structures and Algorithms.pptx
ShreyasLawand
 
PPTX
Data Structures in Python
Devashish Kumar
 
PPTX
Chapter 15 Lists
Praveen M Jigajinni
 
PDF
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
PPTX
Java Stack Data Structure.pptx
vishal choudhary
 
PPTX
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
PPTX
Python dictionary
Mohammed Sikander
 
PPTX
Looping statement in python
RaginiJain21
 
PPTX
Regular expressions in Python
Sujith Kumar
 
PDF
Python exception handling
Mohammed Sikander
 
PDF
Python libraries
Prof. Dr. K. Adisesha
 
PPTX
Python Functions
Mohammed Sikander
 
PPTX
Strings in C
Kamal Acharya
 
PPTX
Arrays in Data Structure and Algorithm
KristinaBorooah
 
PPTX
Arrays in java
Arzath Areeff
 
PDF
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
PPT
Data structures using c
Prof. Dr. K. Adisesha
 
PPTX
Python 3 Programming Language
Tahani Al-Manie
 
PPTX
Python dictionary
Sagar Kumar
 
PPTX
Storage class in C Language
Nitesh Kumar Pandey
 
Python Data Structures and Algorithms.pptx
ShreyasLawand
 
Data Structures in Python
Devashish Kumar
 
Chapter 15 Lists
Praveen M Jigajinni
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
Java Stack Data Structure.pptx
vishal choudhary
 
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
Python dictionary
Mohammed Sikander
 
Looping statement in python
RaginiJain21
 
Regular expressions in Python
Sujith Kumar
 
Python exception handling
Mohammed Sikander
 
Python libraries
Prof. Dr. K. Adisesha
 
Python Functions
Mohammed Sikander
 
Strings in C
Kamal Acharya
 
Arrays in Data Structure and Algorithm
KristinaBorooah
 
Arrays in java
Arzath Areeff
 
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Data structures using c
Prof. Dr. K. Adisesha
 
Python 3 Programming Language
Tahani Al-Manie
 
Python dictionary
Sagar Kumar
 
Storage class in C Language
Nitesh Kumar Pandey
 
Ad

Similar to Arrays In Python | Python Array Operations | Edureka (20)

PPTX
CC-104_Lesson-2_array.pptx. introduction
SARAHJANEMIASCO
 
PPTX
ACP-arrays.pptx
MuhammadSubtain9
 
PPTX
Python array
Arnab Chakraborty
 
PPTX
Array-single dimensional array concept .pptx
SindhuVelmukull
 
PDF
"Automata Basics and Python Applications"
ayeshasiraj34
 
PPTX
An Introduction To Python - Lists, Part 2
Blue Elephant Consulting
 
PPT
ComandosDePython_ComponentesBasicosImpl.ppt
oscarJulianPerdomoCh1
 
PPTX
Brixon Library Technology Initiative
Basil Bibi
 
PPTX
fundamental of python --- vivek singh shekawat
shekhawatasshp
 
PPTX
Arrays Introduction.pptx
AtheenaNugent1
 
PPTX
Python for Beginners
DrRShaliniVISTAS
 
PPTX
lists_list_of_liststuples_of_python.pptx
ShanthiJeyabal
 
PPTX
object oriented programing in python and pip
LakshmiMarineni
 
PPTX
Programming with Python_Unit-3-Notes.pptx
YugandharaNalavade
 
PPTX
Python Dynamic Data type List & Dictionaries
RuchiNagar3
 
PPTX
Python Array Power Point Presentation.pptx
MeowTwo2
 
PDF
List in Python Using Back Developers in Using More Use.
SravaniSravani53
 
PPTX
Introduction To Programming with Python-4
Syed Farjad Zia Zaidi
 
PPTX
In Python, a list is a built-in dynamic sized array. We can store all types o...
Karthik Rohan
 
CC-104_Lesson-2_array.pptx. introduction
SARAHJANEMIASCO
 
ACP-arrays.pptx
MuhammadSubtain9
 
Python array
Arnab Chakraborty
 
Array-single dimensional array concept .pptx
SindhuVelmukull
 
"Automata Basics and Python Applications"
ayeshasiraj34
 
An Introduction To Python - Lists, Part 2
Blue Elephant Consulting
 
ComandosDePython_ComponentesBasicosImpl.ppt
oscarJulianPerdomoCh1
 
Brixon Library Technology Initiative
Basil Bibi
 
fundamental of python --- vivek singh shekawat
shekhawatasshp
 
Arrays Introduction.pptx
AtheenaNugent1
 
Python for Beginners
DrRShaliniVISTAS
 
lists_list_of_liststuples_of_python.pptx
ShanthiJeyabal
 
object oriented programing in python and pip
LakshmiMarineni
 
Programming with Python_Unit-3-Notes.pptx
YugandharaNalavade
 
Python Dynamic Data type List & Dictionaries
RuchiNagar3
 
Python Array Power Point Presentation.pptx
MeowTwo2
 
List in Python Using Back Developers in Using More Use.
SravaniSravani53
 
Introduction To Programming with Python-4
Syed Farjad Zia Zaidi
 
In Python, a list is a built-in dynamic sized array. We can store all types o...
Karthik Rohan
 
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
PDF
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
PDF
Tableau Tutorial for Data Science | Edureka
Edureka!
 
PDF
Python Programming Tutorial | Edureka
Edureka!
 
PDF
Top 5 PMP Certifications | Edureka
Edureka!
 
PDF
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
PDF
Linux Mint Tutorial | Edureka
Edureka!
 
PDF
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
PDF
Importance of Digital Marketing | Edureka
Edureka!
 
PDF
RPA in 2020 | Edureka
Edureka!
 
PDF
Email Notifications in Jenkins | Edureka
Edureka!
 
PDF
EA Algorithm in Machine Learning | Edureka
Edureka!
 
PDF
Cognitive AI Tutorial | Edureka
Edureka!
 
PDF
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
PDF
Blue Prism Top Interview Questions | Edureka
Edureka!
 
PDF
Big Data on AWS Tutorial | Edureka
Edureka!
 
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
PDF
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
PDF
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Edureka!
 

Recently uploaded (20)

PDF
Doc9.....................................
SofiaCollazos
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PPTX
Comunidade Salesforce SĂŁo Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira JĂșnior
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PDF
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Doc9.....................................
SofiaCollazos
 
This slide provides an overview Technology
mineshkharadi333
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
Comunidade Salesforce SĂŁo Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira JĂșnior
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 

Arrays In Python | Python Array Operations | Edureka

  • 2. What is an Array? How to Create an Array in Python? Is Python List same as an Array? Basic Array Operations ‱ Finding the length of an Array ‱ Addition ‱ Removal ‱ Concatenation ‱ Slicing ‱ Looping Accessing Array Elements www.edureka.co/python
  • 3. What is an Array? www.edureka.co/python
  • 4. What is an Array? www.edureka.co/python → a a[0] a[1] a[2] a[3
98] a[99] 1 2 3 
 100 Var_Name Values → Index → Basic structure of an Array: An array is basically a data structure which can hold more than one value at a time. It is a collection or ordered series of elements of the same type.
  • 5. Is Python List same as an Array? www.edureka.co/python
  • 6. Is Python List same as an Array? Python Arrays and lists have the same way of storing data. Arrays take only a single data type elements but lists can have any type of data. Therefore, other than a few operations, the kind of operations performed on them are different. www.edureka.co/python
  • 7. How to create Arrays in Python? www.edureka.co/python
  • 8. Arrays in Python can be created after importing the array module. How to create Arrays in Python? → from array import * USING * 3 → import array → import array as arr WITHOUT ALIAS 1 USING ALIAS 2 www.edureka.co/python
  • 9. Accessing Array Elements www.edureka.co/python
  • 10. ❑ Access elements using index values. ❑ Indexing starts at 0 and not from 1. Hence, the index number is always 1 less than the length of the array. ❑ Negative index values can be used as well. The point to remember is that negative indexing starts from the reverse order of traversal i.e from right to left. www.edureka.co/python a[2]=3 Example: a[2]=3 Accessing Array Elements
  • 11. Basic Array Operations www.edureka.co/python
  • 12. Operations Removing/ Deleting elements of an array Slicing Looping through an Array Basic Array Operations Adding/ Changing element of an Array Finding the length of an Array Array ConcatenationArray Concatenation www.edureka.co/python
  • 13. Finding the length of an Array www.edureka.co/python
  • 14. ❑ Length of an array is the number of elements that are actually present in an array. ❑ You can make use of len() function to achieve this. ❑ The len() function returns an integer value that is equal to the number of elements present in that array. Finding the length of an Array www.edureka.co/python
  • 15. Lengthofanarrayisdeterminedusingthelen()functionasfollows: Finding the length of an Array import array as arr a=arr.array('d', [1.1 , 2.1 ,3.1] ) len(a) len(array_name) Output- 3 SYNTAX: www.edureka.co/python
  • 16. Adding elements to an Array www.edureka.co/python
  • 17. js Insert()extend()append() Used when you want to add a single element at the end of an array. Used when you want to add more than one element at the end of an array. Used when you want to add an element at a specific position in an array. Functions used to add elements to an Array: Adding elements to an Array www.edureka.co/python
  • 18. Thecodesnippetbelowimplementstheappend(),extend()andinsert() functions: Adding elements to an Array Array a= array('d', [1.1, 2.1, 3.1, 3.4]) Array b= array('d', [2.1, 3.2, 4.6, 4.5, 3.6, 7.2]) Array c=array('d', [1.1, 2.1,3.4, 3.1]) import array as arr a=arr.array('d', [1.1 , 2.1 ,3.1] ) a.append(3.4) print("Array a=",a) b=arr.array('d',[2.1,3.2,4.6]) b.extend([4.5,3.6,7.2]) print("Array b=",b) c=arr.array( 'd' , [1.1 , 2.1 ,3.1] ) c.insert(2,3.4) print(“Arrays c=“,c) OUTPUT- www.edureka.co/python
  • 19. Removing elements of an Array www.edureka.co/python
  • 20. Removing elements of an Array js pop() remove() Used when you want to remove an element and return it. Used when you want to remove an element with a specific value without returning it. Functions used to remove elements of an Array: www.edureka.co/python
  • 21. Thecodesnippetbelowshowshowyoucanremoveelementsusingthesetwofunctions: import array as arr a=arr.array('d', [1.1, 2.2, 3.8, 3.1, 3.7]) print(“Popping last element”,a.pop()) print(“Popping 4th element”,a.pop(3)) a.remove(1.1) print(a) Popping last element 3.7 Popping 4th element 3.1 array('d', [2.2, 3.8]) OUTPUT- Removing elements of an Array www.edureka.co/python
  • 23. Arrayconcatenation canbedoneasfollowsusingthe+symbol: Array Concatenation import array as arr a=arr.array('d',[1.1 , 2.1 ,3.1,2.6,7.8]) b=arr.array('d',[3.7,8.6]) c=arr.array('d’) c=a+b print("Array c = ",c) Array c= array(‘d’, [1.1, 2.1, 3.1, 2.6, 7.8, 3.7, 8.6]) OUTPUT- www.edureka.co/python
  • 25. Slicing an Array import array as arr a=arr.array('d',[1.1 , 2.1 ,3.1,2.6,7.8]) print(a[0:3]) OUTPUT - array(‘d’, [1.1, 2.1, 3.1]) An array can be sliced using the : symbol. This returns a range of elements that we have specified by the index numbers. www.edureka.co/python
  • 26. Looping through an Array www.edureka.co/python
  • 27. js for while Iterates over the items of an array specified number of times. Iterates over the elements until a certain condition is met. We can loop through an array easily using the for and while loops. Looping through an Array www.edureka.co/python
  • 28. Some of the for loop implementations are: import array as arr a=arr.array('d', [1.1, 2.2, 3.8, 3.1, 3.7]) print("All values") for x in a: print(x) Allvalues 1.1 2.2 3.8 3.1 3.7 OUTPUT- Looping through an Array using for loop www.edureka.co/python
  • 29. Example for while loop implementation Looping through an Array using while loop import array as arr a=arr.array('d', [1.1, 2.2, 3.8, 3.1, 3.7]) b=0 while b<len(a): print(a[b]) b=b+1 1.1 2.2 3.8 3.1 3.7 OUTPUT- www.edureka.co/python