Python Tutorial for Beginners [DataTypes] | Lists and Its Properties

Pubblicato il: 20 April 2020
sul canale di: harshal mishra
84
3

Full Playlist :    • Py-Pie Python Tutorial  

Facebook :   / py-pie-python-for-beginners-113344127050954  

Twitter :   / shankar35425457  

'''
Python Lists

append()
insert()
extend()

Index()
Negative Indexing
Remove()
pop()

sort() and reverese()
max() ,min() and len()

'''
a = [1,3,5]

1. Lists Are Ordered
print ([1,3,5] == [5,3,1])

2. Lists Can Contain Arbitrary Objects
a = [1,3,"hello", 4.5]
print(a)

3. List Elements Can Be Accessed by Index
print(a[1])

4. Lists Can Be Nested
b = [a, [2,4,6]]
print(b)

5. Lists Are Mutable
a[2] = "Change"
print(a)

6. Lists Are Dynamic
a.append(4)
print(a)

Adding elements to List

append() , insert() and extend()

a.append(6)
#a.insert(0, "hello")
a.extend([7,8,9])

##Accessing elements from the List

a = [1,3,5]

print(a[-4])

Remove elements fron the lists.

remove() and pop()

a.remove(3)
print(a)

a.pop()
print(a)


max() ,min() and len()
print(len(a))
print(max(a))


In questa pagina del sito puoi guardare il video online Python Tutorial for Beginners [DataTypes] | Lists and Its Properties della durata di ore minuti seconda in buona qualità , che l'utente ha caricato harshal mishra 20 April 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 84 volte e gli è piaciuto 3 spettatori. Buona visione!