Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to multi random pick from list python

import random

# Randomly select same sample list every time
alist = [20.5, 40.5, 30.5, 50.5, 70.5]
sample_list = random.sample(alist, 3)
print(sample_list)

# output:
#[40.5, 30.5, 20.5]
Comment

PREVIOUS NEXT
Code Example
Python :: timestamp change python 
Python :: django runserver 
Python :: panda dataframe to list 
Python :: split string in the middle python 
Python :: get current month name python 
Python :: python calculate age from date of birth 
Python :: how to read pdf in python 
Python :: how to increase height of entry in tkinter 
Python :: python screen recorder 
Python :: pygame change color mouse hover 
Python :: pandas groupby as new column 
Python :: python json dump utf8 
Python :: add horizontal line plotly 
Python :: python web3 to wei 
Python :: python for loop jump by 2 
Python :: import forms 
Python :: python import text file 
Python :: How to check how much time elapsed Python 
Python :: wtf forms required 
Python :: mouse in pygame 
Python :: python playsound stop 
Python :: how to install panda3D 
Python :: PySpark get columns with missing values 
Python :: remove column from dataframe 
Python :: python requests.get pdf An appropriate representation of the requested resource could not be found 
Python :: normalize column pandas 
Python :: read image python 
Python :: oddlyspecific09123890183019283 
Python :: python paramiko check ssh connection 
Python :: identity matrix in python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =