content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# 3.2: Stack Min # Runtime: O(1) - Space: O(1) class Node: def __init__(self, value): self.value = value self.next = None self.minimum = None class Stack: def __init__(self): self.top = None self.minimum = None def push(self, value): new_top = Node(value) new_top.next = self.top self.top = new_top if not self.minimum: self.minimum = new_top return if value < self.minimum.value: new_top.minimum = self.minimum self.minimum = new_top else: new_top.minimum = self.minimum def pop(self): item = self.top self.minimum = self.top.minimum self.top = self.top.next return item def min(self): return self.minimum stack = Stack() stack.push(5) stack.push(3) stack.push(2) stack.push(6) stack.push(1) print("top:", stack.top.value) print("min:", stack.min().value) print("popped:", stack.pop().value) print("top:", stack.top.value) print("min:", stack.min().value) print("popped:", stack.pop().value) print("top:", stack.top.value) print("min:", stack.min().value) print("popped:", stack.pop().value) print("top:", stack.top.value) print("min:", stack.min().value) print("popped:", stack.pop().value) print("top:", stack.top.value) print("min:", stack.min().value) print("popped:", stack.pop().value)
class Node: def __init__(self, value): self.value = value self.next = None self.minimum = None class Stack: def __init__(self): self.top = None self.minimum = None def push(self, value): new_top = node(value) new_top.next = self.top self.top = new_top if not self.minimum: self.minimum = new_top return if value < self.minimum.value: new_top.minimum = self.minimum self.minimum = new_top else: new_top.minimum = self.minimum def pop(self): item = self.top self.minimum = self.top.minimum self.top = self.top.next return item def min(self): return self.minimum stack = stack() stack.push(5) stack.push(3) stack.push(2) stack.push(6) stack.push(1) print('top:', stack.top.value) print('min:', stack.min().value) print('popped:', stack.pop().value) print('top:', stack.top.value) print('min:', stack.min().value) print('popped:', stack.pop().value) print('top:', stack.top.value) print('min:', stack.min().value) print('popped:', stack.pop().value) print('top:', stack.top.value) print('min:', stack.min().value) print('popped:', stack.pop().value) print('top:', stack.top.value) print('min:', stack.min().value) print('popped:', stack.pop().value)
def test_configuration_session(eos_conn): eos_conn.register_configuration_session(session_name="scrapli_test_session1") result = eos_conn.send_configs( configs=["interface ethernet 1", "show configuration sessions"], privilege_level="scrapli_test_session1", ) eos_conn.close() # pop the config session out eos_conn.privilege_levels.pop("scrapli_test_session1") assert "* scrapli_test_session" in result[1].result def test_configuration_session_abort(eos_conn): eos_conn.register_configuration_session(session_name="scrapli_test_session2") result = eos_conn.send_configs( configs=["tacocat", "show configuration sessions"], privilege_level="scrapli_test_session2", stop_on_failed=True, ) current_prompt = eos_conn.get_prompt() eos_conn.close() # pop the config session out eos_conn.privilege_levels.pop("scrapli_test_session2") # assert config session was aborted at first sign of failed config assert len(result) == 1 # assert that session aborted and we are back at priv exec assert current_prompt == "localhost#"
def test_configuration_session(eos_conn): eos_conn.register_configuration_session(session_name='scrapli_test_session1') result = eos_conn.send_configs(configs=['interface ethernet 1', 'show configuration sessions'], privilege_level='scrapli_test_session1') eos_conn.close() eos_conn.privilege_levels.pop('scrapli_test_session1') assert '* scrapli_test_session' in result[1].result def test_configuration_session_abort(eos_conn): eos_conn.register_configuration_session(session_name='scrapli_test_session2') result = eos_conn.send_configs(configs=['tacocat', 'show configuration sessions'], privilege_level='scrapli_test_session2', stop_on_failed=True) current_prompt = eos_conn.get_prompt() eos_conn.close() eos_conn.privilege_levels.pop('scrapli_test_session2') assert len(result) == 1 assert current_prompt == 'localhost#'
def print_left_triangle(b): for i in range(1,b+1): print ("*"*i) print ("%"*i) print_left_triangle(20)
def print_left_triangle(b): for i in range(1, b + 1): print('*' * i) print('%' * i) print_left_triangle(20)
def getModels(self): if self._isFalse(self._root): return list([]) if self._isTrue(self._root): models = list([]) else: models = self._getModels(self._root) if self._varFullCount != len(self._varMap): scope1 = self._nodes[self._root].scope scope2 = self._vtreeMan.getScope(self._vtreeMan.getRoot()) missing = list(set(scope1) - set(scope2)) models = self._completeModels(models,missing) return models def _getModels(self,nodeId): node = self._nodes[nodeId] if node.computed: modelsSave, modelsReturn = itertools.tee(node.models,2) node.models = modelsSave return modelsReturn elif isinstance(node,LitNode): model = BitVector(size = self._varFullModelLength) model[node.varId] = (0 if node.negated else 1) node.models = list([model]) node.computed = True return node.models models = [] for (p,s) in node.children: tmpModels = [] if self._isFalse(p) or self._isFalse(s): continue if self._isTrue(p): tmpModels = self._getModels(s) elif self._isTrue(s): tmpModels = self._getModels(p) else: tmpModels= self._product(self._getModels(p),\ self._getModels(s)) #------ complete the computed models if node.scopeCount != self._nodes[p].scopeCount + self._nodes[s].scopeCount: tmpModels = self._completeModels(tmpModels,node.scope,p, s) models = itertools.chain(models,tmpModels) modelsSave, modelsReturn = itertools.tee(node.models,2) node.models = modelsSave return modelsReturn
def get_models(self): if self._isFalse(self._root): return list([]) if self._isTrue(self._root): models = list([]) else: models = self._getModels(self._root) if self._varFullCount != len(self._varMap): scope1 = self._nodes[self._root].scope scope2 = self._vtreeMan.getScope(self._vtreeMan.getRoot()) missing = list(set(scope1) - set(scope2)) models = self._completeModels(models, missing) return models def _get_models(self, nodeId): node = self._nodes[nodeId] if node.computed: (models_save, models_return) = itertools.tee(node.models, 2) node.models = modelsSave return modelsReturn elif isinstance(node, LitNode): model = bit_vector(size=self._varFullModelLength) model[node.varId] = 0 if node.negated else 1 node.models = list([model]) node.computed = True return node.models models = [] for (p, s) in node.children: tmp_models = [] if self._isFalse(p) or self._isFalse(s): continue if self._isTrue(p): tmp_models = self._getModels(s) elif self._isTrue(s): tmp_models = self._getModels(p) else: tmp_models = self._product(self._getModels(p), self._getModels(s)) if node.scopeCount != self._nodes[p].scopeCount + self._nodes[s].scopeCount: tmp_models = self._completeModels(tmpModels, node.scope, p, s) models = itertools.chain(models, tmpModels) (models_save, models_return) = itertools.tee(node.models, 2) node.models = modelsSave return modelsReturn
def Corpus_bello(): return 'Corpus' def actionMan(s): return 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFU'
def corpus_bello(): return 'Corpus' def action_man(s): return 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFU'
# encoding: utf8 owner = 'module2' def show_owner(): print(owner)
owner = 'module2' def show_owner(): print(owner)
# Constants for first year, last year, date of march, and special years FIRST_YEAR = 1900 LAST_YEAR = 2099 DATE_OF_MARCH = 31 SPECIAL_YEARS = [1954, 1981, 2049, 2076] # Prompt and return year def get_year(): valid = False # Enter year until valid year is entered while not valid: year = int(input('Enter a year between 1900 to 2099, or 0 to finish: ')) # Check if valid year is entered if year == 0 or year in range(FIRST_YEAR, LAST_YEAR + 1): valid = True else: print('ERROR...year out of range') print('Please enter a year that is in range. \n') return year # Calculate and return easter sunday date def calculate_easter_sunday(year): a = year % 19 b = year % 4 c = year % 7 d = (19 * a + 24) % 30 e = (2 * b + 4 * c + 6 * d + 5) % 7 easter_sunday = 22 + d + e return easter_sunday # Display easter sunday date in form month day, year def get_date(year, easter_sunday): if easter_sunday > DATE_OF_MARCH: print(f'The date is April {easter_sunday - DATE_OF_MARCH}, {year}. \n') else: print(f'The date is March {easter_sunday}, {year}. \n') # Define main function def main(): finish = False # Enter year until user enters 0 while not finish: # Obtain year year = get_year() # Check if user finishes entering year if year == 0: finish = True else: # Obtain easter sunday date easter_sunday = calculate_easter_sunday(year) # Check if year is in special years if year in SPECIAL_YEARS: easter_sunday -= 7 # Display easter sunday date in form month day, year get_date(year, easter_sunday) # Call main function main()
first_year = 1900 last_year = 2099 date_of_march = 31 special_years = [1954, 1981, 2049, 2076] def get_year(): valid = False while not valid: year = int(input('Enter a year between 1900 to 2099, or 0 to finish: ')) if year == 0 or year in range(FIRST_YEAR, LAST_YEAR + 1): valid = True else: print('ERROR...year out of range') print('Please enter a year that is in range. \n') return year def calculate_easter_sunday(year): a = year % 19 b = year % 4 c = year % 7 d = (19 * a + 24) % 30 e = (2 * b + 4 * c + 6 * d + 5) % 7 easter_sunday = 22 + d + e return easter_sunday def get_date(year, easter_sunday): if easter_sunday > DATE_OF_MARCH: print(f'The date is April {easter_sunday - DATE_OF_MARCH}, {year}. \n') else: print(f'The date is March {easter_sunday}, {year}. \n') def main(): finish = False while not finish: year = get_year() if year == 0: finish = True else: easter_sunday = calculate_easter_sunday(year) if year in SPECIAL_YEARS: easter_sunday -= 7 get_date(year, easter_sunday) main()
def parser(l, r): if all(S[i].isdigit() for i in range(l, r + 1)): return int(S[l:r + 1]) // 2 + 1 ret = [] cnt = 0 start = 0 for i in range(l, r + 1): if S[i] == '[': cnt += 1 if cnt == 1: start = i elif S[i] == ']': if cnt == 1: ret.append(parser(start + 1, i - 1)) cnt -= 1 ret.sort() return sum(ret[:len(ret) // 2 + 1]) N = int(input()) for _ in range(N): S = input() print(parser(0, len(S) - 1))
def parser(l, r): if all((S[i].isdigit() for i in range(l, r + 1))): return int(S[l:r + 1]) // 2 + 1 ret = [] cnt = 0 start = 0 for i in range(l, r + 1): if S[i] == '[': cnt += 1 if cnt == 1: start = i elif S[i] == ']': if cnt == 1: ret.append(parser(start + 1, i - 1)) cnt -= 1 ret.sort() return sum(ret[:len(ret) // 2 + 1]) n = int(input()) for _ in range(N): s = input() print(parser(0, len(S) - 1))
class Strip(object): def plotSurf(self): for cyc in self.cut_cycs: self.df = None print("file to analyse: ",self.file) myResults = RTQuICData_feat(self.file, numCycles =cyc) self.df = myResults.getData() self.addSurflabels() for param in self.params: x_, y_ = 'Surf conc', param sns.stripplot(x = x_,y = y_,hue = "Seed", data = self.df) plt.title("Effect of "+self.surf_name+ " on RTQuIC "+param+ ": "+ str(cyc//4)+ " hours ") plt.legend([],[], frameon=False) plt.show() del self.df
class Strip(object): def plot_surf(self): for cyc in self.cut_cycs: self.df = None print('file to analyse: ', self.file) my_results = rt_qu_ic_data_feat(self.file, numCycles=cyc) self.df = myResults.getData() self.addSurflabels() for param in self.params: (x_, y_) = ('Surf conc', param) sns.stripplot(x=x_, y=y_, hue='Seed', data=self.df) plt.title('Effect of ' + self.surf_name + ' on RTQuIC ' + param + ': ' + str(cyc // 4) + ' hours ') plt.legend([], [], frameon=False) plt.show() del self.df
class Demo: def __init__(self): pass def runDemo(self): print("Hi , This is demo !")
class Demo: def __init__(self): pass def run_demo(self): print('Hi , This is demo !')
def median(l): tmp = l tmp.sort() n = len(tmp) m = n // 2 if n % 2: return tmp[m] else: return (tmp[m] + tmp[m-1]) // 2 n = int(input()) x_ = [] y_ = [] for i in range(n): x, y = [int(j) for j in input().split()] x_.append(x) y_.append(y) y_cable = median(y_) cable = max(x_) - min(x_) cable += sum([abs(y - y_cable) for y in y_]) print(cable)
def median(l): tmp = l tmp.sort() n = len(tmp) m = n // 2 if n % 2: return tmp[m] else: return (tmp[m] + tmp[m - 1]) // 2 n = int(input()) x_ = [] y_ = [] for i in range(n): (x, y) = [int(j) for j in input().split()] x_.append(x) y_.append(y) y_cable = median(y_) cable = max(x_) - min(x_) cable += sum([abs(y - y_cable) for y in y_]) print(cable)
class libro(): def __init__(self,prestamo,devolucion,dame_info): self.prestamo = prestamo self.devolucion = devolucion self.dame_info = dame_info def get_prestamo(self): return def get_devolucion(self): return def get_dame_info(self): return
class Libro: def __init__(self, prestamo, devolucion, dame_info): self.prestamo = prestamo self.devolucion = devolucion self.dame_info = dame_info def get_prestamo(self): return def get_devolucion(self): return def get_dame_info(self): return
class Solution: def findClosestNumber(self, nums: List[int]) -> int: nums.sort(key=lambda x: (abs(x), -x)) return nums[0]
class Solution: def find_closest_number(self, nums: List[int]) -> int: nums.sort(key=lambda x: (abs(x), -x)) return nums[0]
# Create a program that has a tuple fully populated with a count in full, from zero to twenty. # Your program should read a number on the keyboard (between 0 and 20) and show it in full. full = ('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty') while True: number = int(input('Enter a number between 0 and 20: ')) if 0 <= number <= 20: print(f'You typed the number \033[1:32m{full[number]}\033[m.') choice = ' ' while choice not in 'YN': choice = str(input('Do you want to continue? [Y/N] ')).strip().upper()[0] if choice in 'N': break else: print('Try again.', end=' ') print('END')
full = ('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty') while True: number = int(input('Enter a number between 0 and 20: ')) if 0 <= number <= 20: print(f'You typed the number \x1b[1:32m{full[number]}\x1b[m.') choice = ' ' while choice not in 'YN': choice = str(input('Do you want to continue? [Y/N] ')).strip().upper()[0] if choice in 'N': break else: print('Try again.', end=' ') print('END')
class Node: def __init__(self, data): self.val = data self.next = None def __str__(self): return str(self.val) class LinkedList: def __init__(self): self.head = None self._size = 0 def append(self, el): if self.head: pointer = self.head j = 0 while pointer.next: pointer = pointer.next pointer.next = Node(el) else: self.head = Node(el) self._size = self._size + 1 def get(self, index: int): if index > (self._size - 1): return ValueError("Index error") pointer = self.head for _ in range(index): if pointer: pointer = pointer.next return pointer def __len__(self): return self._size if __name__ == '__main__': my_list = LinkedList() my_list.append(5) my_list.append(7) my_list.append(10) for i in range(len(my_list)): print(f"Element in {i} position: ", my_list.get(i)) print("---------------------------") print(my_list.get(0), my_list.get(1), my_list.get(2), my_list.get(3))
class Node: def __init__(self, data): self.val = data self.next = None def __str__(self): return str(self.val) class Linkedlist: def __init__(self): self.head = None self._size = 0 def append(self, el): if self.head: pointer = self.head j = 0 while pointer.next: pointer = pointer.next pointer.next = node(el) else: self.head = node(el) self._size = self._size + 1 def get(self, index: int): if index > self._size - 1: return value_error('Index error') pointer = self.head for _ in range(index): if pointer: pointer = pointer.next return pointer def __len__(self): return self._size if __name__ == '__main__': my_list = linked_list() my_list.append(5) my_list.append(7) my_list.append(10) for i in range(len(my_list)): print(f'Element in {i} position: ', my_list.get(i)) print('---------------------------') print(my_list.get(0), my_list.get(1), my_list.get(2), my_list.get(3))
'''input 2000 ''' inp = int(input('')) print(int((inp-1)*inp*(inp+1)/6+inp))
"""input 2000 """ inp = int(input('')) print(int((inp - 1) * inp * (inp + 1) / 6 + inp))
#File name: SUDOKU.py #Finding unsige cell def FindUnsignedLocation(Board, l): for row in range(0,9): for col in range(0,9): if (Board[row][col] == 0): l[0] = row l[1] = col return True return False def InRow(Board, row, num): for i in range(0,9): if (Board[row][i] == num): return True return False def InCol(Board, col, num): for i in range(0,9): if (Board[i][col] == num): return True return False def InBox(Board, row, col, num): for i in range(0,3): for j in range(0,3): if (Board[i + row][j + col] == num): return True return False def isSafe(Board, row, col, num): return not InCol(Board, col, num) and not InRow(Board, row, num) and not InBox(Board, row - row % 3, col - col % 3, num) def SolveSudoku(Board): l=[0,0] if (not FindUnsignedLocation(Board, l)): return True row = l[0] col = l[1] for num in range(1,10): if (isSafe(Board, row, col, num)): Board[row][col] = num if (SolveSudoku(Board)): return True Board[row][col] = 0 return False
def find_unsigned_location(Board, l): for row in range(0, 9): for col in range(0, 9): if Board[row][col] == 0: l[0] = row l[1] = col return True return False def in_row(Board, row, num): for i in range(0, 9): if Board[row][i] == num: return True return False def in_col(Board, col, num): for i in range(0, 9): if Board[i][col] == num: return True return False def in_box(Board, row, col, num): for i in range(0, 3): for j in range(0, 3): if Board[i + row][j + col] == num: return True return False def is_safe(Board, row, col, num): return not in_col(Board, col, num) and (not in_row(Board, row, num)) and (not in_box(Board, row - row % 3, col - col % 3, num)) def solve_sudoku(Board): l = [0, 0] if not find_unsigned_location(Board, l): return True row = l[0] col = l[1] for num in range(1, 10): if is_safe(Board, row, col, num): Board[row][col] = num if solve_sudoku(Board): return True Board[row][col] = 0 return False
[ [0.02175933, 0.03332428, 0.04187784, 0.03716728, 0.0308031, 0.01415677], [0.02346025, 0.03427124, 0.04290557, 0.0354381, 0.02346025, 0.01953654], ]
[[0.02175933, 0.03332428, 0.04187784, 0.03716728, 0.0308031, 0.01415677], [0.02346025, 0.03427124, 0.04290557, 0.0354381, 0.02346025, 0.01953654]]
def limits(signed, bit_size): signed_limit = 2 ** (bit_size - 1) return (-signed_limit, signed_limit - 1) if signed else (0, 2 * signed_limit - 1) def str_int(signed, bit_size): s = "u" if not signed else "" s += "int" s += "%s" % bit_size return s def assert_int_in_range(value, signed, bit_size): min_val, max_val = limits(signed, bit_size) if value < min_val or value > max_val: s_typ = str_int(signed, bit_size) lim = limits(signed, bit_size) raise(ValueError("%d not in range of %s %s" % (value, s_typ, lim))) def assert_integers_in_range(values, signed, bit_size): for value in values: assert_int_in_range(value, signed, bit_size)
def limits(signed, bit_size): signed_limit = 2 ** (bit_size - 1) return (-signed_limit, signed_limit - 1) if signed else (0, 2 * signed_limit - 1) def str_int(signed, bit_size): s = 'u' if not signed else '' s += 'int' s += '%s' % bit_size return s def assert_int_in_range(value, signed, bit_size): (min_val, max_val) = limits(signed, bit_size) if value < min_val or value > max_val: s_typ = str_int(signed, bit_size) lim = limits(signed, bit_size) raise value_error('%d not in range of %s %s' % (value, s_typ, lim)) def assert_integers_in_range(values, signed, bit_size): for value in values: assert_int_in_range(value, signed, bit_size)
def alternatingCharacters(s): deleted = 0 for i in range(0,len(s)): while True: if i+1 < len(s): if s[i] == s[i+1]: s.pop(i+1) deleted += 1 else: break else: return deleted return deleted print(alternatingCharacters(['a','a','a','a'])) #WRONG ANSWERS ---- DO IT AGAIN
def alternating_characters(s): deleted = 0 for i in range(0, len(s)): while True: if i + 1 < len(s): if s[i] == s[i + 1]: s.pop(i + 1) deleted += 1 else: break else: return deleted return deleted print(alternating_characters(['a', 'a', 'a', 'a']))
class Solution: # @param {integer[]} nums # @return {integer[]} def singleNumber(self, nums): xor = reduce(operator.xor, nums) res = reduce(operator.xor, (x for x in nums if x & xor & -xor)) return [res, res ^ xor]
class Solution: def single_number(self, nums): xor = reduce(operator.xor, nums) res = reduce(operator.xor, (x for x in nums if x & xor & -xor)) return [res, res ^ xor]
class Solution: def num_decodings(self, s: str) -> int: self.memoize = {} return self.find(s) def find(self, s): if s in self.memoize: return self.memoize[s] elif s == '': return 1 else: qty = 0 if int(s[:1]) > 0: qty = self.find(s[1:]) self.memoize[s[1:]] = qty if len(s) >= 2 and 0 < int(s[:2]) <= 26 and s[0] != '0': qty += self.find(s[2:]) self.memoize[s[2:]] = qty - self.memoize[s[1:]] return qty if __name__ == '__main__': solution = Solution() s = ('927297167251227735495393942768951823971422829346' '3398742522722274929422229859968434281231132695842184') print(solution.num_decodings(s))
class Solution: def num_decodings(self, s: str) -> int: self.memoize = {} return self.find(s) def find(self, s): if s in self.memoize: return self.memoize[s] elif s == '': return 1 else: qty = 0 if int(s[:1]) > 0: qty = self.find(s[1:]) self.memoize[s[1:]] = qty if len(s) >= 2 and 0 < int(s[:2]) <= 26 and (s[0] != '0'): qty += self.find(s[2:]) self.memoize[s[2:]] = qty - self.memoize[s[1:]] return qty if __name__ == '__main__': solution = solution() s = '9272971672512277354953939427689518239714228293463398742522722274929422229859968434281231132695842184' print(solution.num_decodings(s))
side = 1080 frames = 48 def shape(thickness): fill(0) stroke(1) strokeWidth(1) with savedState(): rotate(startAngle + f * (endAngle - startAngle), (thickness*0.1, thickness*0.1)) rect(0 - (thickness/2), 0 - (thickness/2), thickness, thickness) for i in range(frames): phase = 2 * pi * i / frames startAngle = 90 * sin(phase) endAngle = 180 * sin(phase + 0.5 * pi) f = i / side points = [] x = side * 0.1 y = side * 0.9 points.append((x, y)) while x < side*0.9: x += 2 if x < side*0.25: y = (-5.3333 * (x - (side * 0.1))) + (side * 0.9) elif x < side*0.5: y = (3.2 * (x - (side * 0.25))) + (side * 0.1) elif x < side*0.75: y = (-3.2 * (x - (side * 0.5))) + (side * 0.9) elif x < side*0.9: y = (5.3333 * (x - (side * 0.75))) + (side * 0.1) points.append((x, y)) newPage(side, side) fill(0) rect(0, 0, side, side) for point in points: with savedState(): translate(point[0], point[1]) shape(side*0.1) saveImage('~/Desktop/23_36_DAYS_OF_TYPE_2020.mp4')
side = 1080 frames = 48 def shape(thickness): fill(0) stroke(1) stroke_width(1) with saved_state(): rotate(startAngle + f * (endAngle - startAngle), (thickness * 0.1, thickness * 0.1)) rect(0 - thickness / 2, 0 - thickness / 2, thickness, thickness) for i in range(frames): phase = 2 * pi * i / frames start_angle = 90 * sin(phase) end_angle = 180 * sin(phase + 0.5 * pi) f = i / side points = [] x = side * 0.1 y = side * 0.9 points.append((x, y)) while x < side * 0.9: x += 2 if x < side * 0.25: y = -5.3333 * (x - side * 0.1) + side * 0.9 elif x < side * 0.5: y = 3.2 * (x - side * 0.25) + side * 0.1 elif x < side * 0.75: y = -3.2 * (x - side * 0.5) + side * 0.9 elif x < side * 0.9: y = 5.3333 * (x - side * 0.75) + side * 0.1 points.append((x, y)) new_page(side, side) fill(0) rect(0, 0, side, side) for point in points: with saved_state(): translate(point[0], point[1]) shape(side * 0.1) save_image('~/Desktop/23_36_DAYS_OF_TYPE_2020.mp4')
#define a dictionary data structure #dictionaries have a key : value pair for elements example_dict = { "class":"Astr 119", "prof":"Brant", "awesomeness":10 } print(type(example_dict)) #get a value using a key course = example_dict["class"] print(course) #change a value using a key example_dict["awesomeness"]+=1 print(example_dict) #print element by element using a for loop for x in example_dict.keys(): print(x,example_dict[x])
example_dict = {'class': 'Astr 119', 'prof': 'Brant', 'awesomeness': 10} print(type(example_dict)) course = example_dict['class'] print(course) example_dict['awesomeness'] += 1 print(example_dict) for x in example_dict.keys(): print(x, example_dict[x])
# Python 3 Program to find # sum of Fibonacci numbers # Computes value of first # fibonacci numbers def calculateSum(n) : if (n <= 0) : return 0 fibo =[0] * (n+1) fibo[1] = 1 # Initialize result sm = fibo[0] + fibo[1] # Add remaining terms for i in range(2,n+1) : fibo[i] = fibo[i-1] + fibo[i-2] sm = sm + fibo[i] return sm n=int(input()) print("Sum of Fibonacci numbers is : " , calculateSum(n))
def calculate_sum(n): if n <= 0: return 0 fibo = [0] * (n + 1) fibo[1] = 1 sm = fibo[0] + fibo[1] for i in range(2, n + 1): fibo[i] = fibo[i - 1] + fibo[i - 2] sm = sm + fibo[i] return sm n = int(input()) print('Sum of Fibonacci numbers is : ', calculate_sum(n))
# Calculando descontos produto = float(input('Qual o valor do produto ? R$ ')) novo = produto - (produto * 5 / 100) print('O produto com 5% de desconto ficara : R$ {:.2f} '.format(novo))
produto = float(input('Qual o valor do produto ? R$ ')) novo = produto - produto * 5 / 100 print('O produto com 5% de desconto ficara : R$ {:.2f} '.format(novo))
def can_build(env, platform): return platform=="android" or platform=="iphone" def configure(env): if (env['platform'] == 'android'): env.android_add_dependency("implementation \"com.android.support:support-v4:28.0.0\"") env.android_add_dependency("implementation \"com.google.android.gms:play-services-location:16.0.0\"") env.android_add_java_dir("android") env.android_add_to_permissions("android/AndroidPermissionsChunk.xml") env.disable_module() if env['platform'] == "iphone": env.Append(FRAMEWORKPATH=['modules/location/ios/lib']) env.Append(LINKFLAGS=['-ObjC', '-framework','CoreLocation'])
def can_build(env, platform): return platform == 'android' or platform == 'iphone' def configure(env): if env['platform'] == 'android': env.android_add_dependency('implementation "com.android.support:support-v4:28.0.0"') env.android_add_dependency('implementation "com.google.android.gms:play-services-location:16.0.0"') env.android_add_java_dir('android') env.android_add_to_permissions('android/AndroidPermissionsChunk.xml') env.disable_module() if env['platform'] == 'iphone': env.Append(FRAMEWORKPATH=['modules/location/ios/lib']) env.Append(LINKFLAGS=['-ObjC', '-framework', 'CoreLocation'])
class Node(object): TRUE = 't' FALSE = 'f' QUERY = '?' NOTHING = '-' def __init__(self, name): self.name = name self.status = self.NOTHING self.cpt = [] self.index = None self.__children = [] self.__parents = [] return def __str__(self): return self.name def addCPT(self, cpt): self.cpt = cpt def addChild(self, node): self.__children.append(node) node.__parents.append(self) def children(self): return self.__children def parents(self): return self.__parents
class Node(object): true = 't' false = 'f' query = '?' nothing = '-' def __init__(self, name): self.name = name self.status = self.NOTHING self.cpt = [] self.index = None self.__children = [] self.__parents = [] return def __str__(self): return self.name def add_cpt(self, cpt): self.cpt = cpt def add_child(self, node): self.__children.append(node) node.__parents.append(self) def children(self): return self.__children def parents(self): return self.__parents
# -*- coding: utf-8 -*- ''' File name: code\su_doku\sol_96.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #96 :: Su Doku # # For more information see: # https://projecteuler.net/problem=96 # Problem Statement ''' Su Doku (Japanese meaning number place) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid. 0 0 39 0 00 0 1 0 2 03 0 58 0 6 6 0 00 0 14 0 0 0 0 87 0 00 0 6 1 0 20 0 07 0 8 9 0 00 0 82 0 0 0 0 28 0 00 0 5 6 0 92 0 30 1 0 5 0 00 0 93 0 0 4 8 39 6 72 5 1 9 2 13 4 58 7 6 6 5 78 2 14 9 3 5 4 87 2 91 3 6 1 3 25 6 47 9 8 9 7 61 3 82 4 5 3 7 28 1 46 9 5 6 8 92 5 34 1 7 5 1 47 6 93 8 2 A well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered easy because it can be solved by straight forward direct deduction. The 6K text file, sudoku.txt (right click and 'Save Link/Target As...'), contains fifty different Su Doku puzzles ranging in difficulty, but all with unique solutions (the first puzzle in the file is the example above). By solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above. ''' # Solution # Solution Approach ''' '''
""" File name: code\\su_doku\\sol_96.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nSu Doku (Japanese meaning number place) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.\n\n\n0 0 39 0 00 0 1\n0 2 03 0 58 0 6\n6 0 00 0 14 0 0\n0 0 87 0 00 0 6\n1 0 20 0 07 0 8\n9 0 00 0 82 0 0\n0 0 28 0 00 0 5\n6 0 92 0 30 1 0\n5 0 00 0 93 0 0\n\n\n\n4 8 39 6 72 5 1\n9 2 13 4 58 7 6\n6 5 78 2 14 9 3\n5 4 87 2 91 3 6\n1 3 25 6 47 9 8\n9 7 61 3 82 4 5\n3 7 28 1 46 9 5\n6 8 92 5 34 1 7\n5 1 47 6 93 8 2\n\n\nA well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered easy because it can be solved by straight forward direct deduction.\nThe 6K text file, sudoku.txt (right click and \'Save Link/Target As...\'), contains fifty different Su Doku puzzles ranging in difficulty, but all with unique solutions (the first puzzle in the file is the example above).\nBy solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above.\n' '\n'
array = [list(map(int, input().split())) for i in range(5)] check = [list(map(int, input().split())) for i in range(5)] def checkBingo(arr): bingoNum = 0 rightSlide = 0 leftSlide = 0 for i in range(5): colZeroNum = 0 verZeroNum = 0 for j in range(5): if(arr[i][j] == 0): colZeroNum += 1 if(arr[j][i] == 0): verZeroNum += 1 if(i == j and arr[i][j]==0): rightSlide += 1 if((i + j) == 4 and arr[i][j]==0): leftSlide += 1 if(colZeroNum == 5): bingoNum+=1 if(verZeroNum == 5): bingoNum+=1 if(leftSlide == 5): bingoNum+=1 if(rightSlide == 5): bingoNum+=1 return bingoNum def checkArr(num, arr): for i in range(5): for j in range(5): if(arr[i][j] == num): arr[i][j] = 0 bingoNum = checkBingo(arr) return bingoNum for i in range(5): for j in range(5): bingonum = checkArr(check[i][j], array) #print(array) if(bingonum >= 3): print(i * 5 + j + 1) break if(bingonum >= 3): break
array = [list(map(int, input().split())) for i in range(5)] check = [list(map(int, input().split())) for i in range(5)] def check_bingo(arr): bingo_num = 0 right_slide = 0 left_slide = 0 for i in range(5): col_zero_num = 0 ver_zero_num = 0 for j in range(5): if arr[i][j] == 0: col_zero_num += 1 if arr[j][i] == 0: ver_zero_num += 1 if i == j and arr[i][j] == 0: right_slide += 1 if i + j == 4 and arr[i][j] == 0: left_slide += 1 if colZeroNum == 5: bingo_num += 1 if verZeroNum == 5: bingo_num += 1 if leftSlide == 5: bingo_num += 1 if rightSlide == 5: bingo_num += 1 return bingoNum def check_arr(num, arr): for i in range(5): for j in range(5): if arr[i][j] == num: arr[i][j] = 0 bingo_num = check_bingo(arr) return bingoNum for i in range(5): for j in range(5): bingonum = check_arr(check[i][j], array) if bingonum >= 3: print(i * 5 + j + 1) break if bingonum >= 3: break
def seq_search(lst, element): pos = 0 found = False while pos < len(lst) and not found: if lst[pos] == element: found = True else: pos += 1 return found arr = [1,2,3,4,5,56] print(seq_search(arr,3)) print(seq_search(arr,56)) print(seq_search(arr,1)) print(seq_search(arr,6))
def seq_search(lst, element): pos = 0 found = False while pos < len(lst) and (not found): if lst[pos] == element: found = True else: pos += 1 return found arr = [1, 2, 3, 4, 5, 56] print(seq_search(arr, 3)) print(seq_search(arr, 56)) print(seq_search(arr, 1)) print(seq_search(arr, 6))
#!/usr/bin/env python3 # https://abc061.contest.atcoder.jp/tasks/abc061_b n, m = map(int, input().split()) a = [0] * n for _ in range(m): u, v = map(int, input().split()) a[u - 1] += 1 a[v - 1] += 1 for x in a: print(x)
(n, m) = map(int, input().split()) a = [0] * n for _ in range(m): (u, v) = map(int, input().split()) a[u - 1] += 1 a[v - 1] += 1 for x in a: print(x)
languages = [ { 'language' : 'lang_cpp', 'display_name' : 'C++', 'build_configurations' : [ { 'compiler': 'msvc', 'builder': 'build_cpp_sources_with_msvc', }, { 'compiler': 'gcc', 'builder': 'build_cpp_sources_with_gcc', }, { 'compiler': 'clang', 'builder': 'build_cpp_sources_with_clang', } ] }, { 'language' : 'lang_d', 'display_name' : 'D', 'build_configurations' : [ { 'compiler' : 'dmd', 'builder' : 'build_d_sources_with_dmd', }, { 'compiler' : 'gdc', 'builder' : 'build_d_sources_with_gdc', }, { 'compiler' : 'ldc', 'builder' : 'build_d_sources_with_ldc', } ] }, { 'language' : 'lang_go', 'display_name' : 'Go', 'build_configurations' : [ { 'compiler' : 'go', 'builder' : 'build_go_sources', }, { 'compiler' : 'gccgo', 'builder' : 'build_go_sources_with_gccgo', } ] } ]
languages = [{'language': 'lang_cpp', 'display_name': 'C++', 'build_configurations': [{'compiler': 'msvc', 'builder': 'build_cpp_sources_with_msvc'}, {'compiler': 'gcc', 'builder': 'build_cpp_sources_with_gcc'}, {'compiler': 'clang', 'builder': 'build_cpp_sources_with_clang'}]}, {'language': 'lang_d', 'display_name': 'D', 'build_configurations': [{'compiler': 'dmd', 'builder': 'build_d_sources_with_dmd'}, {'compiler': 'gdc', 'builder': 'build_d_sources_with_gdc'}, {'compiler': 'ldc', 'builder': 'build_d_sources_with_ldc'}]}, {'language': 'lang_go', 'display_name': 'Go', 'build_configurations': [{'compiler': 'go', 'builder': 'build_go_sources'}, {'compiler': 'gccgo', 'builder': 'build_go_sources_with_gccgo'}]}]
# %% # Ensure the target is unchanged # assert all(y_tr.sort_index() == original_y_train.sort_index()) # Ensure the target is unchanged (unshuffled!) # assert all(y_tr == original_y_train) # %% Predict on X_tr for comparison y_tr_predicted = clf_grid_BEST.predict(X_tr) # original_y_train.value_counts() # y_tr.cat.codes.value_counts() # y_tr_predicted.value_counts() # y_tr.value_counts() train_kappa = kappa(y_tr, y_tr_predicted) logging.info("Metric on training set: {:0.3f}".format(train_kappa)) # these_labels = list(label_maps['AdoptionSpeed'].values()) sk.metrics.confusion_matrix(y_tr, y_tr_predicted) #%% Predict on X_cv for cross validation if CV_FRACTION > 0: y_cv_predicted = clf_grid_BEST.predict(X_cv) train_kappa_cv = kappa(y_cv, y_cv_predicted) logging.info("Metric on Cross Validation set: {:0.3f}".format(train_kappa_cv)) sk.metrics.confusion_matrix(y_cv, y_cv_predicted) #%% Predict on Test set # NB we only want the defaulters column! logging.info("Predicting on X_te".format()) predicted = clf_grid_BEST.predict(X_te) # raise "Lost the sorting of y!" #%% Open the submission # with zipfile.ZipFile(path_data / "test.zip").open("sample_submission.csv") as f: # df_submission = pd.read_csv(f, delimiter=',') logging.info("Creating submission".format()) df_submission_template = pd.read_csv(path_data / 'test' / 'sample_submission.csv', delimiter=',') df_submission = pd.DataFrame({'PetID': df_submission_template.PetID, 'AdoptionSpeed': [int(i) for i in predicted]}) #%% Collect predicitons df_submission.head() #%% Create csv logging.info("Saving submission to csv.".format()) df_submission.to_csv('submission.csv', index=False)
y_tr_predicted = clf_grid_BEST.predict(X_tr) train_kappa = kappa(y_tr, y_tr_predicted) logging.info('Metric on training set: {:0.3f}'.format(train_kappa)) sk.metrics.confusion_matrix(y_tr, y_tr_predicted) if CV_FRACTION > 0: y_cv_predicted = clf_grid_BEST.predict(X_cv) train_kappa_cv = kappa(y_cv, y_cv_predicted) logging.info('Metric on Cross Validation set: {:0.3f}'.format(train_kappa_cv)) sk.metrics.confusion_matrix(y_cv, y_cv_predicted) logging.info('Predicting on X_te'.format()) predicted = clf_grid_BEST.predict(X_te) logging.info('Creating submission'.format()) df_submission_template = pd.read_csv(path_data / 'test' / 'sample_submission.csv', delimiter=',') df_submission = pd.DataFrame({'PetID': df_submission_template.PetID, 'AdoptionSpeed': [int(i) for i in predicted]}) df_submission.head() logging.info('Saving submission to csv.'.format()) df_submission.to_csv('submission.csv', index=False)
def fun(a,b,c,d,e,f): if(a>=d and b>=e and c>=f) and (a>d or b>e or c>f): return 1 elif(a<=d and b<=e and c<=f) and (a<d or b<e or c<f): return 1 return 0 for i in range(int(input())): a = [int(j) for j in input().split()] b = [int(j) for j in input().split()] c = [int(j) for j in input().split()] if(fun(a[0],a[1],a[2],b[0],b[1],b[2]) and fun(a[0],a[1],a[2],c[0],c[1],c[2]) and fun(c[0],c[1],c[2],b[0],b[1],b[2])): print('yes') else: print('no')
def fun(a, b, c, d, e, f): if (a >= d and b >= e and (c >= f)) and (a > d or b > e or c > f): return 1 elif (a <= d and b <= e and (c <= f)) and (a < d or b < e or c < f): return 1 return 0 for i in range(int(input())): a = [int(j) for j in input().split()] b = [int(j) for j in input().split()] c = [int(j) for j in input().split()] if fun(a[0], a[1], a[2], b[0], b[1], b[2]) and fun(a[0], a[1], a[2], c[0], c[1], c[2]) and fun(c[0], c[1], c[2], b[0], b[1], b[2]): print('yes') else: print('no')
class TwoSum: def __init__(self, arr , target: int) : self.arr = arr self.target = target def get_to_sum(self): i = 0 while i<len(arr): val = target - arr[i] if val in arr[i+1:]: return [i, arr.index(val, i+1)] else: i += 1 if __name__ == "__main__": arr = [3,2,4] target = 6 two_sum = TwoSum(arr=arr, target=target) print(two_sum.get_to_sum()) # [1,2]
class Twosum: def __init__(self, arr, target: int): self.arr = arr self.target = target def get_to_sum(self): i = 0 while i < len(arr): val = target - arr[i] if val in arr[i + 1:]: return [i, arr.index(val, i + 1)] else: i += 1 if __name__ == '__main__': arr = [3, 2, 4] target = 6 two_sum = two_sum(arr=arr, target=target) print(two_sum.get_to_sum())
mod = pow(10, 9)+7 match = dict() for i in range(26): match[chr(i+97)] = i+1 def rabin_karp(text, pattern): n, m = len(text), len(pattern) if n < m: return False hash_pattern = 0 i = 0 for p in pattern[::-1]: hash_pattern = (hash_pattern + pow(26, i, mod) * match[p]) % mod i += 1 hash_window = 0 i = 0 for t in text[:m][::-1]: hash_window = (hash_window + pow(26, i, mod) * match[t]) % mod i += 1 i = m-1 while i < n: if hash_pattern == hash_window: j, k = i-m+1, 0 r = True while k < m: if pattern[k] != text[j]: r = False break j += 1 k += 1 if r: return r hash_window = (hash_window - pow(26, m-1, mod) * match[text[i-m+1]] + mod) % mod i += 1 if i < n: hash_window = (hash_window * 26) % mod hash_window = (hash_window + match[text[i]]) % mod return False print(rabin_karp("opaospanwapaosopanwarlosj", "panwar"))
mod = pow(10, 9) + 7 match = dict() for i in range(26): match[chr(i + 97)] = i + 1 def rabin_karp(text, pattern): (n, m) = (len(text), len(pattern)) if n < m: return False hash_pattern = 0 i = 0 for p in pattern[::-1]: hash_pattern = (hash_pattern + pow(26, i, mod) * match[p]) % mod i += 1 hash_window = 0 i = 0 for t in text[:m][::-1]: hash_window = (hash_window + pow(26, i, mod) * match[t]) % mod i += 1 i = m - 1 while i < n: if hash_pattern == hash_window: (j, k) = (i - m + 1, 0) r = True while k < m: if pattern[k] != text[j]: r = False break j += 1 k += 1 if r: return r hash_window = (hash_window - pow(26, m - 1, mod) * match[text[i - m + 1]] + mod) % mod i += 1 if i < n: hash_window = hash_window * 26 % mod hash_window = (hash_window + match[text[i]]) % mod return False print(rabin_karp('opaospanwapaosopanwarlosj', 'panwar'))
class GenericRetriesHandler: def __init__(self, *args, **kwargs): self.count = 0 def is_eligible(self, response): raise NotImplementedError def increment(self): self.count += 1
class Genericretrieshandler: def __init__(self, *args, **kwargs): self.count = 0 def is_eligible(self, response): raise NotImplementedError def increment(self): self.count += 1
def get_answer(lines): # print(lines) lowwater = 0 highwater = len(lines) - 1 j = highwater # print(f"highwater= {highwater}, lowwater= {lowwater}") while lowwater < j: sum = lines[lowwater] + lines[j] if sum == 2020: return(lines[lowwater] * lines[j]) elif lowwater == (j-1) or sum < 2020: lowwater += 1 j = highwater elif sum > 2020: j -= 1 print(f"highwater= {j}, lowwater= {lowwater}") return(0) def main(): lines = [] with open("01-input-sorted") as fp: for line in fp: lines.append(int(line)) answer = get_answer(lines) if answer > 0: print(answer) else: print("No answer") if __name__ == '__main__': main()
def get_answer(lines): lowwater = 0 highwater = len(lines) - 1 j = highwater while lowwater < j: sum = lines[lowwater] + lines[j] if sum == 2020: return lines[lowwater] * lines[j] elif lowwater == j - 1 or sum < 2020: lowwater += 1 j = highwater elif sum > 2020: j -= 1 print(f'highwater= {j}, lowwater= {lowwater}') return 0 def main(): lines = [] with open('01-input-sorted') as fp: for line in fp: lines.append(int(line)) answer = get_answer(lines) if answer > 0: print(answer) else: print('No answer') if __name__ == '__main__': main()
defaults = { "Wiki homepage": "Contents", "Default tab on page load": ("History", "Articles", "Tabs"), "Save pasted images as": ("JPEG", "PNG"), } DB_SCHEMA = 0 PRODUCT_NAME = "Folio" PRODUCT_VERSION = "0.0.7a" PRODUCT = f"{PRODUCT_NAME} ver {PRODUCT_VERSION}"
defaults = {'Wiki homepage': 'Contents', 'Default tab on page load': ('History', 'Articles', 'Tabs'), 'Save pasted images as': ('JPEG', 'PNG')} db_schema = 0 product_name = 'Folio' product_version = '0.0.7a' product = f'{PRODUCT_NAME} ver {PRODUCT_VERSION}'
qtd=(int(input("Enter with the quantity: "))) if(qtd<1): while True: print("Error! The quantity needs to be positive") qtd=(int(input("Enter with the quantity: "))) if not(qtd<1): break def converter(number): return number*-1 number=[] for i in range(qtd): number.append(float(input("Enter with the number: "))) if(number[i]<0): print("This position in list had the negative number converted to be a positive number") print("Pre-converted number: ", number[i]) number[i]=converter(number[i]) print("Converted number: ", number[i]) elif(number[i]>0): print("This position in list had the positive number converted to be a negative number") print("Pre-converted number: ", number[i]) number[i]=converter(number[i]) print("Converted number: ", number[i]) else: print("Zero is a neutral number")
qtd = int(input('Enter with the quantity: ')) if qtd < 1: while True: print('Error! The quantity needs to be positive') qtd = int(input('Enter with the quantity: ')) if not qtd < 1: break def converter(number): return number * -1 number = [] for i in range(qtd): number.append(float(input('Enter with the number: '))) if number[i] < 0: print('This position in list had the negative number converted to be a positive number') print('Pre-converted number: ', number[i]) number[i] = converter(number[i]) print('Converted number: ', number[i]) elif number[i] > 0: print('This position in list had the positive number converted to be a negative number') print('Pre-converted number: ', number[i]) number[i] = converter(number[i]) print('Converted number: ', number[i]) else: print('Zero is a neutral number')
class Bar: def __init__( self, ticker: str, ts: int, open: float, high: float, low: float, close: float, adj_close: float, volume: int, _id: int = None ) -> None: self.id = _id self.ticker = ticker self.date = ts self.open = open self.high = high self.low = low self.close = close self.adj_close = adj_close self.volume = volume class Bars: def __init__(self, bar) -> None: self.bar = bar def save(self) -> None: pass def add(self): pass
class Bar: def __init__(self, ticker: str, ts: int, open: float, high: float, low: float, close: float, adj_close: float, volume: int, _id: int=None) -> None: self.id = _id self.ticker = ticker self.date = ts self.open = open self.high = high self.low = low self.close = close self.adj_close = adj_close self.volume = volume class Bars: def __init__(self, bar) -> None: self.bar = bar def save(self) -> None: pass def add(self): pass
#quick Sorting def quick_sort(list): if len(list)<2: return list else: pivot=int(list.pop()) right_items,left_items=[],[] for item in list: if int(item)>pivot: right_items.append(int(item)) else: left_items.append(int(item)) return quick_sort(left_items)+[pivot]+quick_sort(right_items) a=input("enter numbers separated by space :"). split() print(quick_sort(a))
def quick_sort(list): if len(list) < 2: return list else: pivot = int(list.pop()) (right_items, left_items) = ([], []) for item in list: if int(item) > pivot: right_items.append(int(item)) else: left_items.append(int(item)) return quick_sort(left_items) + [pivot] + quick_sort(right_items) a = input('enter numbers separated by space :').split() print(quick_sort(a))
TABLE_CLOTH_DELTA = 0.6 TABLE_CLOTH_TEXTILE_PRICE = 7 CARRE_TEXTILE_PRICE = 9 USD_TO_BGN = 1.85 number_of_tables = int(input('Rectangular tables')) table_length = float(input('Tables length')) table_width = float(input('Table width')) area_table_cloth = (table_length + TABLE_CLOTH_DELTA) * (table_width + TABLE_CLOTH_DELTA) carre_side = table_length / 2 area_carre = carre_side ** 2 needed_table_cloth = number_of_tables * area_table_cloth needed_carre_cloth = number_of_tables * area_carre cloth_price = needed_table_cloth * TABLE_CLOTH_TEXTILE_PRICE carre_price = needed_carre_cloth * CARRE_TEXTILE_PRICE total_usd = carre_price + cloth_price total_bgn = total_usd * USD_TO_BGN print(f'{total_usd:.2f} USD') print(f'{total_bgn:.2f} BGN')
table_cloth_delta = 0.6 table_cloth_textile_price = 7 carre_textile_price = 9 usd_to_bgn = 1.85 number_of_tables = int(input('Rectangular tables')) table_length = float(input('Tables length')) table_width = float(input('Table width')) area_table_cloth = (table_length + TABLE_CLOTH_DELTA) * (table_width + TABLE_CLOTH_DELTA) carre_side = table_length / 2 area_carre = carre_side ** 2 needed_table_cloth = number_of_tables * area_table_cloth needed_carre_cloth = number_of_tables * area_carre cloth_price = needed_table_cloth * TABLE_CLOTH_TEXTILE_PRICE carre_price = needed_carre_cloth * CARRE_TEXTILE_PRICE total_usd = carre_price + cloth_price total_bgn = total_usd * USD_TO_BGN print(f'{total_usd:.2f} USD') print(f'{total_bgn:.2f} BGN')
# Copyright 2009-2017 Ram Rachum. # This program is distributed under the MIT license. data = '''James John Robert Michael William David Richard Charles Joseph Thomas Christopher Daniel Paul Mark Donald George Kenneth Steven Edward Brian Ronald Anthony Kevin Jason Matthew Gary Timothy Jose Larry Jeffrey Frank Scott Eric Stephen Andrew Raymond Gregory Joshua Jerry Dennis Walter Patrick Peter Harold Douglas Henry Carl Arthur Ryan Roger Joe Juan Jack Albert Jonathan Justin Terry Gerald Keith Samuel Willie Ralph Lawrence Nicholas Roy Benjamin Bruce Brandon Adam Harry Fred Wayne Billy Steve Louis Jeremy Aaron Randy Howard Eugene Carlos Russell Bobby Victor Martin Ernest Phillip Todd Jesse Craig Alan Shawn Clarence Sean Philip Chris Johnny Earl Jimmy Antonio Danny Bryan Tony Luis Mike Stanley Leonard Nathan Dale Manuel Rodney Curtis Norman Allen Marvin Vincent Glenn Jeffery Travis Jeff Chad Jacob Lee Melvin Alfred Kyle Francis Bradley Jesus Herbert Frederick Ray Joel Edwin Don Eddie Ricky Troy Randall Barry Alexander Bernard Mario Leroy Francisco Marcus Micheal Theodore Clifford Miguel Oscar Jay Jim Tom Calvin Alex Jon Ronnie Bill Lloyd Tommy Leon Derek Warren Darrell Jerome Floyd Leo Alvin Tim Wesley Gordon Dean Greg Jorge Dustin Pedro Derrick Dan Lewis Zachary Corey Herman Maurice Vernon Roberto Clyde Glen Hector Shane Ricardo Sam Rick Lester Brent Ramon Charlie Tyler Gilbert Gene Marc Reginald Ruben Brett Angel Nathaniel Rafael Leslie Edgar Milton Raul Ben Chester Cecil Duane Franklin Andre Elmer Brad Gabriel Ron Mitchell Roland Arnold Harvey Jared Adrian Karl Cory Claude Erik Darryl Jamie Neil Jessie Christian Javier Fernando Clinton Ted Mathew Tyrone Darren Lonnie Lance Cody Julio Kelly Kurt Allan Nelson Guy Clayton Hugh Max Dwayne Dwight Armando Felix Jimmie Everett Jordan Ian Wallace Ken Bob Jaime Casey Alfredo Alberto Dave Ivan Johnnie Sidney Byron Julian Isaac Morris Clifton Willard Daryl Ross Virgil Andy Marshall Salvador Perry Kirk Sergio Marion Tracy Seth Kent Terrance Rene Eduardo Terrence Enrique Freddie Wade Austin Stuart Fredrick Arturo Alejandro Jackie Joey Nick Luther Wendell Jeremiah Evan Julius Dana Donnie Otis Shannon Trevor Oliver Luke Homer Gerard Doug Kenny Hubert Angelo Shaun Lyle Matt Lynn Alfonso Orlando Rex Carlton Ernesto Cameron Neal Pablo Lorenzo Omar Wilbur Blake Grant Horace Roderick Kerry Abraham Willis Rickey Jean Ira Andres Cesar Johnathan Malcolm Rudolph Damon Kelvin Rudy Preston Alton Archie Marco Wm Pete Randolph Garry Geoffrey Jonathon Felipe Bennie Gerardo Ed Dominic Robin Loren Delbert Colin Guillermo Earnest Lucas Benny Noel Spencer Rodolfo Myron Edmund Garrett Salvatore Cedric Lowell Gregg Sherman Wilson Devin Sylvester Kim Roosevelt Israel Jermaine Forrest Wilbert Leland Simon Guadalupe Clark Irving Carroll Bryant Owen Rufus Woodrow Sammy Kristopher Mack Levi Marcos Gustavo Jake Lionel Marty Taylor Ellis Dallas Gilberto Clint Nicolas Laurence Ismael Orville Drew Jody Ervin Dewey Al Wilfred Josh Hugo Ignacio Caleb Tomas Sheldon Erick Frankie Stewart Doyle Darrel Rogelio Terence Santiago Alonzo Elias Bert Elbert Ramiro Conrad Pat Noah Grady Phil Cornelius Lamar Rolando Clay Percy Dexter Bradford Merle Darin Amos Terrell Moses Irvin Saul Roman Darnell Randal Tommie Timmy Darrin Winston Brendan Toby Van Abel Dominick Boyd Courtney Jan Emilio Elijah Cary Domingo Santos Aubrey Emmett Marlon Emanuel Jerald Edmond Emil Dewayne Will Otto Teddy Reynaldo Bret Morgan Jess Trent Humberto Emmanuel Stephan Louie Vicente Lamont Stacy Garland Miles Micah Efrain Billie Logan Heath Rodger Harley Demetrius Ethan Eldon Rocky Pierre Junior Freddy Eli Bryce Antoine Robbie Kendall Royce Sterling Mickey Chase Grover Elton Cleveland Dylan Chuck Damian Reuben Stan August Leonardo Jasper Russel Erwin Benito Hans Monte Blaine Ernie Curt Quentin Agustin Murray Jamal Devon Adolfo Harrison Tyson Burton Brady Elliott Wilfredo Bart Jarrod Vance Denis Damien Joaquin Harlan Desmond Elliot Darwin Ashley Gregorio Buddy Xavier Kermit Roscoe Esteban Anton Solomon Scotty Norbert Elvin Williams Nolan Carey Rod Quinton Hal Brain Rob Elwood Kendrick Darius Moises Son Marlin Fidel Thaddeus Cliff Marcel Ali Jackson Raphael Bryon Armand Alvaro Jeffry Dane Joesph Thurman Ned Sammie Rusty Michel Monty Rory Fabian Reggie Mason Graham Kris Isaiah Vaughn Gus Avery Loyd Diego Alexis Adolph Norris Millard Rocco Gonzalo Derick Rodrigo Gerry Stacey Carmen Wiley Rigoberto Alphonso Ty Shelby Rickie Noe Vern Bobbie Reed Jefferson Elvis Bernardo Mauricio Hiram Donovan Basil Riley Ollie Nickolas Maynard Scot Vince Quincy Eddy Sebastian Federico Ulysses Heriberto Donnell Cole Denny Davis Gavin Emery Ward Romeo Jayson Dion Dante Clement Coy Odell Maxwell Jarvis Bruno Issac Mary Dudley Brock Sanford Colby Carmelo Barney Nestor Hollis Stefan Donny Art Linwood Beau Weldon Galen Isidro Truman Delmar Johnathon Silas Frederic Dick Kirby Irwin Cruz Merlin Merrill Charley Marcelino Lane Harris Cleo Carlo Trenton Kurtis Hunter Aurelio Winfred Vito Collin Denver Carter Leonel Emory Pasquale Mohammad Mariano Danial Blair Landon Dirk Branden Adan Numbers Clair Buford German Bernie Wilmer Joan Emerson Zachery Fletcher Jacques Errol Dalton Monroe Josue Dominique Edwardo Booker Wilford Sonny Shelton Carson Theron Raymundo Daren Tristan Houston Robby Lincoln Jame Genaro Gale Bennett Octavio Cornell Laverne Hung Arron Antony Herschel Alva Giovanni Garth Cyrus Cyril Ronny Stevie Lon Freeman Erin Duncan Kennith Carmine Augustine Young Erich Chadwick Wilburn Russ Reid Myles Anderson Morton Jonas Forest Mitchel Mervin Zane Rich Jamel Lazaro Alphonse Randell Major Johnie Jarrett Brooks Ariel Abdul Dusty Luciano Lindsey Tracey Seymour Scottie Eugenio Mohammed Sandy Valentin Chance Arnulfo Lucien Ferdinand Thad Ezra Sydney Aldo Rubin Royal Mitch Earle Abe Wyatt Marquis Lanny Kareem Jamar Boris Isiah Emile Elmo Aron Leopoldo Everette Josef Gail Eloy Dorian Rodrick Reinaldo Lucio Jerrod Weston Hershel Barton Parker Lemuel Lavern Burt Jules Gil Eliseo Ahmad Nigel Efren Antwan Alden Margarito Coleman Refugio Dino Osvaldo Les Deandre Normand Kieth Ivory Andrea Trey Norberto Napoleon Jerold Fritz Rosendo Milford Sang Deon Christoper Alfonzo Lyman Josiah Brant Wilton Rico Jamaal Dewitt Carol Brenton Yong Olin Foster Faustino Claudio Judson Gino Edgardo Berry Alec Tanner Jarred Donn Trinidad Tad Shirley Prince Porfirio Odis Maria Lenard Chauncey Chang Tod Mel Marcelo Kory Augustus Keven Hilario Bud Sal Rosario Orval Mauro Dannie Zachariah Olen Anibal Milo Jed Frances Thanh Dillon Amado Newton Connie Lenny Tory Richie Lupe Horacio Brice Mohamed Delmer Dario Reyes Dee Mac Jonah Jerrold Robt Hank Sung Rupert Rolland Kenton Damion Chi Antone Waldo Fredric Bradly Quinn Kip Burl Walker Tyree Jefferey Ahmed Willy Stanford Oren Noble Moshe Mikel Enoch Brendon Quintin Jamison Florencio Darrick Tobias Minh Hassan Giuseppe Demarcus Cletus Tyrell Lyndon Keenan Werner Theo Geraldo Lou Columbus Chet Bertram Markus Huey Hilton Dwain Donte Tyron Omer Isaias Hipolito Fermin Chung Adalberto Valentine Jamey Bo Barrett Whitney Teodoro Mckinley Maximo Garfield Sol Raleigh Lawerence Abram Rashad King Emmitt Daron Chong Samual Paris Otha Miquel Lacy Eusebio Dong Domenic Darron Buster Antonia Wilber Renato Jc Hoyt Haywood Ezekiel Chas Florentino Elroy Clemente Arden Neville Kelley Edison Deshawn Carrol Shayne Nathanial Jordon Danilo Claud Val Sherwood Raymon Rayford Cristobal Ambrose Titus Hyman Felton Ezequiel Erasmo Stanton Lonny Len Ike Milan Lino Jarod Herb Andreas Walton Rhett Palmer Jude Douglass Cordell Oswaldo Ellsworth Virgilio Toney Nathanael Del Britt Benedict Mose Hong Leigh Johnson Isreal Gayle Garret Fausto Asa Arlen Zack Warner Modesto Francesco Manual Jae Gaylord Gaston Filiberto Deangelo Michale Granville Wes Malik Zackary Tuan Nicky Eldridge Cristopher Cortez Antione Malcom Long Korey Jospeh Colton Waylon Von Hosea Shad Santo Rudolf Rolf Rey Renaldo Marcellus Lucius Lesley Kristofer Boyce Benton Man Kasey Jewell Hayden Harland Arnoldo Rueben Leandro Kraig Jerrell Jeromy Hobert Cedrick Arlie Winford Wally Patricia Luigi Keneth Jacinto Graig Franklyn Edmundo Sid Porter Leif Lauren Jeramy Elisha Buck Willian Vincenzo Shon Michal Lynwood Lindsay Jewel Jere Hai Elden Dorsey Darell Broderick Alonso Emily Madison Emma Olivia Hannah Abigail Isabella Samantha Elizabeth Ashley Alexis Sarah Sophia Alyssa Grace Ava Taylor Brianna Lauren Chloe Natalie Kayla Jessica Anna Victoria Mia Hailey Sydney Jasmine Julia Morgan Destiny Rachel Ella Kaitlyn Megan Katherine Savannah Jennifer Alexandra Allison Haley Maria Kaylee Lily Makayla Brooke Mackenzie Nicole Addison Stephanie Lillian Andrea Zoe Faith Kimberly Madeline Alexa Katelyn Gabriella Gabrielle Trinity Amanda Kylie Mary Paige Riley Jenna Leah Sara Rebecca Michelle Sofia Vanessa Jordan Angelina Caroline Avery Audrey Evelyn Maya Claire Autumn Jocelyn Ariana Nevaeh Arianna Jada Bailey Brooklyn Aaliyah Amber Isabel Danielle Mariah Melanie Sierra Erin Molly Amelia Isabelle Madelyn Melissa Jacqueline Marissa Shelby Angela Leslie Katie Jade Catherine Diana Aubrey Mya Amy Briana Sophie Gabriela Breanna Gianna Kennedy Gracie Peyton Adriana Christina Courtney Daniela Kathryn Lydia Valeria Layla Alexandria Natalia Angel Laura Charlotte Margaret Cheyenne Mikayla Miranda Naomi Kelsey Payton Ana Alicia Jillian Daisy Mckenzie Ashlyn Caitlin Sabrina Summer Ruby Rylee Valerie Skylar Lindsey Kelly Genesis Zoey Eva Sadie Alexia Cassidy Kylee Kendall Jordyn Kate Jayla Karen Tiffany Cassandra Juliana Reagan Caitlyn Giselle Serenity Alondra Lucy Bianca Kiara Crystal Erica Angelica Hope Chelsea Alana Liliana Brittany Camila Makenzie Veronica Lilly Abby Jazmin Adrianna Karina Delaney Ellie Jasmin Maggie Julianna Bella Erika Carly Jamie Mckenna Ariel Karla Kyla Mariana Elena Nadia Kyra Alejandra Esmeralda Bethany Aliyah Amaya Cynthia Monica Vivian Elise Camryn Keira Laila Brenda Mallory Kendra Meghan Makenna Jayden Heather Haylee Hayley Jazmine Josephine Reese Fatima Hanna Rebekah Kara Alison Macy Tessa Annabelle Michaela Savanna Allyson Lizbeth Joanna Nina Desiree Clara Kristen Diamond Guadalupe Julie Shannon Selena Dakota Alaina Lindsay Carmen Piper Katelynn Kira Ciara Cecilia Cameron Heaven Aniyah Kailey Stella Camille Kayleigh Kaitlin Holly Allie Brooklynn April Alivia Esther Claudia Asia Miriam Eleanor Tatiana Carolina Nancy Nora Callie Anastasia Melody Sienna Eliana Kamryn Madeleine Josie Serena Cadence Celeste Julissa Hayden Ashlynn Jaden Eden Paris Skyler Alayna Heidi Jayda Aniya Kathleen Raven Britney Sandra Izabella Cindy Leila Paola Bridget Daniella Violet Natasha Kaylie Alina Eliza Priscilla Wendy Shayla Georgia Kristina Katrina Rose Aurora Alissa Kirsten Patricia Nayeli Ivy Leilani Emely Jadyn Rachael Casey Ruth Denise Lila Brenna London Marley Lexi Yesenia Meredith Helen Imani Emilee Annie Annika Fiona Madalyn Tori Christine Kassandra Ashlee Anahi Lauryn Sasha Iris Scarlett Nia Kiana Tara Kiera Talia Mercedes Yasmin Sidney Logan Rylie Angie Cierra Tatum Ryleigh Dulce Alice Genevieve Harley Malia Joselyn Kiley Lucia Phoebe Kyleigh Rosa Dana Bryanna Brittney Marisol Kassidy Anne Lola Marisa Cora Madisyn Brynn Itzel Delilah Clarissa Marina Valentina Perla Lesly Hailee Baylee Maddison Lacey Kaylin Hallie Sage Gloria Madyson Harmony Whitney Alexus Linda Jane Halle Elisabeth Lisa Francesca Viviana Noelle Cristina Fernanda Madilyn Deanna Shania Khloe Anya Raquel Tiana Tabitha Krystal Ximena Johanna Janelle Teresa Carolyn Virginia Skye Jenny Jaelyn Janiya Amari Kaitlynn Estrella Brielle Macie Paulina Jaqueline Presley Sarai Taryn Ashleigh Ashanti Nyla Kaelyn Aubree Dominique Elaina Alyson Kaydence Teagan Ainsley Raegan India Emilia Nataly Kaleigh Ayanna Addyson Tamia Emerson Tania Alanna Carla Athena Miracle Kristin Marie Destinee Regan Lena Haleigh Cara Cheyanne Martha Alisha Willow America Alessandra Amya Madelynn Jaiden Lyla Samara Hazel Ryan Miley Joy Abbigail Aileen Justice Lilian Renee Kali Lana Emilie Adeline Jimena Mckayla Jessie Penelope Harper Kiersten Maritza Ayla Anika Kailyn Carley Mikaela Carissa Monique Jazlyn Ellen Janet Gillian Juliet Haylie Gisselle Precious Sylvia Melina Kadence Anaya Lexie Elisa Marilyn Isabela Bailee Janiyah Marlene Simone Melany Gina Pamela Yasmine Danica Deja Lillie Kasey Tia Kierra Susan Larissa Elle Lilliana Kailee Laney Angelique Daphne Liberty Tamara Irene Lia Karissa Katlyn Sharon Kenya Isis Maia Jacquelyn Nathalie Helena Carlie Hadley Abbey Krista Kenzie Sonia Aspen Jaida Meagan Dayana Macey Eve Ashton Dayanara Arielle Tiara Kimora Charity Luna Araceli Zoie Janessa Mayra Juliette Janae Cassie Luz Abbie Skyla Amira Kaley Lyric Reyna Felicity Theresa Litzy Barbara Cali Gwendolyn Regina Judith Alma Noemi Kennedi Kaya Danna Lorena Norah Quinn Haven Karlee Clare Kelsie Yadira Brisa Arely Zaria Jolie Cristal Ann Amara Julianne Tyler Deborah Lea Maci Kaylynn Shyanne Brandy Kaila Carlee Amani Kaylyn Aleah Parker Paula Dylan Aria Elaine Ally Aubrie Lesley Adrienne Tianna Edith Annabella Aimee Stacy Mariam Maeve Jazmyn Rhiannon Jaylin Brandi Ingrid Yazmin Mara Tess Marlee Savanah Kaia Kayden Celia Jaclyn Jaylynn Rowan Frances Tanya Mollie Aisha Natalee Rosemary Alena Myah Ansley Colleen Tatyana Aiyana Thalia Annalise Shaniya Sydnee Amiyah Corinne Saniya Hana Aryanna Leanna Esperanza Eileen Liana Jaidyn Justine Chasity Aliya Greta Gia Chelsey Aylin Catalina Giovanna Abril Damaris Maliyah Mariela Tyra Elyse Monserrat Kayley Ayana Karlie Sherlyn Keely Carina Cecelia Micah Danika Taliyah Aracely Emmalee Yareli Lizeth Hailie Hunter Chaya Emery Alisa Jamya Iliana Patience Leticia Caylee Salma Marianna Jakayla Stephany Jewel Laurel Jaliyah Karli Rubi Madalynn Yoselin Kaliyah Kendal Laci Giana Toni Journey Jaycee Breana Maribel Lilah Joyce Amiya Joslyn Elsa Paisley Rihanna Destiney Carrie Evangeline Taniya Evelin Cayla Ada Shayna Nichole Mattie Annette Kianna Ryann Tina Abigayle Princess Tayler Jacey Lara Desirae Zariah Lucille Jaelynn Blanca Camilla Kaiya Lainey Jaylene Antonia Kallie Donna Moriah Sanaa Frida Bria Felicia Rebeca Annabel Shaylee Micaela Shyann Arabella Essence Aliza Aleena Miah Karly Gretchen Saige Ashly Destini Paloma Shea Yvette Rayna Halie Brylee Nya Meadow Kathy Devin Kenna Saniyah Kinsley Sariah Campbell Trista Anabelle Siena Makena Raina Candace Maleah Adelaide Lorelei Ebony Armani Maura Aryana Kinley Alia Amina Katharine Nicolette Mila Isabell Gracelyn Kayli Dalia Yuliana Stacey Nyah Sheila Libby Montana Sandy Margarita Cherish Susana Keyla Jayleen Angeline Kaylah Jenifer Christian Celine Magdalena Karley Chanel Kaylen Nikki Elliana Janice Ciera Phoenix Addisyn Jaylee Noelia Sarahi Belen Devyn Jaylyn Abagail Myla Jalyn Nyasia Abigale Calista Shirley Alize Xiomara Carol Reina Zion Katarina Charlie Nathaly Charlize Dorothy Hillary Selina Kenia Lizette Johana Amelie Natalya Shakira Joana Iyana Yaritza Elissa Belinda Kamila Mireya Alysa Katelin Ericka Rhianna Makaila Jasmyn Kya Akira Savana Madisen Lilyana Scarlet Arlene Areli Tierra Mira Madilynn Graciela Shyla Chana Sally Kelli Robin Elsie Ireland Carson Mina Kourtney Roselyn Braelyn Jazlynn Kacie Zara Miya Estefania Beatriz Adelyn Rocio Londyn Beatrice Kasandra Christiana Kinsey Lina Carli Sydni Jackeline Galilea Janiah Lilia Berenice Sky Candice Melinda Brianne Jailyn Jalynn Anita Selah Unique Devon Fabiola Maryam Averie Hayleigh Myra Tracy Cailyn Taniyah Reilly Joelle Dahlia Amaris Ali Lilianna Anissa Elyssa Caleigh Lyndsey Leyla Dania Diane Casandra Dasia Iyanna Jana Sarina Shreya Silvia Alani Lexus Sydnie Darlene Briley Audrina Mckinley Denisse Anjali Samira Robyn Delia Riya Deasia Lacy Jaylen Adalyn Tatianna Bryana Ashtyn Celina Jazmyne Nathalia Kalyn Citlali Roxana Taya Anabel Jayde Alexandrea Livia Jocelynn Maryjane Lacie Amirah Sonya Valery Anais Mariyah Lucero Mandy Christy Jaime Luisa Yamilet Allyssa Pearl Jaylah Vanesa Gemma Keila Marin Katy Drew Maren Cloe Yahaira Finley Azaria Christa Adyson Yolanda Loren Charlee Marlen Kacey Heidy Alexys Rita Bridgette Luciana Kellie Roxanne Estefani Kaci Joselin Estefany Jacklyn Rachelle Alex Jaquelin Kylah Dianna Karis Noor Asha Treasure Gwyneth Mylee Flor Kelsi Leia Carleigh Alannah Rayne Averi Yessenia Rory Keeley Emelia Marian Giuliana Shiloh Janie Bonnie Astrid Caitlynn Addie Bree Lourdes Rhea Winter Adison Brook Trisha Kristine Yvonne Yaretzi Dallas Eryn Breonna Tayla Juana Ariella Katerina Malaysia Priscila Nylah Kyndall Shawna Kori Anabella Aliana Sheyla Milagros Norma Tristan Lidia Karma Amalia Malaya Katia Bryn Reece Kayleen Adamaris Gabriel Jolene Emani Karsyn Darby Juanita Reanna Rianna Milan Keara Melisa Brionna Jeanette Marcella Nadine Audra Lillianna Abrianna Maegan Diya Isla Chyna Evie Kaela Sade Elianna Joseline Kaycee Alaysia Alyvia Neha Jordin Lori Anisa Izabelle Lisbeth Rivka Noel Harlee Rosalinda Constance Alycia Ivana Emmy Raelynn'''
data = 'James\nJohn\nRobert\nMichael\nWilliam\nDavid\nRichard\nCharles\nJoseph\nThomas\nChristopher\nDaniel\nPaul\nMark\nDonald\nGeorge\nKenneth\nSteven\nEdward\nBrian\nRonald\nAnthony\nKevin\nJason\nMatthew\nGary\nTimothy\nJose\nLarry\nJeffrey\nFrank\nScott\nEric\nStephen\nAndrew\nRaymond\nGregory\nJoshua\nJerry\nDennis\nWalter\nPatrick\nPeter\nHarold\nDouglas\nHenry\nCarl\nArthur\nRyan\nRoger\nJoe\nJuan\nJack\nAlbert\nJonathan\nJustin\nTerry\nGerald\nKeith\nSamuel\nWillie\nRalph\nLawrence\nNicholas\nRoy\nBenjamin\nBruce\nBrandon\nAdam\nHarry\nFred\nWayne\nBilly\nSteve\nLouis\nJeremy\nAaron\nRandy\nHoward\nEugene\nCarlos\nRussell\nBobby\nVictor\nMartin\nErnest\nPhillip\nTodd\nJesse\nCraig\nAlan\nShawn\nClarence\nSean\nPhilip\nChris\nJohnny\nEarl\nJimmy\nAntonio\nDanny\nBryan\nTony\nLuis\nMike\nStanley\nLeonard\nNathan\nDale\nManuel\nRodney\nCurtis\nNorman\nAllen\nMarvin\nVincent\nGlenn\nJeffery\nTravis\nJeff\nChad\nJacob\nLee\nMelvin\nAlfred\nKyle\nFrancis\nBradley\nJesus\nHerbert\nFrederick\nRay\nJoel\nEdwin\nDon\nEddie\nRicky\nTroy\nRandall\nBarry\nAlexander\nBernard\nMario\nLeroy\nFrancisco\nMarcus\nMicheal\nTheodore\nClifford\nMiguel\nOscar\nJay\nJim\nTom\nCalvin\nAlex\nJon\nRonnie\nBill\nLloyd\nTommy\nLeon\nDerek\nWarren\nDarrell\nJerome\nFloyd\nLeo\nAlvin\nTim\nWesley\nGordon\nDean\nGreg\nJorge\nDustin\nPedro\nDerrick\nDan\nLewis\nZachary\nCorey\nHerman\nMaurice\nVernon\nRoberto\nClyde\nGlen\nHector\nShane\nRicardo\nSam\nRick\nLester\nBrent\nRamon\nCharlie\nTyler\nGilbert\nGene\nMarc\nReginald\nRuben\nBrett\nAngel\nNathaniel\nRafael\nLeslie\nEdgar\nMilton\nRaul\nBen\nChester\nCecil\nDuane\nFranklin\nAndre\nElmer\nBrad\nGabriel\nRon\nMitchell\nRoland\nArnold\nHarvey\nJared\nAdrian\nKarl\nCory\nClaude\nErik\nDarryl\nJamie\nNeil\nJessie\nChristian\nJavier\nFernando\nClinton\nTed\nMathew\nTyrone\nDarren\nLonnie\nLance\nCody\nJulio\nKelly\nKurt\nAllan\nNelson\nGuy\nClayton\nHugh\nMax\nDwayne\nDwight\nArmando\nFelix\nJimmie\nEverett\nJordan\nIan\nWallace\nKen\nBob\nJaime\nCasey\nAlfredo\nAlberto\nDave\nIvan\nJohnnie\nSidney\nByron\nJulian\nIsaac\nMorris\nClifton\nWillard\nDaryl\nRoss\nVirgil\nAndy\nMarshall\nSalvador\nPerry\nKirk\nSergio\nMarion\nTracy\nSeth\nKent\nTerrance\nRene\nEduardo\nTerrence\nEnrique\nFreddie\nWade\nAustin\nStuart\nFredrick\nArturo\nAlejandro\nJackie\nJoey\nNick\nLuther\nWendell\nJeremiah\nEvan\nJulius\nDana\nDonnie\nOtis\nShannon\nTrevor\nOliver\nLuke\nHomer\nGerard\nDoug\nKenny\nHubert\nAngelo\nShaun\nLyle\nMatt\nLynn\nAlfonso\nOrlando\nRex\nCarlton\nErnesto\nCameron\nNeal\nPablo\nLorenzo\nOmar\nWilbur\nBlake\nGrant\nHorace\nRoderick\nKerry\nAbraham\nWillis\nRickey\nJean\nIra\nAndres\nCesar\nJohnathan\nMalcolm\nRudolph\nDamon\nKelvin\nRudy\nPreston\nAlton\nArchie\nMarco\nWm\nPete\nRandolph\nGarry\nGeoffrey\nJonathon\nFelipe\nBennie\nGerardo\nEd\nDominic\nRobin\nLoren\nDelbert\nColin\nGuillermo\nEarnest\nLucas\nBenny\nNoel\nSpencer\nRodolfo\nMyron\nEdmund\nGarrett\nSalvatore\nCedric\nLowell\nGregg\nSherman\nWilson\nDevin\nSylvester\nKim\nRoosevelt\nIsrael\nJermaine\nForrest\nWilbert\nLeland\nSimon\nGuadalupe\nClark\nIrving\nCarroll\nBryant\nOwen\nRufus\nWoodrow\nSammy\nKristopher\nMack\nLevi\nMarcos\nGustavo\nJake\nLionel\nMarty\nTaylor\nEllis\nDallas\nGilberto\nClint\nNicolas\nLaurence\nIsmael\nOrville\nDrew\nJody\nErvin\nDewey\nAl\nWilfred\nJosh\nHugo\nIgnacio\nCaleb\nTomas\nSheldon\nErick\nFrankie\nStewart\nDoyle\nDarrel\nRogelio\nTerence\nSantiago\nAlonzo\nElias\nBert\nElbert\nRamiro\nConrad\nPat\nNoah\nGrady\nPhil\nCornelius\nLamar\nRolando\nClay\nPercy\nDexter\nBradford\nMerle\nDarin\nAmos\nTerrell\nMoses\nIrvin\nSaul\nRoman\nDarnell\nRandal\nTommie\nTimmy\nDarrin\nWinston\nBrendan\nToby\nVan\nAbel\nDominick\nBoyd\nCourtney\nJan\nEmilio\nElijah\nCary\nDomingo\nSantos\nAubrey\nEmmett\nMarlon\nEmanuel\nJerald\nEdmond\nEmil\nDewayne\nWill\nOtto\nTeddy\nReynaldo\nBret\nMorgan\nJess\nTrent\nHumberto\nEmmanuel\nStephan\nLouie\nVicente\nLamont\nStacy\nGarland\nMiles\nMicah\nEfrain\nBillie\nLogan\nHeath\nRodger\nHarley\nDemetrius\nEthan\nEldon\nRocky\nPierre\nJunior\nFreddy\nEli\nBryce\nAntoine\nRobbie\nKendall\nRoyce\nSterling\nMickey\nChase\nGrover\nElton\nCleveland\nDylan\nChuck\nDamian\nReuben\nStan\nAugust\nLeonardo\nJasper\nRussel\nErwin\nBenito\nHans\nMonte\nBlaine\nErnie\nCurt\nQuentin\nAgustin\nMurray\nJamal\nDevon\nAdolfo\nHarrison\nTyson\nBurton\nBrady\nElliott\nWilfredo\nBart\nJarrod\nVance\nDenis\nDamien\nJoaquin\nHarlan\nDesmond\nElliot\nDarwin\nAshley\nGregorio\nBuddy\nXavier\nKermit\nRoscoe\nEsteban\nAnton\nSolomon\nScotty\nNorbert\nElvin\nWilliams\nNolan\nCarey\nRod\nQuinton\nHal\nBrain\nRob\nElwood\nKendrick\nDarius\nMoises\nSon\nMarlin\nFidel\nThaddeus\nCliff\nMarcel\nAli\nJackson\nRaphael\nBryon\nArmand\nAlvaro\nJeffry\nDane\nJoesph\nThurman\nNed\nSammie\nRusty\nMichel\nMonty\nRory\nFabian\nReggie\nMason\nGraham\nKris\nIsaiah\nVaughn\nGus\nAvery\nLoyd\nDiego\nAlexis\nAdolph\nNorris\nMillard\nRocco\nGonzalo\nDerick\nRodrigo\nGerry\nStacey\nCarmen\nWiley\nRigoberto\nAlphonso\nTy\nShelby\nRickie\nNoe\nVern\nBobbie\nReed\nJefferson\nElvis\nBernardo\nMauricio\nHiram\nDonovan\nBasil\nRiley\nOllie\nNickolas\nMaynard\nScot\nVince\nQuincy\nEddy\nSebastian\nFederico\nUlysses\nHeriberto\nDonnell\nCole\nDenny\nDavis\nGavin\nEmery\nWard\nRomeo\nJayson\nDion\nDante\nClement\nCoy\nOdell\nMaxwell\nJarvis\nBruno\nIssac\nMary\nDudley\nBrock\nSanford\nColby\nCarmelo\nBarney\nNestor\nHollis\nStefan\nDonny\nArt\nLinwood\nBeau\nWeldon\nGalen\nIsidro\nTruman\nDelmar\nJohnathon\nSilas\nFrederic\nDick\nKirby\nIrwin\nCruz\nMerlin\nMerrill\nCharley\nMarcelino\nLane\nHarris\nCleo\nCarlo\nTrenton\nKurtis\nHunter\nAurelio\nWinfred\nVito\nCollin\nDenver\nCarter\nLeonel\nEmory\nPasquale\nMohammad\nMariano\nDanial\nBlair\nLandon\nDirk\nBranden\nAdan\nNumbers\nClair\nBuford\nGerman\nBernie\nWilmer\nJoan\nEmerson\nZachery\nFletcher\nJacques\nErrol\nDalton\nMonroe\nJosue\nDominique\nEdwardo\nBooker\nWilford\nSonny\nShelton\nCarson\nTheron\nRaymundo\nDaren\nTristan\nHouston\nRobby\nLincoln\nJame\nGenaro\nGale\nBennett\nOctavio\nCornell\nLaverne\nHung\nArron\nAntony\nHerschel\nAlva\nGiovanni\nGarth\nCyrus\nCyril\nRonny\nStevie\nLon\nFreeman\nErin\nDuncan\nKennith\nCarmine\nAugustine\nYoung\nErich\nChadwick\nWilburn\nRuss\nReid\nMyles\nAnderson\nMorton\nJonas\nForest\nMitchel\nMervin\nZane\nRich\nJamel\nLazaro\nAlphonse\nRandell\nMajor\nJohnie\nJarrett\nBrooks\nAriel\nAbdul\nDusty\nLuciano\nLindsey\nTracey\nSeymour\nScottie\nEugenio\nMohammed\nSandy\nValentin\nChance\nArnulfo\nLucien\nFerdinand\nThad\nEzra\nSydney\nAldo\nRubin\nRoyal\nMitch\nEarle\nAbe\nWyatt\nMarquis\nLanny\nKareem\nJamar\nBoris\nIsiah\nEmile\nElmo\nAron\nLeopoldo\nEverette\nJosef\nGail\nEloy\nDorian\nRodrick\nReinaldo\nLucio\nJerrod\nWeston\nHershel\nBarton\nParker\nLemuel\nLavern\nBurt\nJules\nGil\nEliseo\nAhmad\nNigel\nEfren\nAntwan\nAlden\nMargarito\nColeman\nRefugio\nDino\nOsvaldo\nLes\nDeandre\nNormand\nKieth\nIvory\nAndrea\nTrey\nNorberto\nNapoleon\nJerold\nFritz\nRosendo\nMilford\nSang\nDeon\nChristoper\nAlfonzo\nLyman\nJosiah\nBrant\nWilton\nRico\nJamaal\nDewitt\nCarol\nBrenton\nYong\nOlin\nFoster\nFaustino\nClaudio\nJudson\nGino\nEdgardo\nBerry\nAlec\nTanner\nJarred\nDonn\nTrinidad\nTad\nShirley\nPrince\nPorfirio\nOdis\nMaria\nLenard\nChauncey\nChang\nTod\nMel\nMarcelo\nKory\nAugustus\nKeven\nHilario\nBud\nSal\nRosario\nOrval\nMauro\nDannie\nZachariah\nOlen\nAnibal\nMilo\nJed\nFrances\nThanh\nDillon\nAmado\nNewton\nConnie\nLenny\nTory\nRichie\nLupe\nHoracio\nBrice\nMohamed\nDelmer\nDario\nReyes\nDee\nMac\nJonah\nJerrold\nRobt\nHank\nSung\nRupert\nRolland\nKenton\nDamion\nChi\nAntone\nWaldo\nFredric\nBradly\nQuinn\nKip\nBurl\nWalker\nTyree\nJefferey\nAhmed\nWilly\nStanford\nOren\nNoble\nMoshe\nMikel\nEnoch\nBrendon\nQuintin\nJamison\nFlorencio\nDarrick\nTobias\nMinh\nHassan\nGiuseppe\nDemarcus\nCletus\nTyrell\nLyndon\nKeenan\nWerner\nTheo\nGeraldo\nLou\nColumbus\nChet\nBertram\nMarkus\nHuey\nHilton\nDwain\nDonte\nTyron\nOmer\nIsaias\nHipolito\nFermin\nChung\nAdalberto\nValentine\nJamey\nBo\nBarrett\nWhitney\nTeodoro\nMckinley\nMaximo\nGarfield\nSol\nRaleigh\nLawerence\nAbram\nRashad\nKing\nEmmitt\nDaron\nChong\nSamual\nParis\nOtha\nMiquel\nLacy\nEusebio\nDong\nDomenic\nDarron\nBuster\nAntonia\nWilber\nRenato\nJc\nHoyt\nHaywood\nEzekiel\nChas\nFlorentino\nElroy\nClemente\nArden\nNeville\nKelley\nEdison\nDeshawn\nCarrol\nShayne\nNathanial\nJordon\nDanilo\nClaud\nVal\nSherwood\nRaymon\nRayford\nCristobal\nAmbrose\nTitus\nHyman\nFelton\nEzequiel\nErasmo\nStanton\nLonny\nLen\nIke\nMilan\nLino\nJarod\nHerb\nAndreas\nWalton\nRhett\nPalmer\nJude\nDouglass\nCordell\nOswaldo\nEllsworth\nVirgilio\nToney\nNathanael\nDel\nBritt\nBenedict\nMose\nHong\nLeigh\nJohnson\nIsreal\nGayle\nGarret\nFausto\nAsa\nArlen\nZack\nWarner\nModesto\nFrancesco\nManual\nJae\nGaylord\nGaston\nFiliberto\nDeangelo\nMichale\nGranville\nWes\nMalik\nZackary\nTuan\nNicky\nEldridge\nCristopher\nCortez\nAntione\nMalcom\nLong\nKorey\nJospeh\nColton\nWaylon\nVon\nHosea\nShad\nSanto\nRudolf\nRolf\nRey\nRenaldo\nMarcellus\nLucius\nLesley\nKristofer\nBoyce\nBenton\nMan\nKasey\nJewell\nHayden\nHarland\nArnoldo\nRueben\nLeandro\nKraig\nJerrell\nJeromy\nHobert\nCedrick\nArlie\nWinford\nWally\nPatricia\nLuigi\nKeneth\nJacinto\nGraig\nFranklyn\nEdmundo\nSid\nPorter\nLeif\nLauren\nJeramy\nElisha\nBuck\nWillian\nVincenzo\nShon\nMichal\nLynwood\nLindsay\nJewel\nJere\nHai\nElden\nDorsey\nDarell\nBroderick\nAlonso\nEmily\nMadison\nEmma\nOlivia\nHannah\nAbigail\nIsabella\nSamantha\nElizabeth\nAshley\nAlexis\nSarah\nSophia\nAlyssa\nGrace\nAva\nTaylor\nBrianna\nLauren\nChloe\nNatalie\nKayla\nJessica\nAnna\nVictoria\nMia\nHailey\nSydney\nJasmine\nJulia\nMorgan\nDestiny\nRachel\nElla\nKaitlyn\nMegan\nKatherine\nSavannah\nJennifer\nAlexandra\nAllison\nHaley\nMaria\nKaylee\nLily\nMakayla\nBrooke\nMackenzie\nNicole\nAddison\nStephanie\nLillian\nAndrea\nZoe\nFaith\nKimberly\nMadeline\nAlexa\nKatelyn\nGabriella\nGabrielle\nTrinity\nAmanda\nKylie\nMary\nPaige\nRiley\nJenna\nLeah\nSara\nRebecca\nMichelle\nSofia\nVanessa\nJordan\nAngelina\nCaroline\nAvery\nAudrey\nEvelyn\nMaya\nClaire\nAutumn\nJocelyn\nAriana\nNevaeh\nArianna\nJada\nBailey\nBrooklyn\nAaliyah\nAmber\nIsabel\nDanielle\nMariah\nMelanie\nSierra\nErin\nMolly\nAmelia\nIsabelle\nMadelyn\nMelissa\nJacqueline\nMarissa\nShelby\nAngela\nLeslie\nKatie\nJade\nCatherine\nDiana\nAubrey\nMya\nAmy\nBriana\nSophie\nGabriela\nBreanna\nGianna\nKennedy\nGracie\nPeyton\nAdriana\nChristina\nCourtney\nDaniela\nKathryn\nLydia\nValeria\nLayla\nAlexandria\nNatalia\nAngel\nLaura\nCharlotte\nMargaret\nCheyenne\nMikayla\nMiranda\nNaomi\nKelsey\nPayton\nAna\nAlicia\nJillian\nDaisy\nMckenzie\nAshlyn\nCaitlin\nSabrina\nSummer\nRuby\nRylee\nValerie\nSkylar\nLindsey\nKelly\nGenesis\nZoey\nEva\nSadie\nAlexia\nCassidy\nKylee\nKendall\nJordyn\nKate\nJayla\nKaren\nTiffany\nCassandra\nJuliana\nReagan\nCaitlyn\nGiselle\nSerenity\nAlondra\nLucy\nBianca\nKiara\nCrystal\nErica\nAngelica\nHope\nChelsea\nAlana\nLiliana\nBrittany\nCamila\nMakenzie\nVeronica\nLilly\nAbby\nJazmin\nAdrianna\nKarina\nDelaney\nEllie\nJasmin\nMaggie\nJulianna\nBella\nErika\nCarly\nJamie\nMckenna\nAriel\nKarla\nKyla\nMariana\nElena\nNadia\nKyra\nAlejandra\nEsmeralda\nBethany\nAliyah\nAmaya\nCynthia\nMonica\nVivian\nElise\nCamryn\nKeira\nLaila\nBrenda\nMallory\nKendra\nMeghan\nMakenna\nJayden\nHeather\nHaylee\nHayley\nJazmine\nJosephine\nReese\nFatima\nHanna\nRebekah\nKara\nAlison\nMacy\nTessa\nAnnabelle\nMichaela\nSavanna\nAllyson\nLizbeth\nJoanna\nNina\nDesiree\nClara\nKristen\nDiamond\nGuadalupe\nJulie\nShannon\nSelena\nDakota\nAlaina\nLindsay\nCarmen\nPiper\nKatelynn\nKira\nCiara\nCecilia\nCameron\nHeaven\nAniyah\nKailey\nStella\nCamille\nKayleigh\nKaitlin\nHolly\nAllie\nBrooklynn\nApril\nAlivia\nEsther\nClaudia\nAsia\nMiriam\nEleanor\nTatiana\nCarolina\nNancy\nNora\nCallie\nAnastasia\nMelody\nSienna\nEliana\nKamryn\nMadeleine\nJosie\nSerena\nCadence\nCeleste\nJulissa\nHayden\nAshlynn\nJaden\nEden\nParis\nSkyler\nAlayna\nHeidi\nJayda\nAniya\nKathleen\nRaven\nBritney\nSandra\nIzabella\nCindy\nLeila\nPaola\nBridget\nDaniella\nViolet\nNatasha\nKaylie\nAlina\nEliza\nPriscilla\nWendy\nShayla\nGeorgia\nKristina\nKatrina\nRose\nAurora\nAlissa\nKirsten\nPatricia\nNayeli\nIvy\nLeilani\nEmely\nJadyn\nRachael\nCasey\nRuth\nDenise\nLila\nBrenna\nLondon\nMarley\nLexi\nYesenia\nMeredith\nHelen\nImani\nEmilee\nAnnie\nAnnika\nFiona\nMadalyn\nTori\nChristine\nKassandra\nAshlee\nAnahi\nLauryn\nSasha\nIris\nScarlett\nNia\nKiana\nTara\nKiera\nTalia\nMercedes\nYasmin\nSidney\nLogan\nRylie\nAngie\nCierra\nTatum\nRyleigh\nDulce\nAlice\nGenevieve\nHarley\nMalia\nJoselyn\nKiley\nLucia\nPhoebe\nKyleigh\nRosa\nDana\nBryanna\nBrittney\nMarisol\nKassidy\nAnne\nLola\nMarisa\nCora\nMadisyn\nBrynn\nItzel\nDelilah\nClarissa\nMarina\nValentina\nPerla\nLesly\nHailee\nBaylee\nMaddison\nLacey\nKaylin\nHallie\nSage\nGloria\nMadyson\nHarmony\nWhitney\nAlexus\nLinda\nJane\nHalle\nElisabeth\nLisa\nFrancesca\nViviana\nNoelle\nCristina\nFernanda\nMadilyn\nDeanna\nShania\nKhloe\nAnya\nRaquel\nTiana\nTabitha\nKrystal\nXimena\nJohanna\nJanelle\nTeresa\nCarolyn\nVirginia\nSkye\nJenny\nJaelyn\nJaniya\nAmari\nKaitlynn\nEstrella\nBrielle\nMacie\nPaulina\nJaqueline\nPresley\nSarai\nTaryn\nAshleigh\nAshanti\nNyla\nKaelyn\nAubree\nDominique\nElaina\nAlyson\nKaydence\nTeagan\nAinsley\nRaegan\nIndia\nEmilia\nNataly\nKaleigh\nAyanna\nAddyson\nTamia\nEmerson\nTania\nAlanna\nCarla\nAthena\nMiracle\nKristin\nMarie\nDestinee\nRegan\nLena\nHaleigh\nCara\nCheyanne\nMartha\nAlisha\nWillow\nAmerica\nAlessandra\nAmya\nMadelynn\nJaiden\nLyla\nSamara\nHazel\nRyan\nMiley\nJoy\nAbbigail\nAileen\nJustice\nLilian\nRenee\nKali\nLana\nEmilie\nAdeline\nJimena\nMckayla\nJessie\nPenelope\nHarper\nKiersten\nMaritza\nAyla\nAnika\nKailyn\nCarley\nMikaela\nCarissa\nMonique\nJazlyn\nEllen\nJanet\nGillian\nJuliet\nHaylie\nGisselle\nPrecious\nSylvia\nMelina\nKadence\nAnaya\nLexie\nElisa\nMarilyn\nIsabela\nBailee\nJaniyah\nMarlene\nSimone\nMelany\nGina\nPamela\nYasmine\nDanica\nDeja\nLillie\nKasey\nTia\nKierra\nSusan\nLarissa\nElle\nLilliana\nKailee\nLaney\nAngelique\nDaphne\nLiberty\nTamara\nIrene\nLia\nKarissa\nKatlyn\nSharon\nKenya\nIsis\nMaia\nJacquelyn\nNathalie\nHelena\nCarlie\nHadley\nAbbey\nKrista\nKenzie\nSonia\nAspen\nJaida\nMeagan\nDayana\nMacey\nEve\nAshton\nDayanara\nArielle\nTiara\nKimora\nCharity\nLuna\nAraceli\nZoie\nJanessa\nMayra\nJuliette\nJanae\nCassie\nLuz\nAbbie\nSkyla\nAmira\nKaley\nLyric\nReyna\nFelicity\nTheresa\nLitzy\nBarbara\nCali\nGwendolyn\nRegina\nJudith\nAlma\nNoemi\nKennedi\nKaya\nDanna\nLorena\nNorah\nQuinn\nHaven\nKarlee\nClare\nKelsie\nYadira\nBrisa\nArely\nZaria\nJolie\nCristal\nAnn\nAmara\nJulianne\nTyler\nDeborah\nLea\nMaci\nKaylynn\nShyanne\nBrandy\nKaila\nCarlee\nAmani\nKaylyn\nAleah\nParker\nPaula\nDylan\nAria\nElaine\nAlly\nAubrie\nLesley\nAdrienne\nTianna\nEdith\nAnnabella\nAimee\nStacy\nMariam\nMaeve\nJazmyn\nRhiannon\nJaylin\nBrandi\nIngrid\nYazmin\nMara\nTess\nMarlee\nSavanah\nKaia\nKayden\nCelia\nJaclyn\nJaylynn\nRowan\nFrances\nTanya\nMollie\nAisha\nNatalee\nRosemary\nAlena\nMyah\nAnsley\nColleen\nTatyana\nAiyana\nThalia\nAnnalise\nShaniya\nSydnee\nAmiyah\nCorinne\nSaniya\nHana\nAryanna\nLeanna\nEsperanza\nEileen\nLiana\nJaidyn\nJustine\nChasity\nAliya\nGreta\nGia\nChelsey\nAylin\nCatalina\nGiovanna\nAbril\nDamaris\nMaliyah\nMariela\nTyra\nElyse\nMonserrat\nKayley\nAyana\nKarlie\nSherlyn\nKeely\nCarina\nCecelia\nMicah\nDanika\nTaliyah\nAracely\nEmmalee\nYareli\nLizeth\nHailie\nHunter\nChaya\nEmery\nAlisa\nJamya\nIliana\nPatience\nLeticia\nCaylee\nSalma\nMarianna\nJakayla\nStephany\nJewel\nLaurel\nJaliyah\nKarli\nRubi\nMadalynn\nYoselin\nKaliyah\nKendal\nLaci\nGiana\nToni\nJourney\nJaycee\nBreana\nMaribel\nLilah\nJoyce\nAmiya\nJoslyn\nElsa\nPaisley\nRihanna\nDestiney\nCarrie\nEvangeline\nTaniya\nEvelin\nCayla\nAda\nShayna\nNichole\nMattie\nAnnette\nKianna\nRyann\nTina\nAbigayle\nPrincess\nTayler\nJacey\nLara\nDesirae\nZariah\nLucille\nJaelynn\nBlanca\nCamilla\nKaiya\nLainey\nJaylene\nAntonia\nKallie\nDonna\nMoriah\nSanaa\nFrida\nBria\nFelicia\nRebeca\nAnnabel\nShaylee\nMicaela\nShyann\nArabella\nEssence\nAliza\nAleena\nMiah\nKarly\nGretchen\nSaige\nAshly\nDestini\nPaloma\nShea\nYvette\nRayna\nHalie\nBrylee\nNya\nMeadow\nKathy\nDevin\nKenna\nSaniyah\nKinsley\nSariah\nCampbell\nTrista\nAnabelle\nSiena\nMakena\nRaina\nCandace\nMaleah\nAdelaide\nLorelei\nEbony\nArmani\nMaura\nAryana\nKinley\nAlia\nAmina\nKatharine\nNicolette\nMila\nIsabell\nGracelyn\nKayli\nDalia\nYuliana\nStacey\nNyah\nSheila\nLibby\nMontana\nSandy\nMargarita\nCherish\nSusana\nKeyla\nJayleen\nAngeline\nKaylah\nJenifer\nChristian\nCeline\nMagdalena\nKarley\nChanel\nKaylen\nNikki\nElliana\nJanice\nCiera\nPhoenix\nAddisyn\nJaylee\nNoelia\nSarahi\nBelen\nDevyn\nJaylyn\nAbagail\nMyla\nJalyn\nNyasia\nAbigale\nCalista\nShirley\nAlize\nXiomara\nCarol\nReina\nZion\nKatarina\nCharlie\nNathaly\nCharlize\nDorothy\nHillary\nSelina\nKenia\nLizette\nJohana\nAmelie\nNatalya\nShakira\nJoana\nIyana\nYaritza\nElissa\nBelinda\nKamila\nMireya\nAlysa\nKatelin\nEricka\nRhianna\nMakaila\nJasmyn\nKya\nAkira\nSavana\nMadisen\nLilyana\nScarlet\nArlene\nAreli\nTierra\nMira\nMadilynn\nGraciela\nShyla\nChana\nSally\nKelli\nRobin\nElsie\nIreland\nCarson\nMina\nKourtney\nRoselyn\nBraelyn\nJazlynn\nKacie\nZara\nMiya\nEstefania\nBeatriz\nAdelyn\nRocio\nLondyn\nBeatrice\nKasandra\nChristiana\nKinsey\nLina\nCarli\nSydni\nJackeline\nGalilea\nJaniah\nLilia\nBerenice\nSky\nCandice\nMelinda\nBrianne\nJailyn\nJalynn\nAnita\nSelah\nUnique\nDevon\nFabiola\nMaryam\nAverie\nHayleigh\nMyra\nTracy\nCailyn\nTaniyah\nReilly\nJoelle\nDahlia\nAmaris\nAli\nLilianna\nAnissa\nElyssa\nCaleigh\nLyndsey\nLeyla\nDania\nDiane\nCasandra\nDasia\nIyanna\nJana\nSarina\nShreya\nSilvia\nAlani\nLexus\nSydnie\nDarlene\nBriley\nAudrina\nMckinley\nDenisse\nAnjali\nSamira\nRobyn\nDelia\nRiya\nDeasia\nLacy\nJaylen\nAdalyn\nTatianna\nBryana\nAshtyn\nCelina\nJazmyne\nNathalia\nKalyn\nCitlali\nRoxana\nTaya\nAnabel\nJayde\nAlexandrea\nLivia\nJocelynn\nMaryjane\nLacie\nAmirah\nSonya\nValery\nAnais\nMariyah\nLucero\nMandy\nChristy\nJaime\nLuisa\nYamilet\nAllyssa\nPearl\nJaylah\nVanesa\nGemma\nKeila\nMarin\nKaty\nDrew\nMaren\nCloe\nYahaira\nFinley\nAzaria\nChrista\nAdyson\nYolanda\nLoren\nCharlee\nMarlen\nKacey\nHeidy\nAlexys\nRita\nBridgette\nLuciana\nKellie\nRoxanne\nEstefani\nKaci\nJoselin\nEstefany\nJacklyn\nRachelle\nAlex\nJaquelin\nKylah\nDianna\nKaris\nNoor\nAsha\nTreasure\nGwyneth\nMylee\nFlor\nKelsi\nLeia\nCarleigh\nAlannah\nRayne\nAveri\nYessenia\nRory\nKeeley\nEmelia\nMarian\nGiuliana\nShiloh\nJanie\nBonnie\nAstrid\nCaitlynn\nAddie\nBree\nLourdes\nRhea\nWinter\nAdison\nBrook\nTrisha\nKristine\nYvonne\nYaretzi\nDallas\nEryn\nBreonna\nTayla\nJuana\nAriella\nKaterina\nMalaysia\nPriscila\nNylah\nKyndall\nShawna\nKori\nAnabella\nAliana\nSheyla\nMilagros\nNorma\nTristan\nLidia\nKarma\nAmalia\nMalaya\nKatia\nBryn\nReece\nKayleen\nAdamaris\nGabriel\nJolene\nEmani\nKarsyn\nDarby\nJuanita\nReanna\nRianna\nMilan\nKeara\nMelisa\nBrionna\nJeanette\nMarcella\nNadine\nAudra\nLillianna\nAbrianna\nMaegan\nDiya\nIsla\nChyna\nEvie\nKaela\nSade\nElianna\nJoseline\nKaycee\nAlaysia\nAlyvia\nNeha\nJordin\nLori\nAnisa\nIzabelle\nLisbeth\nRivka\nNoel\nHarlee\nRosalinda\nConstance\nAlycia\nIvana\nEmmy\nRaelynn'
n = int(input()) grid = [] for i in range(n): grid.append([int(x) for x in input().split(' ')]) def valid(g): for y in range(n): for x in range(n): if (x+1 < n): if not (g[y][x] < g[y][x+1]): return False if (y+1 < n): if not (g[y][x] < g[y+1][x]): return False return True while True: if not valid(grid): grid = [list(arr) for arr in zip(*grid[::-1])] else: break for flower in grid: print(' '.join([str(k) for k in flower]))
n = int(input()) grid = [] for i in range(n): grid.append([int(x) for x in input().split(' ')]) def valid(g): for y in range(n): for x in range(n): if x + 1 < n: if not g[y][x] < g[y][x + 1]: return False if y + 1 < n: if not g[y][x] < g[y + 1][x]: return False return True while True: if not valid(grid): grid = [list(arr) for arr in zip(*grid[::-1])] else: break for flower in grid: print(' '.join([str(k) for k in flower]))
# https://atcoder.jp/contests/math-and-algorithm/tasks/typical90_n n = int(input()) aa = list(sorted(map(int, input().split()))) bb = list(sorted(map(int, input().split()))) print(sum([abs(aa[i] - bb[i]) for i in range(n)]))
n = int(input()) aa = list(sorted(map(int, input().split()))) bb = list(sorted(map(int, input().split()))) print(sum([abs(aa[i] - bb[i]) for i in range(n)]))
class RegistObject(object): def __init__(self,object_name,scope=None,params=None): self.object_name=object_name self.scope=scope self.params=params class RegistObjectName(object): def __init__(self,object_name,scope=None): self.object_name=object_name self.scope=scope class Content(object): def __init__(self,type,value,element_number,line=0,column=0): self.type=type self.value=value self.element_number=element_number self.line=line self.column=column
class Registobject(object): def __init__(self, object_name, scope=None, params=None): self.object_name = object_name self.scope = scope self.params = params class Registobjectname(object): def __init__(self, object_name, scope=None): self.object_name = object_name self.scope = scope class Content(object): def __init__(self, type, value, element_number, line=0, column=0): self.type = type self.value = value self.element_number = element_number self.line = line self.column = column
# LEER panchofile = open('panchofile.txt', 'w') print(panchofile) # r = panchofile.readlines() # panchofile.write("\nVerso 1") panchofile.close()
panchofile = open('panchofile.txt', 'w') print(panchofile) panchofile.close()
class State: def __init__(self, words_following_dict, name, type_dict): self.words_following_dict = words_following_dict # Dictionary of words which lead to new states self.name = name # name of the state self.type_dict = type_dict #dict of type "State_name" : State to avoid circular problem def __str__(self): return "[State: " + self.name + "]" def __eq__(self, other): return str(self) == str(other) def get_next_state(self, word_read): for word in self.words_following_dict: if word_read == word: return self.type_dict[self.words_following_dict[word]] return None
class State: def __init__(self, words_following_dict, name, type_dict): self.words_following_dict = words_following_dict self.name = name self.type_dict = type_dict def __str__(self): return '[State: ' + self.name + ']' def __eq__(self, other): return str(self) == str(other) def get_next_state(self, word_read): for word in self.words_following_dict: if word_read == word: return self.type_dict[self.words_following_dict[word]] return None
#################################################################################### # Larabot Discord Bot # MIT License # Copyright (c) 2017 Devitgg # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. #################################################################################### ####################### Documentation ###################### # Coming Later ############################################################ def token(): token = 'insert here' return token def googleKey(): this = 'insert here' return this def modAuthority(message): approvedRoles = ['insert here'] for role in message.server.roles: for approved in approvedRoles: if approved == role.name: return True def adminAuthority(message): approvedRoles = ['insert here'] for role in message.server.roles: for approved in approvedRoles: if approved == role.name: return True def roleChannel(): this = 'role_request' return this def searchCommand(): this = 'oogle>' return this def googleResultCount(): this = 5 return this def anonCommand(): this = 'anon>' return this def anonChannel(): this = 'dev_confessions' return this def helpCommand(): this = 'help>' return this def codeCommand(): this = '>' return this def addRoleCommand(): this = 'add>' return this def removeRoleCommand(): this = 'remove>' return this def kickCommand(): this = 'kick>' return this def banCommand(): this = 'ban>' return this def plusRepCommand(): this = 'rep>' return this def viewRepCommand(): this = 'view>' return this def roleInfoCommand(): this = 'roles>' return this def clearCommand(): this = 'clear>' return this
def token(): token = 'insert here' return token def google_key(): this = 'insert here' return this def mod_authority(message): approved_roles = ['insert here'] for role in message.server.roles: for approved in approvedRoles: if approved == role.name: return True def admin_authority(message): approved_roles = ['insert here'] for role in message.server.roles: for approved in approvedRoles: if approved == role.name: return True def role_channel(): this = 'role_request' return this def search_command(): this = 'oogle>' return this def google_result_count(): this = 5 return this def anon_command(): this = 'anon>' return this def anon_channel(): this = 'dev_confessions' return this def help_command(): this = 'help>' return this def code_command(): this = '>' return this def add_role_command(): this = 'add>' return this def remove_role_command(): this = 'remove>' return this def kick_command(): this = 'kick>' return this def ban_command(): this = 'ban>' return this def plus_rep_command(): this = 'rep>' return this def view_rep_command(): this = 'view>' return this def role_info_command(): this = 'roles>' return this def clear_command(): this = 'clear>' return this
employee_one = int(input()) employee_two = int(input()) employee_three = int(input()) people_count = int(input()) all_employees = employee_one + employee_two + employee_three # this many per hour people_answered = 0 hours_needed =0 while people_answered < people_count: hours_needed += 1 if hours_needed % 4 == 0: people_answered += 0 else: people_answered += all_employees print('Time needed: {}h.'.format(hours_needed))
employee_one = int(input()) employee_two = int(input()) employee_three = int(input()) people_count = int(input()) all_employees = employee_one + employee_two + employee_three people_answered = 0 hours_needed = 0 while people_answered < people_count: hours_needed += 1 if hours_needed % 4 == 0: people_answered += 0 else: people_answered += all_employees print('Time needed: {}h.'.format(hours_needed))
def loadyaml(path): ''' Read the config file with yaml :param path: the config file path :return: bidict ''' doc = [] if os.path.exists(path): with codecs.open(path, 'r') as yf: doc = yaml.safe_load(yf) return doc
def loadyaml(path): """ Read the config file with yaml :param path: the config file path :return: bidict """ doc = [] if os.path.exists(path): with codecs.open(path, 'r') as yf: doc = yaml.safe_load(yf) return doc
n = 0 for i in range(1,6): n = n + 1 print(n) print('\n') n = 0 for i in range(1,11): n = n + 1 print(n) print('\n') n = 0 for i in range(0,6): n = n+i**2 print(n) print('\n') n = 0 for i in range(0,6): n = n+i**3 print(n) print('\n') n = 0 for i in range(0,6): n = n + (i - 1)**2 print(n) print('\n') n = 1 for i in range(0,6): n = i*(n-1)/2 print(n) print('\n')
n = 0 for i in range(1, 6): n = n + 1 print(n) print('\n') n = 0 for i in range(1, 11): n = n + 1 print(n) print('\n') n = 0 for i in range(0, 6): n = n + i ** 2 print(n) print('\n') n = 0 for i in range(0, 6): n = n + i ** 3 print(n) print('\n') n = 0 for i in range(0, 6): n = n + (i - 1) ** 2 print(n) print('\n') n = 1 for i in range(0, 6): n = i * (n - 1) / 2 print(n) print('\n')
# # PySNMP MIB module MY-TC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MY-TC # Produced by pysmi-0.3.4 at Wed May 1 14:16:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint") myModules, = mibBuilder.importSymbols("MY-SMI", "myModules") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Bits, Unsigned32, IpAddress, ModuleIdentity, Counter32, ObjectIdentity, Integer32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, NotificationType, TimeTicks, Gauge32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Unsigned32", "IpAddress", "ModuleIdentity", "Counter32", "ObjectIdentity", "Integer32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "NotificationType", "TimeTicks", "Gauge32", "iso") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") myTextualConventions = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 10, 97, 4, 1)) myTextualConventions.setRevisions(('2002-03-20 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: myTextualConventions.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: myTextualConventions.setLastUpdated('200203200000Z') if mibBuilder.loadTexts: myTextualConventions.setOrganization('D-Link Crop.') if mibBuilder.loadTexts: myTextualConventions.setContactInfo(' http://support.dlink.com') if mibBuilder.loadTexts: myTextualConventions.setDescription('This module defines textual conventions used throughout my enterprise mibs.') class IfIndex(TextualConvention, Integer32): description = 'This textual convention is an extension of the interface index convention. Interface include physical port and aggreate port and switch virtual interface and loopBack interface,etc.' status = 'current' displayHint = 'd' subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 2147483647) class MyTrapType(TextualConvention, Integer32): description = 'Private trap(event) type of my switch. ' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27)) namedValues = NamedValues(("coldMy", 1), ("warmMy", 2), ("linkDown", 3), ("linkUp", 4), ("authenFailure", 5), ("newRoot", 6), ("topoChange", 7), ("hardChangeDetected", 8), ("portSecurityViolate", 9), ("stormAlarm", 10), ("macNotification", 11), ("vrrpNewMaster", 12), ("vrrpAuthFailure", 13), ("powerStateChange", 14), ("fanStateChange", 15), ("ospf", 16), ("pim", 17), ("igmp", 18), ("dvmrp", 19), ("entity", 20), ("cluster", 21), ("temperatureWarning", 22), ("sysGuard", 23), ("bgp", 24), ("lineDetect", 25), ("bgpReachMaxPrefix", 26), ("hardwareNotSupport", 27)) class ConfigStatus(TextualConvention, Integer32): description = "Represents the operational status of an table entry. valid(1) - Indicates this entry's status is valid and active. invalid(2) - Indicates this entry's status is invalid. It is decided by implementatio whether entry is delete" status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("valid", 1), ("invalid", 2)) class MemberMap(TextualConvention, OctetString): description = 'Each octet indicate a Logic port, and each octect can have their content means. The lenth of octet string will change along with change of product.' status = 'current' mibBuilder.exportSymbols("MY-TC", PYSNMP_MODULE_ID=myTextualConventions, MemberMap=MemberMap, ConfigStatus=ConfigStatus, MyTrapType=MyTrapType, IfIndex=IfIndex, myTextualConventions=myTextualConventions)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint') (my_modules,) = mibBuilder.importSymbols('MY-SMI', 'myModules') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (bits, unsigned32, ip_address, module_identity, counter32, object_identity, integer32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, notification_type, time_ticks, gauge32, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'Unsigned32', 'IpAddress', 'ModuleIdentity', 'Counter32', 'ObjectIdentity', 'Integer32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'NotificationType', 'TimeTicks', 'Gauge32', 'iso') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') my_textual_conventions = module_identity((1, 3, 6, 1, 4, 1, 171, 10, 97, 4, 1)) myTextualConventions.setRevisions(('2002-03-20 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: myTextualConventions.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: myTextualConventions.setLastUpdated('200203200000Z') if mibBuilder.loadTexts: myTextualConventions.setOrganization('D-Link Crop.') if mibBuilder.loadTexts: myTextualConventions.setContactInfo(' http://support.dlink.com') if mibBuilder.loadTexts: myTextualConventions.setDescription('This module defines textual conventions used throughout my enterprise mibs.') class Ifindex(TextualConvention, Integer32): description = 'This textual convention is an extension of the interface index convention. Interface include physical port and aggreate port and switch virtual interface and loopBack interface,etc.' status = 'current' display_hint = 'd' subtype_spec = Integer32.subtypeSpec + value_range_constraint(1, 2147483647) class Mytraptype(TextualConvention, Integer32): description = 'Private trap(event) type of my switch. ' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27)) named_values = named_values(('coldMy', 1), ('warmMy', 2), ('linkDown', 3), ('linkUp', 4), ('authenFailure', 5), ('newRoot', 6), ('topoChange', 7), ('hardChangeDetected', 8), ('portSecurityViolate', 9), ('stormAlarm', 10), ('macNotification', 11), ('vrrpNewMaster', 12), ('vrrpAuthFailure', 13), ('powerStateChange', 14), ('fanStateChange', 15), ('ospf', 16), ('pim', 17), ('igmp', 18), ('dvmrp', 19), ('entity', 20), ('cluster', 21), ('temperatureWarning', 22), ('sysGuard', 23), ('bgp', 24), ('lineDetect', 25), ('bgpReachMaxPrefix', 26), ('hardwareNotSupport', 27)) class Configstatus(TextualConvention, Integer32): description = "Represents the operational status of an table entry. valid(1) - Indicates this entry's status is valid and active. invalid(2) - Indicates this entry's status is invalid. It is decided by implementatio whether entry is delete" status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('valid', 1), ('invalid', 2)) class Membermap(TextualConvention, OctetString): description = 'Each octet indicate a Logic port, and each octect can have their content means. The lenth of octet string will change along with change of product.' status = 'current' mibBuilder.exportSymbols('MY-TC', PYSNMP_MODULE_ID=myTextualConventions, MemberMap=MemberMap, ConfigStatus=ConfigStatus, MyTrapType=MyTrapType, IfIndex=IfIndex, myTextualConventions=myTextualConventions)
class Organism: alive = True class Animal(Organism): def eat(self): print("This animal is eating!") class Dog(Animal): def bark(self): print("This dog is barking!") dog = Dog() print(dog.alive) dog.eat() dog.bark()
class Organism: alive = True class Animal(Organism): def eat(self): print('This animal is eating!') class Dog(Animal): def bark(self): print('This dog is barking!') dog = dog() print(dog.alive) dog.eat() dog.bark()
def test_firstname_lastname_address(app): contact_from_home_page = app.contact.get_contact_list()[0] contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0) assert contact_from_home_page.firstname == contact_from_edit_page.firstname assert contact_from_home_page.lastname == contact_from_edit_page.lastname assert contact_from_home_page.address == contact_from_edit_page.address
def test_firstname_lastname_address(app): contact_from_home_page = app.contact.get_contact_list()[0] contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0) assert contact_from_home_page.firstname == contact_from_edit_page.firstname assert contact_from_home_page.lastname == contact_from_edit_page.lastname assert contact_from_home_page.address == contact_from_edit_page.address
def multiples (): y = list (range(1,21)) for x in y: if x % 2 == 0: print(x) multiples()
def multiples(): y = list(range(1, 21)) for x in y: if x % 2 == 0: print(x) multiples()
n=str(input("Enter the string")) le=len(n) count=0 for i in range(le-1): for j in range(le): if n[j]==n[i]: count=count+1 else: continue print("%s count is :%d"%(n[i],count)) count=0
n = str(input('Enter the string')) le = len(n) count = 0 for i in range(le - 1): for j in range(le): if n[j] == n[i]: count = count + 1 else: continue print('%s count is :%d' % (n[i], count)) count = 0
# Databricks notebook source # MAGIC %md # MAGIC References:<br> # MAGIC https://docs.azuredatabricks.net/user-guide/secrets/secrets.html<br> # MAGIC https://docs.azuredatabricks.net/spark/latest/data-sources/azure/azure-storage.html<br> # MAGIC https://docs.azuredatabricks.net/user-guide/dbfs-databricks-file-system.html<br> # MAGIC # MAGIC Notes: # MAGIC DBFS commands are very specific. Some hard-coding/specific formats -required-. # MAGIC # MAGIC Prefer Azure Key Vault for secret storage.<br> # MAGIC Create Azure Key Vault, store secret there. Then create ADB secret scope.<br> # MAGIC Then use secret scope and storage acct info to mount storage acct/container to DBFS mount point. # COMMAND ---------- storageAcctName = "pxbrixsa" containerName = "hack" secretScopeName = "pzbrixscope" secretName = "pzbrixsakey" mountPoint = "/mnt/" + containerName # COMMAND ---------- # Explicit version works but hard-codes container and storage account names - have not been able to get this to work with variables and string concat dbutils.fs.mount( source = "wasbs://hack@sa.blob.core.windows.net", mount_point = mountPoint, extra_configs = {"fs.azure.account.key.pzbrixsa.blob.core.windows.net":dbutils.secrets.get(scope = secretScopeName, key = secretName)} ) # COMMAND ---------- # This (or a version of the above using variables) does not work. Gets java.lang.IllegalArgumentException due to invalid mount source. ?? dbutils.fs.mount( "wasbs://{cn}@{san}.blob.core.windows.net" .format( cn=containerName, san=storageAcctName), "/mnt/{mn}".format(mn=mountPoint) ) # COMMAND ---------- # ls in the newly mounted mount point / in the mounted container display(dbutils.fs.ls("/mnt/" + containerName)) # COMMAND ---------- # Unmount the storage mount point dbutils.fs.unmount("/mnt/" + containerName) # COMMAND ---------- # Refresh mounts on other clusters than the one that ran DBFS commands dbutils.fs.refreshMounts() # COMMAND ---------- display(dbutils.fs.ls("/mnt")) # COMMAND ----------
storage_acct_name = 'pxbrixsa' container_name = 'hack' secret_scope_name = 'pzbrixscope' secret_name = 'pzbrixsakey' mount_point = '/mnt/' + containerName dbutils.fs.mount(source='wasbs://hack@sa.blob.core.windows.net', mount_point=mountPoint, extra_configs={'fs.azure.account.key.pzbrixsa.blob.core.windows.net': dbutils.secrets.get(scope=secretScopeName, key=secretName)}) dbutils.fs.mount('wasbs://{cn}@{san}.blob.core.windows.net'.format(cn=containerName, san=storageAcctName), '/mnt/{mn}'.format(mn=mountPoint)) display(dbutils.fs.ls('/mnt/' + containerName)) dbutils.fs.unmount('/mnt/' + containerName) dbutils.fs.refreshMounts() display(dbutils.fs.ls('/mnt'))
# -*- coding: utf-8 -*- class ConnectorException(Exception): pass class UnsupportedDriver(ConnectorException): def __init__(self, driver): message = 'Driver "%s" is not supported' % driver super(UnsupportedDriver, self).__init__(message)
class Connectorexception(Exception): pass class Unsupporteddriver(ConnectorException): def __init__(self, driver): message = 'Driver "%s" is not supported' % driver super(UnsupportedDriver, self).__init__(message)
class TransactCounterSingleton(object): def __new__(cls): if not hasattr(cls, 'instance'): cls.instance = super(TransactCounterSingleton, cls).__new__(cls) cls.instance.count = 0 return cls.instance @staticmethod def get_id(): result = TransactCounterSingleton().count TransactCounterSingleton().count += 1 return result class Transact: def __init__(self, move_moment, current_block): self.create_moment = move_moment self.move_moment = move_moment self._id = TransactCounterSingleton.get_id() self.current_block = current_block self.blocked = False @property def id(self): return self._id def __str__(self): return "{},{},{},{}".format(self.id, round(self.move_moment, 1), type(self.current_block).__name__[:3], type(self.current_block.get_next_block(self)).__name__[:3])
class Transactcountersingleton(object): def __new__(cls): if not hasattr(cls, 'instance'): cls.instance = super(TransactCounterSingleton, cls).__new__(cls) cls.instance.count = 0 return cls.instance @staticmethod def get_id(): result = transact_counter_singleton().count transact_counter_singleton().count += 1 return result class Transact: def __init__(self, move_moment, current_block): self.create_moment = move_moment self.move_moment = move_moment self._id = TransactCounterSingleton.get_id() self.current_block = current_block self.blocked = False @property def id(self): return self._id def __str__(self): return '{},{},{},{}'.format(self.id, round(self.move_moment, 1), type(self.current_block).__name__[:3], type(self.current_block.get_next_block(self)).__name__[:3])
BOT_NAME = 'GroeneScrapy' SPIDER_MODULES = ['GroeneScrapy.spiders'] NEWSPIDER_MODULE = 'GroeneScrapy.spiders' LOG_LEVEL = 'ERROR' GROENE_USERNAME = 'Enter your e-mail address here' GROENE_PASSWORD = 'Enter your password here' GROENE_PDF_PATH = 'GroenePDF'
bot_name = 'GroeneScrapy' spider_modules = ['GroeneScrapy.spiders'] newspider_module = 'GroeneScrapy.spiders' log_level = 'ERROR' groene_username = 'Enter your e-mail address here' groene_password = 'Enter your password here' groene_pdf_path = 'GroenePDF'
#!/usr/bin/env python3 def blocks(height, time): offset = 2 * height - 2 return time * height if time % offset == 0 else 0 if __name__ == '__main__': lines = [line.split(': ') for line in open('input').read().split('\n')] heights = {int(pos): int(height) for pos, height in lines} print(sum(map(lambda col: blocks(heights[col], col), heights))) delay = 0 while True: if sum(map(lambda col: blocks(heights[col], col+delay), heights)) == 0: print(delay) break else: delay += 1
def blocks(height, time): offset = 2 * height - 2 return time * height if time % offset == 0 else 0 if __name__ == '__main__': lines = [line.split(': ') for line in open('input').read().split('\n')] heights = {int(pos): int(height) for (pos, height) in lines} print(sum(map(lambda col: blocks(heights[col], col), heights))) delay = 0 while True: if sum(map(lambda col: blocks(heights[col], col + delay), heights)) == 0: print(delay) break else: delay += 1
class Event: circle_event = False @property def x(self): return 0 @property def y(self): return 0 def __lt__(self, other): if self.y == other.y and self.x == other.x: return self.circle_event and not other.circle_event if self.y == other.y: return self.x < other.x # Switch y axis return self.y > other.y def __eq__(self, other): if other is None: return None return self.y == other.y and self.x == other.x def __ne__(self, other): return not self.__eq__(other)
class Event: circle_event = False @property def x(self): return 0 @property def y(self): return 0 def __lt__(self, other): if self.y == other.y and self.x == other.x: return self.circle_event and (not other.circle_event) if self.y == other.y: return self.x < other.x return self.y > other.y def __eq__(self, other): if other is None: return None return self.y == other.y and self.x == other.x def __ne__(self, other): return not self.__eq__(other)
####DEFINE COLOR SWITCH def code_to_class_string(argument): switcher = { 'n02691156': "airplane", 'n02419796': "antelope", 'n02131653': "bear", 'n02834778': "bicycle", 'n01503061': "bird", 'n02924116': "bus", 'n02958343': "car", 'n02402425': "cattle", 'n02084071': "dog", 'n02121808': "domestic_cat", 'n02503517': "elephant", 'n02118333': "fox", 'n02510455': "giant_panda", 'n02342885': "hamster", 'n02374451': "horse", 'n02129165': "lion", 'n01674464': "lizard", 'n02484322': "monkey", 'n03790512': "motorcycle", 'n02324045': "rabbit", 'n02509815': "red_panda", 'n02411705': "sheep", 'n01726692': "snake", 'n02355227': "squirrel", 'n02129604': "tiger", 'n04468005': "train", 'n01662784': "turtle", 'n04530566': "watercraft", 'n02062744': "whale", 'n02391049': "zebra" } return switcher.get(argument, "nothing") def code_to_code_chall(argument): switcher = { 'n02691156': 1, 'n02419796': 2, 'n02131653': 3, 'n02834778': 4, 'n01503061': 5, 'n02924116': 6, 'n02958343': 7, 'n02402425': 8, 'n02084071': 9, 'n02121808': 10, 'n02503517': 11, 'n02118333': 12, 'n02510455': 13, 'n02342885': 14, 'n02374451': 15, 'n02129165': 16, 'n01674464': 17, 'n02484322': 18, 'n03790512': 19, 'n02324045': 20, 'n02509815': 21, 'n02411705': 22, 'n01726692': 23, 'n02355227': 24, 'n02129604': 25, 'n04468005': 26, 'n01662784': 27, 'n04530566': 28, 'n02062744': 29, 'n02391049': 30 } return switcher.get(argument, "nothing") def class_string_to_comp_code(argument): switcher = { 'airplane': 1, 'antelope': 2, 'bear': 3, 'bicycle': 4, 'bird': 5, 'bus': 6, 'car': 7, 'cattle': 8, 'dog': 9, 'domestic_cat': 10, 'elephant': 11, 'fox': 12, 'giant_panda': 13, 'hamster': 14, 'horse': 15, 'lion': 16, 'lizard': 17, 'monkey': 18, 'motorcycle': 19, 'rabbit': 20, 'red_panda': 21, 'sheep': 22, 'snake': 23, 'squirrel': 24, 'tiger': 25, 'train': 26, 'turtle': 27, 'watercraft': 28, 'whale': 29, 'zebra': 30 } return switcher.get(argument, None) def code_comp_to_class(argument): switcher = { 1:'airplane', 2:'antelope', 3:'bear', 4:'bicycle', 5:'bird', 6:'bus', 7:'car', 8:'cattle', 9:'dog', 10:'domestic_cat', 11:'elephant', 12:'fox', 13:'giant_panda', 14:'hamster', 15:'horse', 16:'lion', 17:'lizard', 18:'monkey', 19:'motorcycle', 20:'rabbit', 21:'red_panda', 22:'sheep', 23:'snake', 24:'squirrel', 25:'tiger', 26:'train', 27:'turtle', 28:'watercraft', 29:'whale', 30:'zebra' } return switcher.get(argument, "nothing") ### Color Switching def name_string_to_color(argument): switcher = { 'airplane': 'black' , 'antelope': 'white', 'bear': 'red', 'bicycle': 'lime' , 'bird': 'blue', 'bus': 'yellow', 'car': 'cyan', 'cattle': 'magenta', 'dog': 'silver', 'domestic_cat': 'gray' , 'elephant':'maroon' , 'fox':'olive' , 'giant_panda':'green' , 'hamster':'purple' , 'horse':'teal' , 'lion':'navy' , 'lizard':'pale violet red' , 'monkey':'deep pink' , 'motorcycle':'aqua marine' , 'rabbit':'powder blue' , 'red_panda':'spring green' , 'sheep':'sea green' , 'snake':'forest green' , 'squirrel':'orange red' , 'tiger':'dark orange' , 'train':'orange' , 'turtle':'dark golden rod' , 'watercraft':'golden rod' , 'whale':'dark red' , 'zebra':'light coral' } return switcher.get(argument, "nothing") def code_to_color(argument): switcher = { 1:(0,0,0), 2:(255,255,255), 3:(255,0,0), 4:(0,255,0), 5:(0,0,255), 6:(255,255,0), 7:(0,255,255), 8:(255,0,255), 9:(192,192,192), 10:(128,128,128), 11:(128,0,0), 12:(128,128,0), 13:(0,128,0), 14:(128,0,128), 15:(0,128,128), 16:(0,0,128), 17:(219,112,147), 18:(255,20,147), 19:(127,255,212), 20:(176,224,230), 21:(0,255,127), 22:(46,139,87), 23:(34,139,34), 24:(255,69,0), 25:(255,140,0), 26:(255,165,0), 27:(184,134,11), 28:(218,165,32), 29:(139,0,0), 30:(240,128,128) } return switcher.get(argument,(0,0,0) ) def label_to_color(argument): switcher = { 'n02691156':(0,0,0), 'n02419796':(255,255,255), 'n02131653':(255,0,0), 'n02834778':(0,255,0), 'n01503061':(0,0,255), 'n02924116':(255,255,0), 'n02958343':(0,255,255), 'n02402425':(255,0,255), 'n02084071':(192,192,192), 'n02121808':(128,128,128), 'n02503517':(128,0,0), 'n02118333':(128,128,0), 'n02510455':(0,128,0), 'n02342885':(128,0,128), 'n02374451':(0,128,128), 'n02129165':(0,0,128), 'n01674464':(219,112,147), 'n02484322':(255,20,147), 'n03790512':(127,255,212), 'n02324045':(176,224,230), 'n02509815':(0,255,127), 'n02411705':(46,139,87), 'n01726692':(34,139,34), 'n02355227':(255,69,0), 'n02129604':(255,140,0), 'n04468005':(255,165,0), 'n01662784':(184,134,11), 'n04530566':(218,165,32), 'n02062744':(139,0,0), 'n02391049':(240,128,128) } return switcher.get(argument,(0,0,0) ) ####### COLOR LEGEND ####### # Black #000000 (0,0,0) # White #FFFFFF (255,255,255) # Red #FF0000 (255,0,0) # Lime #00FF00 (0,255,0) # Blue #0000FF (0,0,255) # Yellow #FFFF00 (255,255,0) # Cyan / Aqua #00FFFF (0,255,255) # Magenta / Fuchsia #FF00FF (255,0,255) # Silver #C0C0C0 (192,192,192) # Gray #808080 (128,128,128) # Maroon #800000 (128,0,0) # Olive #808000 (128,128,0) # Green #008000 (0,128,0) # Purple #800080 (128,0,128) # Teal #008080 (0,128,128) # Navy #000080 (0,0,128) # pale violet red #DB7093 (219,112,147) # deep pink #FF1493 (255,20,147) # aqua marine #7FFFD4 (127,255,212) # powder blue #B0E0E6 (176,224,230) # spring green #00FF7F (0,255,127) # sea green #2E8B57 (46,139,87) # forest green #228B22 (34,139,34) # lime #00FF00 (0,255,0) # orange red #FF4500 (255,69,0) # dark orange #FF8C00 (255,140,0) # orange #FFA500 (255,165,0) # dark golden rod #B8860B (184,134,11) # golden rod #DAA520 (218,165,32) # dark red #8B0000 (139,0,0) # light coral #F08080 (240,128,128) class Classes_List(object): class_name_string_list= ['airplane','antelope','bear','bicycle','bird','bus','car','cattle','dog','domestic_cat','elephant','fox','giant_panda','hamster','horse','lion','lizard','monkey','motorcycle','rabbit','red_panda','sheep','snake','squirrel','tiger','train','turtle','watercraft','whale','zebra'] class_code_string_list= ['n02691156','n02419796','n02131653','n02834778','n01503061','n02924116','n02958343','n02402425','n02084071','n02121808','n02503517','n02118333','n02510455','n02342885','n02374451','n02129165','n01674464','n02484322','n03790512','n02324045','n02509815','n02411705','n01726692','n02355227','n02129604','n04468005','n01662784','n04530566','n02062744','n02391049'] colors_string_list=['black' ,'white','red','lime' ,'blue','yellow','cyan', 'magenta','silver', 'gray' ,'maroon' ,'olive' ,'green' ,'purple' ,'teal' ,'navy' ,'pale violet red' ,'deep pink' ,'aqua marine' ,'powder blue' ,'spring green' ,'sea green' ,'forest green' ,'orange red' ,'dark orange' ,'orange' ,'dark golden rod' ,'golden rod' ,'dark red' ,'light coral' ] colors_code_list=[(0,0,0),(255,255,255),(255,0,0),(0,255,0),(0,0,255),(255,255,0),(0,255,255),(255,0,255),(192,192,192),(128,128,128),(128,0,0),(128,128,0),(0,128,0),(128,0,128),(0,128,128),(0,0,128),(219,112,147),(255,20,147),(127,255,212),(176,224,230),(0,255,127),(46,139,87),(34,139,34),(255,69,0),(255,140,0),(255,165,0),(184,134,11),(218,165,32),(139,0,0),(240,128,128)]
def code_to_class_string(argument): switcher = {'n02691156': 'airplane', 'n02419796': 'antelope', 'n02131653': 'bear', 'n02834778': 'bicycle', 'n01503061': 'bird', 'n02924116': 'bus', 'n02958343': 'car', 'n02402425': 'cattle', 'n02084071': 'dog', 'n02121808': 'domestic_cat', 'n02503517': 'elephant', 'n02118333': 'fox', 'n02510455': 'giant_panda', 'n02342885': 'hamster', 'n02374451': 'horse', 'n02129165': 'lion', 'n01674464': 'lizard', 'n02484322': 'monkey', 'n03790512': 'motorcycle', 'n02324045': 'rabbit', 'n02509815': 'red_panda', 'n02411705': 'sheep', 'n01726692': 'snake', 'n02355227': 'squirrel', 'n02129604': 'tiger', 'n04468005': 'train', 'n01662784': 'turtle', 'n04530566': 'watercraft', 'n02062744': 'whale', 'n02391049': 'zebra'} return switcher.get(argument, 'nothing') def code_to_code_chall(argument): switcher = {'n02691156': 1, 'n02419796': 2, 'n02131653': 3, 'n02834778': 4, 'n01503061': 5, 'n02924116': 6, 'n02958343': 7, 'n02402425': 8, 'n02084071': 9, 'n02121808': 10, 'n02503517': 11, 'n02118333': 12, 'n02510455': 13, 'n02342885': 14, 'n02374451': 15, 'n02129165': 16, 'n01674464': 17, 'n02484322': 18, 'n03790512': 19, 'n02324045': 20, 'n02509815': 21, 'n02411705': 22, 'n01726692': 23, 'n02355227': 24, 'n02129604': 25, 'n04468005': 26, 'n01662784': 27, 'n04530566': 28, 'n02062744': 29, 'n02391049': 30} return switcher.get(argument, 'nothing') def class_string_to_comp_code(argument): switcher = {'airplane': 1, 'antelope': 2, 'bear': 3, 'bicycle': 4, 'bird': 5, 'bus': 6, 'car': 7, 'cattle': 8, 'dog': 9, 'domestic_cat': 10, 'elephant': 11, 'fox': 12, 'giant_panda': 13, 'hamster': 14, 'horse': 15, 'lion': 16, 'lizard': 17, 'monkey': 18, 'motorcycle': 19, 'rabbit': 20, 'red_panda': 21, 'sheep': 22, 'snake': 23, 'squirrel': 24, 'tiger': 25, 'train': 26, 'turtle': 27, 'watercraft': 28, 'whale': 29, 'zebra': 30} return switcher.get(argument, None) def code_comp_to_class(argument): switcher = {1: 'airplane', 2: 'antelope', 3: 'bear', 4: 'bicycle', 5: 'bird', 6: 'bus', 7: 'car', 8: 'cattle', 9: 'dog', 10: 'domestic_cat', 11: 'elephant', 12: 'fox', 13: 'giant_panda', 14: 'hamster', 15: 'horse', 16: 'lion', 17: 'lizard', 18: 'monkey', 19: 'motorcycle', 20: 'rabbit', 21: 'red_panda', 22: 'sheep', 23: 'snake', 24: 'squirrel', 25: 'tiger', 26: 'train', 27: 'turtle', 28: 'watercraft', 29: 'whale', 30: 'zebra'} return switcher.get(argument, 'nothing') def name_string_to_color(argument): switcher = {'airplane': 'black', 'antelope': 'white', 'bear': 'red', 'bicycle': 'lime', 'bird': 'blue', 'bus': 'yellow', 'car': 'cyan', 'cattle': 'magenta', 'dog': 'silver', 'domestic_cat': 'gray', 'elephant': 'maroon', 'fox': 'olive', 'giant_panda': 'green', 'hamster': 'purple', 'horse': 'teal', 'lion': 'navy', 'lizard': 'pale violet red', 'monkey': 'deep pink', 'motorcycle': 'aqua marine', 'rabbit': 'powder blue', 'red_panda': 'spring green', 'sheep': 'sea green', 'snake': 'forest green', 'squirrel': 'orange red', 'tiger': 'dark orange', 'train': 'orange', 'turtle': 'dark golden rod', 'watercraft': 'golden rod', 'whale': 'dark red', 'zebra': 'light coral'} return switcher.get(argument, 'nothing') def code_to_color(argument): switcher = {1: (0, 0, 0), 2: (255, 255, 255), 3: (255, 0, 0), 4: (0, 255, 0), 5: (0, 0, 255), 6: (255, 255, 0), 7: (0, 255, 255), 8: (255, 0, 255), 9: (192, 192, 192), 10: (128, 128, 128), 11: (128, 0, 0), 12: (128, 128, 0), 13: (0, 128, 0), 14: (128, 0, 128), 15: (0, 128, 128), 16: (0, 0, 128), 17: (219, 112, 147), 18: (255, 20, 147), 19: (127, 255, 212), 20: (176, 224, 230), 21: (0, 255, 127), 22: (46, 139, 87), 23: (34, 139, 34), 24: (255, 69, 0), 25: (255, 140, 0), 26: (255, 165, 0), 27: (184, 134, 11), 28: (218, 165, 32), 29: (139, 0, 0), 30: (240, 128, 128)} return switcher.get(argument, (0, 0, 0)) def label_to_color(argument): switcher = {'n02691156': (0, 0, 0), 'n02419796': (255, 255, 255), 'n02131653': (255, 0, 0), 'n02834778': (0, 255, 0), 'n01503061': (0, 0, 255), 'n02924116': (255, 255, 0), 'n02958343': (0, 255, 255), 'n02402425': (255, 0, 255), 'n02084071': (192, 192, 192), 'n02121808': (128, 128, 128), 'n02503517': (128, 0, 0), 'n02118333': (128, 128, 0), 'n02510455': (0, 128, 0), 'n02342885': (128, 0, 128), 'n02374451': (0, 128, 128), 'n02129165': (0, 0, 128), 'n01674464': (219, 112, 147), 'n02484322': (255, 20, 147), 'n03790512': (127, 255, 212), 'n02324045': (176, 224, 230), 'n02509815': (0, 255, 127), 'n02411705': (46, 139, 87), 'n01726692': (34, 139, 34), 'n02355227': (255, 69, 0), 'n02129604': (255, 140, 0), 'n04468005': (255, 165, 0), 'n01662784': (184, 134, 11), 'n04530566': (218, 165, 32), 'n02062744': (139, 0, 0), 'n02391049': (240, 128, 128)} return switcher.get(argument, (0, 0, 0)) class Classes_List(object): class_name_string_list = ['airplane', 'antelope', 'bear', 'bicycle', 'bird', 'bus', 'car', 'cattle', 'dog', 'domestic_cat', 'elephant', 'fox', 'giant_panda', 'hamster', 'horse', 'lion', 'lizard', 'monkey', 'motorcycle', 'rabbit', 'red_panda', 'sheep', 'snake', 'squirrel', 'tiger', 'train', 'turtle', 'watercraft', 'whale', 'zebra'] class_code_string_list = ['n02691156', 'n02419796', 'n02131653', 'n02834778', 'n01503061', 'n02924116', 'n02958343', 'n02402425', 'n02084071', 'n02121808', 'n02503517', 'n02118333', 'n02510455', 'n02342885', 'n02374451', 'n02129165', 'n01674464', 'n02484322', 'n03790512', 'n02324045', 'n02509815', 'n02411705', 'n01726692', 'n02355227', 'n02129604', 'n04468005', 'n01662784', 'n04530566', 'n02062744', 'n02391049'] colors_string_list = ['black', 'white', 'red', 'lime', 'blue', 'yellow', 'cyan', 'magenta', 'silver', 'gray', 'maroon', 'olive', 'green', 'purple', 'teal', 'navy', 'pale violet red', 'deep pink', 'aqua marine', 'powder blue', 'spring green', 'sea green', 'forest green', 'orange red', 'dark orange', 'orange', 'dark golden rod', 'golden rod', 'dark red', 'light coral'] colors_code_list = [(0, 0, 0), (255, 255, 255), (255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0), (0, 255, 255), (255, 0, 255), (192, 192, 192), (128, 128, 128), (128, 0, 0), (128, 128, 0), (0, 128, 0), (128, 0, 128), (0, 128, 128), (0, 0, 128), (219, 112, 147), (255, 20, 147), (127, 255, 212), (176, 224, 230), (0, 255, 127), (46, 139, 87), (34, 139, 34), (255, 69, 0), (255, 140, 0), (255, 165, 0), (184, 134, 11), (218, 165, 32), (139, 0, 0), (240, 128, 128)]
class Grid: def __init__(self, matrix=None): if (matrix): self.matrix = matrix else: self.matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] def __str__(self): return str(str(self.matrix[0][0]) + str(self.matrix[1][0]) + str(self.matrix[2][0]) + "\n" + str(self.matrix[0][1]) + str(self.matrix[1][1]) + str(self.matrix[2][1]) + "\n" + str(self.matrix[0][2]) + str(self.matrix[1][2]) + str(self.matrix[2][2]) ) def get_pos(self, x, y): return self.matrix[x][y] def set_pos(self, x, y, number): self.matrix[x][y] = number def blocksums(self): return ( self.matrix[0][0] + self.matrix[1][0] + self.matrix[0][1] + self.matrix[1][1], self.matrix[1][0] + self.matrix[2][0] + self.matrix[1][1] + self.matrix[2][1], self.matrix[0][1] + self.matrix[1][1] + self.matrix[0][2] + self.matrix[1][2], self.matrix[1][1] + self.matrix[2][1] + self.matrix[1][2] + self.matrix[2][2] ) def count(self, number): count = 0 for x in range(0, 3): for y in range(0, 3): if(self.matrix[x][y] == number): count += 1 return count grids = [] for a in range(0, 2): for b in range(0, 2): for c in range(0, 2): for d in range(0, 2): for e in range(0, 2): for f in range(0, 2): for g in range(0, 2): for h in range(0, 2): for i in range(0, 2): grids.append( Grid([[a, b, c], [d, e, f], [g, h, i]])) print("Blocksums are 3") for grid in grids: if grid.blocksums() == (3, 3, 3, 3) and grid.count(1) == 5 and grid.count(0) == 4: print(grid) print("Blocksums are 2") for grid in grids: if grid.blocksums() == (2, 2, 2, 2) and grid.count(1) == 5 and grid.count(0) == 4: print(grid)
class Grid: def __init__(self, matrix=None): if matrix: self.matrix = matrix else: self.matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] def __str__(self): return str(str(self.matrix[0][0]) + str(self.matrix[1][0]) + str(self.matrix[2][0]) + '\n' + str(self.matrix[0][1]) + str(self.matrix[1][1]) + str(self.matrix[2][1]) + '\n' + str(self.matrix[0][2]) + str(self.matrix[1][2]) + str(self.matrix[2][2])) def get_pos(self, x, y): return self.matrix[x][y] def set_pos(self, x, y, number): self.matrix[x][y] = number def blocksums(self): return (self.matrix[0][0] + self.matrix[1][0] + self.matrix[0][1] + self.matrix[1][1], self.matrix[1][0] + self.matrix[2][0] + self.matrix[1][1] + self.matrix[2][1], self.matrix[0][1] + self.matrix[1][1] + self.matrix[0][2] + self.matrix[1][2], self.matrix[1][1] + self.matrix[2][1] + self.matrix[1][2] + self.matrix[2][2]) def count(self, number): count = 0 for x in range(0, 3): for y in range(0, 3): if self.matrix[x][y] == number: count += 1 return count grids = [] for a in range(0, 2): for b in range(0, 2): for c in range(0, 2): for d in range(0, 2): for e in range(0, 2): for f in range(0, 2): for g in range(0, 2): for h in range(0, 2): for i in range(0, 2): grids.append(grid([[a, b, c], [d, e, f], [g, h, i]])) print('Blocksums are 3') for grid in grids: if grid.blocksums() == (3, 3, 3, 3) and grid.count(1) == 5 and (grid.count(0) == 4): print(grid) print('Blocksums are 2') for grid in grids: if grid.blocksums() == (2, 2, 2, 2) and grid.count(1) == 5 and (grid.count(0) == 4): print(grid)
class HttpCodes(dict): http_100 = (100, 'Continue') http_101 = (101, 'Switching Protocols') http_102 = (102, 'Processing (WebDAV)') http_200 = (200, 'OK') http_201 = (201, 'Created') http_202 = (202, 'Accepted') http_203 = (203, 'Non-Authoritative Information') http_204 = (204, 'No Content') http_205 = (205, 'Reset Content') http_206 = (206, 'Partial Content') http_207 = (207, 'Multi-Status (WebDAV)') http_208 = (208, 'Already Reported (WebDAV)') http_226 = (226, 'IM Used') http_300 = (300, 'Multiple Choices') http_301 = (301, 'Moved Permanently') http_302 = (302, 'Found') http_303 = (303, 'See Other') http_304 = (304, 'Not Modified') http_305 = (305, 'Use Proxy') http_306 = (306, '(Unused)') http_307 = (307, 'Temporary Redirect') http_308 = (308, 'Permanent Redirect (experimental)') http_400 = (400, 'Bad Request') http_401 = (401, 'Unauthorized') http_402 = (402, 'Payment Required') http_403 = (403, 'Forbidden') http_404 = (404, 'Not Found') http_405 = (405, 'Method Not Allowed') http_406 = (406, 'Not Acceptable') http_407 = (407, 'Proxy Authentication Required') http_408 = (408, 'Request Timeout') http_409 = (409, 'Conflict') http_410 = (410, 'Gone') http_411 = (411, 'Length Required') http_412 = (412, 'Precondition Failed') http_413 = (413, 'Request Entity Too Large') http_414 = (414, 'Request-URI Too Long') http_415 = (415, 'Unsupported Media Type') http_416 = (416, 'Requested Range Not Satisfiable') http_417 = (417, 'Expectation Failed') http_418 = (418, 'I\'m a teapot (RFC 2324)') http_420 = (420, 'Enhance Your Calm (Twitter)') http_422 = (422, 'Unprocessable Entity (WebDAV)') http_423 = (423, 'Locked (WebDAV)') http_424 = (424, 'Failed Dependency (WebDAV)') http_425 = (425, 'Reserved for WebDAV') http_426 = (426, 'Upgrade Required') http_428 = (428, 'Precondition Required') http_429 = (429, 'Too Many Requests') http_431 = (431, 'Request Header Fields Too Large') http_444 = (444, 'No Response (Nginx)') http_449 = (449, 'Retry With (Microsoft)') http_450 = (450, 'Blocked by Windows Parental Controls (Microsoft)') http_451 = (451, 'Unavailable For Legal Reasons') http_499 = (499, 'Client Closed Request (Nginx)') http_500 = (500, 'Internal Server Error') http_501 = (501, 'Not Implemented') http_502 = (502, 'Bad Gateway') http_503 = (503, 'Service Unavailable') http_504 = (504, 'Gateway Timeout') http_505 = (505, 'HTTP Version Not Supported') http_506 = (506, 'Variant Also Negotiates (Experimental)') http_507 = (507, 'Insufficient Storage (WebDAV)') http_508 = (508, 'Loop Detected (WebDAV)') http_509 = (509, 'Bandwidth Limit Exceeded (Apache)') http_510 = (510, 'Not Extended') http_511 = (511, 'Network Authentication Required') class ECodes(dict): success = (0, 'ok') fail = (1, 'fail') addr_not_found = (404, 'Address your visit does not exist') token_auth_success = (0, 'Token authentication is successful') login_timeout = (10001, 'Login timed out, please log in again') illegal_token = (10002, 'Illegal token') invalid_token_secret = (10003, 'Invalid token secret') token_expired = (10004, 'Token has expired') token_auth_fail = (10006, 'Token authentication failure')
class Httpcodes(dict): http_100 = (100, 'Continue') http_101 = (101, 'Switching Protocols') http_102 = (102, 'Processing (WebDAV)') http_200 = (200, 'OK') http_201 = (201, 'Created') http_202 = (202, 'Accepted') http_203 = (203, 'Non-Authoritative Information') http_204 = (204, 'No Content') http_205 = (205, 'Reset Content') http_206 = (206, 'Partial Content') http_207 = (207, 'Multi-Status (WebDAV)') http_208 = (208, 'Already Reported (WebDAV)') http_226 = (226, 'IM Used') http_300 = (300, 'Multiple Choices') http_301 = (301, 'Moved Permanently') http_302 = (302, 'Found') http_303 = (303, 'See Other') http_304 = (304, 'Not Modified') http_305 = (305, 'Use Proxy') http_306 = (306, '(Unused)') http_307 = (307, 'Temporary Redirect') http_308 = (308, 'Permanent Redirect (experimental)') http_400 = (400, 'Bad Request') http_401 = (401, 'Unauthorized') http_402 = (402, 'Payment Required') http_403 = (403, 'Forbidden') http_404 = (404, 'Not Found') http_405 = (405, 'Method Not Allowed') http_406 = (406, 'Not Acceptable') http_407 = (407, 'Proxy Authentication Required') http_408 = (408, 'Request Timeout') http_409 = (409, 'Conflict') http_410 = (410, 'Gone') http_411 = (411, 'Length Required') http_412 = (412, 'Precondition Failed') http_413 = (413, 'Request Entity Too Large') http_414 = (414, 'Request-URI Too Long') http_415 = (415, 'Unsupported Media Type') http_416 = (416, 'Requested Range Not Satisfiable') http_417 = (417, 'Expectation Failed') http_418 = (418, "I'm a teapot (RFC 2324)") http_420 = (420, 'Enhance Your Calm (Twitter)') http_422 = (422, 'Unprocessable Entity (WebDAV)') http_423 = (423, 'Locked (WebDAV)') http_424 = (424, 'Failed Dependency (WebDAV)') http_425 = (425, 'Reserved for WebDAV') http_426 = (426, 'Upgrade Required') http_428 = (428, 'Precondition Required') http_429 = (429, 'Too Many Requests') http_431 = (431, 'Request Header Fields Too Large') http_444 = (444, 'No Response (Nginx)') http_449 = (449, 'Retry With (Microsoft)') http_450 = (450, 'Blocked by Windows Parental Controls (Microsoft)') http_451 = (451, 'Unavailable For Legal Reasons') http_499 = (499, 'Client Closed Request (Nginx)') http_500 = (500, 'Internal Server Error') http_501 = (501, 'Not Implemented') http_502 = (502, 'Bad Gateway') http_503 = (503, 'Service Unavailable') http_504 = (504, 'Gateway Timeout') http_505 = (505, 'HTTP Version Not Supported') http_506 = (506, 'Variant Also Negotiates (Experimental)') http_507 = (507, 'Insufficient Storage (WebDAV)') http_508 = (508, 'Loop Detected (WebDAV)') http_509 = (509, 'Bandwidth Limit Exceeded (Apache)') http_510 = (510, 'Not Extended') http_511 = (511, 'Network Authentication Required') class Ecodes(dict): success = (0, 'ok') fail = (1, 'fail') addr_not_found = (404, 'Address your visit does not exist') token_auth_success = (0, 'Token authentication is successful') login_timeout = (10001, 'Login timed out, please log in again') illegal_token = (10002, 'Illegal token') invalid_token_secret = (10003, 'Invalid token secret') token_expired = (10004, 'Token has expired') token_auth_fail = (10006, 'Token authentication failure')
#!/usr/bin/env python # -*-coding: utf-8 -*- #config.py #Dave Landay #LAST UPDATED: 01-01-2020 DEBUG = True SQLALCHEMY_DATABASE_URI = '<PATH_TO_DATABASE.DB>' SECRET_KEY = '<SOME_SECRET_KEY>'
debug = True sqlalchemy_database_uri = '<PATH_TO_DATABASE.DB>' secret_key = '<SOME_SECRET_KEY>'
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"ShuffleBlock": "00_core.ipynb", "OprtType": "00_core.ipynb", "conv_unit": "00_core.ipynb", "conv": "00_core.ipynb", "relu_conv_bn": "00_core.ipynb", "conv_bn_relu": "00_core.ipynb", "bn_relu_conv": "00_core.ipynb", "relu_conv": "00_core.ipynb", "conv_bn": "00_core.ipynb", "relu_conv_bn_shuffle": "00_core.ipynb", "pack_relu_conv_bn": "00_core.ipynb", "pack_bn_relu_conv": "00_core.ipynb", "pack_relu_conv_bn_shuffle": "00_core.ipynb", "resnet_basicblock": "00_core.ipynb", "resnet_bottleneck": "00_core.ipynb", "preresnet_basicblock": "00_core.ipynb", "preresnet_bottleneck": "00_core.ipynb", "xception": "00_core.ipynb", "mbconv2": "00_core.ipynb", "mbconv": "00_core.ipynb", "resnet_stem": "00_core.ipynb", "resnet_stem_deep": "00_core.ipynb", "IdentityMappingMaxPool": "00_core.ipynb", "IdentityMappingAvgPool": "00_core.ipynb", "IdentityMappingConv": "00_core.ipynb", "IdentityMapping": "00_core.ipynb", "Classifier": "00_core.ipynb", "ClassifierBNReLU": "00_core.ipynb", "init_cnn": "00_core.ipynb", "num_params": "00_core.ipynb", "assert_cfg": "01_config.ipynb", "cfg": "01_config.ipynb", "resnet_dag": "02_graph.ipynb", "NodeOP": "03_network.ipynb", "NetworkOP": "03_network.ipynb", "get_pred": "04_resnetx.ipynb", "layer_diff": "04_resnetx.ipynb", "ResNetX": "04_resnetx.ipynb", "resnet_local_to_pretrained": "04_resnetx.ipynb", "resnetx": "04_resnetx.ipynb", "get_num_nodes": "05_automl.ipynb", "FoldBlock": "07_foldnet.ipynb", "ExpandBlock": "08_lookbacknet.ipynb", "FoldNet": "07_foldnet.ipynb", "num_units": "07_foldnet.ipynb", "cal_num_params": "07_foldnet.ipynb", "LookbackBlock": "08_lookbacknet.ipynb", "LookbackNet": "08_lookbacknet.ipynb"} modules = ["core.py", "config.py", "graph.py", "network.py", "resnetx.py", "automl.py", "foldnet.py", "lookbacknet.py"] doc_url = "https://keepsimpler.github.io/wong/" git_url = "https://github.com/keepsimpler/wong/tree/master/" def custom_doc_links(name): return None
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'ShuffleBlock': '00_core.ipynb', 'OprtType': '00_core.ipynb', 'conv_unit': '00_core.ipynb', 'conv': '00_core.ipynb', 'relu_conv_bn': '00_core.ipynb', 'conv_bn_relu': '00_core.ipynb', 'bn_relu_conv': '00_core.ipynb', 'relu_conv': '00_core.ipynb', 'conv_bn': '00_core.ipynb', 'relu_conv_bn_shuffle': '00_core.ipynb', 'pack_relu_conv_bn': '00_core.ipynb', 'pack_bn_relu_conv': '00_core.ipynb', 'pack_relu_conv_bn_shuffle': '00_core.ipynb', 'resnet_basicblock': '00_core.ipynb', 'resnet_bottleneck': '00_core.ipynb', 'preresnet_basicblock': '00_core.ipynb', 'preresnet_bottleneck': '00_core.ipynb', 'xception': '00_core.ipynb', 'mbconv2': '00_core.ipynb', 'mbconv': '00_core.ipynb', 'resnet_stem': '00_core.ipynb', 'resnet_stem_deep': '00_core.ipynb', 'IdentityMappingMaxPool': '00_core.ipynb', 'IdentityMappingAvgPool': '00_core.ipynb', 'IdentityMappingConv': '00_core.ipynb', 'IdentityMapping': '00_core.ipynb', 'Classifier': '00_core.ipynb', 'ClassifierBNReLU': '00_core.ipynb', 'init_cnn': '00_core.ipynb', 'num_params': '00_core.ipynb', 'assert_cfg': '01_config.ipynb', 'cfg': '01_config.ipynb', 'resnet_dag': '02_graph.ipynb', 'NodeOP': '03_network.ipynb', 'NetworkOP': '03_network.ipynb', 'get_pred': '04_resnetx.ipynb', 'layer_diff': '04_resnetx.ipynb', 'ResNetX': '04_resnetx.ipynb', 'resnet_local_to_pretrained': '04_resnetx.ipynb', 'resnetx': '04_resnetx.ipynb', 'get_num_nodes': '05_automl.ipynb', 'FoldBlock': '07_foldnet.ipynb', 'ExpandBlock': '08_lookbacknet.ipynb', 'FoldNet': '07_foldnet.ipynb', 'num_units': '07_foldnet.ipynb', 'cal_num_params': '07_foldnet.ipynb', 'LookbackBlock': '08_lookbacknet.ipynb', 'LookbackNet': '08_lookbacknet.ipynb'} modules = ['core.py', 'config.py', 'graph.py', 'network.py', 'resnetx.py', 'automl.py', 'foldnet.py', 'lookbacknet.py'] doc_url = 'https://keepsimpler.github.io/wong/' git_url = 'https://github.com/keepsimpler/wong/tree/master/' def custom_doc_links(name): return None
# Open input, and split each line into list of 0 or 1 integers with open('./input', encoding='utf8') as file: vent_lines = [[[int(val) for val in endpoint.split(',')] for endpoint in line.split(' -> ')] for line in file] dims = [0, 0] for line in vent_lines: for val in line: dims[0] = max(dims[0], val[0]+1) dims[1] = max(dims[1], val[1]+1) points = [[0] * dims[1] for _ in range(dims[0])] for line in vent_lines: col_step = 1 if line[0][0] <= line[1][0] else -1 row_step = 1 if line[0][1] <= line[1][1] else -1 cols = range(line[0][0], line[1][0]+col_step, col_step) rows = range(line[0][1], line[1][1]+row_step, row_step) if line[0][1] == line[1][1]: for col in cols: points[line[0][1]][col] += 1 elif line[0][0] == line[1][0]: for row in rows: points[row][line[0][0]] += 1 else: steps = zip(cols, rows) for step in list(steps): points[step[1]][step[0]] += 1 count = 0 for row in points: for col in row: if col > 1: count += 1 print(count)
with open('./input', encoding='utf8') as file: vent_lines = [[[int(val) for val in endpoint.split(',')] for endpoint in line.split(' -> ')] for line in file] dims = [0, 0] for line in vent_lines: for val in line: dims[0] = max(dims[0], val[0] + 1) dims[1] = max(dims[1], val[1] + 1) points = [[0] * dims[1] for _ in range(dims[0])] for line in vent_lines: col_step = 1 if line[0][0] <= line[1][0] else -1 row_step = 1 if line[0][1] <= line[1][1] else -1 cols = range(line[0][0], line[1][0] + col_step, col_step) rows = range(line[0][1], line[1][1] + row_step, row_step) if line[0][1] == line[1][1]: for col in cols: points[line[0][1]][col] += 1 elif line[0][0] == line[1][0]: for row in rows: points[row][line[0][0]] += 1 else: steps = zip(cols, rows) for step in list(steps): points[step[1]][step[0]] += 1 count = 0 for row in points: for col in row: if col > 1: count += 1 print(count)
'''https://leetcode.com/problems/plus-one/''' class Solution: def plusOne(self, digits: List[int]) -> List[int]: digits.reverse() ans = [] c = 1 for d in digits: t = d+c if t>9: t = t-10 c=1 else: c=0 ans.append(t) if c: ans.append(1) return reversed(ans)
"""https://leetcode.com/problems/plus-one/""" class Solution: def plus_one(self, digits: List[int]) -> List[int]: digits.reverse() ans = [] c = 1 for d in digits: t = d + c if t > 9: t = t - 10 c = 1 else: c = 0 ans.append(t) if c: ans.append(1) return reversed(ans)
x = 5 print(5) print(x) print('x') message = 'Hello World!' print(message) message = 'Goodbye cruel world...' print(message)
x = 5 print(5) print(x) print('x') message = 'Hello World!' print(message) message = 'Goodbye cruel world...' print(message)
class Dobradura: def get_dobrar(self, numero_dobradura): self.numero_dobradura = 1 if type(numero_dobradura) == int and numero_dobradura > 0: for i in range(0,numero_dobradura): self.numero_dobradura = 2**numero_dobradura return self.numero_dobradura else: return False
class Dobradura: def get_dobrar(self, numero_dobradura): self.numero_dobradura = 1 if type(numero_dobradura) == int and numero_dobradura > 0: for i in range(0, numero_dobradura): self.numero_dobradura = 2 ** numero_dobradura return self.numero_dobradura else: return False
def normal_old_school_method(a,b,tmp): tmp = a a = b b = tmp return a,b def pythonic_swap(a,b): a,b = b,a return a,b if __name__ == '__main__': a,b = 10,25 tmp = 0 print('Original [Before Swap Values]:\t',a,b) print('Old School Method:',normal_old_school_method(a,b,tmp)) print('Pythonic Method:',pythonic_swap(a,b))
def normal_old_school_method(a, b, tmp): tmp = a a = b b = tmp return (a, b) def pythonic_swap(a, b): (a, b) = (b, a) return (a, b) if __name__ == '__main__': (a, b) = (10, 25) tmp = 0 print('Original [Before Swap Values]:\t', a, b) print('Old School Method:', normal_old_school_method(a, b, tmp)) print('Pythonic Method:', pythonic_swap(a, b))
class Vehicle: def __init__(self, max_speed, mileage): self.max_speed = max_speed self.mileage = mileage modelS = Vehicle(200,20) print(modelS.max_speed, modelS.mileage)
class Vehicle: def __init__(self, max_speed, mileage): self.max_speed = max_speed self.mileage = mileage model_s = vehicle(200, 20) print(modelS.max_speed, modelS.mileage)
class MyOwnExceptionError(Exception): pass def do_exception(): try: 1/0 except ZeroDivisionError as error: raise MyOwnExceptionError from error if __name__ == "__main__": try: do_exception() except MyOwnExceptionError: print("My exception was caught!")
class Myownexceptionerror(Exception): pass def do_exception(): try: 1 / 0 except ZeroDivisionError as error: raise MyOwnExceptionError from error if __name__ == '__main__': try: do_exception() except MyOwnExceptionError: print('My exception was caught!')
temperature_change_rate = -2.3 * units.delta_degF / (10 * units.minutes) temperature = 25 * units.degC dt = 1.5 * units.hours print(temperature + temperature_change_rate * dt)
temperature_change_rate = -2.3 * units.delta_degF / (10 * units.minutes) temperature = 25 * units.degC dt = 1.5 * units.hours print(temperature + temperature_change_rate * dt)
# pylint: disable=no-member # -*- encoding: utf-8 -*- ''' @File : zones.py @Time : 2020/03/17 12:45:54 @Author : Kellan Fan @Version : 1.0 @Contact : kellanfan1989@gmail.com @Desc : None ''' # here put the import lib class Zones(object): def __init__(self, status='active'): self.__data = { 'action': 'DescribeZones', 'status': status } def __call__(self): return self.__data
""" @File : zones.py @Time : 2020/03/17 12:45:54 @Author : Kellan Fan @Version : 1.0 @Contact : kellanfan1989@gmail.com @Desc : None """ class Zones(object): def __init__(self, status='active'): self.__data = {'action': 'DescribeZones', 'status': status} def __call__(self): return self.__data
# youtube-search-requests # parser/related_video_data.py # for mobile user-agent def parse_related_video_data1(data): try: d = data['contents']['singleColumnWatchNextResults']['results']['results']['contents'] except KeyError: return None for i in d: try: c = i['itemSectionRenderer']['contents'] except KeyError: continue except TypeError: continue for v in c: try: v['compactVideoRenderer'] return c except KeyError: continue # for desktop user-agent def parse_related_video_data2(data): try: return data['contents']['twoColumnWatchNextResults']['secondaryResults']['secondaryResults']['results'] except KeyError: return None # for bot or unknown user-agent maybe ? def parse_related_video_data3(data): try: d = data['contents']['singleColumnWatchNextResults']['results']['results']['contents'] except KeyError: return None for i in d: try: c = i['itemSectionRenderer']['contents'] except KeyError: continue except TypeError: continue for v in c: try: v['videoWithContextRenderer'] return c except KeyError: continue # for internal API def parse_related_video_data4(data): try: d = data['onResponseReceivedEndpoints'] except KeyError: return None else: for key in d: try: return key['appendContinuationItemsAction']['continuationItems'] except KeyError: continue
def parse_related_video_data1(data): try: d = data['contents']['singleColumnWatchNextResults']['results']['results']['contents'] except KeyError: return None for i in d: try: c = i['itemSectionRenderer']['contents'] except KeyError: continue except TypeError: continue for v in c: try: v['compactVideoRenderer'] return c except KeyError: continue def parse_related_video_data2(data): try: return data['contents']['twoColumnWatchNextResults']['secondaryResults']['secondaryResults']['results'] except KeyError: return None def parse_related_video_data3(data): try: d = data['contents']['singleColumnWatchNextResults']['results']['results']['contents'] except KeyError: return None for i in d: try: c = i['itemSectionRenderer']['contents'] except KeyError: continue except TypeError: continue for v in c: try: v['videoWithContextRenderer'] return c except KeyError: continue def parse_related_video_data4(data): try: d = data['onResponseReceivedEndpoints'] except KeyError: return None else: for key in d: try: return key['appendContinuationItemsAction']['continuationItems'] except KeyError: continue
t = int(input()) while(t!=0): n = input() if(n=='b' or n=='B'): print('BattleShip') elif(n=='c' or n=='C'): print('Cruiser') elif(n=='d' or n=='D'): print('Destroyer') elif(n=='f' or n=='F'): print('Frigate') t-=1
t = int(input()) while t != 0: n = input() if n == 'b' or n == 'B': print('BattleShip') elif n == 'c' or n == 'C': print('Cruiser') elif n == 'd' or n == 'D': print('Destroyer') elif n == 'f' or n == 'F': print('Frigate') t -= 1
class NoSuchFileOrDirectory(Exception): def __init__(self): super().__init__("no such file or directory") class FileOrDirectoryAlreadyExist(Exception): def __init__(self): super().__init__("file or directory already exist") class NotAnDirectory(Exception): def __init__(self): super().__init__("not an directory") class NotAnFile(Exception): def __init__(self): super().__init__("not an file") class NotAnIntiger(Exception): def __init__(self): super().__init__("not an intiger") class PermisionDenied(Exception): def __init__(self): super().__init__("permision denied") class NoSuchIndex(Exception): def __init__(self): super().__init__("no such index")
class Nosuchfileordirectory(Exception): def __init__(self): super().__init__('no such file or directory') class Fileordirectoryalreadyexist(Exception): def __init__(self): super().__init__('file or directory already exist') class Notandirectory(Exception): def __init__(self): super().__init__('not an directory') class Notanfile(Exception): def __init__(self): super().__init__('not an file') class Notanintiger(Exception): def __init__(self): super().__init__('not an intiger') class Permisiondenied(Exception): def __init__(self): super().__init__('permision denied') class Nosuchindex(Exception): def __init__(self): super().__init__('no such index')
class Solution: def findTheDifference(self, s: str, t: str) -> str: seen = {} for ch in s: if ch not in seen: seen[ch] = 0 seen[ch] += 1 for ch in t: if ch in seen and seen[ch] > 0: seen[ch] -= 1 else: return ch return "" if __name__ == '__main__': s = "abcd" t = "bdeac" print(f"Input: s = {s}, t = {t}") print(f"Output: {Solution().findTheDifference(s, t)}")
class Solution: def find_the_difference(self, s: str, t: str) -> str: seen = {} for ch in s: if ch not in seen: seen[ch] = 0 seen[ch] += 1 for ch in t: if ch in seen and seen[ch] > 0: seen[ch] -= 1 else: return ch return '' if __name__ == '__main__': s = 'abcd' t = 'bdeac' print(f'Input: s = {s}, t = {t}') print(f'Output: {solution().findTheDifference(s, t)}')
# https://dmoj.ca/problem/dwite09c1p3 # https://dmoj.ca/submission/2184915 for i in range(5): n = int(input()) nums = [] for j in range(n): nums.append(int(input())) m = 0 for j in range(1,n+2): try: nums.index(j) except ValueError: m = j break print(m)
for i in range(5): n = int(input()) nums = [] for j in range(n): nums.append(int(input())) m = 0 for j in range(1, n + 2): try: nums.index(j) except ValueError: m = j break print(m)
class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: res = 0 n = len(matrix) if n==0: return res m = len(matrix[0]) dp = [[0 for k in range(m)] for l in range(n)] for i in range(n): for j in range(m): if matrix[i][j] == '1': dp[i][j] = 1 res = 1 for i in range(1,n): for j in range(1,m): if (dp[i][j] != 0): dp[i][j] = min(min(dp[i-1][j-1],dp[i-1][j]),dp[i][j-1]) + 1 if res < dp[i][j]: res = dp[i][j] return res*res
class Solution: def maximal_square(self, matrix: List[List[str]]) -> int: res = 0 n = len(matrix) if n == 0: return res m = len(matrix[0]) dp = [[0 for k in range(m)] for l in range(n)] for i in range(n): for j in range(m): if matrix[i][j] == '1': dp[i][j] = 1 res = 1 for i in range(1, n): for j in range(1, m): if dp[i][j] != 0: dp[i][j] = min(min(dp[i - 1][j - 1], dp[i - 1][j]), dp[i][j - 1]) + 1 if res < dp[i][j]: res = dp[i][j] return res * res
def countAndSay(n): seq = "1" for i in range(n-1): seq = getNext(seq) return seq def getNext(seq): i, next_seq = 0, "" while i < len(seq): count = 1 while i < len(seq) -1 and seq[i] == seq[i+1]: count += 1 i += 1 next_seq += str(count) + seq[i] i += 1 return next_seq
def count_and_say(n): seq = '1' for i in range(n - 1): seq = get_next(seq) return seq def get_next(seq): (i, next_seq) = (0, '') while i < len(seq): count = 1 while i < len(seq) - 1 and seq[i] == seq[i + 1]: count += 1 i += 1 next_seq += str(count) + seq[i] i += 1 return next_seq
# Instead of parsing cromwell metadata we pass the intermediate SS2 files ANALYSIS_FILE_INPUT = { "input_uuid": "0244354d-cf37-4483-8db3-425b7e504ca6", "input_file": "", "pipeline_type": "SS2", "workspace_version": "2021-10-19T17:43:52.000000Z", "ss2_bam_file": "call-HISAT2PairedEnd/cacheCopy/0244354d-cf37-4483-8db3-425b7e504ca6_qc.bam", "ss2_bai_file": "call-HISAT2PairedEnd/cacheCopy/0244354d-cf37-4483-8db3-425b7e504ca6_qc.bam.bai", "project_level": False, }
analysis_file_input = {'input_uuid': '0244354d-cf37-4483-8db3-425b7e504ca6', 'input_file': '', 'pipeline_type': 'SS2', 'workspace_version': '2021-10-19T17:43:52.000000Z', 'ss2_bam_file': 'call-HISAT2PairedEnd/cacheCopy/0244354d-cf37-4483-8db3-425b7e504ca6_qc.bam', 'ss2_bai_file': 'call-HISAT2PairedEnd/cacheCopy/0244354d-cf37-4483-8db3-425b7e504ca6_qc.bam.bai', 'project_level': False}
def login(): for n in range(3): username = input("username: ") password = input("password: ") print() if username == "admin" and password == "super_secure": return True print("Nice try @ssh013") def main(): session = login() if session: print("Welcome") if __name__ == '__main__': main()
def login(): for n in range(3): username = input('username: ') password = input('password: ') print() if username == 'admin' and password == 'super_secure': return True print('Nice try @ssh013') def main(): session = login() if session: print('Welcome') if __name__ == '__main__': main()
''' Rooms ''' f_number = int(input()) l_number = int(input()) step = l_number - f_number + 1 if ((l_number % step == 0) and (f_number % step == 1)): print('YES') elif (step == 1): print('YES') else: print('NO')
""" Rooms """ f_number = int(input()) l_number = int(input()) step = l_number - f_number + 1 if l_number % step == 0 and f_number % step == 1: print('YES') elif step == 1: print('YES') else: print('NO')
class ConfigError(Exception): ... class HTTPException(Exception): def __init__(self, status_code: int, detail: str = None) -> None: self.status_code = status_code self.detail = detail or 'no detail' def __repr__(self) -> str: class_name = self.__class__.__name__ return f"{class_name}(status_code={self.status_code!r}, detail={self.detail!r})"
class Configerror(Exception): ... class Httpexception(Exception): def __init__(self, status_code: int, detail: str=None) -> None: self.status_code = status_code self.detail = detail or 'no detail' def __repr__(self) -> str: class_name = self.__class__.__name__ return f'{class_name}(status_code={self.status_code!r}, detail={self.detail!r})'
# https://leetcode.com/problems/find-numbers-with-even-number-of-digits/ class Solution: def findNumbers(self, nums): #1 with string and len count=0 for i in range(0,len(nums)): if (len(str(nums[i]))%2==0): count+=1 return count ''' #2 Using division count=0 for i in nums: cur=0 while(i>0): cur+=1 i=i//10 if cur%2==0: count+=1 return count #3 using log and floor #floor(log10(num)) gives 1 value less than length of integer ie odd return sum((floor(log10(i)))%2 for i in nums) '''
class Solution: def find_numbers(self, nums): count = 0 for i in range(0, len(nums)): if len(str(nums[i])) % 2 == 0: count += 1 return count '\n #2 Using division\n count=0\n for i in nums:\n cur=0\n while(i>0):\n cur+=1\n i=i//10\n if cur%2==0: count+=1\n return count \n \n #3 using log and floor \n #floor(log10(num)) gives 1 value less than length of integer ie odd\n return sum((floor(log10(i)))%2 for i in nums)\n '
sounds = { #'ON': 'data/bin/sounds/on.mp3', 'SUCCESS': ['data/bin/sounds/wicked_sick.mp3', 'data/bin/sounds/holyshit.mp3'], #'FAIL': 'data/bin/sounds/fail.mp3', 'STAGED': 'data/bin/sounds/pwned.mp3', 'KILL': 'data/bin/sounds/killing_spree.mp3', 'STAGER': 'data/bin/sounds/firstblood.mp3' }
sounds = {'SUCCESS': ['data/bin/sounds/wicked_sick.mp3', 'data/bin/sounds/holyshit.mp3'], 'STAGED': 'data/bin/sounds/pwned.mp3', 'KILL': 'data/bin/sounds/killing_spree.mp3', 'STAGER': 'data/bin/sounds/firstblood.mp3'}
class Solution: def restoreString(self, s: str, indices: List[int]) -> str: # Time complexity O(n) array = [0] * len(indices) for idx in range(len(indices)): array[indices[idx]] = s[idx] return "".join(array) class Solution: def restoreString(self, s: str, indices: List[int]) -> str: HashMap = {} string = str() for idx in range(len(indices)): HashMap[indices[idx]] = s[idx] for idx in range(len(indices)): string += HashMap[idx] return string
class Solution: def restore_string(self, s: str, indices: List[int]) -> str: array = [0] * len(indices) for idx in range(len(indices)): array[indices[idx]] = s[idx] return ''.join(array) class Solution: def restore_string(self, s: str, indices: List[int]) -> str: hash_map = {} string = str() for idx in range(len(indices)): HashMap[indices[idx]] = s[idx] for idx in range(len(indices)): string += HashMap[idx] return string
FI_NAME, PYPATH = ( "preparation.py", "/home/nversbra/anaconda3/envs/py36/bin/python" ) with open('command_lines.txt', 'w') as f_output: for i in range(4096): n, file_name = i, "" while n > 0: file_name += str(n % 2) n //= 2 file_name = file_name + "0"*(12 - len(file_name)) f_output.write(" ".join( [PYPATH, FI_NAME, file_name + '\n'] ))
(fi_name, pypath) = ('preparation.py', '/home/nversbra/anaconda3/envs/py36/bin/python') with open('command_lines.txt', 'w') as f_output: for i in range(4096): (n, file_name) = (i, '') while n > 0: file_name += str(n % 2) n //= 2 file_name = file_name + '0' * (12 - len(file_name)) f_output.write(' '.join([PYPATH, FI_NAME, file_name + '\n']))
{ "targets" : [ { "target_name" : "edflib", "sources" : ["../lib/edf.cpp", "edfjs.cpp"], "conditions" : [ [ "OS == \"mac\"", { "xcode_settings": { "OTHER_CPLUSPLUSFLAGS" : ["-std=c++11","-stdlib=libc++"], "OTHER_LDFLAGS": ["-stdlib=libc++"], "MACOSX_DEPLOYMENT_TARGET": "10.7" } }] ] } ] }
{'targets': [{'target_name': 'edflib', 'sources': ['../lib/edf.cpp', 'edfjs.cpp'], 'conditions': [['OS == "mac"', {'xcode_settings': {'OTHER_CPLUSPLUSFLAGS': ['-std=c++11', '-stdlib=libc++'], 'OTHER_LDFLAGS': ['-stdlib=libc++'], 'MACOSX_DEPLOYMENT_TARGET': '10.7'}}]]}]}
def number(a,b): if(a%2==0 and b%2==0): print(min(a,b)) # if(a>b): # print (b) # else: # print (a) elif(a%2!=0 and b%2!=0): print(max(a,b)) # if(a>b): # print (a) # else: # print (b) else: print(max(a,b)) # if(a>b): # print (a) # else: # print (b) a = int(input("Enter the 1st number")) b = int(input("Enter the 2nd number")) number(a,b)
def number(a, b): if a % 2 == 0 and b % 2 == 0: print(min(a, b)) elif a % 2 != 0 and b % 2 != 0: print(max(a, b)) else: print(max(a, b)) a = int(input('Enter the 1st number')) b = int(input('Enter the 2nd number')) number(a, b)
class Bin: def __init__(self, index, floor, ceiling, is_last_bin): self.index = index self.floor = floor self.ceiling = ceiling self.range = self.floor - self.ceiling self.is_last_bin = is_last_bin self.members_asc = [] def count(self): return len(self.members_asc) def add(self, val): if self.is_last_bin == True: if (self.floor <= val) and (val <= self.ceiling): self.members_asc.append(val) else: return False else: # if self.is_last_bin == False if (self.floor <= val) and (val < self.ceiling): self.members_asc.append(val) else: return False return True def sort(self): self.members_asc.sort() def __unicode__(self): s = '[%s, %s' % (str(self.floor), str(self.ceiling)) if (self.is_last_bin == False): s = s + ')' else: s = s + ']' s = s + ': ' + str(self.count()) return s def __str__(self): s = '[%.4f, %.4f' % (self.floor, self.ceiling) if (self.is_last_bin == False): s = s + ')' else: s = s + ']' s = s + ': ' + str(self.count()) return s
class Bin: def __init__(self, index, floor, ceiling, is_last_bin): self.index = index self.floor = floor self.ceiling = ceiling self.range = self.floor - self.ceiling self.is_last_bin = is_last_bin self.members_asc = [] def count(self): return len(self.members_asc) def add(self, val): if self.is_last_bin == True: if self.floor <= val and val <= self.ceiling: self.members_asc.append(val) else: return False elif self.floor <= val and val < self.ceiling: self.members_asc.append(val) else: return False return True def sort(self): self.members_asc.sort() def __unicode__(self): s = '[%s, %s' % (str(self.floor), str(self.ceiling)) if self.is_last_bin == False: s = s + ')' else: s = s + ']' s = s + ': ' + str(self.count()) return s def __str__(self): s = '[%.4f, %.4f' % (self.floor, self.ceiling) if self.is_last_bin == False: s = s + ')' else: s = s + ']' s = s + ': ' + str(self.count()) return s
class PlayerBase: def __init__(self, position=None, team=None): self.position = position self.team = team self.hand = [] class Players(PlayerBase): def __init__(self, number_of_players=4): if number_of_players % 2: raise Exception('Error: number of players must be even') super().__init__() self.players = [PlayerBase(position=i, team=i % 2) for i in range(0, number_of_players)]
class Playerbase: def __init__(self, position=None, team=None): self.position = position self.team = team self.hand = [] class Players(PlayerBase): def __init__(self, number_of_players=4): if number_of_players % 2: raise exception('Error: number of players must be even') super().__init__() self.players = [player_base(position=i, team=i % 2) for i in range(0, number_of_players)]
logo_array = [['--------------------------------------', '--------------------------------------', '--------------------------------------', '---\\\\\\\\\\\\\\\\\\\\\\\\-----------------------', '----\\\\\\ \\\\\\----------------------', '-----\\\\\\ \\\\\\---------------------', '------\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\------', '-------\\\\\\ \\\\\\-----', '--------\\\\\\ \\\\\\----', '---------\\\\\\ ______ \\\\\\---', '----------\\\\\\ ///---', '-----------\\\\\\ ///----', '------------\\\\\\ ///-----', '-------------\\\\\\////////////////------', '--------------------------------------', '--------------------------------------', '--------------------------------------']]
logo_array = [['--------------------------------------', '--------------------------------------', '--------------------------------------', '---\\\\\\\\\\\\\\\\\\\\\\\\-----------------------', '----\\\\\\ \\\\\\----------------------', '-----\\\\\\ \\\\\\---------------------', '------\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\------', '-------\\\\\\ \\\\\\-----', '--------\\\\\\ \\\\\\----', '---------\\\\\\ ______ \\\\\\---', '----------\\\\\\ ///---', '-----------\\\\\\ ///----', '------------\\\\\\ ///-----', '-------------\\\\\\////////////////------', '--------------------------------------', '--------------------------------------', '--------------------------------------']]
def remove_none_entries(dictionary): keys = [k for k in dictionary if dictionary[k] is None] for k in keys: del dictionary[k] def make_dict_body(object): if object is None: return dict() if hasattr(object, 'to_dict'): return object.to_dict() return object def get_body_or_raise_error(resp, exp_code): if resp.status_code == exp_code and exp_code == 204: return None # Since 204 is for 'No Content' if resp.status_code == exp_code: try: body = resp.json() if len(body) == 0: return None else: return body except ValueError: # For the requests with 'optional' body # that can return 201, for example return None resp.raise_for_status()
def remove_none_entries(dictionary): keys = [k for k in dictionary if dictionary[k] is None] for k in keys: del dictionary[k] def make_dict_body(object): if object is None: return dict() if hasattr(object, 'to_dict'): return object.to_dict() return object def get_body_or_raise_error(resp, exp_code): if resp.status_code == exp_code and exp_code == 204: return None if resp.status_code == exp_code: try: body = resp.json() if len(body) == 0: return None else: return body except ValueError: return None resp.raise_for_status()