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
# A digital assistant for browsing the web | |
# Made by Ben Maydan | |
# Imports go here | |
import speech_recognition as sr | |
import webbrowser | |
def search_for(term, transcription): | |
""" |
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 Validator: | |
""" | |
A class for validating input | |
""" | |
def __init__(self, text, booleans): | |
self.text = text | |
self.booleans = booleans | |
@staticmethod | |
def nothing(self): |
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
def maximum(*lists): | |
mapping = {sum(l):l for l in lists} | |
return mapping[max(mapping.keys())] |
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
def instances(objects, objectType): | |
if type(objects) not in [list, set, tuple]: | |
frmt = (str(objects)[0:int(len(objects) / 3)]) + "..." | |
raise TypeError("Object {} is not a collection of elements".format(frmt)) | |
for obj in objects: | |
if not isinstance(obj, objectType): | |
raise TypeError("Object '{}' is not of type {}".format(str(obj), objectType)) |
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
# URL SHORTENER | |
# MADE BY Ben Maydan | |
# REQUEST PERMISSION BEFORE USING | |
# Imports | |
import operations | |
class Shortener: | |
FILE_NAME = "URLS.pickle" |
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 String: | |
""" | |
Composite of str class made to experiment with string formatting | |
""" | |
def __init__(self, string): | |
self.string = string | |
self.new_string = string | |
def _hr(self, addon): |
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 String: | |
""" | |
Composite of str class made to experiment with string formatting | |
""" | |
def __init__(self, string): | |
self.string = string | |
self.new_string = string | |
def __iter__(cls): |
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 requests | |
import time | |
import sys | |
#STATIC VARIABLES | |
BITCOIN_URL = 'https://api.coinmarketcap.com/v1/ticker/bitcoin/' | |
REFRESH_SPEED = 3 | |
ROUND = 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
import itertools | |
import math | |
class Polynomial: | |
""" | |
Polynomial class | |
Magic Methods: | |
__str__ |
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
def nmax(lst): | |
maxed = (int(str(lst[0])[0]), lst.index(lst[0])) | |
for number in lst[1:]: | |
if int(str(number)[0]) > maxed[0]: | |
maxed = (number, lst.index(number)) | |
return maxed |