Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python left rotation

def rotate(l, n):
    return l[n:] + l[:n]

print(rotate([1, 2, 3, 4, 5], 2))

#output : [3, 4, 5, 1, 2]
Comment

PREVIOUS NEXT
Code Example
Python :: pip tensorflow 
Python :: python sort dictionary by key 
Python :: sha512 python 
Python :: create column for year in dataframe python 
Python :: django check if user is admin 
Python :: merge two series by index 
Python :: python list.peek 
Python :: is there a way to skip the first loop on a for loop python 
Python :: django hash password 
Python :: python logging basicconfig stdout 
Python :: python find index by value 
Python :: python read entire file 
Python :: change dataframe value by index 
Python :: Current date and time or Python Datetime today 
Python :: python classes 
Python :: convert dictionary keys/values to lowercase in python 
Python :: how to insert item last in list python 
Python :: program count the number of occurrences of a letter in a string python 
Python :: df to csv 
Python :: roman to integer python 
Python :: how to run linux command in python 
Python :: pvm python 
Python :: Python Requests Library Post Method 
Python :: python add to file 
Python :: binary to decimal python 
Python :: python convert string to bytes 
Python :: python iterate set 
Python :: drop duplicate index pandas 
Python :: multiclass ROC AUC curve 
Python :: user input python 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =