Wednesday, June 19, 2019

list arrays in python

nameslist = ["Sam", "Lisy", "Pit"]
numberslist = [1, 2, 3.14]
mixedlist = ["ham", 'eggs', 3.14, 5]

and append function in python

a=[0,1,2]
print(a)
a.append(5)
a.append( "Zapzoo")
print(a)

output:



empty array is created like this
x=[]

array with zero initialisation values

y= [0]*10 # array of integers with 10 zero elements
z = [0.0]*20 # array of floats with 20 zero elements




No comments:

Post a Comment

python class topic video