Skip to content

Commit cae90db

Browse files
Merge branch 'geekcomputers:master' into testing
2 parents 4f65a3c + 2731d2e commit cae90db

26 files changed

+552
-55
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
numpy==1.26.2
1+
numpy==1.26.4
22
opencv_python==4.9.0.80
33
mediapipe==0.10.9

Laundary System/README.md

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Laundry Service Class
2+
3+
## Overview
4+
The LaundryService class is designed to manage customer details and calculate charges for a cloth and apparel cleaning service. It provides methods to create customer-specific instances, print customer details, calculate charges based on cloth type, branding, and season, and print final details including the expected day of return.
5+
6+
## Class Structure
7+
### Methods
8+
1. `__init__(name, contact, email, cloth_type, branded, season)`: Initializes a new customer instance with the provided details and assigns a unique customer ID.
9+
- Parameters:
10+
- `name`: String, name of the customer.
11+
- `contact`: Numeric (integer), contact number of the customer.
12+
- `email`: Alphanumeric (string), email address of the customer.
13+
- `cloth_type`: String, type of cloth deposited (Cotton, Silk, Woolen, or Polyester).
14+
- `branded`: Boolean (0 or 1), indicating whether the cloth is branded.
15+
- `season`: String, season when the cloth is deposited (Summer or Winter).
16+
17+
2. `customerDetails()`: Prints out the details of the customer, including name, contact number, email, cloth type, and whether the cloth is branded.
18+
19+
3. `calculateCharge()`: Calculates the charge based on the type of cloth, branding, and season.
20+
- Returns:
21+
- Numeric, total charge for cleaning the cloth.
22+
23+
4. `finalDetails()`: Calls `customerDetails()` and `calculateCharge()` methods within itself and prints the total charge and the expected day of return.
24+
- Prints:
25+
- Total charge in Rupees.
26+
- Expected day of return (4 days if total charge > 200, otherwise 7 days).
27+
28+
## Example Usage
29+
```python
30+
# Example usage:
31+
name = input("Enter customer name: ")
32+
contact = int(input("Enter contact number: "))
33+
email = input("Enter email address: ")
34+
cloth_type = input("Enter cloth type (Cotton/Silk/Woolen/Polyester): ")
35+
branded = bool(int(input("Is the cloth branded? (Enter 0 for No, 1 for Yes): ")))
36+
season = input("Enter season (Summer/Winter): ")
37+
38+
customer = LaundryService(name, contact, email, cloth_type, branded, season)
39+
customer.finalDetails()
40+
41+
42+
markdown
43+
Copy code
44+
# Laundry Service Class
45+
46+
## Overview
47+
The LaundryService class is designed to manage customer details and calculate charges for a cloth and apparel cleaning service. It provides methods to create customer-specific instances, print customer details, calculate charges based on cloth type, branding, and season, and print final details including the expected day of return.
48+
49+
## Class Structure
50+
### Methods
51+
1. `__init__(name, contact, email, cloth_type, branded, season)`: Initializes a new customer instance with the provided details and assigns a unique customer ID.
52+
- Parameters:
53+
- `name`: String, name of the customer.
54+
- `contact`: Numeric (integer), contact number of the customer.
55+
- `email`: Alphanumeric (string), email address of the customer.
56+
- `cloth_type`: String, type of cloth deposited (Cotton, Silk, Woolen, or Polyester).
57+
- `branded`: Boolean (0 or 1), indicating whether the cloth is branded.
58+
- `season`: String, season when the cloth is deposited (Summer or Winter).
59+
60+
2. `customerDetails()`: Prints out the details of the customer, including name, contact number, email, cloth type, and whether the cloth is branded.
61+
62+
3. `calculateCharge()`: Calculates the charge based on the type of cloth, branding, and season.
63+
- Returns:
64+
- Numeric, total charge for cleaning the cloth.
65+
66+
4. `finalDetails()`: Calls `customerDetails()` and `calculateCharge()` methods within itself and prints the total charge and the expected day of return.
67+
- Prints:
68+
- Total charge in Rupees.
69+
- Expected day of return (4 days if total charge > 200, otherwise 7 days).
70+
71+
## Example Usage
72+
```python
73+
# Example usage:
74+
name = input("Enter customer name: ")
75+
contact = int(input("Enter contact number: "))
76+
email = input("Enter email address: ")
77+
cloth_type = input("Enter cloth type (Cotton/Silk/Woolen/Polyester): ")
78+
branded = bool(int(input("Is the cloth branded? (Enter 0 for No, 1 for Yes): ")))
79+
season = input("Enter season (Summer/Winter): ")
80+
81+
customer = LaundryService(name, contact, email, cloth_type, branded, season)
82+
customer.finalDetails()
83+
Usage Instructions
84+
Create an instance of the LaundryService class by providing customer details as parameters to the constructor.
85+
Use the finalDetails() method to print the customer details along with the calculated charge and expected day of return.
86+
87+
88+
Contributors
89+
(Rohit Raj)[https://github.com/MrCodYrohit]
90+
91+

Laundary System/code.py

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
id=1
2+
class LaundryService:
3+
def __init__(self,Name_of_customer,Contact_of_customer,Email,Type_of_cloth,Branded,Season,id):
4+
self.Name_of_customer=Name_of_customer
5+
self.Contact_of_customer=Contact_of_customer
6+
self.Email=Email
7+
self.Type_of_cloth=Type_of_cloth
8+
self.Branded=Branded
9+
self.Season=Season
10+
self.id=id
11+
12+
def customerDetails(self):
13+
print("The Specific Details of customer:")
14+
print("customer ID: ",self.id)
15+
print("customer name:", self.Name_of_customer)
16+
print("customer contact no. :", self.Contact_of_customer)
17+
print("customer email:", self.Email)
18+
print("type of cloth", self.Type_of_cloth)
19+
if self.Branded == 1:
20+
a=True
21+
else:
22+
a=False
23+
print("Branded", a)
24+
def calculateCharge(self):
25+
a=0
26+
if self.Type_of_cloth=="Cotton":
27+
a=50.0
28+
elif self.Type_of_cloth=="Silk":
29+
a=30.0
30+
elif self.Type_of_cloth=="Woolen":
31+
a=90.0
32+
elif self.Type_of_cloth=="Polyester":
33+
a=20.0
34+
if self.Branded==1:
35+
a=1.5*(a)
36+
else:
37+
pass
38+
if self.Season=="Winter":
39+
a=0.5*a
40+
else:
41+
a=2*a
42+
print(a)
43+
return a
44+
def finalDetails(self):
45+
self.customerDetails()
46+
print("Final charge:",end="")
47+
if self.calculateCharge() >200:
48+
print("to be return in 4 days")
49+
else:
50+
print("to be return in 7 days")
51+
while True:
52+
name=input("Enter the name: ")
53+
contact=int(input("Enter the contact: "))
54+
email=input("Enter the email: ")
55+
cloth=input("Enter the type of cloth: ")
56+
brand=bool(input("Branded ? "))
57+
season=input("Enter the season: ")
58+
obj=LaundryService(name,contact,email,cloth,brand,season,id)
59+
obj.finalDetails()
60+
id=id+1
61+
z=input("Do you want to continue(Y/N):")
62+
if z=="Y":
63+
continue
64+
elif z =="N":
65+
print("Thanks for visiting!")
66+
break
67+
else:
68+
print("Select valid option")
69+
70+
71+
72+
73+
74+
75+

News_App/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
solara == 1.25.0
1+
solara == 1.32.1
22
Flask
3-
gunicorn ==21.2.0
3+
gunicorn ==22.0.0
44
simple-websocket
55
flask-sock
66
yfinance

Password Generator/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
colorama==0.4.4
2-
inquirer==2.7.0
1+
colorama==0.4.6
2+
inquirer==3.2.4

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Feel free to explore the scripts and use them for your learning and automation n
5353
39. [space_invader.py.py](https://github.com/meezan-mallick/space_invader_game) - Classical 2D space invader game to recall your childhood memories.
5454
40. [Test Case Generator](https://github.com/Tanmay-901/test-case-generator/blob/master/test_case.py) - Generate different types of test cases with a clean and friendly UI, used in competitive programming and software testing.
5555
41. [Extract Thumbnail From Video](https://github.com/geekcomputers/Python/tree/ExtractThumbnailFromVideo) - Extract Thumbnail from video files
56+
42. [How to begin the journey of open source (first contribution)](https://www.youtube.com/watch?v=v2X51AVgl3o) - First Contribution of open source
5657
<hr>
5758

5859
_**Note**: The content in this repository belongs to the respective authors and creators. I'm just providing a formatted README.md for better presentation._

Snake_water_gun/main.py

+20-15
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,26 @@ class bcolors:
2222
run = True
2323
li = ["s", "w", "g"]
2424

25-
system("clear")
26-
b = input(
27-
bcolors.OKBLUE
28-
+ bcolors.BOLD
29-
+ "Welcome to the game 'Snake-Water-Gun'.\nWanna play? Type Y or N: "
30-
+ bcolors.ENDC
31-
).capitalize()
32-
33-
if b == "N":
34-
run = False
35-
print("Ok bubyeee! See you later")
36-
elif b == "Y" or b == "y":
37-
print(
38-
"There will be 10 matches, and the one who wins more matches will win. Let's start."
39-
)
25+
while True:
26+
system("clear")
27+
b = input(
28+
bcolors.OKBLUE
29+
+ bcolors.BOLD
30+
+ "Welcome to the game 'Snake-Water-Gun'.\nWanna play? Type Y or N: "
31+
+ bcolors.ENDC
32+
).capitalize()
33+
34+
if b == "N":
35+
run = False
36+
print("Ok bubyeee! See you later")
37+
break
38+
elif b == "Y" or b == "y":
39+
print(
40+
"There will be 10 matches, and the one who wins more matches will win. Let's start."
41+
)
42+
break
43+
else:
44+
continue
4045

4146
i = 0
4247
score = 0

TaskManager.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import datetime
2+
import csv
3+
4+
def load_tasks(filename='tasks.csv'):
5+
tasks = []
6+
with open(filename, 'r', newline='') as file:
7+
reader = csv.reader(file)
8+
for row in reader:
9+
tasks.append({'task': row[0], 'deadline': row[1], 'completed': row[2]})
10+
return tasks
11+
12+
def save_tasks(tasks, filename='tasks.csv'):
13+
with open(filename, 'w', newline='') as file:
14+
writer = csv.writer(file)
15+
for task in tasks:
16+
writer.writerow([task['task'], task['deadline'], task['completed']])
17+
18+
def add_task(task, deadline):
19+
tasks = load_tasks()
20+
tasks.append({'task': task, 'deadline': deadline, 'completed': 'No'})
21+
save_tasks(tasks)
22+
print("Task added successfully!")
23+
24+
def show_tasks():
25+
tasks = load_tasks()
26+
for task in tasks:
27+
print(f"Task: {task['task']}, Deadline: {task['deadline']}, Completed: {task['completed']}")
28+
29+
# Example usage
30+
add_task('Write daily report', '2024-04-20')
31+
show_tasks()

TaskPlanner.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import datetime
2+
import csv
3+
4+
def load_tasks(filename='tasks.csv'):
5+
tasks = []
6+
with open(filename, 'r', newline='') as file:
7+
reader = csv.reader(file)
8+
for row in reader:
9+
tasks.append({'task': row[0], 'deadline': row[1], 'completed': row[2]})
10+
return tasks
11+
12+
def save_tasks(tasks, filename='tasks.csv'):
13+
with open(filename, 'w', newline='') as file:
14+
writer = csv.writer(file)
15+
for task in tasks:
16+
writer.writerow([task['task'], task['deadline'], task['completed']])
17+
18+
def add_task(task, deadline):
19+
tasks = load_tasks()
20+
tasks.append({'task': task, 'deadline': deadline, 'completed': 'No'})
21+
save_tasks(tasks)
22+
print("Task added successfully!")
23+
24+
def show_tasks():
25+
tasks = load_tasks()
26+
for task in tasks:
27+
print(f"Task: {task['task']}, Deadline: {task['deadline']}, Completed: {task['completed']}")
28+
29+
# Example usage
30+
add_task('Write daily report', '2024-04-20')
31+
show_tasks()

async_downloader/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
aiohttp==3.9.0
1+
aiohttp==3.9.3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from inorder_successor import inorder_successor
2+
# The above line imports the inorder_successor function from the inorder_successor.py file
3+
def delete_node(root,val):
4+
""" This function deletes a node with value val from the BST"""
5+
6+
# search in the left subtree
7+
if root.data < val:
8+
root.right = delete_node(root.right,val)
9+
10+
# search in the right subtree
11+
elif root.data>val:
12+
root.left=delete_node(root.left,val)
13+
14+
# node to be deleted is found
15+
else:
16+
# case 1: no child leaf node
17+
if root.left is None and root.right is None:
18+
return None
19+
20+
# case 2: one child
21+
if root.left is None:
22+
return root.right
23+
24+
# case 2: one child
25+
elif root.right is None:
26+
return root.left
27+
28+
# case 3: two children
29+
30+
# find the inorder successor
31+
IS=inorder_successor(root.right)
32+
root.data=IS.data
33+
root.right=delete_node(root.right,IS.data)
34+
return root
35+
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def inorder_successor(root):
2+
# This function returns the inorder successor of a node in a BST
3+
4+
# The inorder successor of a node is the node with the smallest value greater than the value of the node
5+
current=root
6+
7+
# The inorder successor is the leftmost node in the right subtree
8+
while current.left is not None:
9+
current=current.left
10+
return current
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def inorder(root):
2+
""" This function performs an inorder traversal of a BST"""
3+
4+
# The inorder traversal of a BST is the nodes in increasing order
5+
if root is None:
6+
return
7+
8+
# Traverse the left subtree
9+
inorder(root.left)
10+
11+
# Print the root node
12+
print(root.data)
13+
14+
# Traverse the right subtree
15+
inorder(root.right)

binary_search_trees/insert_in_bst.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from tree_node import Node
2+
def insert(root,val):
3+
4+
""" This function inserts a node with value val into the BST"""
5+
6+
# If the tree is empty, create a new node
7+
if root is None:
8+
return Node(val)
9+
10+
# If the value to be inserted is less than the root value, insert in the left subtree
11+
if val < root.data:
12+
root.left = insert(root.left,val)
13+
14+
# If the value to be inserted is greater than the root value, insert in the right subtree
15+
else:
16+
root.right = insert(root.right,val)
17+
return root

0 commit comments

Comments
 (0)