To generate a random number between 1 and 100 in Python, you can use the randint()
function from the built-in random
module. Here's an example:
main.py75 chars5 lines
This code imports the random
module, generates a random integer between 1 and 100 using randint()
, and then prints the randomly generated number to the console.
gistlibby LogSnag