content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def foo(): for i in range(10): x = yield i**2 print('foo:', x) return 'foo' def bar(): y = yield from foo() print('bar:', y) return 'bar' gtor = bar() print(gtor.send(None)) x = gtor.send(1) print('x:', x) x = gtor.send(2) print('x:', x) x = gtor.send(3) print('x:', x) x = gtor.s...
def foo(): for i in range(10): x = (yield (i ** 2)) print('foo:', x) return 'foo' def bar(): y = (yield from foo()) print('bar:', y) return 'bar' gtor = bar() print(gtor.send(None)) x = gtor.send(1) print('x:', x) x = gtor.send(2) print('x:', x) x = gtor.send(3) print('x:', x) x = g...
_base_ = '../cascade_rcnn/cascade_mask_rcnn_eff-B7_nasfpn_1x_coco.py' # We also need to change the num_classes in head to match the dataset's annotation # model = dict( # roi_head=dict( # bbox_head=[dict(num_classes=1), dict(num_classes=1), dict(num_classes=1)], # mask_head=dict(num_classes=1))) #...
_base_ = '../cascade_rcnn/cascade_mask_rcnn_eff-B7_nasfpn_1x_coco.py' dataset_type = 'COCODataset' train_dir = '/media/feng/584A3B6F4A3B4950/dataset/fish_eye_pig/train' val_dir = '/media/feng/584A3B6F4A3B4950/dataset/fish_eye_pig/val' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_r...
strategy_type = "learning" config = { "strategy_id": "sdnnc", "name": "Standard DNN Classifier", "parameters": [ { "parameter_id": "layers", "label": "Number of layers", "type": "int", "required": True, "default_value": 5, }, ...
strategy_type = 'learning' config = {'strategy_id': 'sdnnc', 'name': 'Standard DNN Classifier', 'parameters': [{'parameter_id': 'layers', 'label': 'Number of layers', 'type': 'int', 'required': True, 'default_value': 5}, {'parameter_id': 'neurons', 'label': 'Number of neurons per layer', 'type': 'int', 'required': True...
def solution(h, q): if(h < 1 or h > 30): raise Exception("Invalid Argument : flux converter height should only take values between 1-30") root = 2**h - 1; #initialize a fixed size output array output = [None] * len(q); # for some speedup performance # if any of q is within a certain...
def solution(h, q): if h < 1 or h > 30: raise exception('Invalid Argument : flux converter height should only take values between 1-30') root = 2 ** h - 1 output = [None] * len(q) for i in range(0, len(q)): if q[i] >= root or q[i] <= 0: output[i] = -1 elif q[i] > root...
userOptions = { "user_actions": { "say_options": ["say", "sing", "chirp", "bark", "growl", "hum", "grunt", "burp", "giggle", "snicker", "click", "sign", "bubble", "yowl", "snap"], "plural_options": ["sings", "chirps", "barks", "growls", "hums", "grunts", "burps", "giggles", "snickers", "clicks", ...
user_options = {'user_actions': {'say_options': ['say', 'sing', 'chirp', 'bark', 'growl', 'hum', 'grunt', 'burp', 'giggle', 'snicker', 'click', 'sign', 'bubble', 'yowl', 'snap'], 'plural_options': ['sings', 'chirps', 'barks', 'growls', 'hums', 'grunts', 'burps', 'giggles', 'snickers', 'clicks', 'signs', 'bubbles', 'yow...
"""Exceptions used by Lbws.""" class LbwsException(Exception): """General Lbws exception occurred.""" pass class LbwsNotConnectedError(LbwsException): """Exception raised when method needs to be connected and it's not.""" def __init__(self): """Initialize the error.""" super().__in...
"""Exceptions used by Lbws.""" class Lbwsexception(Exception): """General Lbws exception occurred.""" pass class Lbwsnotconnectederror(LbwsException): """Exception raised when method needs to be connected and it's not.""" def __init__(self): """Initialize the error.""" super().__init_...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def partition(self, head, x): """ :type head: ListNode :type x: int :rtype: ListNode """ # smaller d1 = List...
class Solution: def partition(self, head, x): """ :type head: ListNode :type x: int :rtype: ListNode """ d1 = list_node(0) h1 = d1 d2 = list_node(0) h2 = d2 while head: if x > head.val: d1.next = list_node(h...
class Solution: def findJudge(self, N: int, trust: List[List[int]]) -> int: list1=[] for x in range(len(trust)): list1.append(trust[x][0]) list2=[] for x in range(len(trust)): list2.append(trust[x][1]) flag=0 for x in range(1,N+1): ...
class Solution: def find_judge(self, N: int, trust: List[List[int]]) -> int: list1 = [] for x in range(len(trust)): list1.append(trust[x][0]) list2 = [] for x in range(len(trust)): list2.append(trust[x][1]) flag = 0 for x in range(1, N + 1): ...
def menu(options): opLens = [len(i) for i in options] opLen = max(opLens) line = '_' * (22 + opLen) + '\n' flag = False while flag == False: print('Enter an option from the menu: ') print(line) for i in range(len(options)): print(' ' * 10 + str(i) + '...
def menu(options): op_lens = [len(i) for i in options] op_len = max(opLens) line = '_' * (22 + opLen) + '\n' flag = False while flag == False: print('Enter an option from the menu: ') print(line) for i in range(len(options)): print(' ' * 10 + str(i) + '. ' + optio...
"""For experiments on our CosaNostra Pizza domain. This file is meant for use in the sparse learning experiments.""" PDDL_DIR = '../problems/mine/cosanostra/' COMMON_PDDLS = ['cosanostra.pddl'] TRAIN_PDDLS = [ # remove two smallest problems to avoid need for special-case logic # 'problems/cosanostra-n1.pddl', ...
"""For experiments on our CosaNostra Pizza domain. This file is meant for use in the sparse learning experiments.""" pddl_dir = '../problems/mine/cosanostra/' common_pddls = ['cosanostra.pddl'] train_pddls = ['problems/cosanostra-n3.pddl', 'problems/cosanostra-n4.pddl', 'problems/cosanostra-n5.pddl'] train_names = None...
class FibRetracement: R0 = 0 R0_236 = 0.236 R0_382 = 0.382 R0_5 = 0.5 R0_618 = 0.618 R0_786 = 0.786 R1 = 1.0 R1_618 = 1.618 R2_618 = 2.618 R3_618 = 3.618 R4_236 = 4.236 @staticmethod def get_retracement_value(fib_coef, value): return value + value * fib_coef
class Fibretracement: r0 = 0 r0_236 = 0.236 r0_382 = 0.382 r0_5 = 0.5 r0_618 = 0.618 r0_786 = 0.786 r1 = 1.0 r1_618 = 1.618 r2_618 = 2.618 r3_618 = 3.618 r4_236 = 4.236 @staticmethod def get_retracement_value(fib_coef, value): return value + value * fib_coef
# This is a practice of string excercises implemented functionally class StringTool: # reverse a string @staticmethod def reversed(input_string): return "".join(reversed(input_string)) # check if a string is a palindrome @staticmethod def isPalindrome(input_string): return (reversed(input_stri...
class Stringtool: @staticmethod def reversed(input_string): return ''.join(reversed(input_string)) @staticmethod def is_palindrome(input_string): return reversed(input_string).lower() == input_string.lower() @staticmethod def test_palindrom(input_string): return '%(str...
# encoding: utf-8 # module Tekla.Structures.Model.UI calls itself UI # from Tekla.Structures.Model,Version=2017.0.0.0,Culture=neutral,PublicKeyToken=2f04dbe497b71114 # by generator 1.145 # no doc # no imports # no functions # classes class ClipPlane(object): """ ClipPlane() """ def Delete(self): """ ...
class Clipplane(object): """ ClipPlane() """ def delete(self): """ Delete(self: ClipPlane) -> bool """ pass def insert(self): """ Insert(self: ClipPlane) -> bool """ pass def modify(self): """ Modify(self: ClipPlane) -> bool """ pass location = prop...
plant_lookup = { 'C':'Clover', 'G':'Grass', 'R':'Radishes', 'V':'Violets' } defaultStudents = [ 'Alice', 'Bob', 'Charlie', 'David', 'Eve', 'Fred', 'Ginny', 'Harriet', 'Ileana', 'Joseph', 'Kincaid', 'Larry' ] class Garden: def __init__(self, diagram, students=None): if not stud...
plant_lookup = {'C': 'Clover', 'G': 'Grass', 'R': 'Radishes', 'V': 'Violets'} default_students = ['Alice', 'Bob', 'Charlie', 'David', 'Eve', 'Fred', 'Ginny', 'Harriet', 'Ileana', 'Joseph', 'Kincaid', 'Larry'] class Garden: def __init__(self, diagram, students=None): if not students: students =...
N_C = input().split() N = int(N_C[0]) C = int(N_C[1]) nums = input().split() for x in range(0, len(nums)): nums[x] = int(nums[x]) nums_dict = {} for element in nums: if element not in nums_dict: nums_dict[element] = 1 else: nums_dict[element] += 1 output = "" for w in sort...
n_c = input().split() n = int(N_C[0]) c = int(N_C[1]) nums = input().split() for x in range(0, len(nums)): nums[x] = int(nums[x]) nums_dict = {} for element in nums: if element not in nums_dict: nums_dict[element] = 1 else: nums_dict[element] += 1 output = '' for w in sorted(nums_dict, key=n...
def shell_sort(a): h = 4 while h >= 1: for i in range(h, len(a)): j = i while j >= h and a[j-h] > a[j]: a[j], a[j-h] = a[j-h], a[j] j -= h h //= 3 a = [54, 88, 77, 26, 93, 17, 49, 10, 17, 77, 11, 31, 22, 44, 17, 20] print(a) shell_sort(a) ...
def shell_sort(a): h = 4 while h >= 1: for i in range(h, len(a)): j = i while j >= h and a[j - h] > a[j]: (a[j], a[j - h]) = (a[j - h], a[j]) j -= h h //= 3 a = [54, 88, 77, 26, 93, 17, 49, 10, 17, 77, 11, 31, 22, 44, 17, 20] print(a) shell...
WELCOME_CONTROL_TOO_MANY_ARGS = "Too many arguments, did you forget to wrap multi-line arugments in quotes?\n" \ "Tip: You can use a backslash to escape quotes inside quotes `\\\"`" WELCOME_CONTROL_MISSING_ARG_1 = "`welcome toggle|add|remove|rm|list|set`" WELCOME_CONTROL_TOGGLE_ON = "Wel...
welcome_control_too_many_args = 'Too many arguments, did you forget to wrap multi-line arugments in quotes?\nTip: You can use a backslash to escape quotes inside quotes `\\"`' welcome_control_missing_arg_1 = '`welcome toggle|add|remove|rm|list|set`' welcome_control_toggle_on = 'Welcomes enabled.' welcome_control_toggle...
def parse_exists(compound, component): i = 4096; while i>0: if(compound - i >=0): compound-=i; if(i == component): return True; i/=2; return False;
def parse_exists(compound, component): i = 4096 while i > 0: if compound - i >= 0: compound -= i if i == component: return True i /= 2 return False
""" CSV Processor. """ __version__ = '2.1.2' default_app_config = 'super_csv.apps.SuperCSVConfig' # pylint: disable=invalid-name
""" CSV Processor. """ __version__ = '2.1.2' default_app_config = 'super_csv.apps.SuperCSVConfig'
# # PySNMP MIB module CISCO-ITP-GSCCP-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ITP-GSCCP-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:46:19 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, single_value_constraint, constraints_union, value_range_constraint) ...
def main(): x = input() for i in range(int(x)): y = input() int(y) print("These are the value that were inputed {}".format(y)) if __name__ == '__main__':main()
def main(): x = input() for i in range(int(x)): y = input() int(y) print('These are the value that were inputed {}'.format(y)) if __name__ == '__main__': main()
set_name(0x8013570C, "PreGameOnlyTestRoutine__Fv", SN_NOWARN) set_name(0x801377C0, "DRLG_PlaceDoor__Fii", SN_NOWARN) set_name(0x80137CA0, "DRLG_L1Shadows__Fv", SN_NOWARN) set_name(0x801380B0, "DRLG_PlaceMiniSet__FPCUciiiiiii", SN_NOWARN) set_name(0x80138524, "DRLG_SetWalls__Fv", SN_NOWARN) set_name(0x801385E0, "DRLG_L1...
set_name(2148751116, 'PreGameOnlyTestRoutine__Fv', SN_NOWARN) set_name(2148759488, 'DRLG_PlaceDoor__Fii', SN_NOWARN) set_name(2148760736, 'DRLG_L1Shadows__Fv', SN_NOWARN) set_name(2148761776, 'DRLG_PlaceMiniSet__FPCUciiiiiii', SN_NOWARN) set_name(2148762916, 'DRLG_SetWalls__Fv', SN_NOWARN) set_name(2148763104, 'DRLG_L1...
#!/usr/bin/python # coding: utf-8 ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'nobody'} DOCUMENTATION = """ --- module: cached_get_url author: - 'Gao Yuan (@altiplanogao)' short_description: get_url with local cache support. descrip...
ansible_metadata = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'nobody'} documentation = "\n---\nmodule: cached_get_url\nauthor:\n - 'Gao Yuan (@altiplanogao)'\nshort_description: get_url with local cache support.\ndescription:\n - When use get_url, the module will download file from remote s...
lines = [] fi = open('input.txt', 'r') for line in fi: lines.append(str(line)) fo = open('output.txt', 'w') for line in lines: print(str(line)) stripped = str(line).rstrip() parsedLine = "" for c in stripped: if c == "\"": parsedLine = parsedLine + "\\\"" else: ...
lines = [] fi = open('input.txt', 'r') for line in fi: lines.append(str(line)) fo = open('output.txt', 'w') for line in lines: print(str(line)) stripped = str(line).rstrip() parsed_line = '' for c in stripped: if c == '"': parsed_line = parsedLine + '\\"' else: ...
## 2. Sets ## gender = [] for legislator in legislators: gender.append(legislator[3]) gender = set(gender) print(gender) ## 3. Exploring the Dataset ## party = [] for legislator in legislators: party.append(legislator[6]) party = set(party) print(party) print(legislators) ## 4. Missing Values ##...
gender = [] for legislator in legislators: gender.append(legislator[3]) gender = set(gender) print(gender) party = [] for legislator in legislators: party.append(legislator[6]) party = set(party) print(party) print(legislators) for legislator in legislators: if legislator[3] == '': legislator[3] = '...
INF = 1e9 def get(s): prev = dict() x, y = s if s in prev: return prev[s] else: if x + y >= 77: return 0 mx = -INF mn = INF for i in [(x + 1, y), (x, y + 1), (x * 2, y), (x, y * 2)]: leng = get(i) if leng % 2 == 0: mn = min(mn, leng + 1) else: mx = max(mx, leng + 1) ...
inf = 1000000000.0 def get(s): prev = dict() (x, y) = s if s in prev: return prev[s] elif x + y >= 77: return 0 mx = -INF mn = INF for i in [(x + 1, y), (x, y + 1), (x * 2, y), (x, y * 2)]: leng = get(i) if leng % 2 == 0: mn = min(mn, leng + 1) ...
def merge_results(first: dict, second: dict) -> dict: first_drugs = first["drugs"] if "drugs" in first else {} second_drugs = second["drugs"] if "drugs" in second else {} first_genes = first["genes"] if "genes" in first else {} second_genes = second["genes"] if "genes" in second else {} for dru...
def merge_results(first: dict, second: dict) -> dict: first_drugs = first['drugs'] if 'drugs' in first else {} second_drugs = second['drugs'] if 'drugs' in second else {} first_genes = first['genes'] if 'genes' in first else {} second_genes = second['genes'] if 'genes' in second else {} for (drug, d...
T=input() T=int(T) for i in range(T): a,b=map(int,input().split()) print(a+b)
t = input() t = int(T) for i in range(T): (a, b) = map(int, input().split()) print(a + b)
def add(x, y): return x + y def diff(x, y): return x - y def multiple(x, y): return x * y def get_x(x,y): return x def get_y(x,y): return y def x_is_greater_than_y(x,y): return (x > y) * 1.0
def add(x, y): return x + y def diff(x, y): return x - y def multiple(x, y): return x * y def get_x(x, y): return x def get_y(x, y): return y def x_is_greater_than_y(x, y): return (x > y) * 1.0
#DeleteEmployeeScreenStringsEnglish ADD_EXPENDITURE_HELP_TEXT = u"Here you can add expenditure to the total expenditure." ADMIN_PASS_INCORRECT = u"The Administrator password was incorrect." EMP_CODE_MISMATCH_TEXT = u"The Employee codes don't match." ENTER_ADMIN_PASS_TEXT = u"Administrator Password: " CODE_ONE_TEXT = u...
add_expenditure_help_text = u'Here you can add expenditure to the total expenditure.' admin_pass_incorrect = u'The Administrator password was incorrect.' emp_code_mismatch_text = u"The Employee codes don't match." enter_admin_pass_text = u'Administrator Password: ' code_one_text = u'Enter Employee Code: ' code_two_text...
basket = ['a','b','c','d','e'] #adding new_list = basket.extend([100]) #print(new_list) print(new_list) #removing basket.pop() #Finding values print('b' in basket) print('v' in basket) #You an also search in String with 'in' print('hi' in 'hi im a little drunk')
basket = ['a', 'b', 'c', 'd', 'e'] new_list = basket.extend([100]) print(new_list) basket.pop() print('b' in basket) print('v' in basket) print('hi' in 'hi im a little drunk')
# Knapsack problem # given a a Lmiting Weight,list of values and weights # construct a matrix whose element at i,j denotes the maximum value possible by considering items 0 to item i # with maximum weight constraint = j # Final matrix to look something like this (if value and weights are used as defined): ...
values = [0] + [10, 40, 30, 50] weights = [0] + [5, 4, 6, 3] max_weight = 10 def initialise_matrix(row, column): matrix = [[]] * row for i in range(row): matrix[i] = [0] * (column + 1) return matrix def knapsack(matrix, values, weights, max_weight): for i in range(len(values)): for j i...
class Solution: # @param A : tuple of integers # @param B : tuple of integers # @param C : tuple of integers # @return an integer def minimize(self, A, B, C): i = 0 j = 0 k = 0 best = 9999999999 while True: m = min([A[i], B[j],...
class Solution: def minimize(self, A, B, C): i = 0 j = 0 k = 0 best = 9999999999 while True: m = min([A[i], B[j], C[k]]) best = min(best, max([abs(A[i] - B[j]), abs(B[j] - C[k]), abs(C[k] - A[i])])) if A[i] == m and i < len(A) - 1: ...
# (C) Datadog, Inc. 2021-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) def initialize_instance(values, **kwargs): filters = values.setdefault('filters', {}) if filters: if isinstance(filters, dict) and 'type' in filters: types = filters['type'] ...
def initialize_instance(values, **kwargs): filters = values.setdefault('filters', {}) if filters: if isinstance(filters, dict) and 'type' in filters: types = filters['type'] if isinstance(types, list): for (i, event_type) in enumerate(types): i...
def reverse(x): str = '' for i in x: str = i + str return str x = input('Masukkan sesuatu: ') print('String original: ',end = '') print(x) print('String Reverse: ',end = '') print(reverse(x))
def reverse(x): str = '' for i in x: str = i + str return str x = input('Masukkan sesuatu: ') print('String original: ', end='') print(x) print('String Reverse: ', end='') print(reverse(x))
#! /usr/bin/env python3.8 def myAdd(a,b): return a + b def mySub(a,b): return a - b def main(): print (myAdd(1, 2)) # if the module is being invoked by itself if __name__ == "__main__": main()
def my_add(a, b): return a + b def my_sub(a, b): return a - b def main(): print(my_add(1, 2)) if __name__ == '__main__': main()
name = input() # Save the identity number of `name` here id_card = id(name)
name = input() id_card = id(name)
def read_file(filename:str) -> str: with open(filename) as a: return a.read() def write_file(filename:str, content:str) -> None: with open(filename, 'w') as a: a.write(content) return
def read_file(filename: str) -> str: with open(filename) as a: return a.read() def write_file(filename: str, content: str) -> None: with open(filename, 'w') as a: a.write(content) return
TRAINING_FILENAME = '../../classification/training-simplified-data-generation.csv' THETA = 0.0 SEPARATOR = ',' RENAME_NUMERICAL = False MEAN_DATA_IMPUTATION = True CLASS_ATTRIBUTE_NAME = 'class_pos_neg' DATASET_FEATURES = ['query_num_of_columns', 'query_num_of_rows', 'query_row_column_ratio', 'query_max_mean', 'query...
training_filename = '../../classification/training-simplified-data-generation.csv' theta = 0.0 separator = ',' rename_numerical = False mean_data_imputation = True class_attribute_name = 'class_pos_neg' dataset_features = ['query_num_of_columns', 'query_num_of_rows', 'query_row_column_ratio', 'query_max_mean', 'query_m...
def Multiply(x,y): z = x * y print("Answer: ",z) def Divide(x,y): if y != 0: z = x / y print("Answer: ",z) else: print("Division by 0 is not defined") def Add(x,y): z = x + y print("Answer: ",z) def Subtract(x,y): z = x - y print("Answer: ",z) ch = "...
def multiply(x, y): z = x * y print('Answer: ', z) def divide(x, y): if y != 0: z = x / y print('Answer: ', z) else: print('Division by 0 is not defined') def add(x, y): z = x + y print('Answer: ', z) def subtract(x, y): z = x - y print('Answer: ', z) ch = 'y' ...
def null_count(df): return df.isnull().sum().sum() def list_to_series(list_to_series, df): df = pd.Series(list_tp_series) return df
def null_count(df): return df.isnull().sum().sum() def list_to_series(list_to_series, df): df = pd.Series(list_tp_series) return df
""" sentry.client.celery.conf ~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ class SentryCeleryConfig(object): CELERY_ROUTING_KEY = 'sentry'
""" sentry.client.celery.conf ~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ class Sentryceleryconfig(object): celery_routing_key = 'sentry'
# average of sum of lists m = [1,43,656,8,54,908,4,5,23,78,435,89,45,476,89] n = [234,56,90,675,56,786,90,564,8,657,87,64,354,2,75] q = [34,76,76,564,34,32,16,67,25,98,90,345,235,64,134,76] def avgSums(a,b,c): summingUp = sum(a) + sum(b) + sum(c) summed = summingUp / 3 return(summed) print(avgSums(m,n,q)) #...
m = [1, 43, 656, 8, 54, 908, 4, 5, 23, 78, 435, 89, 45, 476, 89] n = [234, 56, 90, 675, 56, 786, 90, 564, 8, 657, 87, 64, 354, 2, 75] q = [34, 76, 76, 564, 34, 32, 16, 67, 25, 98, 90, 345, 235, 64, 134, 76] def avg_sums(a, b, c): summing_up = sum(a) + sum(b) + sum(c) summed = summingUp / 3 return summed pr...
class Solution: def sortArrayByParityII(self, A): for n, a in enumerate(A): if (a - n) % 2 != 0: i = n + 1 while i < len(A): if (A[i] - i) % 2 != 0: A[n] = A[i] A[i] = a br...
class Solution: def sort_array_by_parity_ii(self, A): for (n, a) in enumerate(A): if (a - n) % 2 != 0: i = n + 1 while i < len(A): if (A[i] - i) % 2 != 0: A[n] = A[i] A[i] = a ...
# CREATING A MATRIX # DO NOT MODIFY. IT MAY BREAK OTHER FILES r = int(input('Enter the number of rows')) c = int(input('Enter the number of columns')) matrix = [] for i in range(r): row = [] for j in range(c): row.append(int(input(f'Enter number {j}'))) matrix.append(row) for i in range(...
r = int(input('Enter the number of rows')) c = int(input('Enter the number of columns')) matrix = [] for i in range(r): row = [] for j in range(c): row.append(int(input(f'Enter number {j}'))) matrix.append(row) for i in range(r): for j in range(c): print(matrix[i][j], end=' ') print(...
def print_zigzag(string, k): string_dict = dict() for row in range(k): string_dict[row] = "" crow = 0 direction = -1 for i in range(len(string)): for row in range(k): if row == crow: string_dict[row] += string[i] else: string_...
def print_zigzag(string, k): string_dict = dict() for row in range(k): string_dict[row] = '' crow = 0 direction = -1 for i in range(len(string)): for row in range(k): if row == crow: string_dict[row] += string[i] else: string_di...
def counter(s, l): word = str(s) valueToCheck = str(l) count = 0 for letter in word: if letter == valueToCheck : count += 1 print(f'{letter} = {count}') counter ('banana', 'a') counter ('payal', 'p')
def counter(s, l): word = str(s) value_to_check = str(l) count = 0 for letter in word: if letter == valueToCheck: count += 1 print(f'{letter} = {count}') counter('banana', 'a') counter('payal', 'p')
def bSearch(ind,val,l,r): ans = ind while r>=l: m = (r+l)//2 if s[m]>val: ans = m; r = m-1 else: l = m+1 return ans for _ in range(int(input())): n = int(input()) a = list(map(int,input().split())) s = []; size = 1 s.append(a[0]) for i...
def b_search(ind, val, l, r): ans = ind while r >= l: m = (r + l) // 2 if s[m] > val: ans = m r = m - 1 else: l = m + 1 return ans for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) s = [] size = 1 ...
# "Naive" Implementation of the knapsack problem # Purpose is if having a bunch of items with a weight and corresponding value to each object. # Which collection of objects should we choose such that we maximize the value restricted to # a specific capacity of weight? # Programmed by Aladdin Persson <aladdin dot pers...
def knapsack(n, C, W, v, items): if n == 0 or C == 0: return (0, []) elif W[n - 1] > C: (result, items) = knapsack(n - 1, C, W, v, items) else: (tmp1, items1) = knapsack(n - 1, C, W, v, items) (tmp2, items2) = knapsack(n - 1, C - W[n - 1], W, v, items) items = items2 ...
# -*-coding:utf8-*- __all__ = 'conf' class Settings(object): def __init__(self): self.config = dict( TABLE_PREFIX='' ) def __getitem__(self, key): return self.config[key] def get(self, key, default=None): return self.config.get(key, default) def load_set...
__all__ = 'conf' class Settings(object): def __init__(self): self.config = dict(TABLE_PREFIX='') def __getitem__(self, key): return self.config[key] def get(self, key, default=None): return self.config.get(key, default) def load_settings_from(self, settings): self.co...
# variables.................................................................................................................................. price = 10 #int rating = 4.7 #float name = "Vishnu Deepak" #str is_programmer = True #boolean line = "-" * 26 # Formated strin...
price = 10 rating = 4.7 name = 'Vishnu Deepak' is_programmer = True line = '-' * 26 combo = 'Gig price = $' + str(price) + ' \nrating = ' + str(rating) + ' \nName = ' + name + ' \nIs a Programmer ? = ' + str(is_programmer) + '' combo1 = f'Gig price = ${price} \nrating = {rating} \nName = {name} \nIs a Programmer ? = {i...
variants = open('variants.sql') output = open('variants2.sql', 'w') flag = False c_lines = 0 for line in variants: if flag: output.writelines(line) c_lines+=1 if line.startswith('COPY'): flag=True if line.startswith('\.'): break print(c_lines)
variants = open('variants.sql') output = open('variants2.sql', 'w') flag = False c_lines = 0 for line in variants: if flag: output.writelines(line) c_lines += 1 if line.startswith('COPY'): flag = True if line.startswith('\\.'): break print(c_lines)
"""GitPlanExceptions @author Rory Byrne <rory@rory.bio """ class GitPlanException(Exception): """Base exception for git plan""" class CommandNotFound(GitPlanException): """Command doesn't exist""" class NotInitialized(GitPlanException): """The repo was not initialized""" class AlreadyInitialized(Gi...
"""GitPlanExceptions @author Rory Byrne <rory@rory.bio """ class Gitplanexception(Exception): """Base exception for git plan""" class Commandnotfound(GitPlanException): """Command doesn't exist""" class Notinitialized(GitPlanException): """The repo was not initialized""" class Alreadyinitialized(GitPla...
class FeatureSchema: """ Describes the schema used to persist a FeatureModel, which may vary based on the particular backend in use (AGO vs Enterprise). """ def __init__(self, feature_layer): """ Initializes a new FeatureSchema. :param feature_layer: The FeatureLayer used to p...
class Featureschema: """ Describes the schema used to persist a FeatureModel, which may vary based on the particular backend in use (AGO vs Enterprise). """ def __init__(self, feature_layer): """ Initializes a new FeatureSchema. :param feature_layer: The FeatureLayer used to per...
class ColTypes: def __init__(self): self.coltypes = {} def add_coltype(self, name, coltype, **kwargs): kwargs['type'] = coltype self.coltypes[name] = kwargs def get_coltypes(self): return self.coltypes
class Coltypes: def __init__(self): self.coltypes = {} def add_coltype(self, name, coltype, **kwargs): kwargs['type'] = coltype self.coltypes[name] = kwargs def get_coltypes(self): return self.coltypes
# -*- coding: utf-8 -*- """ Fallback to given title when no title/artist detected """ def fallback_title(title): """ Fallback method """ def fallback_t(artist): return [artist, title] return fallback_t
""" Fallback to given title when no title/artist detected """ def fallback_title(title): """ Fallback method """ def fallback_t(artist): return [artist, title] return fallback_t
{ 'variables': { 'os%': 'linux', }, 'targets': [ { 'target_name': 'btree', 'type': 'static_library', 'include_dirs': [ 'include', ], 'direct_dependent_settings': { 'include_dirs': [ 'include', ], }, 'cflags': [ '-std=c99', '-pedantic', '-pthread', '-O3' ], 'ldflags': [ '-pthread' ], '...
{'variables': {'os%': 'linux'}, 'targets': [{'target_name': 'btree', 'type': 'static_library', 'include_dirs': ['include'], 'direct_dependent_settings': {'include_dirs': ['include']}, 'cflags': ['-std=c99', '-pedantic', '-pthread', '-O3'], 'ldflags': ['-pthread'], 'defines': ['_LARGEFILE_SOURCE', '_FILE_OFFSET_BITS=64'...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Statistical tests for SERMeQ Created on Wed May 27 21:39:28 2020 Namespace of Greenland-annual_dL_comparison for now @author: EHU """ ## Regular set--"un-futzed" glaciers corrs = [] spearmans = [] kendalls = [] zero_compare = [] for gid in glaciers_to_plot: tc = ...
""" Statistical tests for SERMeQ Created on Wed May 27 21:39:28 2020 Namespace of Greenland-annual_dL_comparison for now @author: EHU """ corrs = [] spearmans = [] kendalls = [] zero_compare = [] for gid in glaciers_to_plot: tc = -1000 * termpos_corrections[gid] sim_termini = np.take(full_output_dicts['persist...
#!/usr/bin/env python3 # I'd like to eventually create a sort of histogram to show area's of motif enrichment in the genome # Below is my testing of that # Calculating position of each DNA motif test_seq = 'GATACGATTAAAAATCTCAAAAGCACCAGATCGA' test_seq.find('TCTC') # only finds the first occurance # List comprehensi...
test_seq = 'GATACGATTAAAAATCTCAAAAGCACCAGATCGA' test_seq.find('TCTC') t = [i for (i, j) in enumerate('TAAT') if j == 'T'] a = [i for (i, j) in enumerate('TAAT') if j == 'A'] seq = '' for record in SeqIO.parse('k12-gdna.fna', 'fasta'): seq = record.seq seq_sm = seq[:int(len(seq) / 1000)] len(seq_sm) test_dict = {'A'...
def read_next(*args): for element in args: for char in element: yield char for item in read_next('string', (2,), {'d': 1, 'i': 2, 'c': 3, 't': 4}): print(item, end='')
def read_next(*args): for element in args: for char in element: yield char for item in read_next('string', (2,), {'d': 1, 'i': 2, 'c': 3, 't': 4}): print(item, end='')
# map() in python numbers = [1, 2, 3, 4, 5] # Convert to doubles print("------------------") # Way 1 doubles1 = [2, 4, 6, 8, 10] print("------------------") # Way 2 for num in numbers: doubles1.append(num * 2) print(doubles1) print("------------------") # Way 3 doubles3 = map(lambda x: ...
numbers = [1, 2, 3, 4, 5] print('------------------') doubles1 = [2, 4, 6, 8, 10] print('------------------') for num in numbers: doubles1.append(num * 2) print(doubles1) print('------------------') doubles3 = map(lambda x: x * 2, numbers) print(list(doubles3)) print(list(doubles3)) print('------------------') name...
#program to find the sum of the first n positive integers. x = int(input('enter a number: ')) count = 0 for i in range(x+1): count += i print('The result is:', count)
x = int(input('enter a number: ')) count = 0 for i in range(x + 1): count += i print('The result is:', count)
# # @lc app=leetcode id=401 lang=python3 # # [401] Binary Watch # # @lc code=start class Solution: def readBinaryWatch(self, num): self.ans_ls = [] self.helper(num, 0, []) ans = [] for item in self.ans_ls: m = 0 h = 0 for num in item: ...
class Solution: def read_binary_watch(self, num): self.ans_ls = [] self.helper(num, 0, []) ans = [] for item in self.ans_ls: m = 0 h = 0 for num in item: if num >= 4: num -= 4 m += 1 << num ...
# Copyright 2021 The XLS Authors # # 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 in writ...
"""This module contains oss configurations for XLS build rules.""" config = {'xls_outs_attrs': {'outs': attr.string_list(doc='The list of generated files.')}} def enable_generated_file_wrapper(**kwargs): """The function is a placeholder for enable_generated_file_wrapper. The function is intended to be empty. ...
def lambda_handler(event, context): print('event:', event) print('context:', context) return True
def lambda_handler(event, context): print('event:', event) print('context:', context) return True
def sort(arr: list) -> None: target = None cursor = 0 for i in range(1, len(arr)): target = arr[i] for cursor in range(i, 0, -1): if arr[cursor - 1] <= target: break arr[cursor] = arr[cursor - 1] else: cursor = 0 arr[curso...
def sort(arr: list) -> None: target = None cursor = 0 for i in range(1, len(arr)): target = arr[i] for cursor in range(i, 0, -1): if arr[cursor - 1] <= target: break arr[cursor] = arr[cursor - 1] else: cursor = 0 arr[cursor]...
class Solution(object): def missingNumber(self, nums): """ :type nums: List[int] :rtype: int """ nums.sort() k=-1 for i in range(len(nums)): if(i!=nums[i]): k=i break if(k==-1): return(i+1) ...
class Solution(object): def missing_number(self, nums): """ :type nums: List[int] :rtype: int """ nums.sort() k = -1 for i in range(len(nums)): if i != nums[i]: k = i break if k == -1: return i +...
dic={} gols=[] dic['nome']=input('nome do jogador: ') jogos=int(input(f'numero de partidas de {dic["nome"]}: ')) for l in range(0,jogos): gols.append(int(input(f'quantos gols na partida {l+1}: '))) dic['gols']=gols dic['total']=jogos print('=-'*30) print(f'O jogador {dic["nome"]} jogou um total de {dic["total"]} jo...
dic = {} gols = [] dic['nome'] = input('nome do jogador: ') jogos = int(input(f"numero de partidas de {dic['nome']}: ")) for l in range(0, jogos): gols.append(int(input(f'quantos gols na partida {l + 1}: '))) dic['gols'] = gols dic['total'] = jogos print('=-' * 30) print(f"O jogador {dic['nome']} jogou um total de ...
## Leia um valor em metros e exiba convertido em milimetros m = float(input('Insira uma medida em metros: ')) c = m * 100 print(f'{m:.2f} metros equivale a {c:.2f} centimetros' f'\nE equivale a {m*1000:.2f} milimetros')
m = float(input('Insira uma medida em metros: ')) c = m * 100 print(f'{m:.2f} metros equivale a {c:.2f} centimetros\nE equivale a {m * 1000:.2f} milimetros')
"""lambda function""" def get_lambda(): return lambda x,y: x+y def get_lambdas(): return [lambda a,b: a+b, lambda x,y: x+y] def call_lambda( F ): return F() def call_lambda2( callback=None ): return callback() def main(): f = lambda a,b: a+b TestError( f(1,2) == 3 ) TestError( (lambda a,b: a+b)(1,2) == 3 )...
"""lambda function""" def get_lambda(): return lambda x, y: x + y def get_lambdas(): return [lambda a, b: a + b, lambda x, y: x + y] def call_lambda(F): return f() def call_lambda2(callback=None): return callback() def main(): f = lambda a, b: a + b test_error(f(1, 2) == 3) test_error((...
class Solution: def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ dp = [nums[0]] for num in nums[1:]: if dp[-1] < 0: dp.append(num) elif dp[-1] + num > 0: dp.append(dp[-1] + num) ...
class Solution: def max_sub_array(self, nums): """ :type nums: List[int] :rtype: int """ dp = [nums[0]] for num in nums[1:]: if dp[-1] < 0: dp.append(num) elif dp[-1] + num > 0: dp.append(dp[-1] + num) ...
def brute_force(pattern, text): matches = [] for i in range(len(text) - len(pattern) + 1): different = False for j in range(len(pattern)): if pattern[j] != text[i + j]: different = True break if not different: matches.append(i) ...
def brute_force(pattern, text): matches = [] for i in range(len(text) - len(pattern) + 1): different = False for j in range(len(pattern)): if pattern[j] != text[i + j]: different = True break if not different: matches.append(i) ...
def getOutShape(input_dim, layersList): """ params: input_dim : A tupple (in_channels,H_in,W_in) layersList : A list of dictionaries for each layer. """ in_ch, H_in, W_in = input_dim out_ch_prev = in_ch out_ch = in_ch for layer in layersList: for type_, params in layer.item...
def get_out_shape(input_dim, layersList): """ params: input_dim : A tupple (in_channels,H_in,W_in) layersList : A list of dictionaries for each layer. """ (in_ch, h_in, w_in) = input_dim out_ch_prev = in_ch out_ch = in_ch for layer in layersList: for (type_, params) in layer....
class yrange: def __init__(self, n): self.i = 0 self.n = n def __iter__(self): return self def next(self): if self.i < self.n: i = self.i self.i += 1 return i else: raise StopIteration() def borrar(self): f...
class Yrange: def __init__(self, n): self.i = 0 self.n = n def __iter__(self): return self def next(self): if self.i < self.n: i = self.i self.i += 1 return i else: raise stop_iteration() def borrar(self): ...
list1 = ['1','2','3'] list3 = list1 print(list1 is list3) print(list1 == list3) print(id(list1) == id(list3))
list1 = ['1', '2', '3'] list3 = list1 print(list1 is list3) print(list1 == list3) print(id(list1) == id(list3))
''' Here is an example API that you could implement: :download:`download my_api.py <../examples/subclassing/my_api.py>` .. literalinclude:: ../examples/subclassing/my_api.py A user can now use your custom version of the DataFS API: .. code-block:: python >>> from my_api import MyAPI >>> >>> my_api = My...
""" Here is an example API that you could implement: :download:`download my_api.py <../examples/subclassing/my_api.py>` .. literalinclude:: ../examples/subclassing/my_api.py A user can now use your custom version of the DataFS API: .. code-block:: python >>> from my_api import MyAPI >>> >>> my_api = My...
class ProxySorting: """ ProxySorting class represents the proxy sorting method. """ def __init__(self, id, name, criterion): self.id = id self.name = name self.criterion = criterion
class Proxysorting: """ ProxySorting class represents the proxy sorting method. """ def __init__(self, id, name, criterion): self.id = id self.name = name self.criterion = criterion
""" Simple script to output .obj file from raw source code mesh data. This was needed because original .obj file was lost... """ # Mesh vertex data goes here: screen_mesh = { 'v': [-0.94531,-0.69442,-0.09204,-0.92179,-0.70385,-0.08774,-0.95354,-0.67555,-0.09366,-0.9504,-0.68597,-0.09303,-0.95584,-0.65062,-0.09413,-0.9...
""" Simple script to output .obj file from raw source code mesh data. This was needed because original .obj file was lost... """ screen_mesh = {'v': [-0.94531, -0.69442, -0.09204, -0.92179, -0.70385, -0.08774, -0.95354, -0.67555, -0.09366, -0.9504, -0.68597, -0.09303, -0.95584, -0.65062, -0.09413, -0.92179, -0.65072, -...
# required by conversation module NO_DATA_VALUE = 0.0 DATA_BANDS = 1 SPEED_OF_LIGHT_METRES_PER_SECOND = 3e8 DAYS_PER_YEAR = 365.25 # span of year, not a calendar year GDAL_CACHE_MAX = 2**15 GDAL_WARP_MEMORY_LIMIT = 2**10
no_data_value = 0.0 data_bands = 1 speed_of_light_metres_per_second = 300000000.0 days_per_year = 365.25 gdal_cache_max = 2 ** 15 gdal_warp_memory_limit = 2 ** 10
def logger(*arg): string = '' for one_arg in arg: string = string + '---' + str(one_arg) print('Log: ', string) with open('Log.html', 'a') as file: file.write('<div class="line">' + string + '</div>')
def logger(*arg): string = '' for one_arg in arg: string = string + '---' + str(one_arg) print('Log: ', string) with open('Log.html', 'a') as file: file.write('<div class="line">' + string + '</div>')
#!/usr/bin/python3 class SessionKey(object): SESSION_KEY_TIMESTAMP = 'timestamp' SESSION_KEY_ROLE = 'role' SESSION_KEY_ACCOUNT = 'account' SESSION_KEY_USERNAME = 'username' SESSION_KEY_NICKNAME = 'nickname' SESSION_KEY_SESSION_ID = 'session_id'
class Sessionkey(object): session_key_timestamp = 'timestamp' session_key_role = 'role' session_key_account = 'account' session_key_username = 'username' session_key_nickname = 'nickname' session_key_session_id = 'session_id'
''' # phone pick_point 0.75556, -0.04087, -0.23920 pick_normal -0.79761, 0.29078, 0.52846 dist_to_previous_point 0.000000 # toothpaste pick_point 0.66325, -0.12406, -0.11679 pick_normal -0.46777, -0.05299, 0.88226 dist_to_previous_point 0.174430 # oil bottle pick_point 0.78493, -0.03217, -0.01731 pick_normal -0.6309...
""" # phone pick_point 0.75556, -0.04087, -0.23920 pick_normal -0.79761, 0.29078, 0.52846 dist_to_previous_point 0.000000 # toothpaste pick_point 0.66325, -0.12406, -0.11679 pick_normal -0.46777, -0.05299, 0.88226 dist_to_previous_point 0.174430 # oil bottle pick_point 0.78493, -0.03217, -0.01731 pick_normal -0.6309...
def computeIsStrongVertex(graph, vertex): connectedVertices1 = graph[vertex] for connectedVertex in connectedVertices1: connectedVertices2 = graph[connectedVertex] overlap = connectedVertices1.intersection(connectedVertices2) if overlap: return True return False while ...
def compute_is_strong_vertex(graph, vertex): connected_vertices1 = graph[vertex] for connected_vertex in connectedVertices1: connected_vertices2 = graph[connectedVertex] overlap = connectedVertices1.intersection(connectedVertices2) if overlap: return True return False whi...
TUTORIALS_APPS = ( 'wagtail.wagtailforms', 'wagtail.wagtailredirects', 'wagtail.wagtailembeds', 'wagtail.wagtailsites', 'wagtail.wagtailusers', 'wagtail.wagtailsnippets', 'wagtail.wagtaildocs', 'wagtail.wagtailimages', 'wagtail.wagtailsearch', ...
tutorials_apps = ('wagtail.wagtailforms', 'wagtail.wagtailredirects', 'wagtail.wagtailembeds', 'wagtail.wagtailsites', 'wagtail.wagtailusers', 'wagtail.wagtailsnippets', 'wagtail.wagtaildocs', 'wagtail.wagtailimages', 'wagtail.wagtailsearch', 'wagtail.wagtailadmin', 'wagtail.wagtailcore', 'modelcluster', 'wagtail.contr...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def calculator(op, a, b): if op == '+': return a + b elif op == '-': return a - b elif op == '*': return a * b elif op == '/': return a / b def some_func(): '''This function is not tested''' do = 'something' h...
def calculator(op, a, b): if op == '+': return a + b elif op == '-': return a - b elif op == '*': return a * b elif op == '/': return a / b def some_func(): """This function is not tested""" do = 'something' here = ... for i in range(10): b = i + ...
n = int(input()) for i in range(n): p = int(input()) p_num = 0 while p>0: p_num += 0.5 p_num *= 2 p -= 1 print(int(p_num))
n = int(input()) for i in range(n): p = int(input()) p_num = 0 while p > 0: p_num += 0.5 p_num *= 2 p -= 1 print(int(p_num))
#Solution for CodeChef September 2020 Division 2 Long Challenge #https://www.codechef.com/SEPT20B/problems/CRDGAME2 #author: kvv1618 # cook your dish here mod=1000000007 def ncr(n, r, p): num = den = 1 for i in range(r): num = (num * (n - i)) % p den = (den * (i + 1)) % p return (num * ...
mod = 1000000007 def ncr(n, r, p): num = den = 1 for i in range(r): num = num * (n - i) % p den = den * (i + 1) % p return num * pow(den, p - 2, p) % p return C[r] t = int(input()) for j in range(t): n = int(input()) v = list(map(int, input().split())) m = max(v) d = 0 ...
accounts = [{"name": "id", "type": "varchar(256)"}, {"name": "name", "type": "varchar(256)"}, {"name": "tracked_subscription_id", "type": "varchar(256)"}, {"name": "sfdc_id", "type": "varchar(256)"}, {"name": "last_seen_...
accounts = [{'name': 'id', 'type': 'varchar(256)'}, {'name': 'name', 'type': 'varchar(256)'}, {'name': 'tracked_subscription_id', 'type': 'varchar(256)'}, {'name': 'sfdc_id', 'type': 'varchar(256)'}, {'name': 'last_seen_date', 'type': 'timestamp'}, {'name': 'duns_number', 'type': 'varchar(256)'}, {'name': 'industry', '...
def eratosthenes2(n): multiples = set() for i in range(2, n+1): if i not in multiples: yield i multiples.update(list(range(i*i, n+1, i))) print((list(eratosthenes2(100))))
def eratosthenes2(n): multiples = set() for i in range(2, n + 1): if i not in multiples: yield i multiples.update(list(range(i * i, n + 1, i))) print(list(eratosthenes2(100)))
####################### # question 1 def hello(): print("Hello World") ####################### # question 2 def name_func(name): print(f"Hi my name is {name}") ####################### # question 3 def num_func2(x, y, z): if z == True: return x else: return y ####################...
def hello(): print('Hello World') def name_func(name): print(f'Hi my name is {name}') def num_func2(x, y, z): if z == True: return x else: return y def product(x, y): return x * y def is_even(x): return True if x % 2 == 0 else False print(is_even(3)) def is_greater(x, y): ...
def calculate_shipping(): print("calculate shipping") # import ecommerce.shipping
def calculate_shipping(): print('calculate shipping')
class Product: def __init__(self, id, name, image, old_price, price, description, installments, value): self._id = id self.name = name self.image = image self.old_price = old_price self.price = price self.description = description self.installments = installme...
class Product: def __init__(self, id, name, image, old_price, price, description, installments, value): self._id = id self.name = name self.image = image self.old_price = old_price self.price = price self.description = description self.installments = installm...
class Solution: def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]: maxn = max(candies) return [x+extraCandies >= maxn for x in candies]
class Solution: def kids_with_candies(self, candies: List[int], extraCandies: int) -> List[bool]: maxn = max(candies) return [x + extraCandies >= maxn for x in candies]
class Plugin: def __init__(self,stuff): self.parms=stuff def find(self): self.parms[3].insert(0.0,"find not finished")
class Plugin: def __init__(self, stuff): self.parms = stuff def find(self): self.parms[3].insert(0.0, 'find not finished')
#!/usr/bin/env python3 def max_palindrome_product(max_number: int) ->int: """ Gets the maximum product of two numbers less than the given maximum that is a palindrome :param max_number: The maximum value of the two numbers :returns: The largest palindromic number """ palindromes = [] ...
def max_palindrome_product(max_number: int) -> int: """ Gets the maximum product of two numbers less than the given maximum that is a palindrome :param max_number: The maximum value of the two numbers :returns: The largest palindromic number """ palindromes = [] for x in range(max_numbe...
def parse_query(args): result = {} q = "" for key, val in args.items(): if len(val) == 0: q += key continue if val == 'True': val = True if val == 'False': val = False result[key] = val if q is None: return result ...
def parse_query(args): result = {} q = '' for (key, val) in args.items(): if len(val) == 0: q += key continue if val == 'True': val = True if val == 'False': val = False result[key] = val if q is None: return result ...
def txtreader(): f = open("cameras.txt", "r") camera_list = f.readlines() f.close() for element in itertools.cycle(camera_list): print(element) element = element.split(",") cameraName = element[0] cameraIP = element[1] threshold = element[2] lat = eleme...
def txtreader(): f = open('cameras.txt', 'r') camera_list = f.readlines() f.close() for element in itertools.cycle(camera_list): print(element) element = element.split(',') camera_name = element[0] camera_ip = element[1] threshold = element[2] lat = elemen...
# Various helpful routines def safeTeXstring(s): mappings = { '#': r'\#', '_': r'\_' } for key, val in mappings.items(): s = s.replace(key, val) return s
def safe_te_xstring(s): mappings = {'#': '\\#', '_': '\\_'} for (key, val) in mappings.items(): s = s.replace(key, val) return s
class Field: def __init__(self): self.drunk_coordinates = {} def add_drunk(self, drunk, coordinate): self.drunk_coordinates[drunk] = coordinate def move_drunk(self, drunk): delta_x, delta_y = drunk.walk() current_coordinate = self.drunk_coordinates[drunk] new_coordinate = current_coordinat...
class Field: def __init__(self): self.drunk_coordinates = {} def add_drunk(self, drunk, coordinate): self.drunk_coordinates[drunk] = coordinate def move_drunk(self, drunk): (delta_x, delta_y) = drunk.walk() current_coordinate = self.drunk_coordinates[drunk] new_coo...
class BaseState: state = None communicator = None uartObserver = None def __init__(self, communicator, uartObserver): self.communicator = communicator self.uartObserver = uartObserver def get_state(self): return self.state def run(self): print("BaseState run")...
class Basestate: state = None communicator = None uart_observer = None def __init__(self, communicator, uartObserver): self.communicator = communicator self.uartObserver = uartObserver def get_state(self): return self.state def run(self): print('BaseState run')...