samedi 12 novembre 2022

Random password generator using chr function in python

I was searching for this as i had an assignment on it hope it helps i wrote it myslef im new to python but it works:

#RandomPasswordGenerator



import random


def main():
    #random lenght from 8 to 16
        random.randint(8, 16)
var = random.randint(8,16)
print('This is your random password of',var,'characters is:')
#a random number from 33 to 126 for each number in range
for i in range(var):
    num = random.randint(33, 126)
    
    #convert the random num to chr
    letter = chr(num)
    #print the password
    print(letter,end='')



main()

I searched for this specific problem and i didnt find it so here you go




Aucun commentaire:

Enregistrer un commentaire