Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Few Mini Projects from my side #297

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# AdvanceRandomPasswordGenerator.py

import random
import string

def generatePassword(length: int, include_symbols: bool, min_alpha: int, min_num: int, min_sym: int) -> str:
"""Generate a random password based on user specifications."""
if length < min_alpha + min_num + min_sym:
raise ValueError("Password length must be at least the sum of minimum alpha, number, and symbol requirements.")

characters = string.ascii_letters + string.digits
# symbols = string.punctuation if include_symbols else ''
# print(f"symbols: {symbols} {type(symbols)}")

symbols = """!#$%&()*+-/:<=>?@[\]^_~""" if include_symbols else ''
characters += symbols

password = []
password.extend(random.choices(string.ascii_letters, k=min_alpha))
password.extend(random.choices(string.digits, k=min_num))
password.extend(random.choices(symbols, k=min_sym))

remaining_length = length - len(password)
password.extend(random.choices(characters, k=remaining_length))

random.shuffle(password) # Shuffle to ensure random distribution of character types

return ''.join(password)

def main():
"""Run the password generator application."""
try:
include_symbols = input("Include symbols? (y/n): ").strip().lower() == 'y'
length = int(input("Enter the password length: ").strip())
min_alpha = int(input("Enter minimum number of alphabets: ").strip())
min_num = int(input("Enter minimum number of numbers: ").strip())
min_sym = int(input("Enter minimum number of symbols: ").strip())

password = generatePassword(length, include_symbols, min_alpha, min_num, min_sym)
print(f"Generated Password: {password}")

except ValueError as e:
print(f"Error: {e}")

if __name__ == "__main__":
main()
34 changes: 34 additions & 0 deletions Advance_Random_Password_Generator/READEME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
![Star Badge](https://img.shields.io/static/v1?label=%F0%9F%8C%9F&message=If%20Useful&style=style=flat&color=BC4E99)

![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)

# Advance Random Password Generator

## 🛠️ Description

This script generates a random, secure password based on user specifications. It allows you to specify the length of the password, whether to include symbols, and the minimum number of alphabets, numbers, and symbols required. The generated password is randomly shuffled to ensure a secure distribution of character types.

## ⚙️ Languages or Frameworks Used
- Python

## 🌟 How to Run

1. Clone or download the repository.
2. Open the file `AdvanceRandomPasswordGenerator.py` in your Python IDE or text editor.
3. Run the script.
4. Follow the prompts to input your specifications for the password.

### Example Usage:

```bash
Include symbols? (y/n): y
Enter the password length: 12
Enter minimum number of alphabets: 4
Enter minimum number of numbers: 3
Enter minimum number of symbols: 2
```

This will generate a password that meets the specified criteria.

## 🤖 Author
[AtharvaPawar456](https://github.com/AtharvaPawar456)
25 changes: 25 additions & 0 deletions Chatbot with Basic Responses/ChatbotwithBasicResponses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import json

def loadResponses(filePath):
"""Load chatbot responses from a JSON file."""
try:
with open(filePath, 'r') as file:
return json.load(file)
except (FileNotFoundError, json.JSONDecodeError) as e:
print(f"Error loading responses: {e}")
return []

def chatbotResponse(userInput, responses):
"""Return a predefined response based on user input."""
responseDict = {entry["input"]: entry["response"] for entry in responses}
return responseDict.get(userInput.lower(), "I'm sorry, I don't understand.")

if __name__ == "__main__":
responses = loadResponses("chats.json")
if responses:
while True:
userInput = input("You: ")
if userInput.lower() == "bye":
print("Bot: Goodbye! Have a great day!")
break
print(f"Bot: {chatbotResponse(userInput, responses)}")
40 changes: 40 additions & 0 deletions Chatbot with Basic Responses/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
![Star Badge](https://img.shields.io/static/v1?label=%F0%9F%8C%9F&message=If%20Useful&style=style=flat&color=BC4E99)

![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)

# Chatbot with Basic Responses

## 🛠️ Description

This is a simple chatbot that provides predefined responses based on user input. It reads possible inputs and corresponding responses from a JSON file, and can handle basic conversational interactions. If the user input doesn't match any predefined options, the chatbot will respond with a default message.

## ⚙️ Languages or Frameworks Used
- Python
- JSON

## 🌟 How to Run

1. Clone or download the repository.
2. Create a JSON file named `chats.json` containing predefined inputs and responses.
3. Open the file `chatbot.py` in your Python IDE or text editor.
4. Run the script.
5. Start chatting with the bot. To exit, type "bye".

### Example `chats.json` format:

```json
[
{"input": "hello", "response": "Hello! How can I assist you today?"},
{"input": "how are you?", "response": "I'm just a program, so I don't have feelings, but thanks for asking!"}
]
```

### Example Usage:

- **You:** hello
- **Bot:** Hello! How can I assist you today?
- **You:** bye
- **Bot:** Goodbye! Have a great day!

## 🤖 Author
[AtharvaPawar456](https://github.com/AtharvaPawar456)
Loading