Answers for "pyhton random"

87

python random

# imports random
import random
# randint generates a random integar between the first parameter and the second
print(random.randint(1, 100))
Posted by: Guest on December-23-2019
18

how to use random in python

import random
print(random.randint(3, 7)) #Prints a random number between 3 and 7
array = [cars, bananas, jet]
print(random.choice(array)) #Prints one of the values in the array at random
Posted by: Guest on March-07-2020
16

python random

#import random 
import random

names = ['Harry', 'John', 'Smith', 'Larry']

#print random name from names
print(random.choice(names))

#print random integer in a range of numbers
print(random.randint(1, 100)
Posted by: Guest on May-30-2020
5

random python

from random import randint
randint(0,5)#0<=randomNumber<=5
Posted by: Guest on January-20-2021
3

python random number

from random import randint

radnom_number = randint(1, 10) # generate random number from 1 to 10. including 10

print(radnom_number)

# Possible outputs
# 1
# 2
# 3
# 4
# 5
# 6
# 7
# 8
# 9
# 10
Posted by: Guest on November-27-2020
4

python random

from random import randint # Import randint from random
print(randint(1,20)) # Gets random number from first parameter to the second
Posted by: Guest on October-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language