This file contains hidden or 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 Stack: | |
def __init__(self): | |
self.items = [] | |
def push(self, item): | |
self.items.append(item) | |
def pop(self): | |
return self.items.pop() |
This file contains hidden or 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 pyautogui | |
import time | |
def remove_calls(): | |
while True: | |
pyautogui.moveTo(1530, 194) | |
pyautogui.click() | |
time.sleep(1) |
This file contains hidden or 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): | |
self.data = data | |
self.left = None | |
self.right = None | |
def insert(self, val): | |
if val <= self.data: | |
if self.left is None: | |
self.left = Node(val) |
This file contains hidden or 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 sort(lst): | |
for i in range(len(lst)): | |
min_index = i | |
for j in range(i+1, len(lst)): | |
if lst[min_index] > lst[j]: | |
min_index = j | |
lst[i], lst[min_index] = lst[min_index], lst[i] | |
return lst | |
def sort(lst): |
This file contains hidden or 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 collections import OrderedDict | |
def count_datatypes(*args): | |
if not args: | |
return [0, 0, 0, 0, 0, 0] | |
types = {int: 0, str: 0, bool: 0, list: 0, tuple: 0, dict: 0} | |
od = OrderedDict([(int, 0), (str, 0), (bool, 0), (list, 0), (tuple, 0), (dict, 0)]) | |
for k, v in types.items(): |
This file contains hidden or 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 encrypt(word): | |
vowels = { | |
'a': 0, | |
'e': 1, | |
'i': 2, | |
'o': 2, | |
'u': 3, | |
} | |
rev = ''.join(reversed(word.lower())) |
This file contains hidden or 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
"""Write a function that returns True if two arrays, when combined, form a consecutive sequence. A consecutive | |
sequence is a sequence without any gaps in the integers, e.g. 1, 2, 3, 4, 5 is a consecutive sequence, but 1, 2, 4, | |
5 is not. """ | |
def consecutive_combo(lst1, lst2): | |
# Finds max from either lists | |
my_max = 0 | |
maximum1 = max(lst1) | |
maximum2 = max(lst2) |
This file contains hidden or 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
char_to_dots = { | |
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', | |
'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', | |
'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', | |
'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', | |
'Y': '-.--', 'Z': '--..', ' ': ' ', '0': '-----', | |
'1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', | |
'6': '-....', '7': '--...', '8': '---..', '9': '----.', | |
'&': '.-...', "'": '.----.', '@': '.--.-.', ')': '-.--.-', '(': '-.--.', | |
':': '---...', ',': '--..--', '=': '-...-', '!': '-.-.--', '.': '.-.-.-', |
This file contains hidden or 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 neutralise(s1, s2): | |
cl = [] | |
nl = [] | |
zipped = zip(s1, s2) | |
nl += zipped | |
for i in nl: | |
if i[0] != i[1]: | |
cl.append('0') | |
else: | |
cl.append(i[0]) |
This file contains hidden or 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
conversion = { | |
'abc': 2, | |
'def': 3, | |
'ghi': 4, | |
'jkl': 5, | |
'mno': 6, | |
'pqrs': 7, | |
'tuv': 8, | |
'wxyz': 9, | |
} |
NewerOlder