# Interviews - C# Corner

What is the difference between Python Arrays and lists?
By in onJun 20 2019
• Jul, 2019 15

Both python arrays and list have many simillarities like they both are mutable, i.e. the content of both can be changed

they differ with respect to the following
Python arrays are used when we have to store homogenous type of data
whereas List are used when we need to store hetrogenous kind of data

Example

#Arrayarr=array[(1,2,3),(1,2,3)]#listlist=[1,2,3,4,5,6]

one major differnce between the two can be seen by the following example

from array import arrayif __name__=="__main__":    arr=array([1,2,3,4,5])    list=[1,2,3,4,5] #this will not result into an error print(arr/5)  #this will result into an TypeError: array() argument 1 must be a unicode character, not list print(list/5)

• 0