> For the complete documentation index, see [llms.txt](https://digitalgarden.batamladen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://digitalgarden.batamladen.com/notes/programming/python/examples-projects/password-generator.md).

# Password Generator

define character length, symbols and nbers for a password generator, and it tells you if it is a good password.

{% tabs %}
{% tab title="main.py" %}

```python
import random

print("Welcome to the Password Generator!")

letters_number = int(input("What length do you want your password to be?: "))
symbols_number = int(input("How many symbols would you like in your password?: "))
numbers_number = int(input("How many numbers would you like in your password?: "))

letters = ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd',
           'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm']

symbols = ['!', '@', '#', '%', '^', '&', '*', '(', ')',
           '_', '-', '/', '*', '+', '~', '`']

numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']

#add upercase
def password_strength():

    if letters_number <= 5:
        print("Password Strength: Weak")

    if letters_number > 5  and symbols_number < 1 and numbers_number > 0:
        print("Password Strength: Medium")

    if letters_number >= 7 and symbols_number > 0 and numbers_number >= 2:
        print("Password Strength: Strong")


slice_end = (symbols_number + numbers_number)

password = []

for i in range(letters_number):
    password.append(random.choice(letters))

for j in range(symbols_number):
    password.append(random.choice(symbols))

for k in range(numbers_number):
    password.append(random.choice(numbers))

del password[0:slice_end]
random.shuffle(password)

final_password = ''.join(password)
print("\nFinal Password: " + final_password)


if symbols_number > letters_number:
    print("Error: Amount of desired symbols greather than password length")
if numbers_number > letters_number:
    print("Error: Amount of desired numbers greather than password length")
if numbers_number > (letters_number - symbols_number):
    print("Error: Desired password length: ", letters_number, ", amount of desired symbols and numbers:", (symbols_number + numbers_number))
#add "very strong" if user wants uppercase leeters with the symbols and numbers

password_strength()
```

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://digitalgarden.batamladen.com/notes/programming/python/examples-projects/password-generator.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
