1from random import randint
2
3print(randint(1,3))
4
5#Possible Outputs#
6#1
7#2
8#3
1from random import randint
2
3radnom_number = randint(1, 10) # generate random number from 1 to 10. including 10
4
5print(radnom_number)
6
7# Possible outputs
8# 1
9# 2
10# 3
11# 4
12# 5
13# 6
14# 7
15# 8
16# 9
17# 10
1import random
2#random numbers from 1 to 10
3print(random.randint(1,10)) #use of random.randint()
4
5#random word from a list
6print(random.choice(["a","b","c","d","e"])) #use of random.choice()
7
8#random shuffle a list
9random_list = ["a","b","c","d","e"]
10random.shuffle(random_list) #use of random.shuffle()
11print(random_list)
1import random # Imports the random package so that the program has full access to random-based functions
2
3start = 1 # Put your staring value here
4
5end = 8 # Put your ending value here
6
7number = random.randint(start, end) # Calls the randomint function of random to generate a random number
8
9print(number) # Prints the number that was generated above
1# Random number game
2from random import randint
3
4print(randint(1,11))
5
6~~ prints answers from 1 to 10 ~~