Python has a set of built-in methods that you can use on strings.
Program code:
Clear Doubts with Computer TutorIn case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in
Output:
Enter a List: 1 2 3 4 Rotated list is:: ['4', '1', '2', '3']
A list is input from user.
The list can be right rotated by shifting its elements to a position next to them which can be accomplished by looping through the list in reverse order.
The last element of the array will become the first element of the rotated array.
Basic python functionality is demonstrated in above program.
To view all the lessons in chapter 1: http://computertutor.in/class-12-computer-science/chapter-2/
To view entire class 12 computer science study material: http://computertutor.in/resources/
You cannot copy content of this page