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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.