14. Problem to print list in reverse order using index slicing.

In this program, we will take a user input as a list & print the list in reverse order using index slicing with the help of the below-given steps.

List in reverse order:

Steps to solve the program
  1. Take a list as input.
  2. Create a variable and assign its value equal to the given list in the reverse order using indexing.
  3. Print the variable to see the output.
				
					#Input list
list1 = [2,4,6,8]

#Creating a variable
list2 = list1[::-1]

#Printing output
print(list2)
				
			

Output :

				
					[8, 6, 4, 2]
				
			

Related Articles

List in the reverse order using while loop

Reverse a list with reversed and reverse methods

Leave a Comment