How to use randint() to generate random integers in Python

2 Answers

0 votes
import random

for i in range(7):          
     print(random.randint(1, 100))




'''
run:

98
9
98
52
67
52
17

'''

 



answered Jun 14, 2019 by avibootz
0 votes
import random

for i in range(7):          
     print(random.randint(-10, 10))




'''
run:

-4
2
4
10
-1
4
9

'''

 



answered Jun 14, 2019 by avibootz

Related questions

...