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

filerename.py added #3

Merged
merged 71 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
072a0da
Added Tic Tac toe Project
Shubham-Aggarwal-1306 Oct 1, 2023
f242c95
Update in User Name
Shubham-Aggarwal-1306 Oct 1, 2023
55b75eb
Hacktoberfest contribution by Rihan
devrihan Oct 1, 2023
50a31da
Added stopwatch.py
nmnarora600 Oct 2, 2023
33bd1a7
Update CONTRIBUTING.md
nmnarora600 Oct 2, 2023
5dac236
Update CONTRIBUTING.md
MrB141107 Oct 2, 2023
e8ea211
Create Selfie_with_python.py
MrB141107 Oct 2, 2023
8c6ae75
files added
Ronav-b Oct 2, 2023
6a64ace
array file added
porkalai39 Oct 2, 2023
37f7660
Update CONTRIBUTING.md
gayathri-commits Oct 2, 2023
e94ba85
Remove Duplicates from array
gayathri-commits Oct 2, 2023
32bcbf9
Create weatherInfo.py
Jishnu2608 Oct 2, 2023
f8ce9d8
Update CONTRIBUTING.md
Prithsray Oct 2, 2023
89de410
Multiple linear regression added
Prithsray Oct 2, 2023
e714b6c
Merge branch 'main' into main
Prithsray Oct 2, 2023
641e734
Added functions for ellipse and trapezoid area caluclation
Tanay3484 Oct 2, 2023
542f47e
Merge branch 'main' into new-shape-area
Tanay3484 Oct 2, 2023
52d172d
Merge pull request #25 from GhanashyamKadam/main
wbhoomika Oct 2, 2023
3b94c17
Merge pull request #28 from devrihan/Rihan
wbhoomika Oct 2, 2023
54f714b
Merge pull request #31 from Ronav-b/main
wbhoomika Oct 2, 2023
001a50f
Merge pull request #32 from porkalai39/main
wbhoomika Oct 2, 2023
61f0d8e
Merge pull request #35 from Jishnu2608/patch-1
wbhoomika Oct 2, 2023
482fdd2
Added Tic Tac toe Project
Shubham-Aggarwal-1306 Oct 1, 2023
c1c8cc4
Update in User Name
Shubham-Aggarwal-1306 Oct 1, 2023
7274020
Merge branch 'main' of https://github.com/Shubham-Aggarwal-1306/pytho…
Shubham-Aggarwal-1306 Oct 2, 2023
32ab7c0
Rename calc.cpp to Other Languages/calc.cpp
wbhoomika Oct 2, 2023
eeea530
Merge pull request #27 from Shubham-Aggarwal-1306/main
wbhoomika Oct 2, 2023
9857405
Added Email_Slicer
shehzansk Oct 2, 2023
fe469b4
Merge branch 'main' into new-shape-area
Tanay3484 Oct 2, 2023
2815347
Create Random Quote Generator using TKinter
Jishnu2608 Oct 2, 2023
1c52538
added web-scraping python project
Zeeshan-szf Oct 2, 2023
41f25ae
Merge pull request #30 from MrB141107/main
wbhoomika Oct 2, 2023
4cc5e34
Merge pull request #29 from nmnarora600/stopwatch_py
wbhoomika Oct 2, 2023
7eea4f1
Merge pull request #34 from gayathri-commits/gayathri-commits-patch-2
wbhoomika Oct 2, 2023
4c73ede
Merge pull request #36 from Prithsray/main
wbhoomika Oct 2, 2023
54d9963
Merge pull request #37 from Tanay3484/new-shape-area
wbhoomika Oct 2, 2023
73c8563
Add Morse code project
Oct 2, 2023
a6a868e
Merge pull request #42 from shehzansk/main
wbhoomika Oct 2, 2023
1f9c816
Merge pull request #45 from Jishnu2608/patch-2
wbhoomika Oct 2, 2023
c3ad50c
Merge branch 'main' into main
wbhoomika Oct 2, 2023
0c71be9
Merge pull request #46 from Zeeshan-szf/main
wbhoomika Oct 2, 2023
42902dd
Merge branch 'main' into main
wbhoomika Oct 2, 2023
4027123
Merge pull request #47 from shubhamatkal/main
wbhoomika Oct 2, 2023
a2d6dd7
added random password generator
Zeeshan-szf Oct 2, 2023
ec415cb
Update and rename help.md to FETURE_REQUIRED.md
wbhoomika Oct 2, 2023
6678800
Merge branch 'main' of https://github.com/Zeeshan-szf/python4beginner…
Zeeshan-szf Oct 2, 2023
8776112
Merge pull request #49 from wbhoomika/feature-details
wbhoomika Oct 2, 2023
22b75d2
Merge branch 'wbhoomika:main' into main
Zeeshan-szf Oct 2, 2023
04c038b
name fix
wbhoomika Oct 2, 2023
aefd0db
Merge pull request #50 from wbhoomika/fix/name
wbhoomika Oct 2, 2023
176f1de
added snake game
shrey141102 Oct 2, 2023
fa14b10
added the program file terminal_search, and edited Contributing.md file
devAdityaa Oct 2, 2023
4865465
SVM spam classifier added
Prithsray Oct 2, 2023
67fef63
Trapping Rainwater LeetCode solution
nik-6174 Oct 2, 2023
1cc35ba
Frog Jump (LeetCode) Solution
nik-6174 Oct 2, 2023
5f3ac19
Create Frog_Jump.py
nik-6174 Oct 2, 2023
96a1c59
added text_detection feature
ktsrivastava29 Oct 2, 2023
fa1cc88
Create email_slicer
ahmadmasood43 Oct 2, 2023
a4fd714
added hangman_game.py
dev1abhi Oct 2, 2023
7234ce0
Merge pull request #51 from Zeeshan-szf/main
wbhoomika Oct 3, 2023
ccb1399
Merge pull request #52 from shrey141102/main
wbhoomika Oct 3, 2023
9ed8c64
Merge pull request #57 from devAdityaa/devAdityaa
wbhoomika Oct 3, 2023
546017a
Merge pull request #60 from nik-6174/main
wbhoomika Oct 3, 2023
44ffb33
Merge pull request #63 from ktsrivastava29/main
wbhoomika Oct 3, 2023
1724d5b
Merge pull request #61 from nik-6174/patch-1
wbhoomika Oct 3, 2023
06f279b
Merge pull request #58 from Prithsray/main
wbhoomika Oct 3, 2023
cefebd6
Merge pull request #64 from ahmadmasood43/patch-1
wbhoomika Oct 3, 2023
005432d
Merge pull request #67 from dev1abhi/main
wbhoomika Oct 3, 2023
4b4145f
Update README.md
wbhoomika Oct 4, 2023
c99d575
Update CONTRIBUTING.md
wbhoomika Oct 4, 2023
73db3b5
filerename.py is added
GhanashyamKadam Oct 4, 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
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
- GitHub: https://github.com/wbhoomika/
```

```markdown
#### Name: Shubham Aggarwal
- GitHub: https://github.com/Shubham-Aggarwal-1306/
```

```markdown
#### Name: DevVortex504
- GitHub: https://github.com/DevVortex504
Expand All @@ -22,3 +27,37 @@
#### Name: Subha Sundar Chakraborty
- GitHub: https://github.com/csubhasundar
```

```markdown
#### Name: Shubham Atkal
- GitHub: https://github.com/shubhamatkal
```

```markdown
#### Name: <Zeeshan Fahad>
- GitHub: https://github.com/Zeeshan-szf/
```

```markdown
#### Name: MrB141107
- GitHub: https://github.com/MrB141107
```

```markdown
#### Name: Naman Arora
- GitHub: https://github.com/nmnarora600/
```

```markdown
#### Name: Gayathri Sankar
- GitHub: https://github.com/gayathri-commits/<gayathri-commits>/
```

```markdown
#### Name: Prithwish Raymahapatra
- GitHub: https://github.com/Prithsray/
```
```markdown
#### Name: Debaditya Banerji
- GitHub: https://github.com/devAdityaa/
```
4 changes: 4 additions & 0 deletions FEATURE_REQUIRED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Help Required

Workflow to automatically add labels to PR and merge them once accepted.
Issue created in: https://github.com/wbhoomika/python4beginners-Hacktoberfest23/issues/39
File renamed without changes.
6 changes: 6 additions & 0 deletions Python Projects/Email_Slicer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
email = input("Enter Your Email: ").strip()

username = email[:email.index('@')]
domain = email[email.index('@') + 1:]

print(f"Your username is {username} & domain is {domain}")
36 changes: 36 additions & 0 deletions Python Projects/Frog_Jump.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Title: 403. Frog Jump
# Difficulty: Hard
# Problem: https://leetcode.com/problems/frog-jump/description/

# using stack (highest efficiency)
class Solution:
def canCross(self, stones: List[int]) -> bool:
stone_set = set(stones)
visited_set = set()
stack = [(0, 0)]
while stack:
stone, jump = stack.pop()
for j in [jump-1, jump, jump+1]:
s = stone + j
if j > 0 and s in stone_set and (s, j) not in visited_set:
if s == stones[-1]:
return True
stack.append((s, j))
visited_set.add((stone, jump))
return False

# using dp (low efficiency)
class Solution:
def canCross(self, stones: List[int]) -> bool:
n = len(stones)
dp = [set() for _ in range(n)]
dp[0].add(0) # The first stone can only be reached with a jump of size 0

for i in range(n):
for j in dp[i]:
for step in range(j - 1, j + 2): # Next jump size could be j-1, j, or j+1
if step > 0 and stones[i] + step in stones:
next_idx = stones.index(stones[i] + step)
dp[next_idx].add(step)

return len(dp[-1]) > 0
34 changes: 34 additions & 0 deletions Python Projects/MLR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Import the necessary libraries
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.metrics import accuracy_score

# Create a sample dataset (you should replace this with your own data)
data = {'X1': [1, 2, 3, 4, 5],
'X2': [2, 3, 4, 5, 6],
'Y': [2, 4, 5, 4, 6]}

df = pd.DataFrame(data)

# Split the data into training and testing sets
X = df[['X1', 'X2']]
y = df['Y']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Create and fit the linear regression model
model = LinearRegression()
model.fit(X_train, y_train)

# Make predictions on the test set
y_pred = model.predict(X_test)

# Evaluate the model
mse = mean_squared_error(y_test, y_pred)
r2 = r2_score(y_test, y_pred)


print("Mean Squared Error:", mse)
print("R-squared:", r2)
43 changes: 43 additions & 0 deletions Python Projects/SVM_spam _classifier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score, classification_report, confusion_matrix

# Sample data (replace with your own dataset)
emails = ["Buy our amazing products now!",
"Congratulations! You've won $1000.",
"Hello, how are you doing?",
"Discounts on luxury watches!",
"Meeting at 3 pm today."]

labels = [1, 1, 0, 1, 0] # 1 for spam, 0 for not spam

# Split the data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(emails, labels, test_size=0.2, random_state=42)

# Create a TF-IDF Vectorizer to convert text to numerical features
vectorizer = TfidfVectorizer()
X_train_tfidf = vectorizer.fit_transform(X_train)
X_test_tfidf = vectorizer.transform(X_test)

# Create an SVM classifier
svm_classifier = SVC(kernel='linear', C=1.0)

# Train the SVM classifier
svm_classifier.fit(X_train_tfidf, y_train)

# Make predictions on the test data
y_pred = svm_classifier.predict(X_test_tfidf)

# Calculate accuracy and display the results
accuracy = accuracy_score(y_test, y_pred)
print("Accuracy:", accuracy)

confusion = confusion_matrix(y_test, y_pred)
print("Confusion Matrix:")
print(confusion)

classification_rep = classification_report(y_test, y_pred)
print("Classification Report:")
print(classification_rep)
27 changes: 27 additions & 0 deletions Python Projects/Selfie_with_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import cv2
import time
print("Press Space-bar to click Selfie")
print("Press Escape key to terminate the window")
time.sleep(5)
cam = cv2.VideoCapture(0)
cv2.namedWindow("Take selfie with python")
img=0
while True:
ret, frame = cam.read()

if not ret:
print("Failed to grab frame")
break

cv2.imshow("Take selfie with python",frame)
k = cv2.waitKey(1)
if k%256 == 27:
print("Escape hit, closing the window")
break
if k%256 == 32:
img_name = f"Selfie_{img}.jpg"
cv2.imwrite(img_name,frame)
print("Selfie taken!")
img+=1
cam.release
cv2.destroyAllWindows()
1 change: 1 addition & 0 deletions Python Projects/SnakeGame/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
37
19 changes: 19 additions & 0 deletions Python Projects/SnakeGame/food.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from turtle import Turtle
import random


class Food(Turtle):

def __init__(self):
super().__init__()
self.shape("circle")
self.penup()
self.shapesize(stretch_len=0.5, stretch_wid=0.5)
self.color("red")
self.speed("fastest")
self.refresh()

def refresh(self):
random_x = random.randint(-280, 280)
random_y = random.randint(-280, 280)
self.goto(random_x, random_y)
45 changes: 45 additions & 0 deletions Python Projects/SnakeGame/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from turtle import Screen
import time
from scoreboard import Scoreboard
from food import Food
from snake import Snake

scoreboard = Scoreboard()
food = Food()
snake = Snake()
screen = Screen()

screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.title("My Snake Game")
screen.tracer(0)

screen.listen()
screen.onkey(snake.up, "Up")
screen.onkey(snake.down, "Down")
screen.onkey(snake.left, "Left")
screen.onkey(snake.right, "Right")

game_is_on = True
while game_is_on:
screen.update()
time.sleep(0.1)
snake.move()
if snake.head.distance(food) < 15:
food.refresh()
snake.extend()
scoreboard.increase_score()

if snake.head.xcor() > 290 or snake.head.xcor() < -295 or snake.head.ycor() > 290 or snake.head.ycor() < -295:
scoreboard.reset()
snake.reset()

# Detect if hitting itself
for i in snake.segments[1:]:
if snake.head.distance(i) < 10:
scoreboard.reset()
snake.reset()

screen.exitonclick()


38 changes: 38 additions & 0 deletions Python Projects/SnakeGame/scoreboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from turtle import Turtle
ALIGN = "center"
FONT = ("Courier", 24, "bold")


class Scoreboard(Turtle):

def __init__(self):
super().__init__()
self.score = 0
with open("data.txt") as data:
self.high_score = int(data.read())
self.penup()
self.color("white")
self.goto(0, 270)
self.write(f"Score: {self.score}", move=False, align=ALIGN, font=FONT)
self.hideturtle()

def increase_score(self):
self.score += 1
self.update_scoreboard()

def update_scoreboard(self):
self.clear()
self.write(f"Score: {self.score}, High Score: {self.high_score}", move=False, align="center", font=("Arial", 24, "bold"))

# def game_over(self):
# self.goto(0, 0)
# self.color("blue")
# self.write("GAME OVER!!", align="center", font=("Courier", 66, "bold"))

def reset(self):
if self.score > self.high_score:
self.high_score = self.score
with open("data.txt", mode="w") as data:
data.write(str(self.high_score))
self.score = 0
self.update_scoreboard()
58 changes: 58 additions & 0 deletions Python Projects/SnakeGame/snake.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from turtle import Turtle
STARTING_POS = [(0, 0), (-20, 0), (-40, 0)]
MOVE_DISTANCE = 20
UP = 90
DOWN = 270
RIGHT = 0
LEFT = 180


class Snake:
def __init__(self):
self.segments = []
self.create_snake()
self.head = self.segments[0]

def create_snake(self):
for i in STARTING_POS:
self.add_segment(i)

def add_segment(self, position):
a = Turtle("square")
a.color("white")
a.penup()
a.goto(position)
self.segments.append(a)

def extend(self):
self.add_segment(self.segments[-1].position())

def reset(self):
for seg in self.segments:
seg.goto(1000, 1000)
self.segments.clear()
self.create_snake()
self.head = self.segments[0]

def move(self):
for i in range(len(self.segments) - 1, 0, -1):
new_x = self.segments[i - 1].xcor()
new_y = self.segments[i - 1].ycor()
self.segments[i].goto(new_x, new_y)
self.head.forward(MOVE_DISTANCE)

def up(self):
if self.head.heading() != DOWN:
self.head.setheading(UP)

def down(self):
if self.head.heading() != UP:
self.head.setheading(DOWN)

def right(self):
if self.head.heading() != LEFT:
self.head.setheading(RIGHT)

def left(self):
if self.head.heading() != RIGHT:
self.head.setheading(LEFT)
Loading