human
What is a code to reorder the position of the words in alphabetical order and the other steps required given the following:
Reorder the position of the words in alphabetical order | Function to print the ordering of words.
Creating list of words and assigning them index numbers.
Sort the list of words lexicographically.
Print the ordering.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to reorder the position of the words in alphabetical order and the other steps required.
 def reArrange ( words , n ) :
	mp = { }
	for i in range ( n ) :
		mp [ words [ i ] ] = i + 1
	words . sort ( ) ;
	for i in range ( n ) :
		print ( mp [ words [ i ] ] , end = " ▁ " )
words = [ " live " , " place " , " travel " , " word " , " sky " ]
n = len ( words )
reArrange ( words , n ) ;