jeudi 23 mars 2017

How do I use random.randint(1000, 9999) as a function in python

I need to come up with 4 digit pass codes for users of a database at my work and I would like to just press a button, get a random value between 1000 and 9999, and have the program save that number so that it is not output again. I am not going to go through 9000 numbers so the fact that generated values can't appear again isn't a big deal.

How do I make a program that takes a random number between 1000 and 9999 and stores the values it has generated so that they are not used again? As far as generating the random numbers goes, random.randint(x, y) works just fine, I just need to know how to get the display to print to the command prompt or a the file that I write the generated numbers to.




Aucun commentaire:

Enregistrer un commentaire