Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5c64a71
Added new feature in the existing GST calculator
tanujbordikar Aug 4, 2023
0b9e78c
Added new feature in the existing GST calculator
tanujbordikar Aug 4, 2023
2cffc8f
Improved the calculator by using tkinter
tanujbordikar Aug 4, 2023
0ad6ecc
added the screenshot with tkinter gui and also created a new document…
tanujbordikar Aug 5, 2023
369dcbe
added techCrunch.py
Mihan786Chistie Aug 5, 2023
af89634
updated techCrunch.py
Mihan786Chistie Aug 5, 2023
f1ae4ed
updated techCrunch.py
Mihan786Chistie Aug 5, 2023
58c7c6d
added README.md
Mihan786Chistie Aug 5, 2023
3f15a8f
updated techCrunch.py
Mihan786Chistie Aug 5, 2023
2dc2121
added requirements.txt
Mihan786Chistie Aug 5, 2023
e5d8c91
Pixel Art Generator Script Added
andoriyaprashant Aug 5, 2023
eeda4e1
Lint Fix
andoriyaprashant Aug 5, 2023
ac34009
culturally-inspired names imaginary
Swapnil-2503 Aug 5, 2023
66af624
morphological transformations
invigorzz313 Aug 5, 2023
31a905e
Infinite Runner with Obstacles Script Added
andoriyaprashant Aug 5, 2023
46c36bf
Gomoku_game.py
Shikhar9425 Aug 6, 2023
ac814f2
README.md
Shikhar9425 Aug 6, 2023
0171cee
Adding code, README file
MrResilient Aug 8, 2023
2328db2
Adding code, README file
MrResilient Aug 8, 2023
8a9853c
Merge branch 'cont1' of https://github.com/Shivansh-Jain-github/Amazi…
MrResilient Aug 8, 2023
eec9f8b
Merge pull request #2687 from Shivansh-Jain-github/master
1e9abhi1e10 Aug 8, 2023
14d473a
Merge pull request #2686 from Shivansh-Jain-github/cont1
1e9abhi1e10 Aug 8, 2023
a741426
Completed payment receipt project
Yashika-Agrawal Aug 8, 2023
2d2d94b
Merge pull request #2691 from Yashika-Agrawal/Payment
1e9abhi1e10 Aug 8, 2023
3250119
Adding code, README.md file
MrResilient Aug 8, 2023
84f20e8
Adding code, README.md file
MrResilient Aug 8, 2023
83f766a
Add commit
MrResilient Aug 8, 2023
51cf405
Delete
MrResilient Aug 8, 2023
fabfd2c
delete
MrResilient Aug 8, 2023
034c8d4
Merge pull request #2696 from Shivansh-Jain-github/CONT1
1e9abhi1e10 Aug 8, 2023
42b6943
Merge pull request #2695 from Shivansh-Jain-github/cont1
1e9abhi1e10 Aug 8, 2023
2efacbb
Merge pull request #2668 from Shikhar9425/master-8
1e9abhi1e10 Aug 8, 2023
57fe6d4
Merge pull request #2639 from Swapnil-2503/culturally-inspired-names
1e9abhi1e10 Aug 8, 2023
bfb1e89
Merge pull request #2635 from Mihan786Chistie/techCrunch
1e9abhi1e10 Aug 8, 2023
b25ce3d
Merge pull request #2650 from andoriyaprashant/branch28
1e9abhi1e10 Aug 8, 2023
a9dee15
Merge pull request #2637 from andoriyaprashant/branch27
1e9abhi1e10 Aug 8, 2023
8890205
Merge pull request #2640 from invigorzz313/morphtransforms
1e9abhi1e10 Aug 8, 2023
148eaea
Merge pull request #2631 from tanujbordikar/screenshot
1e9abhi1e10 Aug 8, 2023
4d01156
True False Automation
MrResilient Aug 8, 2023
c58725c
WhatsApp_timer_messenger code
MrResilient Aug 8, 2023
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
69 changes: 69 additions & 0 deletions Brain Teaser Game/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Brain Teaser Game

This repository contains a simple brain teaser game implemented in Python. The game presents a series of brain teasers, and the player must provide answers to each one. If the player's answer matches the correct answer, they score a point. The game is a fun way to challenge your brain and test your lateral thinking skills.

## How to Play

1. Clone this repository to your local machine:

```bash
git clone https://github.com/your-username/brain-teaser-game.git
```

