Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to use the "import random" in-built model in python

import random

movies_list = ['The Godfather', 'The Wizard of Oz', 'Citizen Kane', 'The Shawshank Redemption', 'Pulp Fiction']

# pick a random choice from a list of strings.
movie = random.choice(movies_list)
print(movie)
# Output 'The Shawshank Redemption'


#To make two random selection from the list use the below code
for i in range(2):
    movie = random.choice(movies_list)
    print(movie)
# Output 
# 'Citizen Kane'
# 'The Shawshank Redemption'
Comment

PREVIOUS NEXT
Code Example
Python :: how to select the three highest entries within a category in pandas 
Python :: the most effective search algorithm in python 
Python :: web3.eth.personal.newAccount(password, [callback]) 
Python :: dft numpy amplitude 
Python :: decorrelation of data using PCA 
Python :: NMF cosine similarities 
Python :: how to reference second line of matrix in python 
Python :: how to truncate a float in jinja template 
Python :: convert matlab code to python 
Python :: Customizing multiple plots in the same figure 
Python :: extending the existing user model 
Python :: ansible custom module 
Python :: install mangadex python 
Python :: django wsgi application could not be loaded error importing module 
Python :: ex: git push new local repo 
Python :: Open AI Call 
Python :: Problème determinant algebre lineaire pdf mpsi 
Python :: change between two python 3 version in raspberrry pi 
Python :: python script to recursively scan subdirectories 
Python :: duur wordt voor woorden kennis 
Python :: automation script for paytm coupon 
Python :: houghlinesp python stackoverflow 
Python :: python continue inner for loop 
Python :: how to write a correct python code 
Python :: linux desktop files location python 
Python :: djangobook.com jwd django restfremwork plugin 
Python :: Sorts this RDD, which is assumed to consist of (key, value) pairs 
Python :: python code for calculating probability of random variable 
Python :: importando todo o pacote em python 
Python :: sort dataset date wise in matplotlib 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =