Skip to content

Commit d11dd4c

Browse files
chore: commit all changes
2 parents 3622e6b + 41b9055 commit d11dd4c

File tree

132 files changed

+12883
-226
lines changed

Some content is hidden

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

132 files changed

+12883
-226
lines changed

.circleci/config.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Use the latest 2.1 version of CircleCI pipeline process engine.
2+
# See: https://circleci.com/docs/reference/configuration-reference
3+
version: 2.1
4+
5+
# Define a job to be invoked later in a workflow.
6+
# See: https://circleci.com/docs/guides/orchestrate/jobs-steps/#jobs-overview & https://circleci.com/docs/reference/configuration-reference/#jobs
7+
jobs:
8+
say-hello:
9+
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
10+
# See: https://circleci.com/docs/guides/execution-managed/executor-intro/ & https://circleci.com/docs/reference/configuration-reference/#executor-job
11+
docker:
12+
# Specify the version you desire here
13+
# See: https://circleci.com/developer/images/image/cimg/base
14+
- image: cimg/base:current
15+
16+
# Add steps to the job
17+
# See: https://circleci.com/docs/guides/orchestrate/jobs-steps/#steps-overview & https://circleci.com/docs/reference/configuration-reference/#steps
18+
steps:
19+
# Checkout the code as the first step.
20+
- checkout
21+
- run:
22+
name: "Say hello"
23+
command: "echo Hello, World!"
24+
25+
# Orchestrate jobs using workflows
26+
# See: https://circleci.com/docs/guides/orchestrate/workflows/ & https://circleci.com/docs/reference/configuration-reference/#workflows
27+
workflows:
28+
say-hello-workflow: # This is the name of the workflow, feel free to change it to better match your workflow.
29+
# Inside the workflow, you define the jobs you want to run.
30+
jobs:
31+
- say-hello
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# updating records in a binary file
2+
3+
import pickle
4+
5+
6+
def update():
7+
with open("studrec.dat", "rb+") as File:
8+
value = pickle.load(File)
9+
found = False
10+
roll = int(input("Enter the roll number of the record"))
11+
12+
for i in value:
13+
if roll == i[0]:
14+
print(f"current name {i[1]}")
15+
print(f"current marks {i[2]}")
16+
i[1] = input("Enter the new name")
17+
i[2] = int(input("Enter the new marks"))
18+
found = True
19+
20+
if not found:
21+
print("Record not found")
22+
23+
else:
24+
pickle.dump(value, File)
25+
File.seek(0)
26+
print(pickle.load(File))
27+
28+
29+
update()
30+
31+
# ! Instead of AB use WB?
32+
# ! It may have memory limits while updating large files but it would be good
33+
# ! Few lakhs records would be fine and wouldn't create any much of a significant issues
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Updating records in a binary file
2+
# ! Have a .env file please
3+
import pickle
4+
import os
5+
from dotenv import load_dotenv
6+
7+
base = os.path.dirname(__file__)
8+
load_dotenv(os.path.join(base, ".env"))
9+
student_record = os.getenv("STUDENTS_RECORD_FILE")
10+
11+
12+
def update():
13+
with open(student_record, "rb") as F:
14+
S = pickle.load(F)
15+
found = False
16+
rno = int(input("enter the roll number you want to update"))
17+
18+
for i in S:
19+
if rno == i[0]:
20+
print(f"the current name is {i[1]}")
21+
i[1] = input("enter the new name")
22+
found = True
23+
break
24+
25+
if found:
26+
print("Record not found")
27+
28+
with open(student_record, "wb") as F:
29+
pickle.dump(S, F)
30+
31+
32+
update()

8_puzzle.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,20 @@ def priority(self) -> int:
2626
return self.moves + self.manhattan()
2727

2828
def manhattan(self) -> int:
29-
"""Calculate Manhattan distance from current to goal state."""
29+
"""Calculate Manhattan distance using actual goal positions."""
3030
distance = 0
31+
# Create a lookup table for goal tile positions
32+
goal_pos = {self.goal[i][j]: (i, j) for i in range(3) for j in range(3)}
33+
3134
for i in range(3):
3235
for j in range(3):
33-
if self.board[i][j] != 0:
34-
x, y = divmod(self.board[i][j] - 1, 3)
36+
value = self.board[i][j]
37+
if value != 0: # skip the empty tile
38+
x, y = goal_pos[value]
3539
distance += abs(x - i) + abs(y - j)
3640
return distance
3741

42+
3843
def is_goal(self) -> bool:
3944
"""Check if current state matches goal."""
4045
return self.board == self.goal

Assembler/assembler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ def scanner(string):
745745

746746
def scan():
747747
"""
748-
scan: applys function scanner() to each line of the source code.
748+
scan: applies function scanner() to each line of the source code.
749749
"""
750750
global lines
751751
assert len(lines) > 0, "no lines"
@@ -1008,7 +1008,7 @@ def parser():
10081008
elif eax == 3:
10091009
ecx = float(input(">> "))
10101010

1011-
elif eax == 4: # output informations
1011+
elif eax == 4: # output information
10121012
print(ecx)
10131013

10141014
elif token.token == "push": # push commando
@@ -1157,7 +1157,7 @@ def parser():
11571157
pointer = jumps[token.token]
11581158

11591159
else: # error case
1160-
print("Error: Unknow subprogram!")
1160+
print("Error: Unknown subprogram!")
11611161
return
11621162

11631163
else: # error case
@@ -1169,7 +1169,7 @@ def parser():
11691169
pointer = returnStack.pop()
11701170

11711171
else: # error case
1172-
print("Error: No return adress on stack")
1172+
print("Error: No return address on stack")
11731173
return
11741174

11751175
elif token.t == "subprogram":

Automated Scheduled Call Reminders/caller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Here the collection name is on_call which has documents with fields phone , from (%H:%M:%S time to call the person),date
2222

2323

24-
# gets data from cloud database and calls 5 min prior the time (from time) alloted in the database
24+
# gets data from cloud database and calls 5 min prior the time (from time) allotted in the database
2525
def search():
2626
calling_time = datetime.now()
2727
one_hours_from_now = (calling_time + timedelta(hours=1)).strftime("%H:%M:%S")

BlackJack_game/blackjack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def dealer_choice():
106106
while sum(p_cards) < 21:
107107
# to continue the game again and again !!
108108
k = input("Want to hit or stay?\n Press 1 for hit and 0 for stay ")
109-
if k == "1": # Ammended 1 to a string
109+
if k == "1": # Amended 1 to a string
110110
random.shuffle(deck)
111111
p_cards.append(deck.pop())
112112
print("You have a total of " + str(sum(p_cards)) + " with the cards ", p_cards)

BlackJack_game/blackjack_simulate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Card:
4646

4747
def __init__(self, suit, rank, face=True):
4848
"""
49-
:param suit: patter in the card
49+
:param suit: pattern in the card
5050
:param rank: point in the card
5151
:param face: show or cover the face(point & pattern on it)
5252
"""

BoardGame-CLI/snakeLadder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Taking players data
44
players = {} # stores players name their locations
55
isReady = {}
6-
current_loc = 1 # vaiable for iterating location
6+
current_loc = 1 # variable for iterating location
77

88
imp = True
99

@@ -23,7 +23,7 @@ def player_input():
2323
players[name] = current_loc
2424
isReady[name] = False
2525
x = False
26-
play() # play funtion call
26+
play() # play function call
2727

2828
else:
2929
print("Number of player cannot be zero")
@@ -88,7 +88,7 @@ def play():
8888
print(f"you are at position {players[i]}")
8989

9090
elif n == 2:
91-
players = {} # stores player ans their locations
91+
players = {} # stores player and their locations
9292
isReady = {}
9393
current_loc = 1 # reset starting location to 1
9494
player_input()

BrowserHistory/rock_paper_scissors.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
2-
Rock, Paper, Scissors Game (CLI Version)
2+
Triple Round : Rock, Paper, Scissors Game (CLI Version)
3+
Final round is the Winning Round
34
Author: Your Name
45
"""
56

@@ -38,10 +39,13 @@ def decide_winner(player, computer):
3839

3940
def main():
4041
"""Main function to play the game."""
41-
user_choice = get_user_choice()
42-
computer_choice = get_computer_choice()
43-
print(f"Computer chose: {computer_choice}")
44-
print(decide_winner(user_choice, computer_choice))
42+
for i in range(1, 4):
43+
print(f"round -> {i}\n")
44+
user_choice = get_user_choice()
45+
computer_choice = get_computer_choice()
46+
print(f"Computer chose: {computer_choice}")
47+
48+
print(f"Final result : {decide_winner(user_choice, computer_choice)}")
4549

4650

4751
if __name__ == "__main__":

0 commit comments

Comments
 (0)