content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# # This one does a little more then required and handles all types of brackets # def balancedParens(s): stack, opens, closes = [], ['(', '[', '{'], [')', ']', '}'] for c in s: if c in opens: stack.append(c) elif c in closes: try: if opens.index(stack.pop()) != closes.index(c): ...
def balanced_parens(s): (stack, opens, closes) = ([], ['(', '[', '{'], [')', ']', '}']) for c in s: if c in opens: stack.append(c) elif c in closes: try: if opens.index(stack.pop()) != closes.index(c): return False except (V...
"""Helper methods for Hijri conversion.""" def jdn_to_ordinal(jdn: int) -> int: """Convert Julian day number (JDN) to date ordinal number. :param jdn: Julian day number (JDN). :type jdn: int """ return jdn - 1721425 def ordinal_to_jdn(n: int) -> int: """Convert date ordinal number to Julia...
"""Helper methods for Hijri conversion.""" def jdn_to_ordinal(jdn: int) -> int: """Convert Julian day number (JDN) to date ordinal number. :param jdn: Julian day number (JDN). :type jdn: int """ return jdn - 1721425 def ordinal_to_jdn(n: int) -> int: """Convert date ordinal number to Julian d...
def f(): print('hello') print('calling f') f()
def f(): print('hello') print('calling f') f()
n, y = map(int, input().split()) y /= 1000 res10, res5, res1 = -1, -1, -1 for a in range(n + 1): if res1 != -1: break for b in range(n - a + 1): c = n - a - b total = 10000 * a + 5000 * b + 1000 * c if total == y: res10, res5, res1 = a, b, c if res1...
(n, y) = map(int, input().split()) y /= 1000 (res10, res5, res1) = (-1, -1, -1) for a in range(n + 1): if res1 != -1: break for b in range(n - a + 1): c = n - a - b total = 10000 * a + 5000 * b + 1000 * c if total == y: (res10, res5, res1) = (a, b, c) if res1 ...
class Finder: _finders = {} @classmethod def register(cls, finder_class): cls._finders[finder_class.name] = finder_class @classmethod def factory(cls, finder_name, deployment, **args): for name, finder in cls._finders.items(): if name == finder_name: re...
class Finder: _finders = {} @classmethod def register(cls, finder_class): cls._finders[finder_class.name] = finder_class @classmethod def factory(cls, finder_name, deployment, **args): for (name, finder) in cls._finders.items(): if name == finder_name: r...
message = 'Hello World!' message2 = 'Hello World! \n' number = 32/35 display = message + repr(number) display2 = message + str(number) display3 = message2 + repr(number) print(display) print(display2) print(display3) print(repr(display3))
message = 'Hello World!' message2 = 'Hello World! \n' number = 32 / 35 display = message + repr(number) display2 = message + str(number) display3 = message2 + repr(number) print(display) print(display2) print(display3) print(repr(display3))
class Agent(object): def __init__(self): pass def act(self, obs): pass def train(self, replay_buffer, logger, step): pass
class Agent(object): def __init__(self): pass def act(self, obs): pass def train(self, replay_buffer, logger, step): pass
print('Welcome to tip calculator') bill = float(input('Enter Your total bill : $')) per_tip = int(input("Enter percentage of tip would you like to give (10,12 or 15): ")) num = int(input("No.of friends that would split the bill : ")) final_bill = round((bill + bill*0.01*per_tip)/num,2) print(f"Each person should pay ...
print('Welcome to tip calculator') bill = float(input('Enter Your total bill : $')) per_tip = int(input('Enter percentage of tip would you like to give (10,12 or 15): ')) num = int(input('No.of friends that would split the bill : ')) final_bill = round((bill + bill * 0.01 * per_tip) / num, 2) print(f'Each person shoul...
class RequiredFieldsError(Exception): def __init__(self, message, is_get=True, abnormal=False, title=None, error_fields=None): super(RequiredFieldsError, self).__init__() self.message = message self.is_get = is_get self.abnormal = abnormal self.title = title...
class Requiredfieldserror(Exception): def __init__(self, message, is_get=True, abnormal=False, title=None, error_fields=None): super(RequiredFieldsError, self).__init__() self.message = message self.is_get = is_get self.abnormal = abnormal self.title = title self.err...
_perms_self_read_only = [ { "principal": "SELF", "action": "READ_ONLY" } ] _perms_self_read_write = [ { "principal": "SELF", "action": "READ_WRITE" } ] _perms_self_hide = [ { "principal": "SELF", "action": "HIDE" } ] # a dump of an okta...
_perms_self_read_only = [{'principal': 'SELF', 'action': 'READ_ONLY'}] _perms_self_read_write = [{'principal': 'SELF', 'action': 'READ_WRITE'}] _perms_self_hide = [{'principal': 'SELF', 'action': 'HIDE'}] okta_user_schema = {'id': 'https://paracelsus.okta.com/meta/schemas/user/default', '$schema': 'http://json-schema.o...
n, m = map(int, input().split()) a = list(map(int, input().split())) a.insert(0, 0) for _ in range(m): op, x = map(int, input().split()) if op == 2: l = 2**(x - 1) r = min(n + 1, 2**x) print(' '.join(map(str, a[l:r]))) elif op == 1: t = [] t.append(a[x]...
(n, m) = map(int, input().split()) a = list(map(int, input().split())) a.insert(0, 0) for _ in range(m): (op, x) = map(int, input().split()) if op == 2: l = 2 ** (x - 1) r = min(n + 1, 2 ** x) print(' '.join(map(str, a[l:r]))) elif op == 1: t = [] t.append(a[x]) ...
#!/usr/bin/env python3 """Extracting IDs from document""" def idExtractor(channelID, document): for key in document: try: if document[key][0] == channelID: return key, document[key][1] except TypeError: continue return
"""Extracting IDs from document""" def id_extractor(channelID, document): for key in document: try: if document[key][0] == channelID: return (key, document[key][1]) except TypeError: continue return
class BaseException(Exception): default_message = None def __init__(self, *args, **kwargs): if not (args or kwargs): args = (self.default_message,) super().__init__(*args, **kwargs) class NotEnoughBallotClaimTickets(BaseException): default_message = 'You do not have enough cl...
class Baseexception(Exception): default_message = None def __init__(self, *args, **kwargs): if not (args or kwargs): args = (self.default_message,) super().__init__(*args, **kwargs) class Notenoughballotclaimtickets(BaseException): default_message = 'You do not have enough clai...
class APIException(Exception): pass class ADBException(Exception): pass
class Apiexception(Exception): pass class Adbexception(Exception): pass
""" https://leetcode.com/problems/longest-palindromic-subsequence/ Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1: Input: "bbbab" Output: 4 One possible longest palindromic subsequence is "bbbb". Example 2: Input: "cbbd" Outpu...
""" https://leetcode.com/problems/longest-palindromic-subsequence/ Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1: Input: "bbbab" Output: 4 One possible longest palindromic subsequence is "bbbb". Example 2: Input: "cbbd" Outpu...
MAJOR = 0 MINOR = 1 PATCH = 6 __version__ = '%d.%d.%d' % (MAJOR, MINOR, PATCH)
major = 0 minor = 1 patch = 6 __version__ = '%d.%d.%d' % (MAJOR, MINOR, PATCH)
# # PySNMP MIB module TRAPEZE-NETWORKS-AP-IF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-AP-IF-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:19:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) ...
def convex_hull_from_points(raw_v): hull = ConvexHull(raw_v) hull_eq = hull.equations # H representation v = raw_v[hull.vertices,:] num_vertices = len(v) g = np.hstack((np.ones((num_vertices,1)), v)) # zeros for vertex mat = cdd.Matrix(g, number_type='fraction') mat.rep_type = cdd.Re...
def convex_hull_from_points(raw_v): hull = convex_hull(raw_v) hull_eq = hull.equations v = raw_v[hull.vertices, :] num_vertices = len(v) g = np.hstack((np.ones((num_vertices, 1)), v)) mat = cdd.Matrix(g, number_type='fraction') mat.rep_type = cdd.RepType.GENERATOR poly = cdd.Polyhedron(m...
def valid_word(seq, word): check=set(seq) def helper(count, index): if index>=len(word): return True if count>=1 else False return any(helper(count+1, i) for i in range(index+1, len(word)+1) if word[index:i] in seq) return helper(0, 0)
def valid_word(seq, word): check = set(seq) def helper(count, index): if index >= len(word): return True if count >= 1 else False return any((helper(count + 1, i) for i in range(index + 1, len(word) + 1) if word[index:i] in seq)) return helper(0, 0)
# coding: utf-8 """***************************************************************************** * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * re...
"""***************************************************************************** * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
class AbstractToken: name = 'token' def __init__(self, lexemes, form): self.lexemes = lexemes self.form = form self.source = self.get_source(lexemes) self.string = lexemes[0].string self.string_index = lexemes[0].string_index self.string_begin_index = lexemes...
class Abstracttoken: name = 'token' def __init__(self, lexemes, form): self.lexemes = lexemes self.form = form self.source = self.get_source(lexemes) self.string = lexemes[0].string self.string_index = lexemes[0].string_index self.string_begin_index = lexemes[0]....
numbers = input().split() for x in range(len(numbers)): numbers[x] = int(numbers[x]) for a in range(0, len(numbers)-2): for b in range(a+1, len(numbers)-1): for c in range(b+1, len(numbers)): A = numbers[a] B = numbers[b] C = numbers[c] if...
numbers = input().split() for x in range(len(numbers)): numbers[x] = int(numbers[x]) for a in range(0, len(numbers) - 2): for b in range(a + 1, len(numbers) - 1): for c in range(b + 1, len(numbers)): a = numbers[a] b = numbers[b] c = numbers[c] if A + B in...
def calculate_triangles(max_p: int) -> int: max_value = -1 max_p_val = -1 for p in range(12, max_p + 1, 2): current_value = sum((p*p - 2*a*p) % (2*p - 2*a) == 0 for a in range(2, p // 3)) if current_value > max_value: max_value = current_value ...
def calculate_triangles(max_p: int) -> int: max_value = -1 max_p_val = -1 for p in range(12, max_p + 1, 2): current_value = sum(((p * p - 2 * a * p) % (2 * p - 2 * a) == 0 for a in range(2, p // 3))) if current_value > max_value: max_value = current_value max_p_val = ...
app = Flask(__name__) class Model: def __init__(self, obj={}): """@param obj {dict}""" self._obj = obj def get_obj(self): return self._obj def set_property(self, name, value): self._obj[name] = value def set_properties(self, properties): """@param propert...
app = flask(__name__) class Model: def __init__(self, obj={}): """@param obj {dict}""" self._obj = obj def get_obj(self): return self._obj def set_property(self, name, value): self._obj[name] = value def set_properties(self, properties): """@param properties ...
def partition(li, start, end): pivot = li[start] left = start + 1 right = end done = False while not done: while left <= right and li[left] <= pivot: left += 1 while right >= left and li[right] >= pivot: right -= 1 if right < left: done = ...
def partition(li, start, end): pivot = li[start] left = start + 1 right = end done = False while not done: while left <= right and li[left] <= pivot: left += 1 while right >= left and li[right] >= pivot: right -= 1 if right < left: done = T...
number = int(input()) previous = 1 current = 1 for i in range(number - 2): next = previous + current previous = current current = next print(current)
number = int(input()) previous = 1 current = 1 for i in range(number - 2): next = previous + current previous = current current = next print(current)
class Node(object): def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right class Solution(object): def _isValidBSTHelper(self, n, low, high): if not n: return True val = n.val if ((val > low and val < high)...
class Node(object): def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right class Solution(object): def _is_valid_bst_helper(self, n, low, high): if not n: return True val = n.val if (val > low and val < hi...
#For these problems, DON'T COMMENT OUT FUNCTION DEFINITIONS! You will need to use them. ####################################################################################### # 13.1 # Make a function which prints out a random string. Then call it. ###################################################################...
def print2(): x = 20 y = 5 print(x + y) print2() print(x) x = 10 def print3(): x = 7 y = 5 print(x, y) print3() print(x)
DEFAULT_KAFKA_PORT = 9092 #: Compression flag value denoting ``gzip`` was used GZIP = 1 #: Compression flag value denoting ``snappy`` was used SNAPPY = 2 #: This set denotes the compression schemes currently supported by Kiel SUPPORTED_COMPRESSION = (None, GZIP, SNAPPY) CLIENT_ID = "kiel" #: The "api version" value ...
default_kafka_port = 9092 gzip = 1 snappy = 2 supported_compression = (None, GZIP, SNAPPY) client_id = 'kiel' api_version = 0 api_keys = {'produce': 0, 'fetch': 1, 'offset': 2, 'metadata': 3, 'offset_commit': 8, 'offset_fetch': 9, 'group_coordinator': 10, 'join_group': 11, 'heartbeat': 12, 'leave_group': 13, 'sync_grou...
css = [ 'about.css', 'button.css', 'frame.css', 'faq.css', 'index.css', 'map.css', 'ramanujan.css', 'rocket.css', 'shelf.css', 'snackbar.css', 'timeline.css', 'typewriter.css', 'mobile.css', 'info.css' ] concat = '' for i in css: with open(f'css/{i}') as f: ...
css = ['about.css', 'button.css', 'frame.css', 'faq.css', 'index.css', 'map.css', 'ramanujan.css', 'rocket.css', 'shelf.css', 'snackbar.css', 'timeline.css', 'typewriter.css', 'mobile.css', 'info.css'] concat = '' for i in css: with open(f'css/{i}') as f: concat += f.read() concat += '\n\n' f = open...
CONTROLLERS = {} def controller(code): def register_controller(func): CONTROLLERS[code] = func return func return register_controller def get_controller_func(controller): if controller in CONTROLLERS: return CONTROLLERS[controller] raise ValueError('Invalid request')
controllers = {} def controller(code): def register_controller(func): CONTROLLERS[code] = func return func return register_controller def get_controller_func(controller): if controller in CONTROLLERS: return CONTROLLERS[controller] raise value_error('Invalid request')
course = ' Python for Beginners ' print(len(course)) # Genereal perpous function print(course.upper()) print(course) print(course.lower()) print(course.title()) print(course.lstrip()) print(course.rstrip()) # Returns the index of the first occurrence of the character. print(course.find('P')) print(course.find('B'...
course = ' Python for Beginners ' print(len(course)) print(course.upper()) print(course) print(course.lower()) print(course.title()) print(course.lstrip()) print(course.rstrip()) print(course.find('P')) print(course.find('B')) print(course.find('o')) print(course.find('O')) print(course.find('Beginners')) print(cou...
print("Hello World!") x = "Hello World" print(x) y = 42 print(y)
print('Hello World!') x = 'Hello World' print(x) y = 42 print(y)
class Policy(object): """ Base policy """ def __init__(self, action_low=None, action_high=None): self.action_low = action_low self.action_high = action_high def action(self, state, sim_time=0, desired=[], actual=[]): pass def reset(self): pass
class Policy(object): """ Base policy """ def __init__(self, action_low=None, action_high=None): self.action_low = action_low self.action_high = action_high def action(self, state, sim_time=0, desired=[], actual=[]): pass def reset(self): pass
class DefineRegion(object): def __init__(self): self.x = self.y = 10.0 self.depth = 1.0 self.subvolume_edge = 1.0 self.cytosol_depth = 10.0 self.num_chambers = (self.x / self.subvolume_edge) * (self.y / self.subvolume_edge) * ( self.depth / self.subvolume_...
class Defineregion(object): def __init__(self): self.x = self.y = 10.0 self.depth = 1.0 self.subvolume_edge = 1.0 self.cytosol_depth = 10.0 self.num_chambers = self.x / self.subvolume_edge * (self.y / self.subvolume_edge) * (self.depth / self.subvolume_edge) self.num...
#!/usr/bin/env python3 '''module that deals with functions''' def commandpush(devicecmd): #devicecmd=list ''' push commands to devices ''' for coffeetime in devicecmd.keys(): print("Handshaking......connecting with " + coffeetime) for mycmds in devicecmd[coffeetime]: print("Attempti...
"""module that deals with functions""" def commandpush(devicecmd): """ push commands to devices """ for coffeetime in devicecmd.keys(): print('Handshaking......connecting with ' + coffeetime) for mycmds in devicecmd[coffeetime]: print('Attempting to sending command --> ' + mycmds) ...
for v in range(0, 3): print(v) for i, v in enumerate(range(10, 13)): print(i, v) for key, value in {'A': 0, 'B': 1}.items(): print(key, value)
for v in range(0, 3): print(v) for (i, v) in enumerate(range(10, 13)): print(i, v) for (key, value) in {'A': 0, 'B': 1}.items(): print(key, value)
n=22351 l=[] s=str(n) for ch in s: l= l + [int(ch)] highest=sorted (l,reverse=True) s="" for ch in highest: s=s+ str(ch) highest=int(s) n=9 for i in range(n +1,highest+1): print(i)
n = 22351 l = [] s = str(n) for ch in s: l = l + [int(ch)] highest = sorted(l, reverse=True) s = '' for ch in highest: s = s + str(ch) highest = int(s) n = 9 for i in range(n + 1, highest + 1): print(i)
class Solution(object): def intersection(self, nums1, nums2): if len(nums1) > len(nums2): return self.intersection(nums2, nums1) lookup = set() for i in nums1: lookup.add(i) res = [] for i in nums2: if i in lookup: res += ...
class Solution(object): def intersection(self, nums1, nums2): if len(nums1) > len(nums2): return self.intersection(nums2, nums1) lookup = set() for i in nums1: lookup.add(i) res = [] for i in nums2: if i in lookup: res += (...
def add(a, b): return a + b def multiply(a, b): return a * b assert add(10, 10) == 100, "confused addition" assert multiply(10, 10) == 20, "confused multiplication"
def add(a, b): return a + b def multiply(a, b): return a * b assert add(10, 10) == 100, 'confused addition' assert multiply(10, 10) == 20, 'confused multiplication'
def linear_search(a, key): length = len(a) idx = 0 while idx < length: if a[idx] == key: return idx idx += 1 return -1 a = [1, 3, 5, 10, 13] key = 5 print(linear_search(a, key))
def linear_search(a, key): length = len(a) idx = 0 while idx < length: if a[idx] == key: return idx idx += 1 return -1 a = [1, 3, 5, 10, 13] key = 5 print(linear_search(a, key))
# increment.py """This increments (creates a new) serial number with every invocation of the class.""" # STATUS: Not working. See FIXME tag below. # from https://app.pluralsight.com/course-player?clipId=bf34ecab-aa3e-402b-961d-53efb624b957 class ShippingContainer: # Global scope # Class attributes here: n...
"""This increments (creates a new) serial number with every invocation of the class.""" class Shippingcontainer: next_serial = 1337 def __init__(self, owner_code, contents): self.owner_code = owner_code self.contents = contents self.serial = ShippingContainer.next_serial Shippi...
class Bar(): pass def t1(): raise Bar() def t2(): return Bar()
class Bar: pass def t1(): raise bar() def t2(): return bar()
f = open("pb2.txt") n = int(f.readline()) P = [] for i in range(n): x, y = f.readline().split() P.append((float(x), float(y))) # citirea punctelor poligonului print("n=", n, " P=", P) # pentru x-monotonie, de exemplu, vreau sa iau cel mai din stanga punct si sa parcurg punctele pentru ca sunt...
f = open('pb2.txt') n = int(f.readline()) p = [] for i in range(n): (x, y) = f.readline().split() P.append((float(x), float(y))) print('n=', n, ' P=', P) minim = P[0][0] indexmin = -1 for i in range(len(P)): if P[i][0] < minim: minim = P[i][0] indexmin = i (monotonie, elem_precedent, ok...
def histogram(s): ''' Maps values of sequence to its frequency / occurrence. s: sequence ''' d = {} for c in s: d[c] = d.get(c, 0) + 1 return d def invert_dict(d): ''' Inverts a dictionary(d). Returns dictionary with values of d as keys and keys of d ...
def histogram(s): """ Maps values of sequence to its frequency / occurrence. s: sequence """ d = {} for c in s: d[c] = d.get(c, 0) + 1 return d def invert_dict(d): """ Inverts a dictionary(d). Returns dictionary with values of d as keys and keys of d as values....
# # PySNMP MIB module OMNI-gx2EDFA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OMNI-gx2EDFA-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:24:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint, constraints_union) ...
class CQueue: def __init__(self): self.q = [] def appendTail(self, value: int) -> None: self.q.append(value) def deleteHead(self) -> int: return self.q.pop(0) if self.q else -1 # Your CQueue object will be instantiated and called as such: # obj = CQueue() # obj.appendTail(value)...
class Cqueue: def __init__(self): self.q = [] def append_tail(self, value: int) -> None: self.q.append(value) def delete_head(self) -> int: return self.q.pop(0) if self.q else -1
# -*- coding: utf-8 -*- __author__ = "venkat" __author_email__ = "venkatram0273@gmail.com" def block_indentation(): if 10 > 10: print("if statement indented") elif 10 > 5: print("elif statement indented") else: print("else default statement indented") for i in range(10): ...
__author__ = 'venkat' __author_email__ = 'venkatram0273@gmail.com' def block_indentation(): if 10 > 10: print('if statement indented') elif 10 > 5: print('elif statement indented') else: print('else default statement indented') for i in range(10): print(i) print(...
# read numbers numbers = [] with open("nums.txt", "r") as f: lines = f.readlines() numbers = [int(i) for i in lines] print(numbers) # part 1 soln for x,el in enumerate(numbers): for i in range(x+1, len(numbers)): if el + numbers[i] == 2020: print("YAY: {} {}".format(el, num...
numbers = [] with open('nums.txt', 'r') as f: lines = f.readlines() numbers = [int(i) for i in lines] print(numbers) for (x, el) in enumerate(numbers): for i in range(x + 1, len(numbers)): if el + numbers[i] == 2020: print('YAY: {} {}'.format(el, numbers[i])) for (x, el) in enumerate(num...
# -*- coding: UTF-8 -*- def read_file(filepath): with open(filepath,'rb') as file: # yield (file.readlines()) for i in file: yield i a = read_file(r'D:\pythontest/test\python_100/2/base.txt') print(next(a))
def read_file(filepath): with open(filepath, 'rb') as file: for i in file: yield i a = read_file('D:\\pythontest/test\\python_100/2/base.txt') print(next(a))
class Solution: def destCity(self, paths: List[List[str]]) -> str: start = (list(map(lambda x: x[0], paths))) for path in paths: if path[1] not in start: return path[1] # dic = {} # for i in range(len(paths)): # dic[paths[i][0]] = paths[i][1]...
class Solution: def dest_city(self, paths: List[List[str]]) -> str: start = list(map(lambda x: x[0], paths)) for path in paths: if path[1] not in start: return path[1]
# Copyright 2020 Software Improvement Group # # 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 ...
""" Module provides graph query and json query of a call graph in FASTEN json format. """ class Graphquery: def __init__(self, cg): pass def get_trans_callees(self, method): return [] def get_trans_callers(self, method): return []
class Solution: def rotatedDigits(self, n: int) -> int: goodnums = set([2,5,6,9]) badnums = set([3,4,7]) ans = 0 for i in range(1,n+1): good = False num = i while num: remains = num % 10 if remains in good...
class Solution: def rotated_digits(self, n: int) -> int: goodnums = set([2, 5, 6, 9]) badnums = set([3, 4, 7]) ans = 0 for i in range(1, n + 1): good = False num = i while num: remains = num % 10 if remains in goodn...
# TODO: Chain class """ The Chain class will support chaining multiple Digests together. The Chain feature should have support to be placed ANYWHERE within the ApiForm and chain together DigestFeatures A single Digest Feature should run within the same thread/process and be relatively simple. A series of Digest Feat...
""" The Chain class will support chaining multiple Digests together. The Chain feature should have support to be placed ANYWHERE within the ApiForm and chain together DigestFeatures A single Digest Feature should run within the same thread/process and be relatively simple. A series of Digest Features, or features th...
def d(n): return n + sum(list(map(int, list(str(n))))) nums = [x for x in range(1, 10001)] for i in range(1, 10001): if d(i) in nums: nums.remove(d(i)) for num in nums: print(num)
def d(n): return n + sum(list(map(int, list(str(n))))) nums = [x for x in range(1, 10001)] for i in range(1, 10001): if d(i) in nums: nums.remove(d(i)) for num in nums: print(num)
class Node: def __init__(self, data) -> None: self.data = data self.next = None self.traversed = False class LinkedList: def __init__(self) -> None: self.head = self.rear = None def check_loop(node): temp = node.head if temp == None: print("Empty!!") ...
class Node: def __init__(self, data) -> None: self.data = data self.next = None self.traversed = False class Linkedlist: def __init__(self) -> None: self.head = self.rear = None def check_loop(node): temp = node.head if temp == None: print('Empty!!') r...
def is_horiz_or_vert(line): return line[0]["x"] == line[1]["x"] or line[0]["y"] == line[1]["y"] def parse(input_line): return [ {"x": int(x), "y": int(y)} for x, y in [s.strip().split(",") for s in input_line.split("->")] ] def do_it(input_lines, diagonals=False): lines = [ l...
def is_horiz_or_vert(line): return line[0]['x'] == line[1]['x'] or line[0]['y'] == line[1]['y'] def parse(input_line): return [{'x': int(x), 'y': int(y)} for (x, y) in [s.strip().split(',') for s in input_line.split('->')]] def do_it(input_lines, diagonals=False): lines = [line for line in [parse(input_li...
windowWight=650 windowHeight=650 ellipseSize=200 def setup(): size(windowWight,windowHeight) smooth() background(255) fill(50,80) stroke(100) strokeWeight(3) noLoop() def draw(): ellipse(windowWight/2, windowHeight/2 - ellipseSize/2, ellipseSize, ellipseSize) ellipse(wi...
window_wight = 650 window_height = 650 ellipse_size = 200 def setup(): size(windowWight, windowHeight) smooth() background(255) fill(50, 80) stroke(100) stroke_weight(3) no_loop() def draw(): ellipse(windowWight / 2, windowHeight / 2 - ellipseSize / 2, ellipseSize, ellipseSize) ell...
# list(map(int, input().split())) # int(input()) def main(N, A): ans = 0 for n in range(1, N+1, 2): if A[n-1] % 2 == 1: ans += 1 print(ans) if __name__ == '__main__': N = int(input()) A = list(map(int, input().split())) main(N, A)
def main(N, A): ans = 0 for n in range(1, N + 1, 2): if A[n - 1] % 2 == 1: ans += 1 print(ans) if __name__ == '__main__': n = int(input()) a = list(map(int, input().split())) main(N, A)
budget = 150.0 pi_string = '03.14159260' age_string = '21' # convert string to number pi_float = float(pi_string) age_int = int(age_string) # convert and print to string print('The budget is: $' + str(budget)) print('pi_string: ' + pi_string) print('pi_float: ' + str(pi_float)) print('age_int: ' + str(age_int))
budget = 150.0 pi_string = '03.14159260' age_string = '21' pi_float = float(pi_string) age_int = int(age_string) print('The budget is: $' + str(budget)) print('pi_string: ' + pi_string) print('pi_float: ' + str(pi_float)) print('age_int: ' + str(age_int))
ficha=list() while True: nome=str(input('Nome: ')) nota1=float(input('Nota 1: ')) nota2=float(input('Nota 2: ')) media= (nota1+nota2)/2 ficha.append([nome, [nota1,nota2],media]) resp=str(input('Quer continuar? [S/N]: ')).strip().upper() if resp in 'N': break print('-='*30)
ficha = list() while True: nome = str(input('Nome: ')) nota1 = float(input('Nota 1: ')) nota2 = float(input('Nota 2: ')) media = (nota1 + nota2) / 2 ficha.append([nome, [nota1, nota2], media]) resp = str(input('Quer continuar? [S/N]: ')).strip().upper() if resp in 'N': break print('-...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright 2020, Yutong Xie, UIUC. Convert sorted array to binary search tree using recursion. ''' # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.le...
""" Copyright 2020, Yutong Xie, UIUC. Convert sorted array to binary search tree using recursion. """ class Solution(object): def sorted_array_to_bst(self, nums): """ :type nums: List[int] :rtype: TreeNode """ def helper(l, r): if l > r: ...
#exercice 1 #calories calculator. create 2 functions main, calories. #It should calculate the amount of calories from #the grams of carbs, fat and protein. #calories from fat = fat gram x 9 #calories from carbs = carbs gram x 4 #calories from protein = protein gram x 4 #example: #if item has 1 gram of fat, 2 grams o...
def main(): fat = int(input('Please enter a number of grams of fat:\n')) carbs = int(input('Please enter a number of grams of carbs:\n')) protein = int(input('Please enter a number of grams of protein:\n')) calories(fat, carbs, protein) def calories(fat, carbs, protein): total = fat * 9 + carbs * 4...
# 7-3. Multiples of Ten: Ask the user for a number, and then report whether the number is a multiple of 10 or not. number = input("Tell me a number man :v : ") number = int(number) if number % 10 == 0: print(str(number) + " is a multiple of 10.") else: print(str(number) + " is not a multiple of 10.")
number = input('Tell me a number man :v : ') number = int(number) if number % 10 == 0: print(str(number) + ' is a multiple of 10.') else: print(str(number) + ' is not a multiple of 10.')
""" https://www.codewars.com/kata/5168bb5dfe9a00b126000018/train/python Given a string, return its reverse """ def solution(string): return ''.join(reversed([char for char in string])) def solution2(string): return string[::-1] print(solution2('world'))
""" https://www.codewars.com/kata/5168bb5dfe9a00b126000018/train/python Given a string, return its reverse """ def solution(string): return ''.join(reversed([char for char in string])) def solution2(string): return string[::-1] print(solution2('world'))
# pylint: skip-file # pylint: disable=too-many-instance-attributes class GcloudConfig(GcloudCLI): ''' Class to wrap the gcloud config command''' # pylint allows 5 # pylint: disable=too-many-arguments def __init__(self, project=None, region=None): ''' Construct...
class Gcloudconfig(GcloudCLI): """ Class to wrap the gcloud config command""" def __init__(self, project=None, region=None): """ Constructor for gcloud resource """ super(GcloudConfig, self).__init__() self._working_param = {} if project: self._working_param['name'] ...
""" This file holds default settings value and it is used like template for creation userdef.py file. If you want to change any variable listed below do that in generated userdef.py file. """ #args.gn template path webRTCGnArgsTemplatePath='./webrtc/windows/templates/gns/args.gn' #Path where nuget package and all...
""" This file holds default settings value and it is used like template for creation userdef.py file. If you want to change any variable listed below do that in generated userdef.py file. """ web_rtc_gn_args_template_path = './webrtc/windows/templates/gns/args.gn' nuget_folder_path = './webrtc/windows/nuget' nuget_...
class TouchData: x_distance = None y_distance = None x_offset = None y_offset = None relative_distance = None is_external = None in_range = None def __init__(self, joystick, touch): self.joystick = joystick self.touch = touch self._calculate() def _calculate...
class Touchdata: x_distance = None y_distance = None x_offset = None y_offset = None relative_distance = None is_external = None in_range = None def __init__(self, joystick, touch): self.joystick = joystick self.touch = touch self._calculate() def _calculate...
def testing_system(right_answer, Iras_answer): if right_answer == Iras_answer: print("YES") else: print("NO") testing_system(int(input()), int(input()))
def testing_system(right_answer, Iras_answer): if right_answer == Iras_answer: print('YES') else: print('NO') testing_system(int(input()), int(input()))
#!/usr/bin/env python3 ''' lib/subl sublime-ycmd sublime utility module. '''
""" lib/subl sublime-ycmd sublime utility module. """
class StyleGenerator: def __init__(self): self.sidebar_style = {} self.content_style = {} def getSidebarStyle(self): return self.sidebar_style def getContentStyle(self): return self.content_style def setSidebarStyle(self, position="fixed", top=0, left=0, bottom=0, width="0rem", padding="0rem 0rem", back...
class Stylegenerator: def __init__(self): self.sidebar_style = {} self.content_style = {} def get_sidebar_style(self): return self.sidebar_style def get_content_style(self): return self.content_style def set_sidebar_style(self, position='fixed', top=0, left=0, bottom=...
# implementation of linked list using python 3 # Node class class Node: #function to initialize the node object def __init__(self, data): self.data = data #assign data self.next = None #initialize next as null #Linked list class class LinkedList: #function to initialize the linked #...
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def printing_list(self): temp = self.head while temp: print(temp.data) temp = temp.next if __name__ == '__main__'...
def test_content_id_2(): content_id_head = pd.DataFrame({'Content_Rating': ['Everyone', 'Everyone', 'Everyone', 'Teen', 'Everyone']}, index=[101, 101, 101, 102, 101]) assert content_id_df.head().equals(content_id_head)
def test_content_id_2(): content_id_head = pd.DataFrame({'Content_Rating': ['Everyone', 'Everyone', 'Everyone', 'Teen', 'Everyone']}, index=[101, 101, 101, 102, 101]) assert content_id_df.head().equals(content_id_head)
""" PASSENGERS """ numPassengers = 2713 passenger_arriving = ( (0, 6, 4, 4, 1, 0, 4, 5, 3, 6, 1, 0), # 0 (4, 10, 2, 0, 1, 0, 5, 8, 5, 5, 3, 0), # 1 (1, 6, 3, 2, 5, 0, 4, 4, 5, 5, 1, 0), # 2 (3, 10, 6, 3, 3, 0, 5, 5, 4, 2, 0, 0), # 3 (2, 6, 4, 1, 0, 0, 7, 8, 6, 6, 1, 0), # 4 (4, 9, 8, 3, 3, 0, 4, 7, 6, 7, ...
""" PASSENGERS """ num_passengers = 2713 passenger_arriving = ((0, 6, 4, 4, 1, 0, 4, 5, 3, 6, 1, 0), (4, 10, 2, 0, 1, 0, 5, 8, 5, 5, 3, 0), (1, 6, 3, 2, 5, 0, 4, 4, 5, 5, 1, 0), (3, 10, 6, 3, 3, 0, 5, 5, 4, 2, 0, 0), (2, 6, 4, 1, 0, 0, 7, 8, 6, 6, 1, 0), (4, 9, 8, 3, 3, 0, 4, 7, 6, 7, 0, 0), (2, 6, 8, 4, 1, 0, 5, 6, 5,...
#!/usr/bin/python __all__ = [ '__title__', '__summary__', '__uri__', '__version__', '__author__', '__email__', '__license__', '__copyright__', ] __title__ = 'django-simple-datatable' __summary__ = 'Simple datatable' __uri__ = 'https://github.com/2375452377/django-simple-datatable.git' __version__ = '0.1.1' _...
__all__ = ['__title__', '__summary__', '__uri__', '__version__', '__author__', '__email__', '__license__', '__copyright__'] __title__ = 'django-simple-datatable' __summary__ = 'Simple datatable' __uri__ = 'https://github.com/2375452377/django-simple-datatable.git' __version__ = '0.1.1' __author__ = 'Terrence Luo' __ema...
''' def square(num): return num*num a = square(10) print(a) ''' # Lamda function --> Function creating using an expression using lamda keyword square = lambda num: num*num # creating a square lamda function which takes num as input and multiply num*num and return to square num = 10 a=square(num) print(a) ...
""" def square(num): return num*num a = square(10) print(a) """ square = lambda num: num * num num = 10 a = square(num) print(a) sum = lambda a, b, c: a + b + c s = sum(num, 4, 6) print(s)
HTTP_METHOD_DELETE = "DELETE" HTTP_METHOD_GET = "GET" HTTP_METHOD_POST = "POST" HTTP_METHOD_PUT = "PUT"
http_method_delete = 'DELETE' http_method_get = 'GET' http_method_post = 'POST' http_method_put = 'PUT'
GYRO_FSR_250DPS = 0 GYRO_FSR_500DPS = 1 GYRO_FSR_1000DPS = 2 GYRO_FSR_2000DPS = 3
gyro_fsr_250_dps = 0 gyro_fsr_500_dps = 1 gyro_fsr_1000_dps = 2 gyro_fsr_2000_dps = 3
# Hash Table; Two pointers; string # Given a string, find the length of the longest substring without repeating characters. # # Example 1: # # Input: "abcabcbb" # Output: 3 # Explanation: The answer is "abc", with the length of 3. # Example 2: # # Input: "bbbbb" # Output: 1 # Explanation: The answer is "b", with the l...
class Solution(object): def length_of_longest_substring(self, s): """ :type s: str :rtype: int """ (dic, res, start) = ({}, 0, 0) for (i, ch) in enumerate(s): if ch in dic: res = max(res, i - start) start = max(start, dic[c...
ACTIONS_MAP = { "attack": "do_combat", "area": "do_combat", "block": "do_combat", "disrupt": "do_combat", "dodge": "do_combat", "change character": "change_class", "change class": "change_class", }
actions_map = {'attack': 'do_combat', 'area': 'do_combat', 'block': 'do_combat', 'disrupt': 'do_combat', 'dodge': 'do_combat', 'change character': 'change_class', 'change class': 'change_class'}
#!/usr/bin/env python3 count = 0 while count < 5: print(count) count += 1
count = 0 while count < 5: print(count) count += 1
# A sample config file emailInformation = dict( fromEmail = 'senderAccount', toEmail = 'toAccount', username = 'sender username', password = 'sender password' ) dropboxInfo = dict( token = 'dropbox token' )
email_information = dict(fromEmail='senderAccount', toEmail='toAccount', username='sender username', password='sender password') dropbox_info = dict(token='dropbox token')
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class SchedulingPolicyProtoMonthlySchedule(object): """Implementation of the 'SchedulingPolicyProto_MonthlySchedule' model. TODO: type model description here. Attributes: count (int): Count of the day on which to perform the backup (look ...
class Schedulingpolicyprotomonthlyschedule(object): """Implementation of the 'SchedulingPolicyProto_MonthlySchedule' model. TODO: type model description here. Attributes: count (int): Count of the day on which to perform the backup (look above for a more detailed description). ...
# -*- mode: python -*- # vi: set ft=python : """ Downloads a precompiled version of buildifier and makes it available to the WORKSPACE. Example: WORKSPACE: load("@drake//tools/workspace:mirrors.bzl", "DEFAULT_MIRRORS") load("@drake//tools/workspace/buildifier:repository.bzl", "buildifier_repositor...
""" Downloads a precompiled version of buildifier and makes it available to the WORKSPACE. Example: WORKSPACE: load("@drake//tools/workspace:mirrors.bzl", "DEFAULT_MIRRORS") load("@drake//tools/workspace/buildifier:repository.bzl", "buildifier_repository") # noqa buildifier_repository(name...
def largest_palindrome_product(digit_num): pals = list() for i in range(1,10**digit_num): for j in range(1,10**digit_num): n = (10**digit_num-i)*(10**digit_num-j) p = "" for i in range(1,len(str(n))+1): p = p + str(n)[-i] if p...
def largest_palindrome_product(digit_num): pals = list() for i in range(1, 10 ** digit_num): for j in range(1, 10 ** digit_num): n = (10 ** digit_num - i) * (10 ** digit_num - j) p = '' for i in range(1, len(str(n)) + 1): p = p + str(n)[-i] ...
def LEFT(i): return 2*i + 1 def RIGHT(i): return 2*i + 2 def swap(A, i, j): temp = A[i] A[i] = A[j] A[j] = temp def heapify(A, i, size): left = LEFT(i) right = RIGHT(i) largest = i if left < size and A[left] > A[i]: largest = left if right < size and A[right] > A[la...
def left(i): return 2 * i + 1 def right(i): return 2 * i + 2 def swap(A, i, j): temp = A[i] A[i] = A[j] A[j] = temp def heapify(A, i, size): left = left(i) right = right(i) largest = i if left < size and A[left] > A[i]: largest = left if right < size and A[right] > A[l...
class APIException(Exception): """ Encapsulates HTTP errors thrown by the microcosm API. """ def __init__(self, error_message, status_code=None, detail=None): self.status_code = status_code self.detail = detail super(APIException, self).__init__(error_message) def __str__(s...
class Apiexception(Exception): """ Encapsulates HTTP errors thrown by the microcosm API. """ def __init__(self, error_message, status_code=None, detail=None): self.status_code = status_code self.detail = detail super(APIException, self).__init__(error_message) def __str__(s...
# -*- coding: utf-8 -*- """ @author: mwahdan """ class NluDataset: def __init__(self, text, tags, intents): self.text = text self.tags = tags self.intents = intents
""" @author: mwahdan """ class Nludataset: def __init__(self, text, tags, intents): self.text = text self.tags = tags self.intents = intents
""" Model for Player """ class Player: """ Player class """ def __init__(self, player_name): self.name = player_name def say_hello(self): """ Function used by player to introduce him/her self """ print("Hello, I'm ", self.name) def score_runs(self, runs): ...
""" Model for Player """ class Player: """ Player class """ def __init__(self, player_name): self.name = player_name def say_hello(self): """ Function used by player to introduce him/her self """ print("Hello, I'm ", self.name) def score_runs(self, runs): """ Function...
values = { frozenset(("id=72", "vaultUserPermissions%5B2%5D=readOnly")): { "status_code": "200", "text": { "responseData": {}, "responseHeader": { "now": 1492630700324, "requestId": "WPe8rAoQgF4AADVcyb0AAAAv", "status": "ok", ...
values = {frozenset(('id=72', 'vaultUserPermissions%5B2%5D=readOnly')): {'status_code': '200', 'text': {'responseData': {}, 'responseHeader': {'now': 1492630700324, 'requestId': 'WPe8rAoQgF4AADVcyb0AAAAv', 'status': 'ok'}, 'responseStatus': 'ok'}}, frozenset(('vaultUserPermissions%5B274%5D=disabled', 'id=95')): {'statu...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def get_inputs(): """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" # I N P U T S # """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" # Atmosphere options ...
def get_inputs(): """ # I N P U T S # """ atmosphere = 0 nrlmsise00_year = 0.0 nrlmsise00_doy = 172.0 nrlmsise00_sec = 29000.0 nrlmsise00_lst = 16.0 nrlmsise00_f107a = 150.0 nrlmsise00_f107 = 150.0 nrlmsise00_ap = 4.0 ...
IX86_UNCONDITIONAL_JMP_CALLS = ["JMP", "JMP_SHORT", "JMP_FAR", "CALL"] IX86_CONDITIONAL_JMP_CALLS = [ "JA", "JA_SHORT", "JNBE", "JNBE_SHORT", "JAE", "JAE_SHORT", "JNB", "JNB_SHORT", "JB", "JB_SHORT", "JBAE", "JBAE_SHORT", "JC", "JC_SHORT", "JBE", "JBE_SHO...
ix86_unconditional_jmp_calls = ['JMP', 'JMP_SHORT', 'JMP_FAR', 'CALL'] ix86_conditional_jmp_calls = ['JA', 'JA_SHORT', 'JNBE', 'JNBE_SHORT', 'JAE', 'JAE_SHORT', 'JNB', 'JNB_SHORT', 'JB', 'JB_SHORT', 'JBAE', 'JBAE_SHORT', 'JC', 'JC_SHORT', 'JBE', 'JBE_SHORT', 'JBZ', 'JBZ_SHORT', 'JBNA', 'JBNA_SHORT', 'JE', 'JE_SHORT', '...
#!/usr/bin/env python #Lists categoryList = [] factList = [] caseList = [] saList = [] ruleList = [] erList = [] foList = [] evalList = [] #Operations AND = " AND " OR = " OR " NEG = " NEG " IMPLY = " IMPLY " EQUALS = " EQUALS " LESSER = " LESSER " GREATER = " GREATER " #Classes class Cat...
category_list = [] fact_list = [] case_list = [] sa_list = [] rule_list = [] er_list = [] fo_list = [] eval_list = [] and = ' AND ' or = ' OR ' neg = ' NEG ' imply = ' IMPLY ' equals = ' EQUALS ' lesser = ' LESSER ' greater = ' GREATER ' class Category(object): def __init__(self, name=None, description=None): ...
def median3(): numbers1 = input("What numbers are we finding the median of?: ") numbers1 = numbers1.split(",") num = [] for i in numbers1: i = float(i) n = num.append(i) n1 = num.sort() z = len(num) if z % 2 == 0: median1 = num[z//2] median2 = num[z//2-1] ...
def median3(): numbers1 = input('What numbers are we finding the median of?: ') numbers1 = numbers1.split(',') num = [] for i in numbers1: i = float(i) n = num.append(i) n1 = num.sort() z = len(num) if z % 2 == 0: median1 = num[z // 2] median2 = num[z // 2 - 1...
POSTGRES_USER=test POSTGRES_PASSWORD=password POSTGRES_HOST=localhost POSTGRES_PORT=5432 POSTGRES_DB=example
postgres_user = test postgres_password = password postgres_host = localhost postgres_port = 5432 postgres_db = example
""" Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: - Characters ('a' to 'i') are represented by ('1' to '9') respectively. - Characters ('j' to 'z') are represented by ('10#' to '26#') respectively. Return the...
""" Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: - Characters ('a' to 'i') are represented by ('1' to '9') respectively. - Characters ('j' to 'z') are represented by ('10#' to '26#') respectively. Return the...
# Reverse Cipher # https://www.nostarch.com/crackingcodes/ (BSD Licensed) # message = 'Three can keep a secret, if two of them are dead.' # message = '.daed era meht fo owt fi ,terces a peek nac eerhT' message = input('Enter message: ') translated = '' i = len(message) - 1 while i >= 0: translated = translated + ...
message = input('Enter message: ') translated = '' i = len(message) - 1 while i >= 0: translated = translated + message[i] print('i is', i, ', message[i] is', message[i], ', translated is', translated) i = i - 1 print(translated)
# Input: nums = [0,1,2,2,3,0,4,2], val = 2 # Output: 5, nums = [0,1,4,0,3] def removeElement(arr, element): dictonary = {} output = 0 for iter in arr: if iter in dictonary: dictonary[iter] += 1 else: dictonary[iter] = 1 # {0: 2, 1: 1, 3: 1, 4: 1} delete = in...
def remove_element(arr, element): dictonary = {} output = 0 for iter in arr: if iter in dictonary: dictonary[iter] += 1 else: dictonary[iter] = 1 delete = int(dictonary.get(element)) for i in range(delete): arr.remove(element) del dictonary[element...
# Define a coverage report # # Arguments: # name : prefix of generated targets # tests : list of test targets run for the report # srcpath_include : (optional) list of path prefixes used to restrict data from matching sourcefiles # srcpath_exclude : (optional) list of path prefixes used to exclude data from mat...
def coverage_report(name, tests, srcpath_include=[], srcpath_exclude=[]): native.test_suite(name=name + '.suite', tests=['@{}'.format(t) for t in tests]) lcovs = ['@results//:{}.LCOVTracefile'.format(t[2:].replace(':', '/')) for t in tests] native.genrule(name='{}.lcov.unfiltered'.format(name), srcs=lcovs, ...
# arrays bonus = [0.005, 0.12, 0.345, 0.68, 1.125, 1.68, 2.345, 3.12, 4.005, 5 , 6.105, 7.32 ] loss = [0] probability = [0.359, 0.330, 0.3 , 0.27 , 0.24, 0.21 , 0.18, 0.15 , 0.12, 0.09 , 0.06, 0.03 ] time = [] cookies_lost = [] # constants cps = 11.696 #quadrillion # counters total_time = 0 ...
bonus = [0.005, 0.12, 0.345, 0.68, 1.125, 1.68, 2.345, 3.12, 4.005, 5, 6.105, 7.32] loss = [0] probability = [0.359, 0.33, 0.3, 0.27, 0.24, 0.21, 0.18, 0.15, 0.12, 0.09, 0.06, 0.03] time = [] cookies_lost = [] cps = 11.696 total_time = 0 i = 0 while i < 11: loss.append(bonus[i] - bonus[i - 1]) i = i + 1 i = 0 w...