Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python random choice from list

import random
list = [20, 30, 40, 50 ,60, 70, 80]
sampling = random.choices(list, k=4)      # Choices with repetition
sampling = random.sample(list, k=4)       # Choices without repetition
Comment

python random choice in list

import random

my_list = ["a", "b", "c", "d"]
random_from_list = random.choice(my_list)
Comment

PREVIOUS NEXT
Code Example
Python :: python create folder if not exists 
Python :: how to get rid of all null values in array python 
Python :: plotly hide trace 
Python :: from PyQt5 import Qsci 
Python :: where my python modules 
Python :: get_terminal_sizee python 
Python :: write list of dicts to csv python 
Python :: opencv set window size 
Python :: show a image in python 
Python :: python pearson correlation 
Python :: forbidden (csrf cookie not set.) django rest framework 
Python :: Install Basemap on Python 
Python :: python udp receive 
Python :: python check version 
Python :: hypixel main ip 
Python :: panda check a cell value is not a number 
Python :: How to replace both the diagonals of dataframe with 0 in pandas 
Python :: why men are better than woman 
Python :: clock in python 
Python :: label encode one column pandas 
Python :: python import ndjson data 
Python :: 13 digit timestamp python 
Python :: pandas change every row to df 
Python :: count how many times a value shows in python list 
Python :: python control browse mouse selenium 
Python :: selenium python 
Python :: how to check which python version is installed 
Python :: mode of a column in df 
Python :: remove blank spaces from a list python 
Python :: copy a file from one directroy to other using python 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =