Skip to content

Commit

Permalink
Merge branch 'geekcomputers:master' into testing
Browse files Browse the repository at this point in the history
  • Loading branch information
NitkarshChourasia authored May 13, 2024
2 parents 4f65a3c + 2731d2e commit cae90db
Show file tree
Hide file tree
Showing 26 changed files with 552 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Hand-Motion-Detection/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy==1.26.2
numpy==1.26.4
opencv_python==4.9.0.80
mediapipe==0.10.9
91 changes: 91 additions & 0 deletions Laundary System/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Laundry Service Class

## Overview
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.

## Class Structure
### Methods
1. `__init__(name, contact, email, cloth_type, branded, season)`: Initializes a new customer instance with the provided details and assigns a unique customer ID.
- Parameters:
- `name`: String, name of the customer.
- `contact`: Numeric (integer), contact number of the customer.
- `email`: Alphanumeric (string), email address of the customer.
- `cloth_type`: String, type of cloth deposited (Cotton, Silk, Woolen, or Polyester).
- `branded`: Boolean (0 or 1), indicating whether the cloth is branded.
- `season`: String, season when the cloth is deposited (Summer or Winter).

2. `customerDetails()`: Prints out the details of the customer, including name, contact number, email, cloth type, and whether the cloth is branded.

3. `calculateCharge()`: Calculates the charge based on the type of cloth, branding, and season.
- Returns:
- Numeric, total charge for cleaning the cloth.

4. `finalDetails()`: Calls `customerDetails()` and `calculateCharge()` methods within itself and prints the total charge and the expected day of return.
- Prints:
- Total charge in Rupees.
- Expected day of return (4 days if total charge > 200, otherwise 7 days).

## Example Usage
```python
# Example usage:
name = input("Enter customer name: ")
contact = int(input("Enter contact number: "))
email = input("Enter email address: ")
cloth_type = input("Enter cloth type (Cotton/Silk/Woolen/Polyester): ")
branded = bool(int(input("Is the cloth branded? (Enter 0 for No, 1 for Yes): ")))
season = input("Enter season (Summer/Winter): ")

customer = LaundryService(name, contact, email, cloth_type, branded, season)
customer.finalDetails()


markdown
Copy code
# Laundry Service Class

## Overview
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.

## Class Structure
### Methods
1. `__init__(name, contact, email, cloth_type, branded, season)`: Initializes a new customer instance with the provided details and assigns a unique customer ID.
- Parameters:
- `name`: String, name of the customer.
- `contact`: Numeric (integer), contact number of the customer.
- `email`: Alphanumeric (string), email address of the customer.
- `cloth_type`: String, type of cloth deposited (Cotton, Silk, Woolen, or Polyester).
- `branded`: Boolean (0 or 1), indicating whether the cloth is branded.
- `season`: String, season when the cloth is deposited (Summer or Winter).

2. `customerDetails()`: Prints out the details of the customer, including name, contact number, email, cloth type, and whether the cloth is branded.

3. `calculateCharge()`: Calculates the charge based on the type of cloth, branding, and season.
- Returns:
- Numeric, total charge for cleaning the cloth.

4. `finalDetails()`: Calls `customerDetails()` and `calculateCharge()` methods within itself and prints the total charge and the expected day of return.
- Prints:
- Total charge in Rupees.
- Expected day of return (4 days if total charge > 200, otherwise 7 days).

## Example Usage
```python
# Example usage:
name = input("Enter customer name: ")
contact = int(input("Enter contact number: "))
email = input("Enter email address: ")
cloth_type = input("Enter cloth type (Cotton/Silk/Woolen/Polyester): ")
branded = bool(int(input("Is the cloth branded? (Enter 0 for No, 1 for Yes): ")))
season = input("Enter season (Summer/Winter): ")

customer = LaundryService(name, contact, email, cloth_type, branded, season)
customer.finalDetails()
Usage Instructions
Create an instance of the LaundryService class by providing customer details as parameters to the constructor.
Use the finalDetails() method to print the customer details along with the calculated charge and expected day of return.


Contributors
(Rohit Raj)[https://github.com/MrCodYrohit]


75 changes: 75 additions & 0 deletions Laundary System/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
id=1
class LaundryService:
def __init__(self,Name_of_customer,Contact_of_customer,Email,Type_of_cloth,Branded,Season,id):
self.Name_of_customer=Name_of_customer
self.Contact_of_customer=Contact_of_customer
self.Email=Email
self.Type_of_cloth=Type_of_cloth
self.Branded=Branded
self.Season=Season
self.id=id

def customerDetails(self):
print("The Specific Details of customer:")
print("customer ID: ",self.id)
print("customer name:", self.Name_of_customer)
print("customer contact no. :", self.Contact_of_customer)
print("customer email:", self.Email)
print("type of cloth", self.Type_of_cloth)
if self.Branded == 1:
a=True
else:
a=False
print("Branded", a)
def calculateCharge(self):
a=0
if self.Type_of_cloth=="Cotton":
a=50.0
elif self.Type_of_cloth=="Silk":
a=30.0
elif self.Type_of_cloth=="Woolen":
a=90.0
elif self.Type_of_cloth=="Polyester":
a=20.0
if self.Branded==1:
a=1.5*(a)
else:
pass
if self.Season=="Winter":
a=0.5*a
else:
a=2*a
print(a)
return a
def finalDetails(self):
self.customerDetails()
print("Final charge:",end="")
if self.calculateCharge() >200:
print("to be return in 4 days")
else:
print("to be return in 7 days")
while True:
name=input("Enter the name: ")
contact=int(input("Enter the contact: "))
email=input("Enter the email: ")
cloth=input("Enter the type of cloth: ")
brand=bool(input("Branded ? "))
season=input("Enter the season: ")
obj=LaundryService(name,contact,email,cloth,brand,season,id)
obj.finalDetails()
id=id+1
z=input("Do you want to continue(Y/N):")
if z=="Y":
continue
elif z =="N":
print("Thanks for visiting!")
break
else:
print("Select valid option")







4 changes: 2 additions & 2 deletions News_App/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
solara == 1.25.0
solara == 1.32.1
Flask
gunicorn ==21.2.0
gunicorn ==22.0.0
simple-websocket
flask-sock
yfinance
4 changes: 2 additions & 2 deletions Password Generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
colorama==0.4.4
inquirer==2.7.0
colorama==0.4.6
inquirer==3.2.4
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Feel free to explore the scripts and use them for your learning and automation n
39. [space_invader.py.py](https://github.com/meezan-mallick/space_invader_game) - Classical 2D space invader game to recall your childhood memories.
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.
41. [Extract Thumbnail From Video](https://github.com/geekcomputers/Python/tree/ExtractThumbnailFromVideo) - Extract Thumbnail from video files
42. [How to begin the journey of open source (first contribution)](https://www.youtube.com/watch?v=v2X51AVgl3o) - First Contribution of open source
<hr>

_**Note**: The content in this repository belongs to the respective authors and creators. I'm just providing a formatted README.md for better presentation._
35 changes: 20 additions & 15 deletions Snake_water_gun/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,26 @@ class bcolors:
run = True
li = ["s", "w", "g"]

system("clear")
b = input(
bcolors.OKBLUE
+ bcolors.BOLD
+ "Welcome to the game 'Snake-Water-Gun'.\nWanna play? Type Y or N: "
+ bcolors.ENDC
).capitalize()

if b == "N":
run = False
print("Ok bubyeee! See you later")
elif b == "Y" or b == "y":
print(
"There will be 10 matches, and the one who wins more matches will win. Let's start."
)
while True:
system("clear")
b = input(
bcolors.OKBLUE
+ bcolors.BOLD
+ "Welcome to the game 'Snake-Water-Gun'.\nWanna play? Type Y or N: "
+ bcolors.ENDC
).capitalize()

if b == "N":
run = False
print("Ok bubyeee! See you later")
break
elif b == "Y" or b == "y":
print(
"There will be 10 matches, and the one who wins more matches will win. Let's start."
)
break
else:
continue

i = 0
score = 0
Expand Down
31 changes: 31 additions & 0 deletions TaskManager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import datetime
import csv

def load_tasks(filename='tasks.csv'):
tasks = []
with open(filename, 'r', newline='') as file:
reader = csv.reader(file)
for row in reader:
tasks.append({'task': row[0], 'deadline': row[1], 'completed': row[2]})
return tasks

def save_tasks(tasks, filename='tasks.csv'):
with open(filename, 'w', newline='') as file:
writer = csv.writer(file)
for task in tasks:
writer.writerow([task['task'], task['deadline'], task['completed']])

def add_task(task, deadline):
tasks = load_tasks()
tasks.append({'task': task, 'deadline': deadline, 'completed': 'No'})
save_tasks(tasks)
print("Task added successfully!")

def show_tasks():
tasks = load_tasks()
for task in tasks:
print(f"Task: {task['task']}, Deadline: {task['deadline']}, Completed: {task['completed']}")

# Example usage
add_task('Write daily report', '2024-04-20')
show_tasks()
31 changes: 31 additions & 0 deletions TaskPlanner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import datetime
import csv

def load_tasks(filename='tasks.csv'):
tasks = []
with open(filename, 'r', newline='') as file:
reader = csv.reader(file)
for row in reader:
tasks.append({'task': row[0], 'deadline': row[1], 'completed': row[2]})
return tasks

def save_tasks(tasks, filename='tasks.csv'):
with open(filename, 'w', newline='') as file:
writer = csv.writer(file)
for task in tasks:
writer.writerow([task['task'], task['deadline'], task['completed']])

def add_task(task, deadline):
tasks = load_tasks()
tasks.append({'task': task, 'deadline': deadline, 'completed': 'No'})
save_tasks(tasks)
print("Task added successfully!")

def show_tasks():
tasks = load_tasks()
for task in tasks:
print(f"Task: {task['task']}, Deadline: {task['deadline']}, Completed: {task['completed']}")

# Example usage
add_task('Write daily report', '2024-04-20')
show_tasks()
2 changes: 1 addition & 1 deletion async_downloader/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aiohttp==3.9.0
aiohttp==3.9.3
35 changes: 35 additions & 0 deletions binary_search_trees/delete_a_node_in_bst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from inorder_successor import inorder_successor
# The above line imports the inorder_successor function from the inorder_successor.py file
def delete_node(root,val):
""" This function deletes a node with value val from the BST"""

# search in the left subtree
if root.data < val:
root.right = delete_node(root.right,val)

# search in the right subtree
elif root.data>val:
root.left=delete_node(root.left,val)

# node to be deleted is found
else:
# case 1: no child leaf node
if root.left is None and root.right is None:
return None

# case 2: one child
if root.left is None:
return root.right

# case 2: one child
elif root.right is None:
return root.left

# case 3: two children

# find the inorder successor
IS=inorder_successor(root.right)
root.data=IS.data
root.right=delete_node(root.right,IS.data)
return root

10 changes: 10 additions & 0 deletions binary_search_trees/inorder_successor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def inorder_successor(root):
# This function returns the inorder successor of a node in a BST

# The inorder successor of a node is the node with the smallest value greater than the value of the node
current=root

# The inorder successor is the leftmost node in the right subtree
while current.left is not None:
current=current.left
return current
15 changes: 15 additions & 0 deletions binary_search_trees/inorder_traversal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def inorder(root):
""" This function performs an inorder traversal of a BST"""

# The inorder traversal of a BST is the nodes in increasing order
if root is None:
return

# Traverse the left subtree
inorder(root.left)

# Print the root node
print(root.data)

# Traverse the right subtree
inorder(root.right)
17 changes: 17 additions & 0 deletions binary_search_trees/insert_in_bst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from tree_node import Node
def insert(root,val):

""" This function inserts a node with value val into the BST"""

# If the tree is empty, create a new node
if root is None:
return Node(val)

# If the value to be inserted is less than the root value, insert in the left subtree
if val < root.data:
root.left = insert(root.left,val)

# If the value to be inserted is greater than the root value, insert in the right subtree
else:
root.right = insert(root.right,val)
return root
Loading

0 comments on commit cae90db

Please sign in to comment.