Computer Science, asked by sanjanachhabria, 8 months ago

Write a program that rotates the elements of a list so that the element at the first index moves to the second index, the element in the second index moves to the third index, etc., and the element in the last index moves to the first index.

Answers

Answered by prakharagrawal6055
2

Answer:

lst=eval(input("Enter a list:"))

lst1=[lst[-1]]

for i in range(len(lst)-1):

   lst1.append(lst[i])

print("New list after rotating the element to next index is:",lst1)

Explanation:

Answered by niteshrajputs995
0

Answer:

Given below is the answer

Explanation:

l = eval(input("Enter the list: "))

print("Original List")

print(l)

l = l[-1:] + l[:-1]

print("Rotated List")

print(l)

As a replacement for the SETL-inspired ABC programming language, Python was created in the late 1980s[42] by Guido van Rossum at Centrum Wiskunde & Informatica (CWI) in the Netherlands. ABC was able to handle exceptions (from the beginning plus new features in Python 3.11) and interface with the Amoeba operating system. It was put into effect in December 1989. [44] Up until 12 July 2018, when he announced his "permanent vacation" from his duties as Python's "benevolent dictator for life," a title the Python community bestowed upon him to reflect his long-term commitment as the project's chief decision-maker, Van Rossum bore sole responsibility for the project as the lead developer. Active Python core developers chose a five-person Steering Council to oversee the project in January 2019.

See more:

https://brainly.in/question/46847123

#SPJ3

Similar questions