Write a function that takes as argument a string containing multiple words and returns a string containing the same words in reverse order.
Eg., input = 'India is a democracy'; output = 'democracy a is India'

It's a very simple in single row:

string='India is a democracy'
print (' '.join([word for word in reversed(string.split(' '))]))
commented: thank u +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.