-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'geekcomputers:master' into master
- Loading branch information
Showing
33 changed files
with
762 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
class DLL: | ||
""" | ||
a doubly linked list that holds the current page, | ||
next page, and previous page. | ||
Used to enforce order in operations | ||
""" | ||
def __init__(self, val: str =None): | ||
self.val = val | ||
self.nxt = None | ||
self.prev = None | ||
|
||
|
||
class BrowserHistory: | ||
""" | ||
This class designs the operations of a browser history | ||
It works by using a doubly linked list to hold the urls | ||
""" | ||
|
||
def __init__(self, homepage: str): | ||
""" | ||
Returns - None | ||
Input - None | ||
---------- | ||
- Initialize doubly linked list which will serve as the | ||
browser history and sets the current page | ||
""" | ||
self.head = DLL(homepage) | ||
self.curr = self.head | ||
|
||
def visit(self, url: str) -> None: | ||
""" | ||
Returns - None | ||
Input - str | ||
---------- | ||
- Adds the current url to the DLL | ||
- sets both the next and previous values | ||
""" | ||
url_node = DLL(url) | ||
self.curr.nxt = url_node | ||
url_node.prev = self.curr | ||
|
||
self.curr = url_node | ||
|
||
|
||
def back(self, steps: int) -> str: | ||
""" | ||
Returns - str | ||
Input - int | ||
---------- | ||
- Iterates through the DLL backwards `step` number of times | ||
- returns the appropriate value | ||
""" | ||
while steps > 0 and self.curr.prev: | ||
self.curr = self.curr.prev | ||
steps -= 1 | ||
return self.curr.val | ||
|
||
|
||
def forward(self, steps: int) -> str: | ||
""" | ||
Returns - str | ||
Input - int | ||
---------- | ||
- Iterates through the DLL forewards `step` number of times | ||
- returns the appropriate value | ||
""" | ||
while steps > 0 and self.curr.nxt: | ||
self.curr = self.curr.nxt | ||
steps -= 1 | ||
return self.curr.val | ||
|
||
|
||
if __name__ == "__main__": | ||
obj = BrowserHistory("google.com") | ||
obj.visit("twitter.com") | ||
param_2 = obj.back(1) | ||
param_3 = obj.forward(1) | ||
|
||
print(param_2) | ||
print(param_3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
def res(R1, R2): | ||
sum = R1 + R2 | ||
if (option =="series"): | ||
return sum | ||
else: | ||
return (R1 * R2)/(R1 + R2) | ||
Resistance1 = int(input("Enter R1 : ")) | ||
Resistance2 = int(input("Enter R2 : ")) | ||
option = str(input("Enter series or parallel :")) | ||
print("\n") | ||
R = res(Resistance1,Resistance2 ) | ||
print("The total resistance is", R) | ||
def res(R1, R2): | ||
sum = R1 + R2 | ||
if option =="series": | ||
return sum | ||
elif option =="parallel" : | ||
return (R1 * R2)/sum | ||
return 0 | ||
Resistance1 = int(input("Enter R1 : ")) | ||
Resistance2 = int(input("Enter R2 : ")) | ||
option = input("Enter series or parallel :") | ||
print("\n") | ||
R = res(Resistance1,Resistance2 ) | ||
if R==0: | ||
print('Wrong Input!!' ) | ||
else: | ||
print("The total resistance is", R) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
numpy==2.0.0 | ||
opencv_python==4.10.0.82 | ||
mediapipe==0.10.14 | ||
numpy==2.1.3 | ||
opencv_python==4.10.0.84 | ||
mediapipe==0.10.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
solara == 1.32.2 | ||
solara == 1.40.0 | ||
Flask | ||
gunicorn ==22.0.0 | ||
gunicorn ==23.0.0 | ||
simple-websocket | ||
flask-sock | ||
yfinance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Pillow==10.3.0 | ||
Pillow==11.0.0 | ||
fpdf==1.7.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
colorama==0.4.6 | ||
inquirer==3.2.5 | ||
inquirer==3.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.