Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python random select no replace

import random

aList = [20, 40, 80, 100, 120]
print ("choosing 3 random items from a list using random.sample() function")
sampled_list = random.sample(aList, 3)
print(sampled_list)
Comment

PREVIOUS NEXT
Code Example
Python :: get all different element of both list python 
Python :: swapping in python 
Python :: pandas add prefix zeros to column values 
Python :: how to define a class in python 
Python :: python index method 
Python :: reversed() python 
Python :: count no of nan in a 2d array python 
Python :: len(sys.argv) == 2 
Python :: django jinja else if template tags 
Python :: soup.find_all attr 
Python :: how to declare global variable in python 
Python :: panda python 
Python :: input function python 
Python :: django bootstrap 
Python :: django charfield force lowercase 
Python :: dict comprehension 
Python :: how to make tkinter look modern 
Python :: loginrequiredmixin django 
Python :: make tkinter text editing disabled 
Python :: comment lister les fichiers un dossier avec python 
Python :: numpy indexing arrays 
Python :: python requests post form data 
Python :: String search from multiple files 
Python :: pandas if python 
Python :: save image to database using pillow django 
Python :: python dictionary comprehensions 
Python :: class indexing 
Python :: intersection python dict 
Python :: manage python environment in jupyterlab 
Python :: python use variable name as variable 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =