random number python
# generate random integer values
from random import randint
value = randint(0, 10)
print(value)
random number python
# generate random integer values
from random import randint
value = randint(0, 10)
print(value)
python random number
from random import randint
print(randint(1,5))
##Possible Outputs##
#1
#2
#3
#4
#5
python list of random values
# To create a list of random integer values:
import random
randomlist = random.sample(range(10, 30), 5)
# Output:
# [16, 19, 13, 18, 15]
# To create a list of random float numbers:
import numpy
random_float_array = numpy.random.uniform(75.5, 125.5, 2)
# Output:
# [107.50697835, 123.84889979]
python function to print random number
import random
n = random.randint(0,22)
print(n)
random number python
import random
num = random.randint(1, 10) # put any number
print(num)
random number python
import random
random_number = random.randrange(10) #random number from 0 to 9
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us