Code Monkey home page Code Monkey logo

python-password-generator's Introduction

Python-Password-Generator

#Random Password Generator - by Spiral
#importing modules
import random
import string
#welcome text
print("Hello User, Welcome to Password Generator!\nType help for help\nType generate to generate a password without having to exclude anything\nType exclude to exclude a certain type from password.\nAvailable Items To Be Excluded:\nlowercase\nuppercase\nnumbers\nsymbols")

while True:
    option = input("Enter Option")
    if option in ("help", "generate", "exclude"):
        if option == "help":
            print("Type help to bring this text up again\nType generate to generate a password without having to exclude anything\nType exclude to exclude a certain type from password.\nAvailable Items To Be Excluded:\nlowercase\nuppercase\nnumbers\nsymbols")
        elif option == "generate":
            #password length
            passLength = int(input("Enter Password Length: "))
            #data
            lowercase = string.ascii_lowercase
            uppercase = string.ascii_uppercase
            number = string.digits
            symbol = string.punctuation
            #combine data
            data = lowercase + uppercase + number + symbol
            #generate password
            structure = random.sample(data,passLength)
            password = "".join(structure) 
            print(password)
        elif option == "exclude":
            print("Available Items To Be Excluded:\nlowercase\nuppercase\nnumbers\nsymbols")
            choice = input("Enter What You Want To Be Excluded: ")
            if choice in ("lowercase", "uppercase", "numbers", "symbols"):
                if choice == "lowercase":
                    #password length
                    passLength = int(input("Enter Password Length: "))
                    #data
                    uppercase = string.ascii_uppercase
                    number = string.digits
                    symbol = string.punctuation
                    #combine data
                    data = uppercase + number + symbol
                    #generate password
                    structure = random.sample(data,passLength)
                    password = "".join(structure) 
                    print(password)
                elif choice == "uppercase":
                    #password length
                    passLength = int(input("Enter Password Length: "))
                    #data
                    lowercase = string.ascii_lowercase
                    number = string.digits
                    symbol = string.punctuation
                    #combine data
                    data = lowercase + number + symbol
                    #generate password
                    structure = random.sample(data,passLength)
                    password = "".join(structure) 
                    print(password)
                elif choice == "numbers":
                    #password length
                    passLength = int(input("Enter Password Length: "))
                    #data
                    lowercase = string.ascii_lowercase
                    uppercase = string.ascii_uppercase
                    symbol = string.punctuation
                    #combine data
                    data = lowercase + uppercase + symbol
                    #generate password
                    structure = random.sample(data,passLength)
                    password = "".join(structure) 
                    print(password)
                elif choice == "symbols":
                    #password length
                    passLength = int(input("Enter Password Length: "))
                    #data
                    lowercase = string.ascii_lowercase
                    uppercase = string.ascii_uppercase
                    number = string.digits
                    #combine data
                    data = lowercase + uppercase + number
                    #generate password
                    structure = random.sample(data,passLength)
                    password = "".join(structure) 
                    print(password)
            else:
                print("Invalid Choice")
    else: 
        print("Invalid Option...")  

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.