2. Navigate to the repository's directory:

```bash
cd brain-teaser-game
```

3. Run the game using your Python interpreter:

```bash
python brain_teaser_game.py
```

4. The game will present you with a series of brain teasers, and you'll be prompted to provide your answers. Answer as many questions as you can to score points.

## Brain Teasers Included

The game includes the following brain teasers:

1. "I speak without a mouth and hear without ears. I have no body, but I come alive with the wind. What am I?"
- Correct Answer: an echo

2. "What comes once in a minute, twice in a moment, but never in a thousand years?"
- Correct Answer: the letter 'm'

3. "The more you take, the more you leave behind. What am I?"
- Correct Answer: footsteps

4. "What has keys but can't open locks?"
- Correct Answer: a piano

5. "You see a boat filled with people. It has not sunk, but when you look again you don’t see a single person on the boat. Why?"
- Correct Answer: all the people were married

## Gameplay Example

```
Welcome to the Brain Teaser Game!
Try to answer the following brain teasers:

Question: I speak without a mouth and hear without ears. I have no body, but I come alive with the wind. What am I?
Your Answer: wind
Sorry, the correct answer is 'an echo'.

Question: What comes once in a minute, twice in a moment, but never in a thousand years?
Your Answer: m
Correct!

Question: The more you take, the more you leave behind. What am I?
Your Answer: time
Sorry, the correct answer is 'footsteps'.

Game Over! Your final score: 1
```

## Customization

Feel free to customize the `brain_teasers` list by adding more brain teasers or changing the questions and answers. You can enhance the game further by adding features like a timer, different difficulty levels, or a graphical user interface (GUI).
32 changes: 32 additions & 0 deletions Brain Teaser Game/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import random

# Define a list of brain teasers as tuples (question, answer)
brain_teasers = [
("I speak without a mouth and hear without ears. I have no body, but I come alive with the wind. What am I?", "an echo"),
("What comes once in a minute, twice in a moment, but never in a thousand years?", "the letter 'm'"),
("The more you take, the more you leave behind. What am I?", "footsteps"),
("What has keys but can't open locks?", "a piano"),
("You see a boat filled with people. It has not sunk, but when you look again you don’t see a single person on the boat. Why?", "all the people were married"),
]

def play_game():
score = 0
random.shuffle(brain_teasers) # Shuffle the brain teasers for a random order

print("Welcome to the Brain Teaser Game!")
print("Try to answer the following brain teasers:\n")

for question, answer in brain_teasers:
print("Question:", question)
player_answer = input("Your Answer: ").lower()

if player_answer == answer:
print("Correct!\n")
score += 1
else:
print(f"Sorry, the correct answer is '{answer}'.\n")

print("Game Over! Your final score:", score)

if __name__ == "__main__":
play_game()
61 changes: 61 additions & 0 deletions ChatBot using OpenAI API/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

