Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

alphabetical

a=[2,2,4,1]
b=a
a.sort()
// a now points to object [1,2,2,4]
c=sorted(b)
//c and b also points to [1,2,2,4] 
// sort works on array only but sorted also on strings but return array of char
s="sjndk"
print(sorted(s))
// prints ['d', 'j', 'k', 'n', 's']
// sorted also works on list of strings(sorts alphabetically)
Comment

PREVIOUS NEXT
Code Example
Python :: python pop a element by index 
Python :: Python how to use __add__ 
Python :: how to add to beginning of linked list python 
Python :: python defaultdict default value 
Python :: seaborn python 
Python :: bell number python 
Python :: get value of property of object with name python 
Python :: unable to import flask pylint 
Python :: python elementTree tostring write() argument must be str, not bytes 
Python :: string replace in python 
Python :: empty array numpy python 
Python :: python sepia filter 
Python :: Plot kdeplot, lineplot, scatterplot in seaborn 
Python :: how to get wikipedia page link in python 
Python :: impute data by using groupby and transform 
Python :: python n range num list 
Python :: format exponentials python 
Python :: random list 
Python :: least recently used cache 
Python :: encoding character or string to integer in python 
Python :: python get substring 
Python :: tri fusion python code 
Python :: python identify image mode 
Python :: get values from list of dictionaries python 
Python :: turn off yticklabels 
Python :: query first 5 element in django 
Python :: Write a simple python program that adds 2 numbers togethe 
Python :: get dummies pandas 
Python :: rename files in python 
Python :: python counting up and down 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =