How do you generate random numbers in Python?
i just want to know...............................
The easiest method to do this is:
import random random.randint(1, 10)
This simply chooses a random number between 1 and 10. You can change the two numbers to whatever you want just remember that the first number is the
minimum and the second number is the
I hope this helped.
The below code will print a random number between 1 and 100 ten times.
# import the 'random' library and it's commands import random # do this 10 times for x in range(10): #print a random number between 1 and 100 print (random.randint(1,101))
Hope I could help!
Please mark this as answered if your problem has been solved.