I'm fairly new to Python and am trying to find a way to generate two separate, random numbers. I'm using a randint with a range of 0 - 100:
(randint(0, 100))
Is there any way possible for a newbie to make a second range or randint?
Also, if you want to make sure you will get 2 different numbers,use the sample
function, and it would return a list:
random.sample(range(0, 101), k=2)
Just call randint(0, 100)
again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.