content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def flatten(d): if d == {}: return d else: k, v = d.popitem() if dict != type(v): return {k: v, **flatten(d)} else: flat_kv = flatten(v) for k1 in list(flat_kv.keys()): flat_kv[str(k) + '.' + str(k1)] = flat_kv[k1] ...
def flatten(d): if d == {}: return d else: (k, v) = d.popitem() if dict != type(v): return {k: v, **flatten(d)} else: flat_kv = flatten(v) for k1 in list(flat_kv.keys()): flat_kv[str(k) + '.' + str(k1)] = flat_kv[k1] ...
# These dictionaries are merged with the extracted function metadata at build time. # Changes to the metadata should be made here, because functions.py is generated thus any changes get overwritten. functions_override_metadata = { } functions_additional_create_advanced_sequence = { 'FancyCreateAdvancedSequence': ...
functions_override_metadata = {} functions_additional_create_advanced_sequence = {'FancyCreateAdvancedSequence': {'codegen_method': 'python-only', 'returns': 'ViStatus', 'python_name': 'create_advanced_sequence', 'method_templates': [{'session_filename': 'fancy_advanced_sequence', 'documentation_filename': 'default_met...
# Copyright 2021 Richard Johnston <techpowerawaits@outlook.com> # SPDX-license-identifier: 0BSD class AxGetException(Exception): pass class DirNotExistError(AxGetException): def __init__(self, filepath): self.message = f"The directory {filepath} does not exist" super().__init__(self.message)...
class Axgetexception(Exception): pass class Dirnotexisterror(AxGetException): def __init__(self, filepath): self.message = f'The directory {filepath} does not exist' super().__init__(self.message) class Dirnotaccessibleerror(AxGetException): def __init__(self, filepath): self.mes...
#!/usr/bin/env python3 """ ruledxml.decorators ------------------- Decorators implemented for ruledxml to be applied to rules. (C) 2015, meisterluk, BSD 3-clause license """ def annotate_function(key, init, clbk): """Magic function introducing a ``metadata`` dictionary attribute. If this at...
""" ruledxml.decorators ------------------- Decorators implemented for ruledxml to be applied to rules. (C) 2015, meisterluk, BSD 3-clause license """ def annotate_function(key, init, clbk): """Magic function introducing a ``metadata`` dictionary attribute. If this attribute does not exist ye...
# Solution def third_max(nums): first_max = -2147483649 second_max = -2147483649 third_max = -2147483649 for i in range(0, len(nums)): if nums[i] > max(first_max, second_max, third_max): third_max = second_max second_max = first_max first_max = nums[i] elif nums[i]> max(third_max, ...
def third_max(nums): first_max = -2147483649 second_max = -2147483649 third_max = -2147483649 for i in range(0, len(nums)): if nums[i] > max(first_max, second_max, third_max): third_max = second_max second_max = first_max first_max = nums[i] elif nums[...
# # PySNMP MIB module ATSWTCH2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ATSWTCH2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:14:48 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,...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, value_size_constraint, single_value_constraint) ...
def parse_raw_choices(str): """ Parses choices from a raw text string, so it's possible to do things like this: MYFIELD_CHOICES=parse_raw_choices( ''' # Comments (prefixed with "#"), empty lines and spacing are supported # (whitespace improves readability) This option numbe...
def parse_raw_choices(str): """ Parses choices from a raw text string, so it's possible to do things like this: MYFIELD_CHOICES=parse_raw_choices( ''' # Comments (prefixed with "#"), empty lines and spacing are supported # (whitespace improves readability) This option numbe...
""" This file should trigger linting error for unused variable. """ def unused_variable_func(): """ Note the unused variable. Bad bad bad.""" unused = 1
""" This file should trigger linting error for unused variable. """ def unused_variable_func(): """ Note the unused variable. Bad bad bad.""" unused = 1
N = int(input()) if N <= 111: print(111) elif 111 < N <= 222: print(222) elif 222 < N <= 333: print(333) elif 333 < N <= 444: print(444) elif 444 < N <= 555: print(555) elif 555 < N <= 666: print(666) elif 666 < N <= 777: print(777) elif 777 < N <= 888: print(888) elif 888 < N <= 999: ...
n = int(input()) if N <= 111: print(111) elif 111 < N <= 222: print(222) elif 222 < N <= 333: print(333) elif 333 < N <= 444: print(444) elif 444 < N <= 555: print(555) elif 555 < N <= 666: print(666) elif 666 < N <= 777: print(777) elif 777 < N <= 888: print(888) elif 888 < N <= 999: ...
def main(j, args, params, tags, tasklet): params.merge(args) params.result = "" doc = params.doc if doc.content.find("@DESTRUCTED@") != -1: # page no longer show, destruction message doc.destructed = True doc.content = doc.content.replace("@DESTRUCTED@", "") else: ...
def main(j, args, params, tags, tasklet): params.merge(args) params.result = '' doc = params.doc if doc.content.find('@DESTRUCTED@') != -1: doc.destructed = True doc.content = doc.content.replace('@DESTRUCTED@', '') elif doc.destructed is False: newdoc = '@DESTRUCTED@\n%s' % ...
# While loops x = 0 while x < 5: print(f'Current value of x is: {x}') x += 1 else: print("X is not less than five") # Break, Continue, Pass # break: Breaks out of the current closest enclosing loop. # continue: Goes to the top of the closest enclosing loop. # pass: Does nothing at all # Pass print('# Pa...
x = 0 while x < 5: print(f'Current value of x is: {x}') x += 1 else: print('X is not less than five') print('# Pass #') x = [1, 2, 3] for i in x: pass print('# Continue #') my_string = 'David' for letter in myString: if letter == 'a': continue print(letter) print('# Break #') my_string =...
def quicksort(left,right,p): l=left r=right pivot=list[left] while(left<right): if p==1: while((list[right]>=pivot) and left<right): right=right-1 if(left!=right): ...
def quicksort(left, right, p): l = left r = right pivot = list[left] while left < right: if p == 1: while list[right] >= pivot and left < right: right = right - 1 if left != right: list[left] = list[right] left = left + 1 ...
# -*- coding: utf-8 -*- """Adapters module.""" class AdapterError(Exception): pass
"""Adapters module.""" class Adaptererror(Exception): pass
def find_symbols(nodes): symbols = {} #variables, docs and contexts for symbol_type in ("doc", "variable", "context"): for node in nodes[symbol_type]: name = node["name"] if name in symbols: other_symbol_type = symbols[name]["type"] msg = "Duplicat...
def find_symbols(nodes): symbols = {} for symbol_type in ('doc', 'variable', 'context'): for node in nodes[symbol_type]: name = node['name'] if name in symbols: other_symbol_type = symbols[name]['type'] msg = 'Duplicate symbol name: %s (%s and %s)'...
class Guitar: def play(self): return "Playing the guitar" class Children: def play(self): return "Children are playing" def eat(self): return 'Children are eating' def start_playing(i_can_play): return i_can_play.play() children = Children() guitar = Guitar() print(start_...
class Guitar: def play(self): return 'Playing the guitar' class Children: def play(self): return 'Children are playing' def eat(self): return 'Children are eating' def start_playing(i_can_play): return i_can_play.play() children = children() guitar = guitar() print(start_pla...
# coding: utf-8 """ Standard gamepad mappings. Pulled in to Gamepad.py directly. """ class PS3(Gamepad): fullName = 'PlayStation 3 controller' def __init__(self, joystickNumber = 0): Gamepad.__init__(self, joystickNumber) self.axisNames = { 0: 'LEFT-X', 1: 'LEFT-Y', ...
""" Standard gamepad mappings. Pulled in to Gamepad.py directly. """ class Ps3(Gamepad): full_name = 'PlayStation 3 controller' def __init__(self, joystickNumber=0): Gamepad.__init__(self, joystickNumber) self.axisNames = {0: 'LEFT-X', 1: 'LEFT-Y', 2: 'L2', 3: 'RIGHT-X', 4: 'RIGHT-Y', 5: 'R2'...
DICT = { 'update_radius' : 1, 'seed':160, 'number_of_runs':500, 'scramble_rate':1, 'initial_randomness':0.20, 'scramble_amount':0.1, 'valid_revision_limit' : 0.1 } def make_params_string(param_dict) : stringa = "" for key in param_dict : stringa += key + "=" + str(param_dict[key]) + '\n' return stringa def print...
dict = {'update_radius': 1, 'seed': 160, 'number_of_runs': 500, 'scramble_rate': 1, 'initial_randomness': 0.2, 'scramble_amount': 0.1, 'valid_revision_limit': 0.1} def make_params_string(param_dict): stringa = '' for key in param_dict: stringa += key + '=' + str(param_dict[key]) + '\n' return strin...
eval_iter_period = 5 checkpoint_config = dict(iter_period=eval_iter_period) log_config = dict(period=5) work_dir = './work_dirs' # the dir to save logs and models # load_from = '/home/datasets/mix_data/model/visdial_model_imix/vqa_weights.pth' # load_from = '~/iMIX/imix/work_dirs/epoch18_model.pth' # seed = 13 CUDNN_...
eval_iter_period = 5 checkpoint_config = dict(iter_period=eval_iter_period) log_config = dict(period=5) work_dir = './work_dirs' cudnn_benchmark = False model_device = 'cuda' find_unused_parameters = True gradient_accumulation_steps = 10 is_lr_accumulation = False
class Solution: def removeDuplicates(self, s: str, k: int) -> str: stack = [] for ch in s: if not stack or stack[-1][0] != ch: stack.append([ch, 1]) else: stack[-1][-1] = (stack[-1][-1] + 1) % k if stack[-1][-1] == 0: ...
class Solution: def remove_duplicates(self, s: str, k: int) -> str: stack = [] for ch in s: if not stack or stack[-1][0] != ch: stack.append([ch, 1]) else: stack[-1][-1] = (stack[-1][-1] + 1) % k if stack[-1][-1] == 0: ...
class Solution: def minMutation(self, start: str, end: str, bank: List[str]) -> int: bfs = [(start, 0)] while bfs: gene, step = bfs.pop(0) if gene == end: return step for i in range(8): for x in "ACGT": mutation = gene[:i] + x +...
class Solution: def min_mutation(self, start: str, end: str, bank: List[str]) -> int: bfs = [(start, 0)] while bfs: (gene, step) = bfs.pop(0) if gene == end: return step for i in range(8): for x in 'ACGT': mutat...
def getipaddressconfig(routername): intconfig="" sampletemplate=""" interface f0/0 ip address ipinfof0/0 interface f1/0 ip address ipinfof1/0 interface f0/1 ip address ipinfof0/1 """ if (routername == "testindia"): f0_0="11.0.0.1 255.0.0.0" f1_0="10.0.0.1 255.0...
def getipaddressconfig(routername): intconfig = '' sampletemplate = '\n interface f0/0\n ip address ipinfof0/0\n interface f1/0\n ip address ipinfof1/0\n interface f0/1\n ip address ipinfof0/1\n ' if routername == 'testindia': f0_0 = '11.0.0.1 255.0.0.0' f1_0 = '10.0....
"""BUILD macros used in OSS builds.""" load("@protobuf_archive//:protobuf.bzl", "cc_proto_library", "py_proto_library") def tfx_bsl_proto_library( name, srcs = [], has_services = False, deps = [], visibility = None, testonly = 0, cc_grpc_version = None, ...
"""BUILD macros used in OSS builds.""" load('@protobuf_archive//:protobuf.bzl', 'cc_proto_library', 'py_proto_library') def tfx_bsl_proto_library(name, srcs=[], has_services=False, deps=[], visibility=None, testonly=0, cc_grpc_version=None, cc_api_version=2): """Opensource cc_proto_library.""" _ignore = [has_s...
# # @lc app=leetcode id=350 lang=python3 # # [350] Intersection of Two Arrays II # # @lc code=start class Solution: def intersect(self, nums1, nums2): if not nums1 or not nums2: return [] d1 = dict() d2 = dict() while nums1: i1 = nums1.pop() if i1...
class Solution: def intersect(self, nums1, nums2): if not nums1 or not nums2: return [] d1 = dict() d2 = dict() while nums1: i1 = nums1.pop() if i1 not in d1: d1[i1] = 1 else: d1[i1] += 1 while n...
class Cocinero(): def prepararPlatillo(self): self.cuchillo = Cuchillo() self.cuchillo.cortarVegetales() self.estufa = Estufa() self.estufa.boilVegetables() self.freidora = Freidora() self.freidora.freirVegetales() class Cuchillo(): def cortarVegetales(self): ...
class Cocinero: def preparar_platillo(self): self.cuchillo = cuchillo() self.cuchillo.cortarVegetales() self.estufa = estufa() self.estufa.boilVegetables() self.freidora = freidora() self.freidora.freirVegetales() class Cuchillo: def cortar_vegetales(self): ...
n, kDomino = int(input().split()) prevPair = int(input().split()) for i in range(n - 1): nextPair = int(input().split())
(n, k_domino) = int(input().split()) prev_pair = int(input().split()) for i in range(n - 1): next_pair = int(input().split())
# Write your code here n,k = input().split() n = int(n) k = int(k) l = list(map(int,input().split())) i = 0 while (i < n) : if (i + k < n + 1) : print(max(l[i:i + k]),end = " ") i += 1
(n, k) = input().split() n = int(n) k = int(k) l = list(map(int, input().split())) i = 0 while i < n: if i + k < n + 1: print(max(l[i:i + k]), end=' ') i += 1
def grab_shape(slide, shape_name): return slide.Shapes(shape_name) def grab_styles(shape): return {'width': shape.Width, 'height': shape.Height, 'top': shape.Top, 'left': shape.Left, 'lock_aspect_ratio': shape.LockAspectRatio} def apply_styles(shape, styl...
def grab_shape(slide, shape_name): return slide.Shapes(shape_name) def grab_styles(shape): return {'width': shape.Width, 'height': shape.Height, 'top': shape.Top, 'left': shape.Left, 'lock_aspect_ratio': shape.LockAspectRatio} def apply_styles(shape, styles): shape.LockAspectRatio = styles['lock_aspect_ra...
#!/usr/bin/python # A function is a block of code which only runs when it is called. It can pass parameters and can return data as a result. def func(): print("Hello function") # function is defined using the def keyword func() # calling a func # Information can be passed to functions as parameter.You can a...
def func(): print('Hello function') func() def func2(fname): print('HI ' + fname) func2('X') func2('Y') func2('Z') def func3(game='Football'): print('I play ' + game) func3('Cricket') func3() def func4(y=1): return y + 1 print(func4(3)) def func5(grocery): for x in grocery: print(x) groc...
__author__ = 'mike' """ __init__.py @author: mike """
__author__ = 'mike' '\n__init__.py \n@author: mike\n\n'
""" https://leetcode-cn.com/problems/two-sum/submissions/ """ class Solution(object): def twoSum(nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ r = [] for i in range(len(nums)): try: if(i in r): con...
""" https://leetcode-cn.com/problems/two-sum/submissions/ """ class Solution(object): def two_sum(nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ r = [] for i in range(len(nums)): try: if i in r: ...
numb = int(input('digite um numero: ')) result = numb%2 if result == 0: print(f'{numb} e \033[0;34;0mPAR') else: print(f'{numb} e \033[0;33;0mIMPAR')
numb = int(input('digite um numero: ')) result = numb % 2 if result == 0: print(f'{numb} e \x1b[0;34;0mPAR') else: print(f'{numb} e \x1b[0;33;0mIMPAR')
lz = list('Alamakota') print(lz.index('a')) print(lz.index('m')) print(lz.index('k')) print() tab = [] for n in range(30+1): tab.append(3**n - 2**n) print(tab) print() print(tab.index(1161737179)) print() print(3**19-2**19)
lz = list('Alamakota') print(lz.index('a')) print(lz.index('m')) print(lz.index('k')) print() tab = [] for n in range(30 + 1): tab.append(3 ** n - 2 ** n) print(tab) print() print(tab.index(1161737179)) print() print(3 ** 19 - 2 ** 19)
class UserMixin: """Test autheticated user CRUD views """ # User endpoints async def test_get_user_401(self): request = await self.client.get(self.api_url('user')) self.check401(request.response) async def test_get_user_200(self): request = await self.client.get(self.api_u...
class Usermixin: """Test autheticated user CRUD views """ async def test_get_user_401(self): request = await self.client.get(self.api_url('user')) self.check401(request.response) async def test_get_user_200(self): request = await self.client.get(self.api_url('user'), token=self...
message: dict = { 'TrackingID': str, 'MessageType': str, 'Duration': int, 'Host': str, 'Node': str, 'ClientHost': str, 'BackendSystem': str, 'BackendMethod': str, 'FrontendMethod': str, 'BackendServiceName': str, 'ApplicationName': str, 'ServiceVersion': str, 'StartDa...
message: dict = {'TrackingID': str, 'MessageType': str, 'Duration': int, 'Host': str, 'Node': str, 'ClientHost': str, 'BackendSystem': str, 'BackendMethod': str, 'FrontendMethod': str, 'BackendServiceName': str, 'ApplicationName': str, 'ServiceVersion': str, 'StartDateTime': str, 'EndDateTime': str, 'Aspects': str, 'Qu...
def main(): print("This program computes the fuel efficiency") print("of your vehicle in miles per gallon.") prev_odom = float(input("Enter the previous odometer reading in miles: ")) curr_odom = float(input("Enter the current odometer reading in miles: ")) fuel_amount = float(input("Enter the amou...
def main(): print('This program computes the fuel efficiency') print('of your vehicle in miles per gallon.') prev_odom = float(input('Enter the previous odometer reading in miles: ')) curr_odom = float(input('Enter the current odometer reading in miles: ')) fuel_amount = float(input('Enter the amoun...
# https://leetcode.com/problems/valid-parentheses/ class Solution: # ---- In-place Solution def isMatch(self, s1: str, s2: str) -> bool: if s1 == "(" and s2 == ")": return True if s1 == "[" and s2 == "]": return True if s1 == "{" and s2 == "}": return True return False ...
class Solution: def is_match(self, s1: str, s2: str) -> bool: if s1 == '(' and s2 == ')': return True if s1 == '[' and s2 == ']': return True if s1 == '{' and s2 == '}': return True return False def solve_inplace(self, s: str): l = li...
# Copyright 2018 The Bazel Authors. All rights reserved. # # 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 la...
""" This module implements the node toolchain rule. """ node_info = provider(doc='Information about how to invoke the node executable.', fields={'target_tool': 'A hermetically downloaded nodejs executable target for the target platform.', 'target_tool_path': 'Path to an existing nodejs executable for the target platfor...
a = 0 def foo(): global a a = 1
a = 0 def foo(): global a a = 1
def inorder(node): if not node: return yield from inorder(node.left) yield node yield from inorder(node.right)
def inorder(node): if not node: return yield from inorder(node.left) yield node yield from inorder(node.right)
string = m = [] while string != 'end': string = input() m.append(list(map(int, string.split(' ')))) if string != 'end' else None li, lj = len(m), len(m[0]) new = [[sum([m[i-1][j], m[(i+1)%li][j], m[i][j-1], m[i][(j+1)%lj]]) for j in range(lj)] for i in range(li)] [print(' '.join(map(str, row))) for row in new]
string = m = [] while string != 'end': string = input() m.append(list(map(int, string.split(' ')))) if string != 'end' else None (li, lj) = (len(m), len(m[0])) new = [[sum([m[i - 1][j], m[(i + 1) % li][j], m[i][j - 1], m[i][(j + 1) % lj]]) for j in range(lj)] for i in range(li)] [print(' '.join(map(str, row))) ...
class Solution: """ @param A: An integer array @param index1: the first index @param index2: the second index @return: nothing """ def swapIntegers(self, A, index1, index2): # write your code here temp = A[index1] A[index1] = A[index2] A[index2] = temp ...
class Solution: """ @param A: An integer array @param index1: the first index @param index2: the second index @return: nothing """ def swap_integers(self, A, index1, index2): temp = A[index1] A[index1] = A[index2] A[index2] = temp return A
alphabet = string.ascii_lowercase filepath = 'data/gutenberg.txt' TEXT = open(filepath).read() def tokens(text): words = re.findall('[a-z]+',text.lower()) return words WORDS = tokens(TEXT) COUNTS = Counter(WORDS) data = open("data/count_1w.txt",'w') for i in COUNTS: data.write(i+'\t'+str(COUNTS[i])+'\n'...
alphabet = string.ascii_lowercase filepath = 'data/gutenberg.txt' text = open(filepath).read() def tokens(text): words = re.findall('[a-z]+', text.lower()) return words words = tokens(TEXT) counts = counter(WORDS) data = open('data/count_1w.txt', 'w') for i in COUNTS: data.write(i + '\t' + str(COUNTS[i]) +...
def test_ping(test_app): response = test_app.get("/ping") assert response.status_code == 200 assert response.json() == {"ping":"pong!"} def test_foo(test_app): response = test_app.get("/foo") assert response.status_code == 200 assert response.json() == {"foo":"bar!"}
def test_ping(test_app): response = test_app.get('/ping') assert response.status_code == 200 assert response.json() == {'ping': 'pong!'} def test_foo(test_app): response = test_app.get('/foo') assert response.status_code == 200 assert response.json() == {'foo': 'bar!'}
class Solution: def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: if n <= 0: return [] if n == 1: return [0] graph = collections.defaultdict(set) for u, v in edges: graph[u].add(v) graph[v].add(u) queue = collections.deque() ...
class Solution: def find_min_height_trees(self, n: int, edges: List[List[int]]) -> List[int]: if n <= 0: return [] if n == 1: return [0] graph = collections.defaultdict(set) for (u, v) in edges: graph[u].add(v) graph[v].add(u) ...
# -*- coding: utf-8 -*- def urldecode(res): return dict([data.split('=') for data in res.split('&') if True])
def urldecode(res): return dict([data.split('=') for data in res.split('&') if True])
# Filter some words user_filter = input().split(' ') user_text = input() for cur_filter in user_filter: user_text = user_text.replace(cur_filter, '*' * len(cur_filter)) print(user_text)
user_filter = input().split(' ') user_text = input() for cur_filter in user_filter: user_text = user_text.replace(cur_filter, '*' * len(cur_filter)) print(user_text)
NOTE_VALUE_EXCEPTION_MESSAGE = "Ensure note value is greater than 0." class Notes: """A class to define notes, based on the midi input.""" NOTES = ( "C", # 0 "C#/Db", # 1 "D", # 2 "D#/Eb", # 3 "E", # 4 "F", # 5 "F#/Gb", # 6 "G", # 7 ...
note_value_exception_message = 'Ensure note value is greater than 0.' class Notes: """A class to define notes, based on the midi input.""" notes = ('C', 'C#/Db', 'D', 'D#/Eb', 'E', 'F', 'F#/Gb', 'G', 'G#/Ab', 'A', 'A#/Bb', 'B') def __init__(self, note_int): """Constructor method. Paramete...
class ProgramName: def __init__(self, name, value): self.name = name self.value = value def __lt__(self, other): return self.value < other.value def __le__(self, other): return self.value <= other.value def __eq__(self, other): return self.value == other.val...
class Programname: def __init__(self, name, value): self.name = name self.value = value def __lt__(self, other): return self.value < other.value def __le__(self, other): return self.value <= other.value def __eq__(self, other): return self.value == other.value...
# # PySNMP MIB module DLINK-3100-CDB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-CDB-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:33:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, constraints_intersection, single_value_constraint, value_size_constraint) ...
# -*- coding: utf-8 -*- def test_all_unique_violation_codes(all_violations): """Ensures that all violations have unique violation codes.""" codes = [] for violation in all_violations: codes.append(int(violation.code)) assert len(set(codes)) == len(all_violations) def test_all_violations_cor...
def test_all_unique_violation_codes(all_violations): """Ensures that all violations have unique violation codes.""" codes = [] for violation in all_violations: codes.append(int(violation.code)) assert len(set(codes)) == len(all_violations) def test_all_violations_correct_numbers(all_module_viol...
def insertion_sort(list): result = list[:1] list.pop(0) while len(list) != 0: currentIndex = len(result) - 1 while currentIndex >= 0 and list[0] < result[currentIndex]: currentIndex -= 1 result.insert(currentIndex + 1, list[0]) list.pop(0) return result nums ...
def insertion_sort(list): result = list[:1] list.pop(0) while len(list) != 0: current_index = len(result) - 1 while currentIndex >= 0 and list[0] < result[currentIndex]: current_index -= 1 result.insert(currentIndex + 1, list[0]) list.pop(0) return result nums...
n = int(input()) l = list(map(int, input().split(" "))) minTemp = 999999 mini = 0 for i in range(n-2): temp = max(l[i], l[i+2]) if temp < minTemp: minTemp = temp mini = i print(mini+1, minTemp)
n = int(input()) l = list(map(int, input().split(' '))) min_temp = 999999 mini = 0 for i in range(n - 2): temp = max(l[i], l[i + 2]) if temp < minTemp: min_temp = temp mini = i print(mini + 1, minTemp)
# Problem is to find the number of islands # given: # [ 1, 0, 0, 0, 1, # 0, 1, 0, 0, 1, # 0, 1, 0, 1, 0 # 0, 1, 1, 0, 0, # 1, 1, 1, 0, 0 ] # A '1' represents land, '0' represents sea. # the number of islands is 4 as an island # is a slice of the matrix that has all elements # as 1. However, # [0, 1 # 1, 0] #...
mat = [[1, 0, 0, 0, 1], [0, 1, 0, 0, 1], [0, 1, 0, 1, 0], [0, 1, 1, 0, 0], [1, 1, 1, 0, 0]] def dfs(i, j, mat, visited): """ Applies Depth first search. Args: i (int): The row index of the src element j (int): The column index of the src element mat (List[List[int]]): The input...
def get_tag(tag, body): arr = [] tmp_body = body while True: idx = tmp_body.find("<"+tag) if -1 == idx: return arr id_end = tmp_body.find(">") arr.append(tmp_body[idx:id_end+1]) tmp_body = tmp_body[id_end+1:]
def get_tag(tag, body): arr = [] tmp_body = body while True: idx = tmp_body.find('<' + tag) if -1 == idx: return arr id_end = tmp_body.find('>') arr.append(tmp_body[idx:id_end + 1]) tmp_body = tmp_body[id_end + 1:]
class ParslError(Exception): """ Base class for all exceptions Only to be invoked when only a more specific error is not available. """ pass class NotFutureError(ParslError): ''' Basically a type error. A non future item was passed to a function that expected a future. ''' pass class...
class Parslerror(Exception): """ Base class for all exceptions Only to be invoked when only a more specific error is not available. """ pass class Notfutureerror(ParslError): """ Basically a type error. A non future item was passed to a function that expected a future. """ pass class ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a ListNode def insertionSortList(self, head): if not head: return head helper = ListNode(0)...
class Solution: def insertion_sort_list(self, head): if not head: return head helper = list_node(0) helper.next = cur = head while cur.next: if cur.next.val < cur.val: pre = helper while pre.next.val < cur.next.val: ...
def makeArrayConsecutive2(statues): count = 0 for i in range(min(statues), max(statues)): if i not in statues: count += 1 return count
def make_array_consecutive2(statues): count = 0 for i in range(min(statues), max(statues)): if i not in statues: count += 1 return count
""" Builder design-pattern implemented as a House builder class example ( houses) with a few builder sub-classes. NOTE: In this implementation, we have combined the director and the builder into a single class. The builder itself is responsible for building the house, adding rooms and porches and returning the built ...
""" Builder design-pattern implemented as a House builder class example ( houses) with a few builder sub-classes. NOTE: In this implementation, we have combined the director and the builder into a single class. The builder itself is responsible for building the house, adding rooms and porches and returning the built ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def anything_to_string(input_data): if isinstance(input_data, str): return input_data elif isinstance(input_data, bytes): # return input_data.decode('utf-8', 'ignore') return input_data.decode('utf-8') elif isinstance(input_data, int):...
def anything_to_string(input_data): if isinstance(input_data, str): return input_data elif isinstance(input_data, bytes): return input_data.decode('utf-8') elif isinstance(input_data, int): return str(input_data) else: return input_data.__str__() def anything_to_bytes(in...
# Find the factorial of a given number def factorial(n): return 1 if (n == 1 or n == 0) else n * factorial(n - 1) factorial(5) # 120 factorial(11) # 39916800
def factorial(n): return 1 if n == 1 or n == 0 else n * factorial(n - 1) factorial(5) factorial(11)
#The hailstone sequence starting at a positive integer n. Is generated by following two simple rules: # (1) If n even, the next number in the sequence is n/ 2. # (2) If n is odd, the next number in the sequence is 3*n+1 # A recursive function hailstone (n) Which prints the hailstone sequence beginning at 1. Stop when...
def generate_hailstone_using_recursion(n): if n == 1: return 1 elif n % 2 == 0: print(int(n), end=',') return generate_hailstone_using_recursion(n / 2) else: print(int(n), end=',') return generate_hailstone_using_recursion(3 * n + 1) print('Enter a number to generate ...
class FoxAndClassroom: def ableTo(self, n, m): s, i, j = set(), 0, 0 while (i, j) not in s: s.add((i, j)) i, j = (i + 1) % n, (j + 1) % m return "Possible" if len(s) == n * m else "Impossible"
class Foxandclassroom: def able_to(self, n, m): (s, i, j) = (set(), 0, 0) while (i, j) not in s: s.add((i, j)) (i, j) = ((i + 1) % n, (j + 1) % m) return 'Possible' if len(s) == n * m else 'Impossible'
class Node: def __init__(self, val): self.val = val self.l = None self.r = None def __repr__(self): return "{}=[l={}, r={}]".format(self.val, self.l, self.r) def get_hbal_tree(arr): if not arr: return None mid = len(arr) // 2 node = Node(arr[mid]) node...
class Node: def __init__(self, val): self.val = val self.l = None self.r = None def __repr__(self): return '{}=[l={}, r={}]'.format(self.val, self.l, self.r) def get_hbal_tree(arr): if not arr: return None mid = len(arr) // 2 node = node(arr[mid]) node....
class Credential: """ Class that generate new instances of credential """ credential_list = [] #empty credential list #Init method up here def save_credential(self): ''' save_credential method saves credential objects into credential_list ''' Credential.creden...
class Credential: """ Class that generate new instances of credential """ credential_list = [] def save_credential(self): """ save_credential method saves credential objects into credential_list """ Credential.credential_list.append(self) def delete_credential(s...
option_numbers = 5 factors_names = ('raw') reverse_scoring_numbers =(1,3,8,10,11) factors_interpretation = { (16,32) :'mild' , (33,48):'moderate' , (49,1000):'severe' }
option_numbers = 5 factors_names = 'raw' reverse_scoring_numbers = (1, 3, 8, 10, 11) factors_interpretation = {(16, 32): 'mild', (33, 48): 'moderate', (49, 1000): 'severe'}
# Simple recursive solution by DFS. call dfs with current sum. It will keep calling itself with left and right nodes. # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): de...
class Solution(object): def has_path_sum(self, root, sum): """ :type root: TreeNode :type sum: int :rtype: bool """ self.sum = sum return self.helper(root, 0) def helper(self, node, s): if not node: return False s += node.val ...
# dependencies_map.py # # Map of GitHub project names to clone target paths, relative to the GPUPerfAPI # project root on the local disk. # This script is used by the UpdateCommon.py script # GitHub GPUOpen-Tools projects map # Define a set of dependencies that exist as separate git projects. The parameters a...
git_mapping = {'common-lib-amd-ADL': ['../Common/Lib/AMD/ADL', None], 'common-lib-amd-APPSDK-3.0': ['../Common/Lib/AMD/APPSDK', None], 'common-lib-ext-OpenGL': ['../Common/Lib/Ext/OpenGL', None], 'common-lib-ext-WindowsKits': ['../Common/Lib/Ext/Windows-Kits', None], 'googletest': ['../Common/Lib/Ext/GoogleTest', 'v1.8...
data = [ { 'var': 'total', 'exp': {'var': 'registration.donation'}, }, ]
data = [{'var': 'total', 'exp': {'var': 'registration.donation'}}]
config = { 'account': '618537831167', 'region': 'us-west-1', }
config = {'account': '618537831167', 'region': 'us-west-1'}
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 1 22:13:26 2020 @author: sawleen """
""" Created on Tue Sep 1 22:13:26 2020 @author: sawleen """
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 23 15:17:38 2019 @author: usingh """
""" Created on Sat Nov 23 15:17:38 2019 @author: usingh """
#!/usr/bin/env python ''' Copyright (C) 2019, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'Approach (Approach)' def is_waf(self): schemes = [ # This method of detection is old (though most reliable), so we check it first self.matchContent(r'approach.{0,10}?web appl...
""" Copyright (C) 2019, WAFW00F Developers. See the LICENSE file for copying permission. """ name = 'Approach (Approach)' def is_waf(self): schemes = [self.matchContent('approach.{0,10}?web application (firewall|filtering)'), self.matchContent('approach.{0,10}?infrastructure team')] if any((i for i in schemes)...
''' These sub-modules were created to support the calibration of specific L4C model variants (which are also implemented in the corresponding sub-module for forward-run simulations, `pyl4c.apps.l4c.extensions`). '''
""" These sub-modules were created to support the calibration of specific L4C model variants (which are also implemented in the corresponding sub-module for forward-run simulations, `pyl4c.apps.l4c.extensions`). """
input = """ 1 2 1 0 3 1 3 1 0 2 3 1 3 0 0 8 2 2 3 0 0 0 3 a 2 b 0 B+ 0 B- 1 0 1 """ output = """ {b, a} """
input = '\n1 2 1 0 3\n1 3 1 0 2\n3 1 3 0 0\n8 2 2 3 0 0\n0\n3 a\n2 b\n0\nB+\n0\nB-\n1\n0\n1\n' output = '\n{b, a}\n'
# Derived from https://github.com/nightrome/cocostuff/blob/master/labels.md # Labels start from 0:person, and removed labels are backfilled label_map = { 0: 'person', 1: 'bicycle', 2: 'car', 3: 'motorcycle', 4: 'airplane', 5: 'bus', 6: 'train', 7: 'truck', 8:'boat', 9:...
label_map = {0: 'person', 1: 'bicycle', 2: 'car', 3: 'motorcycle', 4: 'airplane', 5: 'bus', 6: 'train', 7: 'truck', 8: 'boat', 9: 'traffic light', 10: 'fire hydrant', 11: 'stop sign', 12: 'parking meter', 13: 'bench', 14: 'bird', 15: 'cat', 16: 'dog', 17: 'horse', 18: 'sheep', 19: 'cow', 20: 'elephant', 21: 'bear', 22:...
""" Calibration following https://casaguides.nrao.edu/index.php?title=EVLA_6cmWideband_Tutorial_SN2010FZ https://casaguides.nrao.edu/index.php/EVLA_high_frequency_Spectral_Line_tutorial_-_IRC%2B10216-CASA4.5#Bandpass_and_Delay """ vis = '16B-202.sb32532587.eb32875589.57663.07622001157.ms' cont_vis = '16B-202.width8.co...
""" Calibration following https://casaguides.nrao.edu/index.php?title=EVLA_6cmWideband_Tutorial_SN2010FZ https://casaguides.nrao.edu/index.php/EVLA_high_frequency_Spectral_Line_tutorial_-_IRC%2B10216-CASA4.5#Bandpass_and_Delay """ vis = '16B-202.sb32532587.eb32875589.57663.07622001157.ms' cont_vis = '16B-202.width8.con...
# -*- coding: utf-8 -*- """ Created on Wed Sep 2 20:21:49 2020 @author: Abhishek Mukherjee """ class Solution: def reverseParentheses(self, s: str) -> str: temp=[] for i in s: if i==')': tempPrime=[] for j in range(len(temp[::-1])): ...
""" Created on Wed Sep 2 20:21:49 2020 @author: Abhishek Mukherjee """ class Solution: def reverse_parentheses(self, s: str) -> str: temp = [] for i in s: if i == ')': temp_prime = [] for j in range(len(temp[::-1])): tempPrime.appen...
pkgname = "cups-pk-helper" pkgver = "0.2.6_git20210504" # using git because last release was years ago and needs intltool _commit = "151fbac90f62f959ccc648d4f73ca6aafc8f8e6a" pkgrel = 0 build_style = "meson" hostmakedepends = ["meson", "pkgconf", "glib-devel", "gettext-tiny"] makedepends = ["libglib-devel", "cups-devel...
pkgname = 'cups-pk-helper' pkgver = '0.2.6_git20210504' _commit = '151fbac90f62f959ccc648d4f73ca6aafc8f8e6a' pkgrel = 0 build_style = 'meson' hostmakedepends = ['meson', 'pkgconf', 'glib-devel', 'gettext-tiny'] makedepends = ['libglib-devel', 'cups-devel', 'polkit-devel'] pkgdesc = 'PolicyKit helper to configure CUPS w...
# operators description # == if the values of two operands are equal, then the condition become true # != if values of two operands are not equal, then the condition become true # > if the value of left operand is greater than the value of right operand, then the condition is true ...
print(1 == 1) print(1 != 1) print(1 != 10) print(5 > 3) print(6 > 9) print(4 < 7) print(6 < 5) print(4 >= 4) print(6 >= 8) print(3 <= 3) print(3 <= 2)
r"""Diamonds, by Al Sweigart al@inventwithpython.com Draws diamonds of various sizes. /\ /\ / \ //\\ /\ /\ / \ ///\\\ / \ //\\ / \ ////\\\\ /\ /\ / \ ///\\\ \ / \\\\//// / \ //\\ \ / \\\/// \ ...
"""Diamonds, by Al Sweigart al@inventwithpython.com Draws diamonds of various sizes. /\\ /\\ / \\ //\\\\ /\\ /\\ / \\ ///\\\\\\ / \\ //\\\\ / \\ ////\\\\\\\\ /\\ /\\ / \\ ///\\\\\\ \\ / \\\\\\\\//// /...
words = ['one', 'fish', 'two', 'fish', 'red', 'fish', 'blue', 'fish'] word_lengths = list(map(len, words)) comp_word_lengths = [len(word) for word in words] print(word_lengths) print(comp_word_lengths)
words = ['one', 'fish', 'two', 'fish', 'red', 'fish', 'blue', 'fish'] word_lengths = list(map(len, words)) comp_word_lengths = [len(word) for word in words] print(word_lengths) print(comp_word_lengths)
filename = 'programming.txt' with open(filename, 'w') as file_object: file_object.write("I love python programming.\n") file_object.write("I love creating games.\n") with open(filename, 'a') as file_object: file_object.write("I also like analyzing large data sets.\n")
filename = 'programming.txt' with open(filename, 'w') as file_object: file_object.write('I love python programming.\n') file_object.write('I love creating games.\n') with open(filename, 'a') as file_object: file_object.write('I also like analyzing large data sets.\n')
doc = open("./doctor.csv", "r") #hosp = open("./hospital.csv", "r") xml_doc = open("./doctor_final.xml", "w") #xml_hosp = open("./hospital_mini.xml", "w") # def find_ind(lista, name): # for x in range(len(lista)): # if lista[x] == name: # return x doc2 = doc.read().splitlines()...
doc = open('./doctor.csv', 'r') xml_doc = open('./doctor_final.xml', 'w') doc2 = doc.read().splitlines() doc3 = [] for x in doc2: doc3.append(x.split(',')) ind_npi = doc3[0].index('NPI') ind_first_name = doc3[0].index('First Name') ind_middle_name = doc3[0].index('Middle Name') ind_last_name = doc3[0].index('Last N...
#script to print first N odd natural no.s in reverse order print("enter the value of n") n=int(input()) i=1 while(i<=2*n-1): print(2*n-i) i+=2
print('enter the value of n') n = int(input()) i = 1 while i <= 2 * n - 1: print(2 * n - i) i += 2
HEIGHT = 600 WIDTH = 600 LINE_WIDTH = 10 GRID = 4 # NxN Grid COLORS = { 'background': (200, 200, 200), 'line': (0, 0, 0), 'red': (255, 0, 0), 'dark_red': (150, 0, 0), 'blue': (0, 0, 255), 'dark_blue': (0, 0, 150), 'gray': (100, 100, 100) }
height = 600 width = 600 line_width = 10 grid = 4 colors = {'background': (200, 200, 200), 'line': (0, 0, 0), 'red': (255, 0, 0), 'dark_red': (150, 0, 0), 'blue': (0, 0, 255), 'dark_blue': (0, 0, 150), 'gray': (100, 100, 100)}
def count_trees(): pos = 0 trees = 0 for line in open('3/input.txt'): if line[pos] == "#": trees += 1 pos = (pos + 3) % len(line.rstrip()) return trees print(count_trees())
def count_trees(): pos = 0 trees = 0 for line in open('3/input.txt'): if line[pos] == '#': trees += 1 pos = (pos + 3) % len(line.rstrip()) return trees print(count_trees())
# -*- coding: utf-8 -*- """ pip_services3_components.counters.CounterType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Counter type enumeration :copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ class Counter...
""" pip_services3_components.counters.CounterType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Counter type enumeration :copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ class Countertype(object): """ ...
class Solution: def numDistinct(self, s: str, t: str) -> int: N, M = len(t), len(s) dp = [[0] * (M + 1) for _ in range(N + 1)] for i in range(N + 1): dp[i][ 0] = 0 # Number of subsequences of zero length S can be formed which equal t[0:i] for j in range(...
class Solution: def num_distinct(self, s: str, t: str) -> int: (n, m) = (len(t), len(s)) dp = [[0] * (M + 1) for _ in range(N + 1)] for i in range(N + 1): dp[i][0] = 0 for j in range(M + 1): dp[0][j] = 1 for i in range(1, N + 1): for j in ...
#!/bin/bash/ env python3 ### Should be #!/usr/bin/env python3 def compute_sum(tol): k = 1 conv_sum = 0 term = (1/k**2) while tol < term: term = (1/k**2) conv_sum += term k += 1 return conv_sum ### This return breaks the while loop immediately ...
def compute_sum(tol): k = 1 conv_sum = 0 term = 1 / k ** 2 while tol < term: term = 1 / k ** 2 conv_sum += term k += 1 return conv_sum if __name__ == '__main__': convergence = compute_sum(tol=0.01) print('If tol is 1e-2, sum converges at', convergence) smaller...
def getNextIndex(str, command): i = 0 while i < len(str): if str[i] == command: return i + 1 i += 1 return None def getNextValue(str, command, default): i = 0 while i < len(str): if str[i] == command: return str[i + 1] i += 1 return de...
def get_next_index(str, command): i = 0 while i < len(str): if str[i] == command: return i + 1 i += 1 return None def get_next_value(str, command, default): i = 0 while i < len(str): if str[i] == command: return str[i + 1] i += 1 return de...
OUT = 0 IN = 1 HIGH = True LOW = False class GPIOLineInUsedError(Exception): pass class GPIOInvalidLineError(Exception): pass class BaseGPIO(): """ Base class for implementing simple digital IO for a platform. Implementors are expected to subclass from this and provide an ...
out = 0 in = 1 high = True low = False class Gpiolineinusederror(Exception): pass class Gpioinvalidlineerror(Exception): pass class Basegpio: """ Base class for implementing simple digital IO for a platform. Implementors are expected to subclass from this and provide an implementation ...
# # PySNMP MIB module VERILINK-ENTERPRISE-NCMGENERIC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VERILINK-ENTERPRISE-NCMGENERIC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:26:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, constraints_union, value_range_constraint) ...
# Maximum Pairwise Product # Author: jerrybelmonte # Input: First line contains an integer n. # Second line contains n non-negative integers separated by spaces. # Output: Integer of the maximum pairwise product. def maximum_pairwise_product(numbers): # sorting in descending order is O(n*logn) numbers.sort(r...
def maximum_pairwise_product(numbers): numbers.sort(reverse=True) return numbers[0] * numbers[1] if __name__ == '__main__': input_n = int(input()) input_numbers = [int(num) for num in input().split()] print(maximum_pairwise_product(input_numbers))
# https://www.codewars.com/kata/55f2b110f61eb01779000053/train/python def get_sum(a,b): sum=0 higher=b if b>a else a lower=a if b>a else b while lower<=higher: sum+=lower lower+=1 return sum print(get_sum(-1,2))
def get_sum(a, b): sum = 0 higher = b if b > a else a lower = a if b > a else b while lower <= higher: sum += lower lower += 1 return sum print(get_sum(-1, 2))
{ "targets": [{ "target_name": "registry-changes-detector", "sources": [ 'addon.cpp' ], 'include_dirs': [ "<!@(node -p \"require('node-addon-api').include\")", "<!@(node -p \"var a = require('node-addon-api').include; var b = a.substr(0, a.length ...
{'targets': [{'target_name': 'registry-changes-detector', 'sources': ['addon.cpp'], 'include_dirs': ['<!@(node -p "require(\'node-addon-api\').include")', '<!@(node -p "var a = require(\'node-addon-api\').include; var b = a.substr(0, a.length - 15); b + \'event-source-base\' + a[a.length-1]")'], 'dependencies': ['<!(no...
#https://docs.python.org/3.4/library/string.html #Refer to Format Specification Mini-Language section to understand class Solution: def hammingDistance(self, x: int, y: int) -> int: a = bin(x) b = bin(y) a = "{:0>33}".format(a[2:]) b = "{:0>33}".format(b[2:]) ...
class Solution: def hamming_distance(self, x: int, y: int) -> int: a = bin(x) b = bin(y) a = '{:0>33}'.format(a[2:]) b = '{:0>33}'.format(b[2:]) ham = 0 for i in range(len(a)): if a[i] != b[i]: ham += 1 return ham
class BinaryTree: '''A simple binary tree. ''' def __init__(self, root, left=None, right=None): '''Construct a binary tree. Arguments: root (str or int): The value of the root node. left (BinaryTree or None): The left subtree. right (BinaryTree or None):...
class Binarytree: """A simple binary tree. """ def __init__(self, root, left=None, right=None): """Construct a binary tree. Arguments: root (str or int): The value of the root node. left (BinaryTree or None): The left subtree. right (BinaryTree or None):...
def grade(input_data, quality_data, submission): score = 0.0 scoreUB = 1.0 feedback = '' lines = input_data.split('\n') first_line = lines[0].split(); items = int(first_line[0]); capacity = int(first_line[1]); values = [] weights = [] for i in range(1,items+1): line =...
def grade(input_data, quality_data, submission): score = 0.0 score_ub = 1.0 feedback = '' lines = input_data.split('\n') first_line = lines[0].split() items = int(first_line[0]) capacity = int(first_line[1]) values = [] weights = [] for i in range(1, items + 1): line = li...
# address configuration for running test LOCAL_IF="igb0" LOCAL_ADDR6="2001:630:42:110:ae1f:6bff:fe46:9eda" LOCAL_MAC="ac:1f:6b:46:9e:da" REMOTE_ADDR6="2001:630:42:110:2a0:98ff:fe15:ece7" REMOTE_MAC="00:a0:98:15:ec:e7"
local_if = 'igb0' local_addr6 = '2001:630:42:110:ae1f:6bff:fe46:9eda' local_mac = 'ac:1f:6b:46:9e:da' remote_addr6 = '2001:630:42:110:2a0:98ff:fe15:ece7' remote_mac = '00:a0:98:15:ec:e7'
class MangoPayException(Exception): """ Base class for all MangoPaySDK exceptions. (Currently only one defined: ResponseException) """ pass
class Mangopayexception(Exception): """ Base class for all MangoPaySDK exceptions. (Currently only one defined: ResponseException) """ pass