+ 1

How to create a "random number function" in a python?

I want something, the python could create a random number, or many random numbers, which I can use further. How to write such a function ?? P. S. How can I make a random set of letters?

20th Apr 2017, 7:55 AM
Khimich Konstantin
Khimich Konstantin - avatar
2 ответов
+ 4
import random i = random.randint(1, 100) print(i) You could put it in a loop for more output- while x < 10: i = random.randint(1, 100) print(i)
20th Apr 2017, 8:13 AM
Rich Korba
Rich Korba - avatar
+ 2
If you want random letters, use chr() on a random integer out of the appropriate range.
20th Apr 2017, 10:26 AM
Tob
Tob - avatar