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
class Node: | |
def __init__(self, data) -> None: | |
self.data = data | |
self.next = None | |
self.previous = None | |
class DoublyLinkedList: | |
def __init__(self) -> None: | |
self.head = None |
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
# Creating a simple browser history app using a doubly linked list in Python is a practical project. | |
# Below is a basic implementation of a browser history app that allows you to navigate through visited websites using a doubly linked list: | |
class Node: | |
def __init__(self, url): | |
self.url = url | |
self.prev = None | |
self.next = None | |
def __repr__(self) -> str: | |
return self.url |
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
from tkinter import filedialog as fd | |
def open_file_selection(): | |
files = fd.askopenfiles() | |
for file in files: | |
print(files) | |
open_file_selection() |
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
from tkinter import filedialog as fd | |
def open_file_selection(): | |
file = fd.askopenfile() | |
print(file.read()) | |
open_file_selection() |
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
from tkinter import filedialog as fd | |
def open_file_selection(): | |
filetypes = ( | |
('pdf files', '*.pdf'), | |
('doc files', '*.doc') | |
) | |
files = fd.askopenfilenames( | |
filetypes=filetypes, | |
initialdir='/Users/phionabasemera/Documents/pdfscrapper' |
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
import pathlib | |
from tkinter import filedialog as fd | |
from PyPDF2 import PdfFileReader | |
from docx import Document | |
def open_file_selection(): | |
filenames = fd.askopenfilenames() | |
for filename in filenames: | |
extension = pathlib.Path(filename).suffix | |
if extension == '.pdf': |
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
import pathlib | |
from tkinter import filedialog as fd | |
def open_file_selection(): | |
filenames = fd.askopenfilenames() | |
print(filenames) | |
open_file_selection() |
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
import json | |
class HashTable: | |
def __init__(self) -> None: | |
self.count = 0 | |
self.store = {} | |
def add_val(self, values): | |
# common interview question to find duplicates in a list | |
duplicates = set() |
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
<?php | |
/** | |
* Class for creating the binary tree | |
*/ | |
class BinaryTree { | |
private $root = null; | |
public function __construct() { | |
$this->root = null; |
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
<?php | |
/** | |
* This is a class for creating the binary nodes | |
*/ | |
class BinaryNode { | |
private $data; | |
private $left; | |
private $right; |