content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
"""Exceptions""" class ModelException(Exception): pass
"""Exceptions""" class Modelexception(Exception): pass
nota_trabalhos = float(input()) nota_prova = float(input()) media = (nota_trabalhos + nota_prova) / 2 if media >= 6: print('aprovado') elif nota_trabalhos >= 2: print('talvez com a sub') else: print('reprovado')
nota_trabalhos = float(input()) nota_prova = float(input()) media = (nota_trabalhos + nota_prova) / 2 if media >= 6: print('aprovado') elif nota_trabalhos >= 2: print('talvez com a sub') else: print('reprovado')
def KthLSB(n, k): return (n>>(k-1))&1 if __name__ == '__main__': n = 10 k = 4 print(KthLSB(n, k))
def kth_lsb(n, k): return n >> k - 1 & 1 if __name__ == '__main__': n = 10 k = 4 print(kth_lsb(n, k))
# # PySNMP MIB module ERI-DNX-STM1-OC3-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ERI-DNX-STM1-OC3-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:51:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) ...
class User: user = [] ''' this class creates new instance of user data ''' def __init__(self, username, password): ''' init method to define objects Args: username: to ask user a username password: to either generate or ask user for a password ...
class User: user = [] '\n this class creates new instance of user data\n ' def __init__(self, username, password): """ init method to define objects Args: username: to ask user a username password: to either generate or ask user for a password ...
def gcd(a,b): if a==0: return b else: return gcd(b%a,a) c = gcd(100,35) # c = 5 print(c)
def gcd(a, b): if a == 0: return b else: return gcd(b % a, a) c = gcd(100, 35) print(c)
def debug(ctx,n): print("######### BEGIN DEBUG"+n+"################") print(ctx.getText()) print("######### END DEBUG ################") class ASTException(Exception): pass
def debug(ctx, n): print('######### BEGIN DEBUG' + n + '################') print(ctx.getText()) print('######### END DEBUG ################') class Astexception(Exception): pass
class QuadTree: """A class implementing a quadtree.""" def __init__(self, boundary, max_points=4, depth=0): """Initialize this node of the quadtree. boundary is a Rect object defining the region from which points are placed into this node; max_points is the maximum number of points the...
class Quadtree: """A class implementing a quadtree.""" def __init__(self, boundary, max_points=4, depth=0): """Initialize this node of the quadtree. boundary is a Rect object defining the region from which points are placed into this node; max_points is the maximum number of points the...
defines = { 'base00': '#F7B3DA', 'base01': '#f55050', 'base02': '#488214', 'base03': '#EEB422', 'base04': '#468dd4', 'base05': '#551a8b', 'base06': '#1b9e9e', 'base07': '#75616b', 'base08': '#9e8b95', 'base09': '#e06a26', 'base0A': '#f0dde6', 'base0B': '#b5a3ac', 'bas...
defines = {'base00': '#F7B3DA', 'base01': '#f55050', 'base02': '#488214', 'base03': '#EEB422', 'base04': '#468dd4', 'base05': '#551a8b', 'base06': '#1b9e9e', 'base07': '#75616b', 'base08': '#9e8b95', 'base09': '#e06a26', 'base0A': '#f0dde6', 'base0B': '#b5a3ac', 'base0C': '#8a7680', 'base0D': '#3b2c33', 'base0E': '#d46...
# -*- coding: utf-8 -*- """ Created on Sat Mar 13 11:40:13 2021 @author: Mayur """ """ Product class has all functinality related to adding/removing/displaying products """ class Product: name = "" price = 0 def __init__(self): self.all_products = [] def reset(self): self.all_...
""" Created on Sat Mar 13 11:40:13 2021 @author: Mayur """ '\nProduct class has all functinality related to adding/removing/displaying products\n' class Product: name = '' price = 0 def __init__(self): self.all_products = [] def reset(self): self.all_products.clear() def add_pro...
""" ScriptList object (and friends). """ __all__ = ["ScriptList", "ScriptRecord", "ScriptCount", "LangSysRecord", "LangSysCount"] class ScriptList(object): __slots__ = ["ScriptCount", "ScriptRecord"] def __init__(self): self.ScriptCount = 0 self.ScriptRecord = None def loadFromFontTools...
""" ScriptList object (and friends). """ __all__ = ['ScriptList', 'ScriptRecord', 'ScriptCount', 'LangSysRecord', 'LangSysCount'] class Scriptlist(object): __slots__ = ['ScriptCount', 'ScriptRecord'] def __init__(self): self.ScriptCount = 0 self.ScriptRecord = None def load_from_font_tool...
class Solution(object): def destCity(self, paths): """ :type paths: List[List[str]] :rtype: str """ record = {} all_cities = [] for cities in paths: record[cities[0]] = cities[1] for city in record.values(): if city not...
class Solution(object): def dest_city(self, paths): """ :type paths: List[List[str]] :rtype: str """ record = {} all_cities = [] for cities in paths: record[cities[0]] = cities[1] for city in record.values(): if city not in rec...
#MenuTitle: Show Glyphs with this Anchor # -*- coding: utf-8 -*- __doc__=""" New Tab with all Glyphs that have the selected anchor. """ thisFont = Glyphs.font # frontmost font selectedLayer = thisFont.selectedLayers[0] selection = selectedLayer.selection editString = "" for i, anchor in enumerate(selection): if i >...
__doc__ = '\nNew Tab with all Glyphs that have the selected anchor.\n' this_font = Glyphs.font selected_layer = thisFont.selectedLayers[0] selection = selectedLayer.selection edit_string = '' for (i, anchor) in enumerate(selection): if i > 0: edit_string += '\n\n' if type(anchor) == GSAnchor: an...
"""715. Range Module https://leetcode.com/problems/range-module/ A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner. addRange(int left, int right) Adds the half-open interval [left, right), tracking every real number in that ...
"""715. Range Module https://leetcode.com/problems/range-module/ A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner. addRange(int left, int right) Adds the half-open interval [left, right), tracking every real number in that ...
a,b = input("Enter A(x1, y1): ").split() c,d = input("Enter B(x2, y2): ").split() distance = pow((pow((int(c)-int(a)),2) + pow((int(d)-int(b)),2)), 0.5) print("Distance between points A and B: ",distance)
(a, b) = input('Enter A(x1, y1): ').split() (c, d) = input('Enter B(x2, y2): ').split() distance = pow(pow(int(c) - int(a), 2) + pow(int(d) - int(b), 2), 0.5) print('Distance between points A and B: ', distance)
class FileReader: def __init__(self): pass def read_text_file(self, path): file = open(path, 'r') return file.read()
class Filereader: def __init__(self): pass def read_text_file(self, path): file = open(path, 'r') return file.read()
# -*- coding:utf-8 -*- BIND_HOST='0.0.0.0' BIND_PORT=9999 USER_HOME = '%s/var/users' %BASE_DIR USER_ACCOUNT={ 'alex':{'password':'123456', 'quotation':1000000,#1GB 'expire':'2017-01-22' } }
bind_host = '0.0.0.0' bind_port = 9999 user_home = '%s/var/users' % BASE_DIR user_account = {'alex': {'password': '123456', 'quotation': 1000000, 'expire': '2017-01-22'}}
# Created by MechAviv # Map ID :: 620100029 # Spaceship : In Front of the Shuttle sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.forcedInput(0) OBJECT_1 = sm.sendNpcController(9270083, 2415, -134) sm.showNpcSpecialActionByObjectId(O...
sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.forcedInput(0) object_1 = sm.sendNpcController(9270083, 2415, -134) sm.showNpcSpecialActionByObjectId(OBJECT_1, 'summon', 0) sm.sendSessionValue('Ade', OBJECT_1) sm.forcedInput(1) sm.sen...
# # PySNMP MIB module WIRELESS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WIRELESS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:29:45 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,...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_intersection, constraints_union, value_range_constraint) ...
class DisjointSet: def __init__(self, *args): """Initializes the disjoint set :param args: any number of integers """ # the value implies the index of the root node of the index # e.g.: [0, 0, 1]; nodes 0 and 1 are in the same set with root = node 0 # {{0, 1}, 2} ...
class Disjointset: def __init__(self, *args): """Initializes the disjoint set :param args: any number of integers """ self.roots = list(args) self.ranks = [0] * len(args) def find(self, x): while x != self.roots[x]: x = self.roots[x] return ...
class Semester: def __init__(self, season:str, year:int, brother_id:int, amount:float): self.season = season self.year = year self.brother_id = brother_id self.amount = amount
class Semester: def __init__(self, season: str, year: int, brother_id: int, amount: float): self.season = season self.year = year self.brother_id = brother_id self.amount = amount
# -*- coding: utf-8 -*- def test_dataset_sizes(test_file): ds = test_file.dataset assert ds.sizes == {"ch": 2, "pixel": 1024, "Time": 50} def test_dataset_variables(test_file): ds = test_file.dataset for var in ["Count", "FilteredCount", "Rough_wavelength"]: assert var in ds def test_config(...
def test_dataset_sizes(test_file): ds = test_file.dataset assert ds.sizes == {'ch': 2, 'pixel': 1024, 'Time': 50} def test_dataset_variables(test_file): ds = test_file.dataset for var in ['Count', 'FilteredCount', 'Rough_wavelength']: assert var in ds def test_config(test_file): print(test...
def append_node_to_dict(node1, node2, dict_connections): if not node1 in dict_connections: dict_connections[node1] = [node2] else: node_connections = dict_connections[node1] if not node2 in node_connections: node_connections.append(node2) dict_connections[node1] =...
def append_node_to_dict(node1, node2, dict_connections): if not node1 in dict_connections: dict_connections[node1] = [node2] else: node_connections = dict_connections[node1] if not node2 in node_connections: node_connections.append(node2) dict_connections[node1] =...
#!/usr/bin/env python3.8 """ given a string return list of all the possible permutations of the string and count of possible permutations """ count = 0 list = [] def permutation(string,prefix): global count if len(string)==0: count += 1 list.append(prefix) else: for i in range(len(string)): permutation(s...
""" given a string return list of all the possible permutations of the string and count of possible permutations """ count = 0 list = [] def permutation(string, prefix): global count if len(string) == 0: count += 1 list.append(prefix) else: for i in range(len(string)): p...
""" Events, the fundamental message. """ class SpaceEvent(object): def __init__(self, data): self.data = data def __str__(self): return '<%s>: %s' % (self.__class__.__name__, self.data) class KernelEvent(SpaceEvent): """A special event.""" pass
""" Events, the fundamental message. """ class Spaceevent(object): def __init__(self, data): self.data = data def __str__(self): return '<%s>: %s' % (self.__class__.__name__, self.data) class Kernelevent(SpaceEvent): """A special event.""" pass
class TrieNode: def __init__(self): self.children: Dict[str, TrieNode] = defaultdict(TrieNode) self.deleted = False class Solution: def deleteDuplicateFolder(self, paths: List[List[str]]) -> List[List[str]]: ans = [] root = TrieNode() subtreeToNodes: Dict[str, List[TrieNode]] = defaultdict(lis...
class Trienode: def __init__(self): self.children: Dict[str, TrieNode] = defaultdict(TrieNode) self.deleted = False class Solution: def delete_duplicate_folder(self, paths: List[List[str]]) -> List[List[str]]: ans = [] root = trie_node() subtree_to_nodes: Dict[str, Lis...
# -*- coding: utf-8 -*- # TODO: doc """feelsbook """ __version__ = (0, 0, 0)
"""feelsbook """ __version__ = (0, 0, 0)
class Type1: def f1_1(): pass def test(t1): t1.f1_1() t2 = t1
class Type1: def f1_1(): pass def test(t1): t1.f1_1() t2 = t1
TABLE8 = [0] * 2 ** 8 for index in range(len(TABLE8)): TABLE8[index] = (index & 1) + TABLE8[index >> 1] class Solution: def hammingWeight(self, n: int) -> int: return TABLE8[n & 0xff] + TABLE8[(n >> 8) & 0xff] + TABLE8[(n >> 16) & 0xff] + TABLE8[n >> 24]
table8 = [0] * 2 ** 8 for index in range(len(TABLE8)): TABLE8[index] = (index & 1) + TABLE8[index >> 1] class Solution: def hamming_weight(self, n: int) -> int: return TABLE8[n & 255] + TABLE8[n >> 8 & 255] + TABLE8[n >> 16 & 255] + TABLE8[n >> 24]
class SensorReadError(Exception): pass class CommunicationErrorException(Exception): pass
class Sensorreaderror(Exception): pass class Communicationerrorexception(Exception): pass
# @time: 2022/1/10 5:31 PM # Author: pan # @File: study.py # @Software: PyCharm print("study py") name = "pan" age = 10 def study(): print("good good study, day day up!")
print('study py') name = 'pan' age = 10 def study(): print('good good study, day day up!')
class Response(object): def __init__(self, request=None): self.intent_name = request.intent_name if request else '' self.lang = request.lang if request else '' self.data = request.data if request else '' self._speech = '' self._text = '' @property def text(self): ...
class Response(object): def __init__(self, request=None): self.intent_name = request.intent_name if request else '' self.lang = request.lang if request else '' self.data = request.data if request else '' self._speech = '' self._text = '' @property def text(self): ...
''' math > ad-hoc difficulty: easy date: 09/Jun/2020 problem: how many bishops can be placed on a n x n chessboard without threatening each other? by: @brpapa ''' while (1): try: n = int(input()) ans = n + (n-2 if n > 2 else 0) print(ans) except EOFError: break
""" math > ad-hoc difficulty: easy date: 09/Jun/2020 problem: how many bishops can be placed on a n x n chessboard without threatening each other? by: @brpapa """ while 1: try: n = int(input()) ans = n + (n - 2 if n > 2 else 0) print(ans) except EOFError: break
ENCRYPTED_MESSAGE = 'MORA EVOCU ECCLESIA TUTIS AUT TIBI NISI OLIM OCIUS NOVEM' DECRYPTED_MESSAGE = 'MEETATNOON' CIPHER_OPTIONS = ['null','caesar','atbash'] cipher_used_in_this_example = CIPHER_OPTIONS[0] # replace with the index of the cipher used in this encryption
encrypted_message = 'MORA EVOCU ECCLESIA TUTIS AUT TIBI NISI OLIM OCIUS NOVEM' decrypted_message = 'MEETATNOON' cipher_options = ['null', 'caesar', 'atbash'] cipher_used_in_this_example = CIPHER_OPTIONS[0]
x1, x2, y1, y2 = 150, 193, -86, -136 def passes_through(vx, vy): nx, ny = 0, 0 points = [] while nx <= x2 and ny >= y2: nx, ny = nx + vx, ny + vy points += [[nx, ny]] if vx > 0: vx = vx - 1 vy = vy - 1 if x1 <= nx and nx <= x2 and y2 <= ny and ny <= y1:...
(x1, x2, y1, y2) = (150, 193, -86, -136) def passes_through(vx, vy): (nx, ny) = (0, 0) points = [] while nx <= x2 and ny >= y2: (nx, ny) = (nx + vx, ny + vy) points += [[nx, ny]] if vx > 0: vx = vx - 1 vy = vy - 1 if x1 <= nx and nx <= x2 and (y2 <= ny) a...
#Practical proof of fact, that numbers 2^x are almost perfect number #END = 30 END = int(input("End of loop")) for i in range(2,END): s = set([1]) n = 2**i for j in range(int(n/2+1),1,-1): if(n % j==0): s.add(j) print(n,end=" - ") print(sum(s)+1==n) #OUTPUT """ 4 - True 8 - Tr...
end = int(input('End of loop')) for i in range(2, END): s = set([1]) n = 2 ** i for j in range(int(n / 2 + 1), 1, -1): if n % j == 0: s.add(j) print(n, end=' - ') print(sum(s) + 1 == n) '\n4 - True\n8 - True\n16 - True\n32 - True\n64 - True\n128 - True\n...\n2^i - True\n'
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def buildTree(self, inorder: 'List[int]', postorder: 'List[int]') -> 'TreeNode': if not inorder or not postorder: ret...
class Solution: def build_tree(self, inorder: 'List[int]', postorder: 'List[int]') -> 'TreeNode': if not inorder or not postorder: return root = tree_node(postorder[-1]) i = 0 while inorder[i] != postorder[-1]: i += 1 root.left = self.buildTree(inorde...
expected_output = { "tag": { "1": { "topo_type": "unicast", "topo_name": "base", "tid": 0, "topo_id": "0x0", "flex_algo": { "None": { "prefix": { "4.4.4.4": { "...
expected_output = {'tag': {'1': {'topo_type': 'unicast', 'topo_name': 'base', 'tid': 0, 'topo_id': '0x0', 'flex_algo': {'None': {'prefix': {'4.4.4.4': {'prefix_attr': {'x_flag': False, 'r_flag': False, 'n_flag': True}, 'subnet': '32', 'source_router_id': '4.4.4.4', 'algo': {0: {}, 1: {}}, 'via_interface': {'GigabitEthe...
"""/** * @author [Jai Miles] * @email [jaimiles23@gmail.com] * @create date 2020-05-05 13:56:45 * @modify date 2020-05-05 13:56:45 * @desc [ Data module for the fallback handler. ] */ """ ########## # Standard Fallback ########## MS_FALLBACK = "I can't help you with that right now." ########## # Did no...
"""/** * @author [Jai Miles] * @email [jaimiles23@gmail.com] * @create date 2020-05-05 13:56:45 * @modify date 2020-05-05 13:56:45 * @desc [ Data module for the fallback handler. ] */ """ ms_fallback = "I can't help you with that right now." "Sorry, I didn't catch your answer. Can you please try again." mt_...
# MIT License # (C) Copyright 2021 Hewlett Packard Enterprise Development LP. # # netFlow : ECOS Netflow configuration def get_net_flow_configuration( self, ne_id: str, cached: bool, ) -> dict: """Get netflow configurations from Edge Connect appliance .. list-table:: :header-rows: 1 ...
def get_net_flow_configuration(self, ne_id: str, cached: bool) -> dict: """Get netflow configurations from Edge Connect appliance .. list-table:: :header-rows: 1 * - Swagger Section - Method - Endpoint * - netFlow - GET - /netFlow/{neId} :pa...
#!/usr/bin/env python class Section: def has_item(self, item): return hasattr(self, item) def __getitem__(self, item): return self.__dict__[item] class ConfigReader(object): """ ConfgiReader - An improved config parser. """ def __init__(self): self.sections = [] d...
class Section: def has_item(self, item): return hasattr(self, item) def __getitem__(self, item): return self.__dict__[item] class Configreader(object): """ ConfgiReader - An improved config parser. """ def __init__(self): self.sections = [] def __load(self, lines...
class AccidentData: """Clase base que tiene por objetivo darle contexto a los datos de accidentes""" def __init__(self): self.client = 0 self.client_name = "" self.client_contact = "" self.client_phone = "" self.data_origin = ""
class Accidentdata: """Clase base que tiene por objetivo darle contexto a los datos de accidentes""" def __init__(self): self.client = 0 self.client_name = '' self.client_contact = '' self.client_phone = '' self.data_origin = ''
{ "targets": [ { "target_name": "baseJump", "sources": [ "cc/baseJump.cc", "cc/BigInteger.cc", "cc/BigIntegerAlgorithms.cc", "cc/BigIntegerUtils.cc", "cc/BigUnsigned.cc", "cc/BigUnsignedInABase.cc" ], "include_dirs": [ "<!(node -e \"require('nan')\")" ], "cflags!": [ "-f...
{'targets': [{'target_name': 'baseJump', 'sources': ['cc/baseJump.cc', 'cc/BigInteger.cc', 'cc/BigIntegerAlgorithms.cc', 'cc/BigIntegerUtils.cc', 'cc/BigUnsigned.cc', 'cc/BigUnsignedInABase.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'cond...
# 48. Rotate Image # ttungl@gmail.com # You are given an n x n 2D matrix representing an image. # Rotate the image by 90 degrees (clockwise). # Note: # You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. # Example...
class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ matrix[:] = zip(*matrix[::-1]) matrix.reverse() for i in range(len(matrix)): for j in rang...
i = 0 while i < 3: print("i: ", i) j = 0 while j < 3: print("j: ", j) j += 1 i += 1
i = 0 while i < 3: print('i: ', i) j = 0 while j < 3: print('j: ', j) j += 1 i += 1
#!/usr/bin/env python3 # # Author: Vishwas K Singh # Email: vishwasks32@gmail.com # # Script to Program to find Sum, Diff, Prod, Avg, Div num1 = input("Enter the first Number: ") num2 = input("Enter the second Number: ") # Check if the user has entered the number itself try: # Convert the numbers to double always...
num1 = input('Enter the first Number: ') num2 = input('Enter the second Number: ') try: num1 = float(num1) num2 = float(num2) except ValueError: print('The entered input is not a number') exit(0) except TypeError: print('The entered input is not a number') exit(0) print('Sum of the two Numbers i...
class Bands: all_bands = [] def __init__(self, band_name, members): self.band_name = 'band_name' self.members = members self.__class__.all_bands.append(self) def to_list(self): return self.all_bands def __str__(self): return f'the band name is {se...
class Bands: all_bands = [] def __init__(self, band_name, members): self.band_name = 'band_name' self.members = members self.__class__.all_bands.append(self) def to_list(self): return self.all_bands def __str__(self): return f'the band name is {self.band_name}'...
# Author: btjanaka (Bryon Tjanaka) # Problem: (Leetcode) 1 # Title: Two Sum # Link: https://leetcode.com/problems/two-sum/ # Idea: The easy solution is to check every pair of elements, but this is # O(n^2). To achieve O(n), the basic idea is to use a set that keeps track of # which elements we have seen so far while it...
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: prev_nums_with_indices = dict() for i in range(len(nums)): x = nums[i] if target - x in prev_nums_with_indices: prev_num_index = prev_nums_with_indices[target - x] r...
a = list(map(lambda i: ord(i) - 97, list(input()))) idx_array = [-1 for _ in range(26)] for i in range(len(a)): if idx_array[a[i]] == -1: idx_array[a[i]] = i for idx in idx_array: print(idx, end=' ')
a = list(map(lambda i: ord(i) - 97, list(input()))) idx_array = [-1 for _ in range(26)] for i in range(len(a)): if idx_array[a[i]] == -1: idx_array[a[i]] = i for idx in idx_array: print(idx, end=' ')
# https://leetcode.com/problems/kth-smallest-element-in-a-bst/ # # algorithms # Medium (49.79%) # Total Accepted: 199,308 # Total Submissions: 400,327 # beats 100.0% of python submissions # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # sel...
class Solution(object): def kth_smallest(self, root, k): """ :type root: TreeNode :type k: int :rtype: int """ self.k = k self.res = None self.recursive(root) return self.res def recursive(self, node): if not node or self.res: ...
# Complete the compareTriplets function below. def compareTriplets(a, b): al =0 bo=0 for i in range(3): if(a[i]>b[i]): al+=1 elif(b[i]>a[i]): bo+=1 return(al,bo) if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') a = list(map(int, in...
def compare_triplets(a, b): al = 0 bo = 0 for i in range(3): if a[i] > b[i]: al += 1 elif b[i] > a[i]: bo += 1 return (al, bo) if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') a = list(map(int, input().rstrip().split())) b = list(...
def partition(top, end, array): pivot_index = top pivot = array[pivot_index] while top < end: while top < len(array) and array[top] <= pivot: top += 1 while array[end] > pivot: end -= 1 if(top < end): array[top], array[end] = array[end], array[top] ar...
def partition(top, end, array): pivot_index = top pivot = array[pivot_index] while top < end: while top < len(array) and array[top] <= pivot: top += 1 while array[end] > pivot: end -= 1 if top < end: (array[top], array[end]) = (array[end], array[to...
def find_coordinates(x, y): # Get coordinates of mouse click return (x- x%10, y - y%10) def get_all_neighbours(cell): # get neighbours along with current cell (x,y) = cell return [(x-i,y-j) for i in range(-10,20,10) for j in range(-10,20,10)] def get_next_generation(cells): # Get next generati...
def find_coordinates(x, y): return (x - x % 10, y - y % 10) def get_all_neighbours(cell): (x, y) = cell return [(x - i, y - j) for i in range(-10, 20, 10) for j in range(-10, 20, 10)] def get_next_generation(cells): next_gen = {} which_cells_to_check = set() for (curr_cell, _) in cells.items()...
# # PySNMP MIB module BIANCA-BRICK-PPP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BIANCA-BRICK-PPP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:37:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ...
def gcd(a,b): res = 1 for i in range(1, min(a,b)+1): if a % i == 0 and b % i == 0: res = i return res def solution(w,h): return w * h - (w + h - gcd(w,h))
def gcd(a, b): res = 1 for i in range(1, min(a, b) + 1): if a % i == 0 and b % i == 0: res = i return res def solution(w, h): return w * h - (w + h - gcd(w, h))
def markov_tweet(): #Created a nested dictionary with the 1st Key = a word second key = possible words that come after and value = counter words_dic = {} with open("prunedLyrics.txt", 'r', encoding="utf-8") as f: for line in f: line = line.replace("\n"," \n") words_list = line.split(" ") for index, word i...
def markov_tweet(): words_dic = {} with open('prunedLyrics.txt', 'r', encoding='utf-8') as f: for line in f: line = line.replace('\n', ' \n') words_list = line.split(' ') for (index, word) in enumerate(words_list): temp_kv_dic = {} if w...
class Person: @property def full_name(self): return f"{self.first_name} {self.last_name}"
class Person: @property def full_name(self): return f'{self.first_name} {self.last_name}'
""" Setting for project """ logfile = "demo_project.log"
""" Setting for project """ logfile = 'demo_project.log'
chassis_900 = '192.168.65.36' chassis_910 = '192.168.65.21' linux_900 = '192.168.65.34:443' linux_910 = '192.168.65.23:443' windows_900 = 'localhost:11009' windows_910 = 'localhost:11009' cm_900 = '172.40.0.204:443' server_properties = {'linux_900': {'server': linux_900, 'locatio...
chassis_900 = '192.168.65.36' chassis_910 = '192.168.65.21' linux_900 = '192.168.65.34:443' linux_910 = '192.168.65.23:443' windows_900 = 'localhost:11009' windows_910 = 'localhost:11009' cm_900 = '172.40.0.204:443' server_properties = {'linux_900': {'server': linux_900, 'locations': [f'{chassis_900}/1/1', f'{chassis_9...
n=int(input()) arr=list(map(int,input().split())) a=0 p=0 for k in range(0,n): a=a+arr[k] for j in range(0,n): d=(arr[j] - (a/n))**2 p=p+d sigma=float ((p/n)**(1/2)) print(sigma)
n = int(input()) arr = list(map(int, input().split())) a = 0 p = 0 for k in range(0, n): a = a + arr[k] for j in range(0, n): d = (arr[j] - a / n) ** 2 p = p + d sigma = float((p / n) ** (1 / 2)) print(sigma)
class Port: def __init__(self, path, vendor_id, product_id, serial_number): self.path = path self.vendor_id = vendor_id self.product_id = product_id self.serial_number = serial_number def __repr__(self): return f'<Port ' \ f'path={self.path} ' \ ...
class Port: def __init__(self, path, vendor_id, product_id, serial_number): self.path = path self.vendor_id = vendor_id self.product_id = product_id self.serial_number = serial_number def __repr__(self): return f'<Port path={self.path} vendor_id={self.vendor_id} product...
def less_or_equal(value): if value : # Change this line return "25 or less" elif value : # Change this line return "75 or less" else: return "More than 75" # Change the value 1 below to experiment with different values print(less_or_equal(1))
def less_or_equal(value): if value: return '25 or less' elif value: return '75 or less' else: return 'More than 75' print(less_or_equal(1))
# # @lc app=leetcode id=2 lang=python3 # # [2] Add Two Numbers # # https://leetcode.com/problems/add-two-numbers/description/ # # algorithms # Medium (30.66%) # Likes: 5024 # Dislikes: 1280 # Total Accepted: 848.6K # Total Submissions: 2.7M # Testcase Example: '[2,4,3]\n[5,6,4]' # # You are given ...
class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: if not l1.next and l1.val == 0: return l2 if not l2.next and l2.val == 0: return l1 (p1, p2) = (l1, l2) sol = list_node(0) head = sol head.next = None (...
""" Tickle. The word "tickle" jitters when the cursor hovers over. Sometimes, it can be tickled off the screen. """ message = "tickle" # X and Y coordinates of text x = 0 y = 0 # horizontal and vertical radius of the text hr = 0 vr = 0 def setup(): global x, y, hr, vr size(640, 360) # Create the font ...
""" Tickle. The word "tickle" jitters when the cursor hovers over. Sometimes, it can be tickled off the screen. """ message = 'tickle' x = 0 y = 0 hr = 0 vr = 0 def setup(): global x, y, hr, vr size(640, 360) text_font(create_font('Georgia', 36)) text_align(CENTER, CENTER) hr = text_width(message...
# coding=utf-8 """ Package to manage Sentry for ESST """
""" Package to manage Sentry for ESST """
class Solution(object): def partitionDisjoint(self, nums): """ :type nums: List[int] :rtype: int """ now_min= 10^6 nearly_max= nums[0] last_time_max_value = nums[0] last_time_max= -1 record_list = [] for i, v in enumerate(nums): ...
class Solution(object): def partition_disjoint(self, nums): """ :type nums: List[int] :rtype: int """ now_min = 10 ^ 6 nearly_max = nums[0] last_time_max_value = nums[0] last_time_max = -1 record_list = [] for (i, v) in enumerate(nums)...
class ValueBlend: def _init_corners(self, **kwargs): # Corners is list of tuples: # [bottomleft, bottomright, topleft, topright] if 'corners' in kwargs: self.corners = kwargs['corners'] if len(self.corners) != 4 or \ any(len(v) != 2 for v in self.cor...
class Valueblend: def _init_corners(self, **kwargs): if 'corners' in kwargs: self.corners = kwargs['corners'] if len(self.corners) != 4 or any((len(v) != 2 for v in self.corners)): raise value_error("corner should be a list of four tuples, set either option 'corners'...
class Solution(object): def bulbSwitch(self, n): """ :type n: int :rtype: int """ num_of_facs = [1 for i in range(n)] for j in range(2, n + 1): for k in range(1, n / j + 1): num_of_facs[j * k - 1] += 1 res = 0 for num in nu...
class Solution(object): def bulb_switch(self, n): """ :type n: int :rtype: int """ num_of_facs = [1 for i in range(n)] for j in range(2, n + 1): for k in range(1, n / j + 1): num_of_facs[j * k - 1] += 1 res = 0 for num in n...
str_1 = input() str_2 = input() str_3 = input() print([str_1, [str_2], [[str_3]]])
str_1 = input() str_2 = input() str_3 = input() print([str_1, [str_2], [[str_3]]])
class Dataset(object): def __init__(self, name=None): self.name = name def __str__(self): return self.name def get_instance_name(self, filepath, id): raise NotImplementedError("Abstract class") def import_model(self, filepath): raise NotImplementedError("Abstra...
class Dataset(object): def __init__(self, name=None): self.name = name def __str__(self): return self.name def get_instance_name(self, filepath, id): raise not_implemented_error('Abstract class') def import_model(self, filepath): raise not_implemented_error('Abstract ...
def isValid(s: str) -> bool: open_to_close = { '(': ')', '{': '}', '[': ']' } close_to_open = {v: k for k, v in open_to_close.items()} stack = [] for i in s: if i in open_to_close: stack.append(i) elif i in close_to_open: ...
def is_valid(s: str) -> bool: open_to_close = {'(': ')', '{': '}', '[': ']'} close_to_open = {v: k for (k, v) in open_to_close.items()} stack = [] for i in s: if i in open_to_close: stack.append(i) elif i in close_to_open: if len(stack) <= 0: retur...
client_id = 'Ch8pNOBOAYzASwSmKClKZJKts8VnKDsj' # your bot's client ID token = 'Mzc3MDU4MTc2MzUwMDI3Nzc3.DQ8csA.YRTHtBKENVulI8bk17-6gzGnScU' # your bot's token carbon_key = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiIyMjA5NTkxNzg3NzkyNjI5ODYiLCJyYW5kIjozOTksImlhdCI6MTUxMjkzNTQ5NH0.1Al7nXx5HmvA7Lyc_ddc6V_czVxv...
client_id = 'Ch8pNOBOAYzASwSmKClKZJKts8VnKDsj' token = 'Mzc3MDU4MTc2MzUwMDI3Nzc3.DQ8csA.YRTHtBKENVulI8bk17-6gzGnScU' carbon_key = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiIyMjA5NTkxNzg3NzkyNjI5ODYiLCJyYW5kIjozOTksImlhdCI6MTUxMjkzNTQ5NH0.1Al7nXx5HmvA7Lyc_ddc6V_czVxvD5K7dxPdrW0D1yE' bots_key = 'https://discord...
"""Device module handling /device/ API calls.""" class Device(object): """Device class with /device/ API calls.""" def __init__(self, opensprinkler): """Device class initializer.""" self._opensprinkler = opensprinkler def _getOption(self, option): """Retrieve option""" (r...
"""Device module handling /device/ API calls.""" class Device(object): """Device class with /device/ API calls.""" def __init__(self, opensprinkler): """Device class initializer.""" self._opensprinkler = opensprinkler def _get_option(self, option): """Retrieve option""" (r...
def generate_concept_HTML(concept_title, concept_description): html_text_1 = ''' <div class="concept"> <div class="concept-title"> ''' + concept_title html_text_2 = ''' </div> <div class="concept-description"> ''' + concept_description html_text_3 = ''' </div> </di...
def generate_concept_html(concept_title, concept_description): html_text_1 = '\n<div class="concept">\n <div class="concept-title">\n ' + concept_title html_text_2 = '\n </div>\n <div class="concept-description">\n ' + concept_description html_text_3 = '\n </div>\n</div>' full_...
nop = b'\x00\x00' brk = b'\x00\xA0' ld1 = b'\x63\x25' # Load 0x25 into register V3 ld2 = b'\x64\x26' # Load 0x26 into register V4 sne = b'\x93\x40' # Skip next instruction if V3 != V4 with open("snevxvytest.bin", 'wb') as f: f.write(ld1) # 0x0200 <-- Load the byte 0x25 into register V3 f.write(ld2) # 0x...
nop = b'\x00\x00' brk = b'\x00\xa0' ld1 = b'c%' ld2 = b'd&' sne = b'\x93@' with open('snevxvytest.bin', 'wb') as f: f.write(ld1) f.write(ld2) f.write(sne) f.write(brk) f.write(nop) f.write(nop) f.write(brk) f.write(nop)
''' Python program to remove two duplicate numbers from a given number of list. Sample Input: ([1,2,3,2,3,4,5]) ([1,2,3,2,4,5]) ([1,2,3,4,5]) Sample Output: [1, 4, 5] [1, 3, 4, 5] [1, 2, 3, 4, 5] ''' a = [10,20,30,20,10,50,60,40,80,50,40] dup_items = set() uniq_items = [] for x in a: if x not in dup_items: ...
""" Python program to remove two duplicate numbers from a given number of list. Sample Input: ([1,2,3,2,3,4,5]) ([1,2,3,2,4,5]) ([1,2,3,4,5]) Sample Output: [1, 4, 5] [1, 3, 4, 5] [1, 2, 3, 4, 5] """ a = [10, 20, 30, 20, 10, 50, 60, 40, 80, 50, 40] dup_items = set() uniq_items = [] for x in a: if x not in dup_ite...
# optimal performance def copy_random_list(head): if not head: return head # copy each node and insert right after itself curr = head while curr: node_new = RandomListNode(curr.label) node_next = curr.next curr.next = node_new node_new.next = node_next curr = no...
def copy_random_list(head): if not head: return head curr = head while curr: node_new = random_list_node(curr.label) node_next = curr.next curr.next = node_new node_new.next = node_next curr = node_next curr = head while curr: if curr.random: ...
class CoinPaymentsProviderError(Exception): pass class TxInfoException(Exception): pass
class Coinpaymentsprovidererror(Exception): pass class Txinfoexception(Exception): pass
#!/usr/bin/env python # vi: set ft=python sts=4 ts=4 sw=4 et: ###################################################################### # # See COPYING file distributed along with the psignifit package for # the copyright and license terms # ###################################################################### __do...
__docformat__ = 'restructuredtext' class Nosampleserror(Exception): """An exception that is raised whenever we try to use samples but there are none""" def __init__(self, msg): self.msg = msg def __str__(self): return repr(self.msg) class Samplingerror(Exception): """An exception tha...
current_number=0 while current_number <=5: current_number +=1 print(current_number)
current_number = 0 while current_number <= 5: current_number += 1 print(current_number)
#!/usr/bin/python3 def add_sub(shellcode: bytes, add_or_sub: bool=True, to_num: int=1, decode: bool=False) -> bytes: """Perform a add or sub encoding scheme on `shellcode`. :return: bytes object """ shellcode = bytearray(shellcode) encoded_payload = bytearray() calculated_num = (int(add_or_s...
def add_sub(shellcode: bytes, add_or_sub: bool=True, to_num: int=1, decode: bool=False) -> bytes: """Perform a add or sub encoding scheme on `shellcode`. :return: bytes object """ shellcode = bytearray(shellcode) encoded_payload = bytearray() calculated_num = (int(add_or_sub) * 2 - 1) * to_num ...
def tree(length): if length>5: t.forward(length) t.right(20) tree(length-15) t.left(40) tree(length-15) t.right(20) t.backward(length) t.left(90) t.color("green") t.speed(1) tree(90)
def tree(length): if length > 5: t.forward(length) t.right(20) tree(length - 15) t.left(40) tree(length - 15) t.right(20) t.backward(length) t.left(90) t.color('green') t.speed(1) tree(90)
#!/usr/bin/env python ''' https://leetcode.com/problems/find-the-duplicate-number/ Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. Input: [1,3,4...
""" https://leetcode.com/problems/find-the-duplicate-number/ Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. Input: [1,3,4,2,2] Output: 2 Input:...
cases = int(input()) for a in range(cases): tracks = int(input().split(" ")[0]) requests = input().split(" ") last = int(requests[0]) total = 0 for i in requests[1:]: next = int(i) total += min(tracks - ((next - last - 1) % tracks + tracks) % tracks, ((next - last - 1) % trac...
cases = int(input()) for a in range(cases): tracks = int(input().split(' ')[0]) requests = input().split(' ') last = int(requests[0]) total = 0 for i in requests[1:]: next = int(i) total += min(tracks - ((next - last - 1) % tracks + tracks) % tracks, ((next - last - 1) % tracks + tra...
def alternating_sums(a): even, odd = [], [] for i in range(len(a)): if i % 2 == 0: even.append(a[i]) else: odd.append(a[i]) return [sum(even), sum(odd)] def alternating_sums_short(a): return [ sum(a[::2]), sum(a[1::2]) ] if __name__ == '__main__': ...
def alternating_sums(a): (even, odd) = ([], []) for i in range(len(a)): if i % 2 == 0: even.append(a[i]) else: odd.append(a[i]) return [sum(even), sum(odd)] def alternating_sums_short(a): return [sum(a[::2]), sum(a[1::2])] if __name__ == '__main__': a = [50, ...
# [h] close all fonts '''Close all open fonts.''' all_fonts = AllFonts() if len(all_fonts) > 0: for font in all_fonts: font.close()
"""Close all open fonts.""" all_fonts = all_fonts() if len(all_fonts) > 0: for font in all_fonts: font.close()
"""Implementation for directed graph.""" class GraphNode: def __init__(self, node_id): self.id = node_id self.data = None self.adj = set() class DirectedGraph: """Implements a directed graph. Nodes have unique ids. Attributes: nodes: A map of id to node object....
"""Implementation for directed graph.""" class Graphnode: def __init__(self, node_id): self.id = node_id self.data = None self.adj = set() class Directedgraph: """Implements a directed graph. Nodes have unique ids. Attributes: nodes: A map of id to node object. ...
"""Top-level package for with-op script.""" __author__ = """Vince Broz""" __email__ = 'vince@broz.cc' __version__ = '1.1.1'
"""Top-level package for with-op script.""" __author__ = 'Vince Broz' __email__ = 'vince@broz.cc' __version__ = '1.1.1'
def adder(a:int, b:int) -> int: while b: _xor = a ^ b _and = (a & b) << 1 a = _xor b = _and return a if __name__ == "__main__": bin_digits = 8 for i in range(2 ** bin_digits): for ii in range(2 ** bin_digits): true = i + ii test = adder(i, ii) if true != test: print(f"Adding: {i:b} + {ii:b}"...
def adder(a: int, b: int) -> int: while b: _xor = a ^ b _and = (a & b) << 1 a = _xor b = _and return a if __name__ == '__main__': bin_digits = 8 for i in range(2 ** bin_digits): for ii in range(2 ** bin_digits): true = i + ii test = adder(i...
# calculate 10! @profile def factorial(num): if num == 1: return 1 else: print("Calculating " + str(num) + "!") return factorial(num -1) * num @profile def profiling_factorial(): value = 10 result = factorial(value) print("10!= " + str(result)) if __name__ == "__main__": ...
@profile def factorial(num): if num == 1: return 1 else: print('Calculating ' + str(num) + '!') return factorial(num - 1) * num @profile def profiling_factorial(): value = 10 result = factorial(value) print('10!= ' + str(result)) if __name__ == '__main__': profiling_fact...
""" Holds utilities related with Earth plotting """ EARTH_PALETTE = { "land_color": "#9fc164", "ocean_color": "#b2d9ff", "lake_color": "#e9eff9", "dessert_color": "d8c596", } """ A color palette based on Earth colors """
""" Holds utilities related with Earth plotting """ earth_palette = {'land_color': '#9fc164', 'ocean_color': '#b2d9ff', 'lake_color': '#e9eff9', 'dessert_color': 'd8c596'} ' A color palette based on Earth colors '
BZX = Contract.from_abi("BZX", "0xc47812857a74425e2039b57891a3dfcf51602d5d", interface.IBZx.abi) TOKEN_REGISTRY = Contract.from_abi("TOKEN_REGISTRY", "0x2fA30fB75E08f5533f0CF8EBcbb1445277684E85", TokenRegistry.abi) list = TOKEN_REGISTRY.getTokens(0, 100) for l in list: iTokenTemp = Contract.from_abi("iTokenTemp", ...
bzx = Contract.from_abi('BZX', '0xc47812857a74425e2039b57891a3dfcf51602d5d', interface.IBZx.abi) token_registry = Contract.from_abi('TOKEN_REGISTRY', '0x2fA30fB75E08f5533f0CF8EBcbb1445277684E85', TokenRegistry.abi) list = TOKEN_REGISTRY.getTokens(0, 100) for l in list: i_token_temp = Contract.from_abi('iTokenTemp',...
lowestPossible = 1 highestPossible = 999 num = 0 while True: enemy = hero.findNearest(hero.findEnemies()) if enemy: if enemy.type == "scout": lowestPossible = num elif enemy.type == "munchkin": highestPossible = num hero.attack(enemy) else: num = lowe...
lowest_possible = 1 highest_possible = 999 num = 0 while True: enemy = hero.findNearest(hero.findEnemies()) if enemy: if enemy.type == 'scout': lowest_possible = num elif enemy.type == 'munchkin': highest_possible = num hero.attack(enemy) else: num = l...
#!/usr/bin/env python # coding: utf-8 # Utility functions def get_image_size(model_prefix): if 'caffenet' in model_prefix: return 227 elif 'squeezenet' in model_prefix: return 227 elif 'alexnet' in model_prefix: return 227 elif 'googlenet' in model_prefix: return 299 elif 'inception-v3' in m...
def get_image_size(model_prefix): if 'caffenet' in model_prefix: return 227 elif 'squeezenet' in model_prefix: return 227 elif 'alexnet' in model_prefix: return 227 elif 'googlenet' in model_prefix: return 299 elif 'inception-v3' in model_prefix: return 299 ...
# variable = a container for a value. # Behaves as the value that it contains first_name = "Bro" last_name = "Code" full_name = first_name +" "+ last_name #name='Bro' print("Hello "+full_name) #print(type(name)) age = 21 age += 1 print("Your age is: "+str(age)) #print(age) #print(type(age)) height = 250.5 print("Yo...
first_name = 'Bro' last_name = 'Code' full_name = first_name + ' ' + last_name print('Hello ' + full_name) age = 21 age += 1 print('Your age is: ' + str(age)) height = 250.5 print('Your height is: ' + str(height) + 'cm') human = True print('Are you a human: ' + str(human))
#!/usr/bin/python # Any system should have an sh capable of `command -v` # REQUIRES: command -v sh print("Oh, but it is!") # CHECK: This should never be compared
print('Oh, but it is!')
# CloudShell L1 resource autoload XML helper # # It should not be necessary to edit this file. # # - Generates the autoload XML resource format to return to CloudShell # - Subresources are also represented with nested instances of this class # - See example usage in <project>_l1_handler.py class L1DriverReso...
class L1Driverresourceinfo: def __init__(self, name, full_address, family, model, map_path=None, serial='-1'): """ :param name: str :param full_address: str :param family: str :param model: str :param map_path: str :param serial: str """ self....
class Solution: def intToRoman(self, num): symbols_list = [ ["M", "M", "M"], ["C", "D", "M"], ["X", "L", "C"], ["I", "V", "X"] ] pown_list = [1000, 100, 10, 1] def digitToRoman(digit, symbols): if digit < 4: ...
class Solution: def int_to_roman(self, num): symbols_list = [['M', 'M', 'M'], ['C', 'D', 'M'], ['X', 'L', 'C'], ['I', 'V', 'X']] pown_list = [1000, 100, 10, 1] def digit_to_roman(digit, symbols): if digit < 4: return symbols[0] * digit elif digit == ...
# Copyright 2015 Ufora Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
"""DefaultDict - dictionary with a default item DefaultDict overrides a normal dict. When created, give it a lambda function that takes a key and produces the 'zero' element for the dictionary for that key. """ class Defaultdict(dict): def __init__(self, defaultFunction): dict.__init__(self) self...
CLUSTERS_DB = 'complete_clusters.db' SAMPLE2PROTEIN_DB = 'sample2protein.db' SAMPLE2PATH = 'sample2path.tsv'
clusters_db = 'complete_clusters.db' sample2_protein_db = 'sample2protein.db' sample2_path = 'sample2path.tsv'