Header Ads

Responsive Ads Here

List Methods

 List Methods



lang = ["Python", "Java", "Javascript", "C++","Java", "C#","Java"]
#count
print(lang.count("Java"))


#reverse
lang.reverse()
print(lang)


#clear
lang.clear()
print(lang)


#copy
l = lang.copy()
l.pop()
print(l)
print(lang)


#sort and sorted funtion
lang.sort()
print(lang)


num = [34,56,21,19,5,78,76]
num.sort()
print(num)
print(sorted(num))
print(num)

print(sorted(num))
print(num)
print(sorted(lang))
print(lang)


Powered by Blogger.