content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class IConvertible: """ Defines methods that convert the value of the implementing reference or value type to a common language runtime type that has an equivalent value. """ def GetTypeCode(self): """ GetTypeCode(self: IConvertible) -> TypeCode Returns the System.TypeCode for this instance. Re...
class Iconvertible: """ Defines methods that convert the value of the implementing reference or value type to a common language runtime type that has an equivalent value. """ def get_type_code(self): """ GetTypeCode(self: IConvertible) -> TypeCode Returns the System.TypeCode for this instance...
img_wink_png_map = bytes([ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x32, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x3f, 0x88, 0xb1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0...
img_wink_png_map = bytes([137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 50, 0, 0, 0, 50, 8, 6, 0, 0, 0, 30, 63, 136, 177, 0, 0, 0, 6, 98, 75, 71, 68, 0, 255, 0, 255, 0, 255, 160, 189, 167, 147, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, 19, 0, 0, 11, 19, 1, 0, 154, 156, 24, 0, 0, 0, 7, 116, 73, 77...
for i in range(1,16+1): if i%3==0 or i%5==0: print('fizz'*(i%3==0) + 'buzz'*(i%5==0)) else: print(i)
for i in range(1, 16 + 1): if i % 3 == 0 or i % 5 == 0: print('fizz' * (i % 3 == 0) + 'buzz' * (i % 5 == 0)) else: print(i)
N = input() def counter(string): count = 0 for i in string: if i=='0' or i=='6' or i=='9': count += 6 elif i=='1': count += 2 elif i=='2' or i=='3' or i=='5': count += 5 elif i=='4': count += 4 elif i=='7': ...
n = input() def counter(string): count = 0 for i in string: if i == '0' or i == '6' or i == '9': count += 6 elif i == '1': count += 2 elif i == '2' or i == '3' or i == '5': count += 5 elif i == '4': count += 4 elif i == '7'...
''' Created on 29 Mar 2021 @author: thomasgumbricht ''' __version__ = '0.9.0' VERSION = tuple( int(x) for x in __version__.split('.') ) metadataD = { 'name':'numpyproc', 'author':'Thomas Gumbricht', 'author_email':'thomas.gumbricht@gmail.com', 'title':'numpyproc', 'label':'Spatial data processing using...
""" Created on 29 Mar 2021 @author: thomasgumbricht """ __version__ = '0.9.0' version = tuple((int(x) for x in __version__.split('.'))) metadata_d = {'name': 'numpyproc', 'author': 'Thomas Gumbricht', 'author_email': 'thomas.gumbricht@gmail.com', 'title': 'numpyproc', 'label': 'Spatial data processing using numpy.', '...
TEST_PATH = 'tests/text.txt' TEST_PURGE_PATH = 'text.txt' TEST_PURGE_PATH_1 = '1_text.txt' TEST_TEXT = 'text for the test' TEST_CHANGE_TEXT = 'some data to be written to the file' TEST_DIR_PATH = './' TEST_DIR_PATH_1 = './tests/test_a' TEST_DIR_PATH_2 = './tests/test_b' TEST_FILE_PATH = '/a.txt' TEST_FILE_PATH_1 = '/b....
test_path = 'tests/text.txt' test_purge_path = 'text.txt' test_purge_path_1 = '1_text.txt' test_text = 'text for the test' test_change_text = 'some data to be written to the file' test_dir_path = './' test_dir_path_1 = './tests/test_a' test_dir_path_2 = './tests/test_b' test_file_path = '/a.txt' test_file_path_1 = '/b....
def extractTheludicroushattertranslationsWordpressCom(item): ''' Parser for 'theludicroushattertranslations.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('The Sales Executive\'s ...
def extract_theludicroushattertranslations_wordpress_com(item): """ Parser for 'theludicroushattertranslations.wordpress.com' """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None tagmap = [("T...
TYPEID_ASDU = { 0x01: 'M_SP_NA_1 (1)', 0x03: 'M_DP_NA_1 (3)', 0x05: 'M_ST_NA_1 (5)', 0x07: 'M_BO_NA_1 (7)', 0x09: 'M_ME_NA_1 (9)', 0x0D: 'M_ME_NC_1 (13)', 0x1E: 'M_SP_TB_1 (30)', 0x1F: 'M_DP_TB_1 (31)', 0x24: 'M_ME_TF_1 (36)', 0x25: 'M_IT_TB_1 (37)', 0x2D: 'C_SC_NA...
typeid_asdu = {1: 'M_SP_NA_1 (1)', 3: 'M_DP_NA_1 (3)', 5: 'M_ST_NA_1 (5)', 7: 'M_BO_NA_1 (7)', 9: 'M_ME_NA_1 (9)', 13: 'M_ME_NC_1 (13)', 30: 'M_SP_TB_1 (30)', 31: 'M_DP_TB_1 (31)', 36: 'M_ME_TF_1 (36)', 37: 'M_IT_TB_1 (37)', 45: 'C_SC_NA_1 (45)', 46: 'C_DC_NA_1 (46)', 50: 'C_SE_NC_1 (50)', 70: 'M_EI_NA_1 (70)', 100: 'C...
""" .. todo:: WRITEME """ def is_iterable(obj): """ Robustly test whether an object is iterable. Parameters ---------- obj : object The object to be checked. Returns ------- is_iterable : bool `True` if the object is iterable, `False` otherwise. Notes --...
""" .. todo:: WRITEME """ def is_iterable(obj): """ Robustly test whether an object is iterable. Parameters ---------- obj : object The object to be checked. Returns ------- is_iterable : bool `True` if the object is iterable, `False` otherwise. Notes ---...
# # PySNMP MIB module MBG-SNMP-LT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MBG-SNMP-LT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:10:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, constraints_union, value_range_constraint) ...
class Solution: """ @param grids: a matrix of integer @return: return a boarder sort matrix """ def BoarderSort(self, grids): # write your code here n = len(grids) rowStart = colStart = 0 rowEnd = colEnd = n - 1 while rowStart <= rowEnd and colStart <= colEnd:...
class Solution: """ @param grids: a matrix of integer @return: return a boarder sort matrix """ def boarder_sort(self, grids): n = len(grids) row_start = col_start = 0 row_end = col_end = n - 1 while rowStart <= rowEnd and colStart <= colEnd: indices = []...
# Time: O(min(n, h)), per operation # Space: O(min(n, h)) # # Design a data structure that supports the following two operations: # # void addWord(word) # bool search(word) # search(word) can search a literal word or a regular expression string containing only letters a-z or .. # A . means it can represent any one le...
class Trienode: def __init__(self): self.is_string = False self.leaves = {} class Worddictionary: def __init__(self): self.root = trie_node() def add_word(self, word): curr = self.root for c in word: if not c in curr.leaves: curr.leaves...
def binary_search_iterative(target: int, nums: list[int]) -> int: s_idx = 0 e_idx = len(nums) - 1 while s_idx <= e_idx: mid = (e_idx - s_idx + 1) // 2 + s_idx if target == nums[mid]: return mid elif target < nums[mid]: e_idx = mid - 1 else: ...
def binary_search_iterative(target: int, nums: list[int]) -> int: s_idx = 0 e_idx = len(nums) - 1 while s_idx <= e_idx: mid = (e_idx - s_idx + 1) // 2 + s_idx if target == nums[mid]: return mid elif target < nums[mid]: e_idx = mid - 1 else: ...
class UnknownWrapper(object): """ Wraps objects the marshaler should marshal as a VT_UNKNOWN. UnknownWrapper(obj: object) """ @staticmethod def __new__(self, obj): """ __new__(cls: type,obj: object) """ pass WrappedObject = property( lambda self: object(),...
class Unknownwrapper(object): """ Wraps objects the marshaler should marshal as a VT_UNKNOWN. UnknownWrapper(obj: object) """ @staticmethod def __new__(self, obj): """ __new__(cls: type,obj: object) """ pass wrapped_object = property(lambda self: object(), lambda self, v: None, l...
# init mon = int(input("Enter monitor cost> ")) sys = int(input("Enter system unit cost> ")) key = int(input("Enter keyboard cost> ")) mou = int(input("Enter mouse cost> ")) num = int(input("Enter PC's number> ")) # out print("\nAll cost = %i$" % ((mon + sys + key + mou) * num))
mon = int(input('Enter monitor cost> ')) sys = int(input('Enter system unit cost> ')) key = int(input('Enter keyboard cost> ')) mou = int(input('Enter mouse cost> ')) num = int(input("Enter PC's number> ")) print('\nAll cost = %i$' % ((mon + sys + key + mou) * num))
x=set() y=set() include=[] for i in range(8): a,b=map(int,input().split()) include.append((a,b)) x.add(a) y.add(b) flag=1 if len(x)!=3 or len(y)!=3: flag=0 else: notinclude=[] x=sorted(x) y=sorted(y) for i in x: for j in y: if (i,j) not in include: ...
x = set() y = set() include = [] for i in range(8): (a, b) = map(int, input().split()) include.append((a, b)) x.add(a) y.add(b) flag = 1 if len(x) != 3 or len(y) != 3: flag = 0 else: notinclude = [] x = sorted(x) y = sorted(y) for i in x: for j in y: if (i, j) not...
def get_bloodlines(data, cur): for bloodlineID in data: obj = data[bloodlineID] cur.execute('INSERT INTO BloodLines Values(?, ?, ?)', [bloodlineID, obj.get('type'), obj.get('owner')] ) members = obj.get('member') if not isinstance(members, list): ...
def get_bloodlines(data, cur): for bloodline_id in data: obj = data[bloodlineID] cur.execute('INSERT INTO BloodLines Values(?, ?, ?)', [bloodlineID, obj.get('type'), obj.get('owner')]) members = obj.get('member') if not isinstance(members, list): members = [members] ...
def format_audit_message(error_message, user_message): message = error_message if user_message: message = message + ('\n' if message else '') + user_message return message
def format_audit_message(error_message, user_message): message = error_message if user_message: message = message + ('\n' if message else '') + user_message return message
""" Model for DHCD DFD api """ APP_ID = 'bit4kvfmq' # TODO commented out mappings are b/c we are currently not using the # data from these other tables. When we want to add additional # data from these fields, we should uncomment them. TABLE_ID_MAPPING = { 'Projects' : 'bit4krbdh', ...
""" Model for DHCD DFD api """ app_id = 'bit4kvfmq' table_id_mapping = {'Projects': 'bit4krbdh', 'Properties': 'bi4xqgzv4'} app_metadata_fields = ['table_name', 'table_dbid', 'table_alias', 'key_fid', 'default_sort_fid', 'default_sort_order', 'single_record_name', 'plural_record_name', 'field_metadata_line_start', 'fie...
def convert_log_finished(out): re_compile = re.compile('\| Finished') # Finished matches = re_compile.findall(out) if matches: return {'par' : "100"} else: return None def convert_log_cycles(out): # {'wtime': '2020-05-17 14:44:15.342858', 'par': '100.0', 'frame': '0', 'mem': '151.45M', 'elapsed': '00:0...
def convert_log_finished(out): re_compile = re.compile('\\| Finished') matches = re_compile.findall(out) if matches: return {'par': '100'} else: return None def convert_log_cycles(out): re_compile = re.compile('Fra:(\\d+)\\sMem:(\\w+.\\w+)\\s\\(.+?\\)\\W\\|\\WTime:([0-9a-zA-Z_:.]+)\...
m: int; n: int somalinha: float m = int(input("Qual a quantidade de linhas da matriz? ")) n = int(input("Qual a quantidade de colunas da matriz? ")) matriz: [[float]] = [[0 for x in range(n)] for x in range(m)] vetor: [float] = [0 for x in range(m)] for i in range(m): print(f"Digite os elementos da {i + 1} a. linha...
m: int n: int somalinha: float m = int(input('Qual a quantidade de linhas da matriz? ')) n = int(input('Qual a quantidade de colunas da matriz? ')) matriz: [[float]] = [[0 for x in range(n)] for x in range(m)] vetor: [float] = [0 for x in range(m)] for i in range(m): print(f'Digite os elementos da {i + 1} a. linha'...
def speed_test(model, iterations = 100): model.eval() input = torch.randn(1,3,1024,2048).to(device) with torch.no_grad(): torch.cuda.synchronize() torch.cuda.synchronize() t_start = time.time() for _ in range(20): model(input) torch.cuda.synchronize() torch.cuda.synchronize() ela...
def speed_test(model, iterations=100): model.eval() input = torch.randn(1, 3, 1024, 2048).to(device) with torch.no_grad(): torch.cuda.synchronize() torch.cuda.synchronize() t_start = time.time() for _ in range(20): model(input) torch.cuda.synchronize() ...
class Incrementors: def increment(self, inValue): print('increment inValue', inValue) return inValue + 1
class Incrementors: def increment(self, inValue): print('increment inValue', inValue) return inValue + 1
t=int(input()) s=[] se=set() for i in range(t): n=int(input()) for j in range(n): s.append(set(input())) se=s[0] for k in range(1,n): se=se.intersection(s[k]) print(len(se)) se=set() s=[]
t = int(input()) s = [] se = set() for i in range(t): n = int(input()) for j in range(n): s.append(set(input())) se = s[0] for k in range(1, n): se = se.intersection(s[k]) print(len(se)) se = set() s = []
''' 1. Write a Python program to check whether two given circles (given center (x,y) and radius) are intersecting. Return true for intersecting otherwise false. Sample Output: True False 2. Write a Python program to compute the digit distance between two integers. The digit distance between two numbers is the a...
""" 1. Write a Python program to check whether two given circles (given center (x,y) and radius) are intersecting. Return true for intersecting otherwise false. Sample Output: True False 2. Write a Python program to compute the digit distance between two integers. The digit distance between two numbers is the absolute...
"""Provide a scene per viewpoint filter class for template-based file export. Copyright (c) 2021 Peter Triesberger For further information see https://github.com/peter88213/PyWriter Published under the MIT License (https://opensource.org/licenses/mit-license.php) """ class ScVpFilter(): """Filter Scene ...
"""Provide a scene per viewpoint filter class for template-based file export. Copyright (c) 2021 Peter Triesberger For further information see https://github.com/peter88213/PyWriter Published under the MIT License (https://opensource.org/licenses/mit-license.php) """ class Scvpfilter: """Filter Scene per viewpoin...
# # @lc app=leetcode.cn id=647 lang=python3 # # [647] palindromic-substrings # None # @lc code=end
None
#!/usr/bin/python # =================== Misc vars =================== ## SHOW_CONSOLE_OUTPUT = False # Show the console output when 'make' is called? # ============== Backup related vars ============== ## BACKUPS_DIR = '/storage/emulated/0/theme-backups' BACKUP_OPTIONS = [] # ============= g...
show_console_output = False backups_dir = '/storage/emulated/0/theme-backups' backup_options = [] contrib_themes = '/data/eon-custom-themes/contributed-themes' excluded_themes = ['Example', 'ignoreme', 'Colton'] min_sim_threshold = 0.25 op_ver = 0.1 op_loc = '' welcome_text = ['Created By: Colton (Brandon) S. EndLine \...
""" Dictionary lookup and update. """ print("Dictionary Lookup") print("=================") cipher = {'p': 'o', 'y': 'h', 't': 'n', 'h': 't', 'o': 'y', 'n': 'p'} print(cipher) # Use indexing with keys to access values print(cipher['t']) print(cipher['n']) def encrypt(cipher, word): """encrypt word u...
""" Dictionary lookup and update. """ print('Dictionary Lookup') print('=================') cipher = {'p': 'o', 'y': 'h', 't': 'n', 'h': 't', 'o': 'y', 'n': 'p'} print(cipher) print(cipher['t']) print(cipher['n']) def encrypt(cipher, word): """encrypt word using cipher""" encrypted = '' for char in word: ...
class Env(object): """Abstract class for an environment. Simplified OpenAI API. """ def __init__(self): self.n_actions = None self.state_shape = None def step(self, action): """Run one timestep of the environment's dynamics. Accepts an action and returns a tuple (obse...
class Env(object): """Abstract class for an environment. Simplified OpenAI API. """ def __init__(self): self.n_actions = None self.state_shape = None def step(self, action): """Run one timestep of the environment's dynamics. Accepts an action and returns a tuple (observ...
"""The module docstring.""" THE_ATTRIBUTE: int = 0 """The attribute docstring.""" def the_function(): """The function docstring.""" class TheClass: """The class docstring.""" THE_ATTRIBUTE: float = 0.1 """The attribute 0.1 docstring.""" class TheNestedClass: """The nested class docstr...
"""The module docstring.""" the_attribute: int = 0 'The attribute docstring.' def the_function(): """The function docstring.""" class Theclass: """The class docstring.""" the_attribute: float = 0.1 'The attribute 0.1 docstring.' class Thenestedclass: """The nested class docstring.""" ...
"""566. Reshape the Matrix""" class Solution(object): def matrixReshape(self, nums, r, c): """ :type nums: List[List[int]] :type r: int :type c: int :rtype: List[List[int]] """ n = len(nums) m = len(nums[0]) if m*n != r*c: return n...
"""566. Reshape the Matrix""" class Solution(object): def matrix_reshape(self, nums, r, c): """ :type nums: List[List[int]] :type r: int :type c: int :rtype: List[List[int]] """ n = len(nums) m = len(nums[0]) if m * n != r * c: re...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 18 21:31:59 2019 @author: xiayezi """
""" Created on Tue Jun 18 21:31:59 2019 @author: xiayezi """
result_4 = {'4001': 'a person holding a pair of scissors', '85': 'a man is standing next to a car', '4133': 'a person holding a cell phone in a room', '2593': 'a person holding a cell phone in a hand', '2637': 'a man sitting on the back of a car', '5629': 'a woman is sitting on a car with a surfboard', '3473': 'a perso...
result_4 = {'4001': 'a person holding a pair of scissors', '85': 'a man is standing next to a car', '4133': 'a person holding a cell phone in a room', '2593': 'a person holding a cell phone in a hand', '2637': 'a man sitting on the back of a car', '5629': 'a woman is sitting on a car with a surfboard', '3473': 'a perso...
# A rule that takes in a series of "declarations" and produces "compiled # output" for some of those declarations, along with a manifest. Here, the # declarations are simply words in a dictionary text file, and the compiled # output of a word is just its hash. # # The compiled outputs are specified by the user, while t...
def _word_hashes_impl(ctx): dictionary = ctx.file.dictionary manifest = ctx.outputs.manifest for hashfile in ctx.outputs.hashes: basename = hashfile.basename if not basename.endswith('.md5'): fail("Hash file '%s' must end in '.md5'".format(basename)) word = basename[:-len...
# Copyright 2017 OpenStack.org # # 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 writin...
""" List resources from the Load Balancer service. For a full guide see TODO(etoews):link to docs on developer.openstack.org """ def list_loadbalancers(conn): print('List Load Balancer:') query = {} for load_balancer in conn.load_balancer.load_balancers(**query): print(load_balancer) def create_l...
class Accuracy(): 'abstract' def reset(self): raise NotImplementedError def set(self, output, targs): raise NotImplementedError def get(self): raise NotImplementedError def print(self): raise NotImplementedError class ArgmaxAccuracy(...
class Accuracy: """abstract""" def reset(self): raise NotImplementedError def set(self, output, targs): raise NotImplementedError def get(self): raise NotImplementedError def print(self): raise NotImplementedError class Argmaxaccuracy: """argmax""" def _...
# START # Largest Fibonacci under 10,000 a, b = 1, 1 while b < 10000: a, b = b, a + b # END print(a)
(a, b) = (1, 1) while b < 10000: (a, b) = (b, a + b) print(a)
# Depth first search traversel, depth mai ghus jao aur fir backtracking ki vajah se saare nodes ko explore kar lo -> recursive # 1 # / \ # / \ # / \ # 2----3----4 # | # 5 class Graph: def __init__(self, vertices): self.vertices = vertices self.adj_list = {} de...
class Graph: def __init__(self, vertices): self.vertices = vertices self.adj_list = {} def add_edge(self, node1, node2): if node1 in self.adj_list: self.adj_list[node1].append(node2) else: self.adj_list[node1] = [node2] if node2 in self.adj_list:...
''' Leetcode problem No 494 TargetSum Solution written by Xuqiang Fang on 4 April ''' class Solution(object): def findTargetSumWays(self, nums, S): sum = 0; for i in nums: sum += i if(sum < S or (sum+S)%2 > 0): return 0 else: return self.subsetS...
""" Leetcode problem No 494 TargetSum Solution written by Xuqiang Fang on 4 April """ class Solution(object): def find_target_sum_ways(self, nums, S): sum = 0 for i in nums: sum += i if sum < S or (sum + S) % 2 > 0: return 0 else: return self.su...
def no_annotation(num: int): """ This function contains no return annotation >>> no_annotation(5) 10 """ return num + 5 def contains_annotation(num: int) -> None: """ This function contains return annotation >>> contains_annotation() None """ return None class ClassTe...
def no_annotation(num: int): """ This function contains no return annotation >>> no_annotation(5) 10 """ return num + 5 def contains_annotation(num: int) -> None: """ This function contains return annotation >>> contains_annotation() None """ return None class Classtest...
# # PySNMP MIB module DECATM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DECATM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:22:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ...
class RequestException(Exception): def __init__(self, title, message=None, error_code=400): self.title = title self.message = message if message else title self.error_code = error_code class DomainExists(RequestException): pass
class Requestexception(Exception): def __init__(self, title, message=None, error_code=400): self.title = title self.message = message if message else title self.error_code = error_code class Domainexists(RequestException): pass
load("@bazel_skylib//lib:paths.bzl", "paths") SphinxInfo = provider( doc = "Info pertaining to Sphinx build.", fields = ["open_uri"], ) def _sphinx_html_impl(ctx): sandbox = ctx.actions.declare_directory(ctx.label.name + "_sandbox") output_dir = ctx.actions.declare_directory(ctx.label.name + "_html"...
load('@bazel_skylib//lib:paths.bzl', 'paths') sphinx_info = provider(doc='Info pertaining to Sphinx build.', fields=['open_uri']) def _sphinx_html_impl(ctx): sandbox = ctx.actions.declare_directory(ctx.label.name + '_sandbox') output_dir = ctx.actions.declare_directory(ctx.label.name + '_html') root_dir = ...
class ExternalResourceLoadContext(object, IDisposable): """ This class contains data describing the context related to an external resource load operation. """ def CallingDocumentHasModelPath(self): """ CallingDocumentHasModelPath(self: ExternalResourceLoadContext) -> bool ...
class Externalresourceloadcontext(object, IDisposable): """ This class contains data describing the context related to an external resource load operation. """ def calling_document_has_model_path(self): """ CallingDocumentHasModelPath(self: ExternalResourceLoadContext) -> bool Indicate...
# Method 1: Binary Search on each row, if the first element of the row is already bigger than target, then skip # Time Complexity: O(mlogn) def searchMatrix1(self, matrix, target): def helper(low, high, row): while low <= high: mid = (low + high) // 2 if matrix[row][mid] < target: lo...
def search_matrix1(self, matrix, target): def helper(low, high, row): while low <= high: mid = (low + high) // 2 if matrix[row][mid] < target: low = mid + 1 elif matrix[row][mid] > target: high = mid - 1 else: r...
# Constants # dimensions WIDTH = 500 HEIGHT = 500 ROWS = 3 COLS = 3 SQUARE_SIZE = 166 LINE_WIDTH = 7 C_RADIUS = 50 C_WIDTH = 12 CROSS_WIDTH = 20 SPACE = 37 # space between the line and cross # colors -> rgb values BG_COLOR = (171,219,227) LINE_COLOR = (21,76,121) O_COLOR = (237, 233, 213) X_COLOR = (55,49,39,255) ...
width = 500 height = 500 rows = 3 cols = 3 square_size = 166 line_width = 7 c_radius = 50 c_width = 12 cross_width = 20 space = 37 bg_color = (171, 219, 227) line_color = (21, 76, 121) o_color = (237, 233, 213) x_color = (55, 49, 39, 255) score = {1: 10, 2: -10, 'Draw': 0} p = [1, 2]
class Solution: def threeSumClosest(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ nums.sort() length = len(nums) closest = [] for i, num in enumerate(nums[0:-2]): l,r = i+1, length-1 ...
class Solution: def three_sum_closest(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ nums.sort() length = len(nums) closest = [] for (i, num) in enumerate(nums[0:-2]): (l, r) = (i + 1, length - 1) ...
def tomo_o_salto(casillas: list[int]): if len(casillas) == 0: return 0 elif len(casillas) == 1: return casillas[0] elif len(casillas) == 2: return max(casillas) else: best = [casillas[0], max(casillas[0], casillas[1])] for i in range(2, len(casillas)): ...
def tomo_o_salto(casillas: list[int]): if len(casillas) == 0: return 0 elif len(casillas) == 1: return casillas[0] elif len(casillas) == 2: return max(casillas) else: best = [casillas[0], max(casillas[0], casillas[1])] for i in range(2, len(casillas)): ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isUnivalTree(self, root): """ :type root: TreeNode :rtype: bool """ def dfs(node): ...
class Solution: def is_unival_tree(self, root): """ :type root: TreeNode :rtype: bool """ def dfs(node): if not node: return True if node.val == root.val and dfs(node.left) and dfs(node.right): return True ...
class Scheme: def __init__(self, data): self.data = data def is_valid(self) -> bool: raise NotImplementedError # pragma: no cover
class Scheme: def __init__(self, data): self.data = data def is_valid(self) -> bool: raise NotImplementedError
############################## # RemoteFacade configuration # ############################## core_facade_soap_service_name = '/weblab/soap/' core_facade_bind = '' core_facade_port = 28345 core_facade_server_route = 'route2' core_coordinator_clean = False ############################## # RemoteFaca...
core_facade_soap_service_name = '/weblab/soap/' core_facade_bind = '' core_facade_port = 28345 core_facade_server_route = 'route2' core_coordinator_clean = False login_facade_soap_service_name = '/weblab/login/soap/'
with open("../data/1880-boys.txt") as f_boys: boys = f_boys.read() with open("../data/1880-girls.txt") as f_girls: girls = f_girls.read() with open("../data/1880-all.txt", "w") as f: f.write(boys + "\n" + girls)
with open('../data/1880-boys.txt') as f_boys: boys = f_boys.read() with open('../data/1880-girls.txt') as f_girls: girls = f_girls.read() with open('../data/1880-all.txt', 'w') as f: f.write(boys + '\n' + girls)
class ArrayTools: @staticmethod def create_array_of_size(size: int, basic_item) -> list: """Creates array of given size containing copies of given items""" array = [] for i in range(0, size): array.append(basic_item.copy()) return array[:] @staticmethod def c...
class Arraytools: @staticmethod def create_array_of_size(size: int, basic_item) -> list: """Creates array of given size containing copies of given items""" array = [] for i in range(0, size): array.append(basic_item.copy()) return array[:] @staticmethod def ...
# Copyright (C) Mesosphere, Inc. See LICENSE file for details. """This module defines all the custom exceptions used in test harness""" class ARTestHarnessException(Exception): """Base exception from which all test-harness exceptions must inherit""" pass class EndpointException(ARTestHarnessException): ...
"""This module defines all the custom exceptions used in test harness""" class Artestharnessexception(Exception): """Base exception from which all test-harness exceptions must inherit""" pass class Endpointexception(ARTestHarnessException): """Signal error in processing request by endpoint This excep...
def add_offline_conversion_feed_operation(google_click_id: 'String' = None, conversion_name: 'String' = None, conversion_time: 'DateTime' = None, conversion_value: 'Double' = 0, conversion_currency_code: 'String' = 'BRL', ...
def add_offline_conversion_feed_operation(google_click_id: 'String'=None, conversion_name: 'String'=None, conversion_time: 'DateTime'=None, conversion_value: 'Double'=0, conversion_currency_code: 'String'='BRL', external_attribution_credit: 'Double'=None, external_attribution_model: 'String'=None, operator: 'String'='A...
#!/usr/bin/env python3 class Solution: def wordBreak(self, s, wordDict): # DP part dp = [[] for c in s+' '] for i in range(len(s)): if i == 0 or len(dp[i]) > 0: for w in wordDict: if s[i:i+len(w)] == w: dp[i+len(w)].app...
class Solution: def word_break(self, s, wordDict): dp = [[] for c in s + ' '] for i in range(len(s)): if i == 0 or len(dp[i]) > 0: for w in wordDict: if s[i:i + len(w)] == w: dp[i + len(w)].append(i) print('i = %d' ...
command_aliases = { 'print': ['echo', 'lmfao'], 'bold': ['style', 'bold'], 'italic': ['style', 'italic'], 'underline': ['style', 'underline'], 'mark': ['style', 'mark'], 'compile': ['tio'], }
command_aliases = {'print': ['echo', 'lmfao'], 'bold': ['style', 'bold'], 'italic': ['style', 'italic'], 'underline': ['style', 'underline'], 'mark': ['style', 'mark'], 'compile': ['tio']}
#!/usr/bin/env python class ppTagConfig(): """A simple class holding the config for ppTag""" ####################### Change HERE ####################### #if you do not have a token you have to supply your credentials PLEX_LOGIN = '' PLEX_PASS = '' # if you already have a token pass it here ...
class Pptagconfig: """A simple class holding the config for ppTag""" plex_login = '' plex_pass = '' plex_token = '' plex_url = 'http://192.168.0.200:32400' userdata = {'user': '1234'} servername = 'plexserver' plex_section = '' photos_library_path_plex = '/<some path>/' photos_li...
class Solution: def convertToBase7(self, num: int) -> str: base7 = [] if num < 0: flag = 1 num = -num else: flag = 0 while num >= 7: fig = str(num % 7) base7.append(fig) num //= 7 base7.append(str(num)) ...
class Solution: def convert_to_base7(self, num: int) -> str: base7 = [] if num < 0: flag = 1 num = -num else: flag = 0 while num >= 7: fig = str(num % 7) base7.append(fig) num //= 7 base7.append(str(num)...
CONTRACTS = { 'mainnet': { "v1.2.0": { "FeedFactory": "0xEF078E8330f99186079BE1d2ee6b4a5d6f23E8F1", "ErasureUsers": "0x789D0082B20A929D6fB64EB4c10c68e827AAB7aB" } }, 'rinkeby': { "v1.2.0": { "FeedFactory": "0xDE19C478b2eD51668e36704b2341b81DEBFe2c4...
contracts = {'mainnet': {'v1.2.0': {'FeedFactory': '0xEF078E8330f99186079BE1d2ee6b4a5d6f23E8F1', 'ErasureUsers': '0x789D0082B20A929D6fB64EB4c10c68e827AAB7aB'}}, 'rinkeby': {'v1.2.0': {'FeedFactory': '0xDE19C478b2eD51668e36704b2341b81DEBFe2c40', 'ErasureUsers': '0xbF7339e68b81a1261FDF46FDBe916cd88f3609c0'}}, 'test': {'v...
class Graph: def __init__(self): g=[('root','a'),('a','b'),('a','d'),('b','j'),('b','c'),('b','g'),('j','k'),('k','l'),('k','m'),('c','i'),('c','o'),('d','e') ,('root','f'),('f','h'),('h','n'),('h','p'),('h','q'),('p','r'),('r','s')] a = { 'label':'root' ,'childre...
class Graph: def __init__(self): g = [('root', 'a'), ('a', 'b'), ('a', 'd'), ('b', 'j'), ('b', 'c'), ('b', 'g'), ('j', 'k'), ('k', 'l'), ('k', 'm'), ('c', 'i'), ('c', 'o'), ('d', 'e'), ('root', 'f'), ('f', 'h'), ('h', 'n'), ('h', 'p'), ('h', 'q'), ('p', 'r'), ('r', 's')] a = {'label': 'root', 'chil...
# Databricks notebook source dbutils.widgets.text('db', '', 'db') DB = dbutils.widgets.get('db') assert DB dbutils.widgets.text('match_lookup_final_name', 'match_lookup_final', 'match_lookup_final_name') MATCH_LOOKUP_FINAL_TABLE_NAME = dbutils.widgets.get('match_lookup_final_name') assert MATCH_LOOKUP_FINAL_TABLE_NAME...
dbutils.widgets.text('db', '', 'db') db = dbutils.widgets.get('db') assert DB dbutils.widgets.text('match_lookup_final_name', 'match_lookup_final', 'match_lookup_final_name') match_lookup_final_table_name = dbutils.widgets.get('match_lookup_final_name') assert MATCH_LOOKUP_FINAL_TABLE_NAME def remove_records(db: str, ...
""" 1150. Check If a Number Is Majority Element in a Sorted Array Easy Given an array nums sorted in non-decreasing order, and a number target, return True if and only if target is a majority element. A majority element is an element that appears more than N/2 times in an array of length N. Example 1: Input: nums =...
""" 1150. Check If a Number Is Majority Element in a Sorted Array Easy Given an array nums sorted in non-decreasing order, and a number target, return True if and only if target is a majority element. A majority element is an element that appears more than N/2 times in an array of length N. Example 1: Input: nums =...
#!/usr/bin/env python atomicSymbols = [ 'H' , 'He', 'Li', 'Be', 'B' , 'C' , 'N' , 'O' , 'F' , 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P' , 'S' , 'Cl', 'Ar', 'K' , 'Ca', 'Sc', 'Ti', 'V' , 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'G...
atomic_symbols = ['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', '...
class PostResponseDecider: def __init__(self): self.raise_recoverable_exception = False self.raise_unrecoverable_exception = False self.exception = None self.stop_raise_exception_after = 0 self.current_retry_number=0 def reset(self): self.raise_recoverable_except...
class Postresponsedecider: def __init__(self): self.raise_recoverable_exception = False self.raise_unrecoverable_exception = False self.exception = None self.stop_raise_exception_after = 0 self.current_retry_number = 0 def reset(self): self.raise_recoverable_exc...
#http://www.ensembl.org/info/data/ftp/index.html dict_aa = {} seq = "GATGAGJHTYYYYHKTRBJNKRBJNLRBLRBGB" for aa in seq: # try: # dict_aa[aa]+=1 # except KeyError: # dict_aa[aa]=1 if aa in dict_aa.keys(): dict_aa[aa] += 1 else: dict_aa[aa] = 1 print (dict_aa)
dict_aa = {} seq = 'GATGAGJHTYYYYHKTRBJNKRBJNLRBLRBGB' for aa in seq: if aa in dict_aa.keys(): dict_aa[aa] += 1 else: dict_aa[aa] = 1 print(dict_aa)
""" astra web framework """ class Request: def __init__(self, route, params, env): self.route = route self.params = params self.env = env self.body = None self.extra = {}
""" astra web framework """ class Request: def __init__(self, route, params, env): self.route = route self.params = params self.env = env self.body = None self.extra = {}
'''Define the Asset class. What is an Asset? An Asset is a folder containing the necessary files to realize a specific idea. The most common assets are nouns (like: chair, table, lamp) but this definition is not so limiting. An asset could also be a entire scene, or something less concrete, like a sky, or lighting se...
"""Define the Asset class. What is an Asset? An Asset is a folder containing the necessary files to realize a specific idea. The most common assets are nouns (like: chair, table, lamp) but this definition is not so limiting. An asset could also be a entire scene, or something less concrete, like a sky, or lighting se...
def multiple(x): if x % 15 == 0: return 'BangBoom' elif x % 3 == 0: return 'Bang' elif x % 5 == 0: return 'Boom' return 'Miss'
def multiple(x): if x % 15 == 0: return 'BangBoom' elif x % 3 == 0: return 'Bang' elif x % 5 == 0: return 'Boom' return 'Miss'
class Solution(object): def sortColors(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ self.nums = nums left, right = 0, len(nums) - 1 i = 0 while i <= right: w...
class Solution(object): def sort_colors(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ self.nums = nums (left, right) = (0, len(nums) - 1) i = 0 while i <= right: while i <= ri...
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. # duration_ms: {duration_ms} # max_file_size_bytes: 10000000000 PERFETTO_CONFIG_TEMPLATE = """\ buffers: {{ size_kb: {buffer_size_kb} fill_policy: RING_BUFFER }} buffers: {{ size_kb: {buffer_size2_kb} fill_policy: RING_BUF...
perfetto_config_template = 'buffers: {{\n size_kb: {buffer_size_kb}\n fill_policy: RING_BUFFER\n}}\nbuffers: {{\n size_kb: {buffer_size2_kb}\n fill_policy: RING_BUFFER\n}}\n{cpu_sys_stats_config}\n{power_config}{heapprofd_config}{linux_process_stats_config}{gpu_memory_config}{linux_ftrace_config}{android_lo...
Print("Module and PIP") Print('''Module = is an python file that can be imported to the current python file, to access to the previous files functions/functionalities and codes inside the current file. There are built in modules There are external modules are in the Lib folder of the python program folde...
print('Module and PIP') print('Module = is an python file that can be\n imported to the current python file, to access to the previous\n files functions/functionalities and codes inside the current file.\n There are built in modules\n\n There are external modules are in the Lib folder of the python\n program folder.\n ...
table = [0 for i in range(98)] def hash_table(key, value): hash = key % 97 table[hash] = value def read_hash_table(key): hash = key % 97 return table[hash] def test_storing_value_in_hash_table(): hash_table(key=1, value='value for one') assert read_hash_table(key=1) == 'value for one' de...
table = [0 for i in range(98)] def hash_table(key, value): hash = key % 97 table[hash] = value def read_hash_table(key): hash = key % 97 return table[hash] def test_storing_value_in_hash_table(): hash_table(key=1, value='value for one') assert read_hash_table(key=1) == 'value for one' def te...
# This is free and unencumbered software released into the public domain. class Object: """An object of interest.""" def __init__(self, uuid=None): self.uuid = uuid def __repr__(self): """Returns a human-readable string representation of this object.""" return "object{{uuid={}}}"....
class Object: """An object of interest.""" def __init__(self, uuid=None): self.uuid = uuid def __repr__(self): """Returns a human-readable string representation of this object.""" return 'object{{uuid={}}}'.format(self.uuid) def __str__(self): """Returns a human-readab...
class Light: def __init__ (self): self.power = False self.brightness = 0 self.maxbrightness = 100 def signal(self, key, value=None): if (key == "keys?"): return ("power?", "brightness?", ) elif (key == "power?"): return self.power elif (key == "brightness?...
class Light: def __init__(self): self.power = False self.brightness = 0 self.maxbrightness = 100 def signal(self, key, value=None): if key == 'keys?': return ('power?', 'brightness?') elif key == 'power?': return self.power elif key == 'b...
# idea: the smallest cookie will, at best, satisfy the least greedy child, and if not, we may as well throw it away, since we can't add it to another cookie # likewise for every cookie from the smallest. By extension, there's no reason to try satisfying a more greedy child before the least greedy # so sort both groups ...
class Solution: def find_content_children(self, g, s): """ :type g: List[int] :type s: List[int] :rtype: int """ if len(s) < 1: return 0 g.sort() s.sort() ik = 0 ic = 0 sat = 0 while ik < len(g) and ic < len...
# noinspection PyMethodMayBeStatic class Sample: def simple(self): print("simple") def simple(self, details): print("Simple with details: {}".format(details)) s = Sample() s.simple("Some details") s.simple()
class Sample: def simple(self): print('simple') def simple(self, details): print('Simple with details: {}'.format(details)) s = sample() s.simple('Some details') s.simple()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 8 21:21:05 2021 @author: Alexander Southan """ class response: def __init__(self, name, unit=None, **kwargs): self.name = name if unit is None: self.unit = 1 else: self.unit = unit self...
""" Created on Mon Nov 8 21:21:05 2021 @author: Alexander Southan """ class Response: def __init__(self, name, unit=None, **kwargs): self.name = name if unit is None: self.unit = 1 else: self.unit = unit self.model_type = kwargs.get('model_type', None) ...
''' Exercise 6: Rewrite your pay computation with time-and-a-half for overtime\ and create a function called computepay which takes two parameters (hours and rate). ----Example: Enter Hours: 45 Enter Rate: 10 Pay: 475.0 ''' def computepay(hours, rate): if(hours>40): ...
""" Exercise 6: Rewrite your pay computation with time-and-a-half for overtime and create a function called computepay which takes two parameters (hours and rate). ----Example: Enter Hours: 45 Enter Rate: 10 Pay: 475.0 """ def computepay(hours, rate): if hours > 40: ...
for dice1 in range(1, 7): for dice2 in range(1, 7): one = "" both = "" summ = dice1 + dice2 if summ == 2: both = "xx" if dice1 == 1 or dice2 == 1: one = "x" print("{} {} {: >1} {: >2}".format(dice1, dice2, one, both))
for dice1 in range(1, 7): for dice2 in range(1, 7): one = '' both = '' summ = dice1 + dice2 if summ == 2: both = 'xx' if dice1 == 1 or dice2 == 1: one = 'x' print('{} {} {: >1} {: >2}'.format(dice1, dice2, one, both))
class Ticket: def __init__(self, id, key, summary, title, labels, created_date, reporter, assignee, subtasks, link, status, ticket_type): self.id = id self.key = key self.summary = summary self.title = title self.labels = labels self.created_date = created_date ...
class Ticket: def __init__(self, id, key, summary, title, labels, created_date, reporter, assignee, subtasks, link, status, ticket_type): self.id = id self.key = key self.summary = summary self.title = title self.labels = labels self.created_date = created_date ...
""" BSD 3-Clause License Copyright (c) 2019, HJ Reachability Group All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list o...
""" BSD 3-Clause License Copyright (c) 2019, HJ Reachability Group All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list o...
"""data module this module aim to implement the following functions after receiving inputs that fulfil requirements of `MetReg` (refer to docs/requirements.pdf). And generating json file of datasets, images of basic information (e.g., entropy, average, seasonal trending, etc) and images of causality relationship betw...
"""data module this module aim to implement the following functions after receiving inputs that fulfil requirements of `MetReg` (refer to docs/requirements.pdf). And generating json file of datasets, images of basic information (e.g., entropy, average, seasonal trending, etc) and images of causality relationship betw...
# -*- coding: utf-8 -*- """ Created on Thu Oct 14 20:22:48 2021 @author: Mike """ def busquedaBinaria(Lista, clave, inferior = 0, superior = 0): if(superior == 0): superior = len(Lista)-1 central = (inferior + superior) // 2 if(Lista[central] == clave): return central else: if(...
""" Created on Thu Oct 14 20:22:48 2021 @author: Mike """ def busqueda_binaria(Lista, clave, inferior=0, superior=0): if superior == 0: superior = len(Lista) - 1 central = (inferior + superior) // 2 if Lista[central] == clave: return central else: if Lista[central] < clave: ...
print ("first number") lol = input("--") print ("second number") trool = input ("--") caution = input ("are you shure that u want to break ur PC [Y/N]") if (('Y') in caution): print("ok") print("here we go") for crash in range (int(lol),int(trool)): print (crash) print ("press enter to exit the ...
print('first number') lol = input('--') print('second number') trool = input('--') caution = input('are you shure that u want to break ur PC [Y/N]') if 'Y' in caution: print('ok') print('here we go') for crash in range(int(lol), int(trool)): print(crash) print('press enter to exit the program') ...
PACKAGE = { "version": "1.25.22", "name": "harvester", "cpu": "2048", "memory": "8192", "celery_cpu": "2048", "celery_memory": "8192" }
package = {'version': '1.25.22', 'name': 'harvester', 'cpu': '2048', 'memory': '8192', 'celery_cpu': '2048', 'celery_memory': '8192'}
# import os # import time # f = open ("TROOL.txt",'w+') # a = open ("VIRUS.txt",'w+') # for i in range (0,999): # os.mkdir(f"{i}") # f.write(f"I printed this {i-1} times\n") # for q in range (0,i-q): # a.write("GET TROOOLED\n") # f.close # a.close # print ("Wow u made it through all this shit!!...
print('SHeesh i was soo bad')
def min1(arr): n = len(arr) print(arr) if n == 1: return arr[0] else: temp = min1(arr[0:n - 1]) print(temp) if temp <= arr[n]: return temp else: return arr[n] A = [8, 1, 3, 7, 5, 2, 12] print(min1(A))
def min1(arr): n = len(arr) print(arr) if n == 1: return arr[0] else: temp = min1(arr[0:n - 1]) print(temp) if temp <= arr[n]: return temp else: return arr[n] a = [8, 1, 3, 7, 5, 2, 12] print(min1(A))
def extractSilverliningtranslationsWordpressCom(item): ''' Parser for 'silverliningtranslations.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None if item['title'].startswith("Skeleton Knight "): ...
def extract_silverliningtranslations_wordpress_com(item): """ Parser for 'silverliningtranslations.wordpress.com' """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if item['title'].startswi...
#!/usr/bin/python expenses = [] fichier = open('day1_input.txt') for l in fichier: expenses.append(int(l)) expenses.sort() for a in expenses: for b in expenses: for c in expenses: if a+b+c == 2020: print("%s + %s +%s = %s ; produit = %s" % (a,b,c,a+b+c,a*b*c)) ...
expenses = [] fichier = open('day1_input.txt') for l in fichier: expenses.append(int(l)) expenses.sort() for a in expenses: for b in expenses: for c in expenses: if a + b + c == 2020: print('%s + %s +%s = %s ; produit = %s' % (a, b, c, a + b + c, a * b * c)) s...
A = 12345 B = 67890 TRACE = 1 MAXDATASIZE = 20; # This constant controls the maximum size of the buffer in a Message and in a Packet def checksumCalc(payload): #The implemention of function that calculates checksum goes here return class Packet: def __init__(self, s, a, c, p=''): self.seqNum =...
a = 12345 b = 67890 trace = 1 maxdatasize = 20 def checksum_calc(payload): return class Packet: def __init__(self, s, a, c, p=''): self.seqNum = s self.ackNum = a self.checksum = c self.payload = p def to_str(self): return 'seqNum: ' + str(self.seqNum) + ' ackNum:...
#program to define a string containing special characters in various forms. char_1="^#$@$#@" char_2="'Hello World!'" char_3='012-482-0493-877' print(char_1) print(char_2) print(char_3)
char_1 = '^#$@$#@' char_2 = "'Hello World!'" char_3 = '012-482-0493-877' print(char_1) print(char_2) print(char_3)
# # @lc app=leetcode.cn id=1666 lang=python3 # # [1666] make-the-string-great # None # @lc code=end
None
# coding=utf-8 # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. class MockFunction: def __init__(self, default=None): self.data = dict() self.default = default def put(self, key, value): self.data[...
class Mockfunction: def __init__(self, default=None): self.data = dict() self.default = default def put(self, key, value): self.data[key] = value def get(self, key): if key in self.data: return self.data[key] return self.default def remove(self, ke...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is an example of how a person could implement a basic abstract factory pattern. This is very similar to the factory pattern but is abstracted one more layer. """ class MotorCycleInterface(object): """ Abstract Motorcycle Class """ def __in...
""" This file is an example of how a person could implement a basic abstract factory pattern. This is very similar to the factory pattern but is abstracted one more layer. """ class Motorcycleinterface(object): """ Abstract Motorcycle Class """ def __init__(self): self.wheels = 2 self...
"""Substitutes algorithm module.""" class FindSubstitutes: """Find substitute for a product.""" @classmethod def run(cls, product): """Run function. Start the research.""" categories = product.categories.all() categories = sorted( categories, key=lambda elem: elem.prod...
"""Substitutes algorithm module.""" class Findsubstitutes: """Find substitute for a product.""" @classmethod def run(cls, product): """Run function. Start the research.""" categories = product.categories.all() categories = sorted(categories, key=lambda elem: elem.product_set.count(...
if 1: 1 elif 2: 2 elif 3: 3 else: if 4: 4 elif 5: 5 else: 6
if 1: 1 elif 2: 2 elif 3: 3 elif 4: 4 elif 5: 5 else: 6
class Context: def __init__(self, bot, contact, member, content): self.bot = bot self.contact = contact self.member = member self.content = content def send(context, text): context.bot.SendTo(context.contact, text, resendOn1202=True)
class Context: def __init__(self, bot, contact, member, content): self.bot = bot self.contact = contact self.member = member self.content = content def send(context, text): context.bot.SendTo(context.contact, text, resendOn1202=True)
username="bhavesh.kalra92@gmail.com" pwd="" rootUser="root" smtp='smtp.gmail.com:587'
username = 'bhavesh.kalra92@gmail.com' pwd = '' root_user = 'root' smtp = 'smtp.gmail.com:587'