python program Lists

PHPz
Release: 2024-08-28 18:31:03
Original
991 people have browsed it

python program Lists

mylist create

mylist=["singam","goat","rayyan","leo"]
print(mylist)
print(mylist[2])
mylist[1]="mersal"
print(mylist)
mylist=["singam","goat","raayan"]
mylist.append("mersal")
print(mylist)
mylist=["singam","goat","raayan"]
mylist.insert(1,"Mersal")
print(mylist)
mylist=["singam","goat","rayaan","mersal"]
mylist.remove("singam")
print(mylist)
mylist=["singam","goat","rayaan","mersal"]
for x in mylist:
print(x)
mylist=["singam","goat","rayaan","mersal"]
mylist.sort()
print(mylist)
mylist=["singam","goat","rayaan","mersal"]
mylist.pop()
print(mylist)
o/p
['singam', 'goat', 'rayyan', 'leo']
rayyan
['singam', 'mersal', 'rayyan', 'leo']
['singam', 'goat', 'raayan', 'mersal']
['singam', 'Mersal', 'goat', 'raayan']
['goat', 'rayaan', 'mersal']
singam
goat
rayaan
mersal
['goat', 'mersal', 'rayaan', 'singam']
['singam', 'goat', 'rayaan']

The above is the detailed content of python program Lists. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!