Created
November 6, 2022 14:02
-
-
Save KhanMarshaI/2dc385a068deb02ea1194000f80a58a6 to your computer and use it in GitHub Desktop.
A simple password generator which randomly generates an 8 character password.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| def shuffle(string): | |
| tempList = list(string) | |
| random.shuffle(tempList) | |
| return ''.join(tempList) | |
| uppercaseLetter1 = chr(random.randint(65,90)) | |
| uppercaseLetter2 = chr(random.randint(65,90)) | |
| lowercaseLetter1 = chr(random.randint(97,122)) | |
| lowercaseLetter2 = chr(random.randint(97,122)) | |
| digit1 = chr(random.randint(48,57)) | |
| digit2 = chr(random.randint(48,57)) | |
| symbol1 = chr(random.randint(33,47)) | |
| symbol2 = chr(random.randint(33,47)) | |
| password = uppercaseLetter1 + uppercaseLetter2 + lowercaseLetter1 + lowercaseLetter2 + digit1 + digit2 + symbol1 + symbol2 | |
| password = shuffle(password) | |
| print(password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment