Skip to content

Commit 003bc91

Browse files
authored
Merge branch 'avinashkranjan:master' into 1580-scrabble
2 parents e166854 + b2a36b2 commit 003bc91

File tree

281 files changed

+158745
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+158745
-21
lines changed

.deepsource.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
version = 1
22

3+
[[analyzers]]
4+
name = "shell"
5+
6+
[[analyzers]]
7+
name = "javascript"
8+
39
[[analyzers]]
410
name = "python"
5-
enabled = true
611

712
[analyzers.meta]
8-
runtime_version = "3.x.x"
9-
10-
[[transformers]]
11-
name = "autopep8"
12-
enabled = true
13+
runtime_version = "3.x.x"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Floating Text Effects
2+
3+
This Python script demonstrates how to create floating text effects. It prints each character of the text with a slight delay, giving the appearance of floating text.
4+
5+
## Installation
6+
7+
1. Clone the repository:
8+
9+
```bash
10+
git clone https://github.com/your-username/repository-name.git
11+
```
12+
13+
2. Navigate to the project directory:
14+
15+
```bash
16+
cd repository-name
17+
```
18+
19+
## Usage
20+
21+
1. Open the Python script in your preferred editor.
22+
23+
2. Customize the text by modifying the `print_floating_text` function calls.
24+
25+
```python
26+
print_floating_text("Hi, I am Shivansh Jain.")
27+
time.sleep(1) # Simulating a delay
28+
print_floating_text("I am a Computer Science student.")
29+
time.sleep(1) # Simulating a delay
30+
print_floating_text("I have added this python script which creates floating text effects.")
31+
time.sleep(1) # Simulating a delay
32+
print_floating_text("I know full stack web development using HTML, CSS, Javascript, Django.")
33+
time.sleep(1) # Simulating a delay
34+
print_floating_text("I like cricket, music and mythology.")
35+
```
36+
37+
3. Adjust the sleep duration in the `print_floating_text` function to control the speed of the floating text.
38+
39+
4. Run the script:
40+
41+
```bash
42+
python script.py
43+
```
44+
45+
## License
46+
47+
This project is licensed under the [MIT License](LICENSE).
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import time
2+
3+
# Function to print floating text
4+
5+
6+
def print_floating_text(text):
7+
for char in text:
8+
print(char, end='', flush=True)
9+
time.sleep(0.05) # Adjust the sleep duration for desired speed
10+
print()
11+
12+
13+
# Installation process
14+
print_floating_text("Hi, I am Shivansh Jain.")
15+
time.sleep(1) # Simulating a delay
16+
print_floating_text("I am a Computer Science student.")
17+
time.sleep(1) # Simulating a delay
18+
print_floating_text(
19+
"I have added this python script which creates floating text effects.")
20+
time.sleep(1) # Simulating a delay
21+
print_floating_text(
22+
"I know full stack web development using HTML, CSS, Javascript, Django.")
23+
time.sleep(1) # Simulating a delay
24+
print_floating_text("I like cricket, music and mythology.")
25+
26+
# Further code execution
27+
print("Continuing with further code execution...")
28+
# ... Rest of the code ...

AI Chat Bot/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# AI Chat Bot
2+
It is an AI Chat bot that makes you use Chat GPT right from your console
3+
4+
# Getting API Key
5+
6+
Subscribe and Use the API Key from the link below
7+
8+
https://rapidapi.com/LightningDev/api/simple-chatgpt-api
9+
10+
# Installation & Run
11+
`pip install -r requirements.txt`
12+
13+
`python main.py`
14+
15+
# Screenshots
16+
![image.png](https://i.postimg.cc/X7cFsqBr/image.png)

AI Chat Bot/main.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import requests
2+
import pyfiglet
3+
import itertools
4+
import threading
5+
import time
6+
import sys
7+
8+
url = "https://simple-chatgpt-api.p.rapidapi.com/ask"
9+
10+
11+
headers = {
12+
"content-type": "application/json",
13+
"X-RapidAPI-Key": "OUR API KEY",
14+
"X-RapidAPI-Host": "simple-chatgpt-api.p.rapidapi.com"
15+
}
16+
17+
def animate():
18+
for c in itertools.cycle(['|', '/', '-', '\\']):
19+
if done:
20+
break
21+
sys.stdout.write('\r' + c)
22+
sys.stdout.flush()
23+
time.sleep(0.1)
24+
25+
# Clear the console output
26+
sys.stdout.write('\r')
27+
sys.stdout.flush()
28+
29+
def ask(question):
30+
payload = { "question": question }
31+
response = requests.post(url, json=payload, headers=headers)
32+
return response.json().get("answer")
33+
34+
if __name__ == "__main__":
35+
print(pyfiglet.figlet_format("AI Chat BOT"))
36+
print("Enter the question to ask:")
37+
print()
38+
while True:
39+
# print("/>> ", end="")
40+
question = str(input(">> "))
41+
if(question == 'q'):
42+
print(">> Bye! Thanks for Using...")
43+
break
44+
# loading
45+
done = False
46+
#here is the animation
47+
t = threading.Thread(target=animate)
48+
t.start()
49+
answer = ask(question)
50+
time.sleep(5)
51+
done = True
52+
t.join()
53+
print(">> ",answer)
54+
print()
55+

AI Chat Bot/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pyfiglet==0.8.post1
2+
Requests==2.31.0
-3.75 KB
Loading
-55.5 KB
Loading
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import tkinter as tk
2+
3+
4+
def convert_temperature():
5+
try:
6+
temperature = float(entry.get())
7+
if var.get() == 0: # Celsius to Fahrenheit
8+
result = temperature * 9/5 + 32
9+
output_label.configure(text=f"{temperature}°C = {result}°F")
10+
elif var.get() == 1: # Fahrenheit to Celsius
11+
result = (temperature - 32) * 5/9
12+
output_label.configure(text=f"{temperature}°F = {result}°C")
13+
except ValueError:
14+
output_label.configure(text="Invalid input")
15+
16+
17+
# Create the main window
18+
window = tk.Tk()
19+
window.title("Temperature Converter")
20+
21+
# Create input label and entry widget
22+
input_label = tk.Label(window, text="Enter temperature:")
23+
input_label.pack()
24+
entry = tk.Entry(window)
25+
entry.pack()
26+
27+
# Create radio buttons for temperature conversion options
28+
var = tk.IntVar()
29+
celsius_to_fahrenheit = tk.Radiobutton(
30+
window, text="Celsius to Fahrenheit", variable=var, value=0)
31+
celsius_to_fahrenheit.pack()
32+
fahrenheit_to_celsius = tk.Radiobutton(
33+
window, text="Fahrenheit to Celsius", variable=var, value=1)
34+
fahrenheit_to_celsius.pack()
35+
36+
# Create convert button
37+
convert_button = tk.Button(window, text="Convert", command=convert_temperature)
38+
convert_button.pack()
39+
40+
# Create output label for displaying result
41+
output_label = tk.Label(window)
42+
output_label.pack()
43+
44+
# Run the main event loop
45+
window.mainloop()

Age_Calculator/Age_Calculator.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from datetime import date
22

3+
34
def calculate_age(birthday):
45
today = date.today()
56

@@ -9,22 +10,23 @@ def calculate_age(birthday):
910

1011
day_check = ((today.month, today.day) < (birthday.month, birthday.day))
1112
year_diff = today.year - birthday.year - day_check
12-
remaining_months = abs((12-birthday.month)+today.month)
13+
remaining_months = abs((12-birthday.month)+today.month)
1314
remaining_days = abs(today.day - birthday.day)
1415

1516
# Return the age as a formatted string
1617
age_string = f"Age: {year_diff} years, {remaining_months} months, and {remaining_days} days"
1718
return age_string
1819

20+
1921
if __name__ == "__main__":
20-
print(" Age Calculator By Python")
21-
22-
try:
23-
birthYear = int(input("Enter the birth year: "))
24-
birthMonth = int(input("Enter the birth month: "))
25-
birthDay = int(input("Enter the birth day: "))
26-
dateOfBirth = date(birthYear, birthMonth, birthDay)
27-
age = calculate_age(dateOfBirth)
28-
print(age)
29-
except ValueError:
30-
print("Invalid input. Please enter valid integers for the year, month, and day.")
22+
print(" Age Calculator By Python")
23+
24+
try:
25+
birthYear = int(input("Enter the birth year: "))
26+
birthMonth = int(input("Enter the birth month: "))
27+
birthDay = int(input("Enter the birth day: "))
28+
dateOfBirth = date(birthYear, birthMonth, birthDay)
29+
age = calculate_age(dateOfBirth)
30+
print(age)
31+
except ValueError:
32+
print("Invalid input. Please enter valid integers for the year, month, and day.")

0 commit comments

Comments
 (0)