```markdown
# OpenAI Chatbot Example

This repository contains examples of using the OpenAI GPT-3 model to create a chatbot that can hold conversations with users.

## Prerequisites

- OpenAI Python Package (`openai`)
- `requests` library (for Method 2)

You can install the required libraries using the following commands:

```bash
pip install openai requests
```

## Method 1 - Using OpenAI Python Package

This method demonstrates how to use the OpenAI Python package to create a chatbot using the `gpt-3.5-turbo` model.

The code provided in the repository (`method_1_openai_package.py`) includes:

- Setting up the OpenAI API key.
- Initiating a conversation with a system message.
- Taking user inputs and generating replies using the chatbot.
- Displaying the chat history.

## Method 2 - Using API Endpoint

This method demonstrates how to interact with the OpenAI API directly using HTTP requests.

The code provided in the repository (`method_2_api_endpoint.py`) includes:

- Defining the API endpoint URL.
- Creating a payload with user inputs and other parameters.
- Sending a POST request to the API endpoint.
- Extracting and displaying the generated response.

## Usage

1. Set up your OpenAI API key by replacing `'sk-'` in the code with your actual API key.

2. Choose the method you want to use (Method 1 or Method 2).

3. Run the selected script using a Python interpreter:

```bash
python method_1_openai_package.py
```
or
```bash
python method_2_api_endpoint.py
```

4. Observe the interaction with the chatbot and the generated responses.

## Notes

- Make sure to review the OpenAI API documentation for more information on available models, parameters, and best practices.

90 changes: 90 additions & 0 deletions ChatBot using OpenAI API/script1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"\n",
"!pip install -q openai"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"\n",
"import openai"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"\n",
"openai.api_key = 'sk-'"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"\n",
"messages = [\n",
" {\"role\": \"system\", \"content\": \"You are a kind helpful assistant.\"},\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"while True:\n",
" message = input(\"User : \")\n",
" if message:\n",
" messages.append(\n",
" {\"role\": \"user\", \"content\": message},\n",
" )\n",
" chat = openai.ChatCompletion.create(\n",
" model=\"gpt-3.5-turbo\", messages=messages\n",
" )\n",
" \n",
" reply = chat.choices[0].message.content\n",
" print(f\"ChatGPT: {reply}\")\n",
" messages.append({\"role\": \"assistant\", \"content\": reply})\n",
" "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
96 changes: 96 additions & 0 deletions ChatBot using OpenAI API/script2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'openai' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[1], line 18\u001b[0m\n\u001b[0;32m 3\u001b[0m URL \u001b[39m=\u001b[39m \u001b[39m\"\u001b[39m\u001b[39mhttps://api.openai.com/v1/chat/completions\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 5\u001b[0m payload \u001b[39m=\u001b[39m {\n\u001b[0;32m 6\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mmodel\u001b[39m\u001b[39m\"\u001b[39m: \u001b[39m\"\u001b[39m\u001b[39mgpt-3.5-turbo\u001b[39m\u001b[39m\"\u001b[39m,\n\u001b[0;32m 7\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mmessages\u001b[39m\u001b[39m\"\u001b[39m: [{\u001b[39m\"\u001b[39m\u001b[39mrole\u001b[39m\u001b[39m\"\u001b[39m: \u001b[39m\"\u001b[39m\u001b[39muser\u001b[39m\u001b[39m\"\u001b[39m, \u001b[39m\"\u001b[39m\u001b[39mcontent\u001b[39m\u001b[39m\"\u001b[39m: \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mWhat is the first computer in the world?\u001b[39m\u001b[39m\"\u001b[39m}],\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 13\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mfrequency_penalty\u001b[39m\u001b[39m\"\u001b[39m:\u001b[39m0\u001b[39m,\n\u001b[0;32m 14\u001b[0m }\n\u001b[0;32m 16\u001b[0m headers \u001b[39m=\u001b[39m {\n\u001b[0;32m 17\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mContent-Type\u001b[39m\u001b[39m\"\u001b[39m: \u001b[39m\"\u001b[39m\u001b[39mapplication/json\u001b[39m\u001b[39m\"\u001b[39m,\n\u001b[1;32m---> 18\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mAuthorization\u001b[39m\u001b[39m\"\u001b[39m: \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mBearer \u001b[39m\u001b[39m{\u001b[39;00mopenai\u001b[39m.\u001b[39mapi_key\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m\n\u001b[0;32m 19\u001b[0m }\n\u001b[0;32m 21\u001b[0m response \u001b[39m=\u001b[39m requests\u001b[39m.\u001b[39mpost(URL, headers\u001b[39m=\u001b[39mheaders, json\u001b[39m=\u001b[39mpayload, stream\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m)\n",
"\u001b[1;31mNameError\u001b[0m: name 'openai' is not defined"
]
}
],
"source": [
"import requests\n",
"\n",
"URL = \"https://api.openai.com/v1/chat/completions\"\n",
"\n",
"payload = {\n",
"\"model\": \"gpt-3.5-turbo\",\n",
"\"messages\": [{\"role\": \"user\", \"content\": f\"What is the first computer in the world?\"}],\n",
"\"temperature\" : 1.0,\n",
"\"top_p\":1.0,\n",
"\"n\" : 1,\n",
"\"stream\": False,\n",
"\"presence_penalty\":0,\n",
"\"frequency_penalty\":0,\n",
"}\n",
"\n",
"headers = {\n",
"\"Content-Type\": \"application/json\",\n",
"\"Authorization\": f\"Bearer {openai.api_key}\"\n",
"}\n",
"\n",
"response = requests.post(URL, headers=headers, json=payload, stream=False)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'response' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[2], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m response\u001b[39m.\u001b[39mcontent\n",
"\u001b[1;31mNameError\u001b[0m: name 'response' is not defined"
]
}
],
"source": [
"\n",
"response.content"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading