CODING PRACTICE - 20 List Reverse

 List Reverse

List Reverse 
Given a list of words, write a program to reverse the words in the list.

Input

The first line of input will contain space-separated words, denoting the elements of the list.
Output

The output should be a single line containing a list with the elements in reverse order.
Explanation

For example, if the given sentence is the following.
Banana Apple Pomegranate Strawberry Grapes Orange

Your code should print the list by reversing the words in the given sentence. So the output should be
['Orange', 'Grapes', 'Strawberry', 'Pomegranate', 'Apple', 'Banana']
Sample Input 1
Banana Apple Pomegranate Strawberry Grapes Orange
Sample Output 1
['Orange', 'Grapes', 'Strawberry', 'Pomegranate', 'Apple', 'Banana']
Sample Input 2
Cricket Hockey Football Badminton Tennis Basketball Golf Volleyball Archery Boxing
Sample Output 2
['Boxing', 'Archery', 'Volleyball', 'Golf', 'Basketball', 'Tennis', 'Badminton', 'Football', 'Hockey', 'Cricket']


code:

a= input()
w = a.split()
re=w[::-1]
print(re)


Comments

Popular posts from this blog

CODING ASSIGNMENT 3 Library Management

CODING PRACTICE 11 Music Page

CCBP Static Website Coding Assignment 2 Solution | Yoga Page