Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python shuffle list

import random
number_list = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]
print ("Original list : ",  number_list)

random.shuffle(number_list) #shuffle method
print ("List after shuffle  : ",  number_list)
Comment

python shuffle list with seed

>>> import random
>>> x = [1, 2, 3, 4, 5, 6]
>>> random.Random(4).shuffle(x)
>>> x
[4, 6, 5, 1, 3, 2]
>>> x = [1, 2, 3, 4, 5, 6]
>>> random.Random(4).shuffle(x)
>>> x
[4, 6, 5, 1, 3, 2]
Comment

PREVIOUS NEXT
Code Example
Python :: python opens windows store 
Python :: python replace part in large file 
Python :: how to print all rows in pandas 
Python :: dropping columns in pandas 
Python :: how to convert an image to matrix in python 
Python :: check numpy arrays equal 
Python :: how to test wifi speed py 
Python :: how to draw a bar graph in python 
Python :: selenium zoom out python 
Python :: write number of lines in file python 
Python :: python install bigquery 
Python :: How to set up flash message in html template in flask app 
Python :: python csv read header only 
Python :: get last file in directory python 
Python :: how to check the type of a variable in python 
Python :: grab a href using beuatiful soup 
Python :: python list all files in directory 
Python :: numpy how to calculate variance 
Python :: how to create a loop in python turtle 
Python :: parse first characters from string python 
Python :: update python mac 
Python :: norm complex numpy 
Python :: install qt designer python ubuntu 
Python :: boxplot pandas 
Python :: how to check if a number is a perfect square python 
Python :: link python to python3 
Python :: python get methods of object 
Python :: cyclically rotate an array by one 
Python :: python __gt__ 
Python :: get working directory in python 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =