circular list rotation in python

Description

Python Program to get list size n and n elements of list, rotate the elements of list in left side for m times.
Input:
5
5 7 9 3 1
2
Output:
9 3 1 5 7

Solution

l=list(map(int,input("Enter numbers:").split(" ")))
r=int(input("Roatations?:"))
for i in range(0,r):
    temp=l[0]
    for j in range(0,len(l)-1):
        l[j]=l[j+1]
    l[len(l)-1]=temp
print(l)
        
    


Explanation

repeat the below steps for r times:

store the l[0] in temp
temp=l[0]

move all elements located in 1 to len(l)-1 to its previous location
l[j]=l[j+1]

store the temp in l[len(l)-1]
l[len(l)-1]=temp



Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution