Posts

Showing posts from June, 2020

Password Generator in PYTHON

The following is tkinter (python GUI library) built app that generates any random strong password on entering the required length. pyCode:- from tkinter import * import string import random as ra def generate(): length = int(e2.get()) e2.delete(0, END) l = [] password = f"\n Your {length} digit password is: \n" choices = "*@"+string.ascii_letters+string.digits for i in choices: l.append(i) for s in range(length): a = ra.randint(0, 65) password += l[a] e1.insert(INSERT, password) root = Tk() e1 = Text(root, bg = "greenyellow", fg = "red") e2 = Entry(root, bg = "cyan", bd = 3, fg = "yellow") Button(root, text = "generate", command = generate).pack() e2.pack() e1.pack() root.mainloop() Explanation 1. tkinter lib is imported to build GUI 2. string lib is imported to use ASCII letters and digits 3. random module is imported so that any random password of given length could be generated (ra.randint