How to make a Random number generator in python?
I’ve been working on a simple game, when it occurred to me:
I don’t know how to make a random number generator in python!
I’ve looked it up, but I cannot figure it out. Does anyone know how to do this?
number = random.ranint(5, 15)
This code will generate a random number between 5 and 15. you can change these two numbers to suit you.
It will also save the selected number under the variable,"number".
you can change this by changing wheere it says number at the start of the code. you can chek the number saved by using this line of code.
again, if instead of using number as your variable, you can change it whenever you like, and put that in the brackets of the print command
Hope this helped :)