Answers for "list random python"

5

random from list python

import random

foo = ['a', 'b', 'c', 'd', 'e']
print(random.choice(foo))
Posted by: Guest on March-29-2021
1

python random list

import random
#Generate 5 random numbers between 10 and 30
# sample number needs to be smaller than population
randomlist = random.sample(range(10, 30), 5)
print(randomlist)
Posted by: Guest on December-03-2020
1

python random liste

import random

liste = ["world, HELLO !", "hello world !"]

N = random.choice(liste)

print(N)
Posted by: Guest on January-15-2021

Python Answers by Framework

Browse Popular Code Answers by Language