content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class DataGridViewCellStyleConverter(TypeConverter): """ Converts System.Windows.Forms.DataGridViewCellStyle objects to and from other data types. DataGridViewCellStyleConverter() """ def CanConvertTo(self,*__args): """ CanConvertTo(self: DataGridViewCellStyleConverter,context: ITypeDescriptorConte...
class Datagridviewcellstyleconverter(TypeConverter): """ Converts System.Windows.Forms.DataGridViewCellStyle objects to and from other data types. DataGridViewCellStyleConverter() """ def can_convert_to(self, *__args): """ CanConvertTo(self: DataGridViewCellStyleConverter,context: ITypeDescrip...
s=[1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
s = [1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
# encoding: utf-8 # module perfmon # from C:\Python27\lib\site-packages\win32\perfmon.pyd # by generator 1.147 # no doc # no imports # functions def CounterDefinition(*args, **kwargs): # real signature unknown pass def LoadPerfCounterTextStrings(*args, **kwargs): # real signature unknown pass def ObjectType...
def counter_definition(*args, **kwargs): pass def load_perf_counter_text_strings(*args, **kwargs): pass def object_type(*args, **kwargs): pass def perf_mon_manager(*args, **kwargs): pass def unload_perf_counter_text_strings(*args, **kwargs): pass
temperatura_celsus = 0 def convert_celsus(temperatura_celsus): celsus = ((temperatura_celsus - 32) / 1.8) return celsus print(convert_celsus(100))
temperatura_celsus = 0 def convert_celsus(temperatura_celsus): celsus = (temperatura_celsus - 32) / 1.8 return celsus print(convert_celsus(100))
class AsyncIterWrapper: """Async wrapper for sync iterables Copied from aitertools package. """ def __init__(self, iterable): self._it = iter(iterable) def __aiter__(self): return self async def __anext__(self): try: return next(self._it) except S...
class Asynciterwrapper: """Async wrapper for sync iterables Copied from aitertools package. """ def __init__(self, iterable): self._it = iter(iterable) def __aiter__(self): return self async def __anext__(self): try: return next(self._it) except St...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def hasCycle(self, head: Optional[ListNode]) -> bool: ## without using any set ## Floyd's Tortoise and Hare method ## https://www.yo...
class Solution: def has_cycle(self, head: Optional[ListNode]) -> bool: (slow, fast) = (head, head) while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: return True return False val_pos = set() w...
#question 2 #generate the series #3 8 14 22 34 53 83 129 197 294 print("Enter the lenght of the series:") seriesLength =int(input()) s1,s2,s3 = 1,5,3 gen_series = [] for itr in range(1,seriesLength): gen_series.append(s3) s3 += s2 s2 += s1 s1 += itr result = (str(gen_series).replace(',','...
print('Enter the lenght of the series:') series_length = int(input()) (s1, s2, s3) = (1, 5, 3) gen_series = [] for itr in range(1, seriesLength): gen_series.append(s3) s3 += s2 s2 += s1 s1 += itr result = str(gen_series).replace(',', ' ')[1:-1] print(result)
my_name = "Juan Manuel Young Hoyos" print(my_name[0]) # * Both of them are equal print(my_name[0:3]) print(my_name[:3]) # * Both of them are equal print(my_name[1:len(my_name)]) print(my_name[1:]) # * Slicing with steps print(my_name[1:len(my_name):2]) # * It brings me everything print(my_name[::])
my_name = 'Juan Manuel Young Hoyos' print(my_name[0]) print(my_name[0:3]) print(my_name[:3]) print(my_name[1:len(my_name)]) print(my_name[1:]) print(my_name[1:len(my_name):2]) print(my_name[:])
settlement = "ISHUV" street1="REHOV1" street2="REHOV2" road1="KVISH1" road2="KVISH2" junction_name = "SHEM_ZOMET" settlement_sign = "SEMEL_YISHUV" street_sign = "SEMEL_RECHOV" street_name = "SHEM_RECHOV" table_number = "MS_TAVLA" code = "KOD" name = "NAME" sign = "SEMEL" urban_intersection="ZOMET_IRONI" non_urban_inter...
settlement = 'ISHUV' street1 = 'REHOV1' street2 = 'REHOV2' road1 = 'KVISH1' road2 = 'KVISH2' junction_name = 'SHEM_ZOMET' settlement_sign = 'SEMEL_YISHUV' street_sign = 'SEMEL_RECHOV' street_name = 'SHEM_RECHOV' table_number = 'MS_TAVLA' code = 'KOD' name = 'NAME' sign = 'SEMEL' urban_intersection = 'ZOMET_IRONI' non_u...
''' Class that maps to the JSON TokenInfo ''' class MTTokenInfo(): v = None code = None code_desc = None token_id = None timestamp_sec = None timestamp_iso = None hostname = None is_dev_host = None action = None ip = None def __init__(self, v: str, code: int, codeDesc: st...
""" Class that maps to the JSON TokenInfo """ class Mttokeninfo: v = None code = None code_desc = None token_id = None timestamp_sec = None timestamp_iso = None hostname = None is_dev_host = None action = None ip = None def __init__(self, v: str, code: int, codeDesc: str, t...
""" Extrusion. Converts a flat image into spatial data points and rotates the points around the center. """ a = None onetime = True aPixels = None values = None angle = 0 def setup(): size(640, 360, P3D) aPixels = [[0] * width for i in range(height)] values = [[0] * width for i in range(height)] noF...
""" Extrusion. Converts a flat image into spatial data points and rotates the points around the center. """ a = None onetime = True a_pixels = None values = None angle = 0 def setup(): size(640, 360, P3D) a_pixels = [[0] * width for i in range(height)] values = [[0] * width for i in range(height)] no...
test = { 'name': 'Problem 11', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (define (square x) (* x x)) square scm> square (lambda (x) (* x x)) scm> (square 21) 441 scm> square ; check to make sure lambd...
test = {'name': 'Problem 11', 'points': 1, 'suites': [{'cases': [{'code': "\n scm> (define (square x) (* x x))\n square\n scm> square\n (lambda (x) (* x x))\n scm> (square 21)\n 441\n scm> square ; check to make sure lambda body hasn't changed\n (l...
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: # O(N) for idx, t in enumerate(numbers): targ = target - t # O(logN) left, right = 0, len(numbers) - 1 ans = [] while left <= right: mid = left...
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: for (idx, t) in enumerate(numbers): targ = target - t (left, right) = (0, len(numbers) - 1) ans = [] while left <= right: mid = left + (right - left) // 2 ...
class Sorter: def __init__(self, group): self.group = group self.found = False def __call__(self, x): if x in self.group: self.found = True return (0, x) return (1, x)
class Sorter: def __init__(self, group): self.group = group self.found = False def __call__(self, x): if x in self.group: self.found = True return (0, x) return (1, x)
## Exceptions __all__ = ['PyDSTool_Error', 'PyDSTool_BoundsError', 'PyDSTool_KeyError', 'PyDSTool_UncertainValueError', 'PyDSTool_TypeError', 'PyDSTool_ExistError', 'PyDSTool_AttributeError', 'PyDSTool_ValueError', 'PyDSTool_UndefinedError', 'PyDSTool_InitError', 'PyDS...
__all__ = ['PyDSTool_Error', 'PyDSTool_BoundsError', 'PyDSTool_KeyError', 'PyDSTool_UncertainValueError', 'PyDSTool_TypeError', 'PyDSTool_ExistError', 'PyDSTool_AttributeError', 'PyDSTool_ValueError', 'PyDSTool_UndefinedError', 'PyDSTool_InitError', 'PyDSTool_ClearError', 'PyDSTool_ContError'] class Pydstool_Error(Exc...
def modpower(x,y,mod): ans = 1 x = x % mod while y: if ((y & 1) == 1) : ans = (ans * x) % mod y = y >> 1 x = (x * x) % mod return ans T=int(input()) for tt in range(1,T+1): N,K=[int(x) for x in input().split()] S=input() copyS=list(S) total=0 M...
def modpower(x, y, mod): ans = 1 x = x % mod while y: if y & 1 == 1: ans = ans * x % mod y = y >> 1 x = x * x % mod return ans t = int(input()) for tt in range(1, T + 1): (n, k) = [int(x) for x in input().split()] s = input() copy_s = list(S) total = 0...
load("@build_bazel_rules_apple//apple/bundling:entitlements.bzl", entitlements_rule="entitlements") load( "@build_bazel_rules_apple//apple/bundling:entitlements.bzl", "AppleEntitlementsInfo", ) def _entitlements_writer_impl(ctx): entitlement_info = ctx.attr.entitlements[AppleEntitlementsInfo] out...
load('@build_bazel_rules_apple//apple/bundling:entitlements.bzl', entitlements_rule='entitlements') load('@build_bazel_rules_apple//apple/bundling:entitlements.bzl', 'AppleEntitlementsInfo') def _entitlements_writer_impl(ctx): entitlement_info = ctx.attr.entitlements[AppleEntitlementsInfo] out = ctx.new_file(c...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # Copyright 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
"""This module exposes constants used inside the tool.""" version = 'v1.2-beta1' codejam_agent_name = 'cmdline-%s' % VERSION user_config_path = '{base_dir}/config/user_config.py' current_config_path = '{base_dir}/config/current_config.py' _runtime_constants = {} def get_runtime_constant(key, default_value=None): "...
"""A base presenter for common properties needed when rendering annotations.""" class AnnotationBasePresenter: def __init__(self, annotation): self.annotation = annotation @property def target(self): target = {"source": self.annotation.target_uri} if self.annotation.target_selecto...
"""A base presenter for common properties needed when rendering annotations.""" class Annotationbasepresenter: def __init__(self, annotation): self.annotation = annotation @property def target(self): target = {'source': self.annotation.target_uri} if self.annotation.target_selecto...
#!/usr/bin/python3 ############## # Load input # ############## rules = dict() with open("input.txt", "r") as f: initial_state = f.readline().strip().split(" ")[2] f.readline() for line in f.readlines(): rules[line.split(" => ")[0]] = line.strip().split(" => ")[1] ############## # Solution 1 # ##...
rules = dict() with open('input.txt', 'r') as f: initial_state = f.readline().strip().split(' ')[2] f.readline() for line in f.readlines(): rules[line.split(' => ')[0]] = line.strip().split(' => ')[1] current_state = '....' + initial_state + '....' for step in range(20): new_state = '' for i...
a = int(input("Please enter the first number: ")) b = int(input("Please enter the second number: ")) count = 0 for i in range(a, b + 1): if i % 2 == 0: count += i print(count)
a = int(input('Please enter the first number: ')) b = int(input('Please enter the second number: ')) count = 0 for i in range(a, b + 1): if i % 2 == 0: count += i print(count)
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: domainbounds.py # # Tests: libsim - connecting to simulation and retrieving data from it. # mesh - 3D rectilinear mesh # # Programmer: Kathleen Biagas # Date: June 17, 2014 #...
sim = test_simulation('domainbounds', 'domainbounds.sim2') (started, connected) = test_sim_start_and_connect('domainbounds00', sim) if connected: test_sim_meta_data('domainbounds01', sim.metadata()) add_plot('Subset', 'Domains') draw_plots() v = get_view3_d() v.viewNormal = (0.672727, 0.569817, 0.47...
__author__ = 'Devon Evans dle4qw' def main(): greeting('hello') def greeting(msg): print(msg) if __name__=='__main__': main()
__author__ = 'Devon Evans dle4qw' def main(): greeting('hello') def greeting(msg): print(msg) if __name__ == '__main__': main()
""" Module: 'uasyncio.core' on esp8266 v1.9.4 """ # MCU: (sysname='esp8266', nodename='esp8266', release='2.2.0-dev(9422289)', version='v1.9.4-8-ga9a3caad0 on 2018-05-11', machine='ESP module with ESP8266') # Stubber: 1.1.2 class CancelledError: '' DEBUG = 0 class EventLoop: '' def call_at_(): pas...
""" Module: 'uasyncio.core' on esp8266 v1.9.4 """ class Cancellederror: """""" debug = 0 class Eventloop: """""" def call_at_(): pass def call_later(): pass def call_later_ms(): pass def call_soon(): pass def close(): pass def create_task()...
## emails ## from_email = "" to_email = "" smtp = ""
from_email = '' to_email = '' smtp = ''
class Item: ''' Component defines entity as an item ''' def __init__(self, use_function=None, targeting=False, targeting_message=None, **kwargs): self.use_function = use_function self.targeting = targeting self.targeting_message = targeting_message self.function_kwargs = ...
class Item: """ Component defines entity as an item """ def __init__(self, use_function=None, targeting=False, targeting_message=None, **kwargs): self.use_function = use_function self.targeting = targeting self.targeting_message = targeting_message self.function_kwargs =...
# # # "3 is not equal to 5". # Save the above proposition in ans1 using the # # == or != operator. # # ans1 = None # # # "21 is a number greater than 5*10." # Save the above proposition in ans2 using # # # or < operator. # # ans2 = None # # # "5/3 share is greater than or equal to 1". # Save the above proposition in...
ans1 = 1 != 0 ans2 = 2 < 1 ans3 = 2 <= 3 print(ans1, ans2, ans3)
""" SeleniumBase constants are stored in this file. """ class Environment: # Usage Example => "--env=qa" => Then access value in tests with "self.env" QA = "qa" STAGING = "staging" DEVELOP = "develop" PRODUCTION = "production" MASTER = "master" LOCAL = "local" TEST = "test" class Fil...
""" SeleniumBase constants are stored in this file. """ class Environment: qa = 'qa' staging = 'staging' develop = 'develop' production = 'production' master = 'master' local = 'local' test = 'test' class Files: downloads_folder = 'downloaded_files' archived_downloads_folder = 'arc...
#Configuration details of user uname = "Guru HariHaraun" email = "guru@gmail.com" district_id = 560 # The 506 is the district code for trichy. vaccine_type = "COVAXIN" # Either user COVISHIED or COVAXIN All should be in UPPERCASE fee_type ="Free" # The fee type should be Paid or Free All should be in UPPERCASE a...
uname = 'Guru HariHaraun' email = 'guru@gmail.com' district_id = 560 vaccine_type = 'COVAXIN' fee_type = 'Free' age_limit = 45 attempt = 1 wait_time = 300 smtp_server = 'smtp.gmail.com' smtp_port = 587 smtp_user_name = 'test@gmail.com' smtp_password = 'qwerty@1234' is_user_notified = 0 available_flag_break = 0
gitignore = """ # Dolphin .directory # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usuall...
gitignore = '\n# Dolphin\n.directory\n# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nenv/\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\n*.egg-info/\n.installed.cfg\n*.eg...
# A P I - K E Y S # --------------- keys = ['XXXX'] # S F T P - S E R V E R # --------------------- hostname = 'XXXX' username = 'XXXX' password = 'XXXX' path = 'XXXX' # P O R T - C O D E #------------------ port_num = 'XXXX'
keys = ['XXXX'] hostname = 'XXXX' username = 'XXXX' password = 'XXXX' path = 'XXXX' port_num = 'XXXX'
# # Copyright (c) 2013-2018 Quarkslab. # This file is part of IRMA project. # # 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 in the top-level directory # of this distribution and at: # # http:...
"""Defines common Object Oriented Patterns One should re-use these instead of defining their owns. """ class Singletonmetaclass(type): """Metaclass for singleton design pattern. .. warning:: This metaclass should not be used directly. To declare a class using the singleton pattern, o...
''' Author: Justin Muirhead ''' room = 0 rooms = [ 'Hall', 'Hall2', 'Courtyard', 'Hall3', 'Kitchen', 'Hall4', 'Hall5', 'Bedroom', 'CheeseRoom' ] desc = [ 'Hall with carpet', 'Hall with paintings', 'Courtyard with paving stones', 'Hallway with plants', 'Kitchen has old moldy food', 'Hallway has ra...
""" Author: Justin Muirhead """ room = 0 rooms = ['Hall', 'Hall2', 'Courtyard', 'Hall3', 'Kitchen', 'Hall4', 'Hall5', 'Bedroom', 'CheeseRoom'] desc = ['Hall with carpet', 'Hall with paintings', 'Courtyard with paving stones', 'Hallway with plants', 'Kitchen has old moldy food', 'Hallway has rat droppings', 'Hallway has...
def fqname_for(cls: type) -> str: """ Returns the fully qualified name of ``cls``. Parameters ---------- cls The class we are interested in. Returns ------- str The fully qualified name of ``cls``. """ return f"{cls.__module__}.{cls.__qualname__}"
def fqname_for(cls: type) -> str: """ Returns the fully qualified name of ``cls``. Parameters ---------- cls The class we are interested in. Returns ------- str The fully qualified name of ``cls``. """ return f'{cls.__module__}.{cls.__qualname__}'
def main(): n = int(input()) *s, = map(int, input().split()) *t, = map(int, input().split()) inf = 1 << 60 for i in range(2 * n): i %= n j = (i + 1) % n t[j] = min( t[j], t[i] + s[i], ) print(*t, sep='\n') main()
def main(): n = int(input()) (*s,) = map(int, input().split()) (*t,) = map(int, input().split()) inf = 1 << 60 for i in range(2 * n): i %= n j = (i + 1) % n t[j] = min(t[j], t[i] + s[i]) print(*t, sep='\n') main()
inp = int(input()) sum = 0 for i in range(1, inp + 1): sum += i print(sum)
inp = int(input()) sum = 0 for i in range(1, inp + 1): sum += i print(sum)
#!/usr/bin/env python3 if __name__ == '__main__': mark_1 = int(input('Enter the first number: ')) mark_2 = int(input('Enter the second number: ')) mark_3 = int(input('Enter the third number: ')) mark_4 = int(input('Enter the fourth number: ')) mark_5 = int(input('Enter the fifth number: ')) ...
if __name__ == '__main__': mark_1 = int(input('Enter the first number: ')) mark_2 = int(input('Enter the second number: ')) mark_3 = int(input('Enter the third number: ')) mark_4 = int(input('Enter the fourth number: ')) mark_5 = int(input('Enter the fifth number: ')) max_mark = max([mark_1, ...
def sieve_of_sundaram(n): res = [] if n > 2: res.append(2) n = int((n - 1) / 2) table = [0] * (n + 1) for i in range(1, n + 1): j = i while (i + j + 2 * i * j) <= n: table[i + j + 2 * i * j] = 1 j += 1 for i in range(1, n + 1): if tabl...
def sieve_of_sundaram(n): res = [] if n > 2: res.append(2) n = int((n - 1) / 2) table = [0] * (n + 1) for i in range(1, n + 1): j = i while i + j + 2 * i * j <= n: table[i + j + 2 * i * j] = 1 j += 1 for i in range(1, n + 1): if table[i] ==...
class FastLRUCache(object): __slots__ = ['__key2value', '__max_size', '__weights'] def __init__(self, max_size: int): self.__max_size = max_size self.__key2value = {} # key->value self.__weights = [] # keys ordered in LRU def __update_weight(self, key): try: s...
class Fastlrucache(object): __slots__ = ['__key2value', '__max_size', '__weights'] def __init__(self, max_size: int): self.__max_size = max_size self.__key2value = {} self.__weights = [] def __update_weight(self, key): try: self.__weights.remove(key) exc...
weight = int(input("enter your weight ---> " )) unit = input("(L)bs or (K)g ---> ") if unit.upper() == "K": weight_lbs = weight / 0.45 print("your weight in lbs is --->", weight_lbs) elif unit.upper() == "L": weight_kg = weight * 0.45 print("your weight in kg is --->", weight_kg)
weight = int(input('enter your weight ---> ')) unit = input('(L)bs or (K)g ---> ') if unit.upper() == 'K': weight_lbs = weight / 0.45 print('your weight in lbs is --->', weight_lbs) elif unit.upper() == 'L': weight_kg = weight * 0.45 print('your weight in kg is --->', weight_kg)
#!/usr/bin/env python3 class ExtraComputationWarning(UserWarning): """ Warning thrown when a GP model does extra computation that it is not designed to do. This is mostly designed for :obj:`~gpytorch.variational.UnwhitenedVariationalStrategy`, which should cache most of its solves up front. """ ...
class Extracomputationwarning(UserWarning): """ Warning thrown when a GP model does extra computation that it is not designed to do. This is mostly designed for :obj:`~gpytorch.variational.UnwhitenedVariationalStrategy`, which should cache most of its solves up front. """ pass class Gpinputwarn...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None """ Slicing an array is expensive. It's better to pass bounds of array into recursive calls! """ class Solution: def sortedArrayToBST(self, nums): """ ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None "\nSlicing an array is expensive. It's better to pass bounds of array into recursive calls!\n" class Solution: def sorted_array_to_bst(self, nums): """ :type nums: List[int] ...
while True: correto = True try: expressao = input() parenteses_aberto = [] for e in expressao: if e == '(': parenteses_aberto.append(e) if e == ')': if len(parenteses_aberto) > 0: parenteses_aberto.pop() else: ...
while True: correto = True try: expressao = input() parenteses_aberto = [] for e in expressao: if e == '(': parenteses_aberto.append(e) if e == ')': if len(parenteses_aberto) > 0: parenteses_aberto.pop() ...
""" Copyright (c) 2020 Intel Corporation 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...
""" Copyright (c) 2020 Intel Corporation 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...
# Fibannci-ser def recur_fibo(n): if n <= 1: return n else: return(recur_fibo(n-1) + recur_fibo(n-2)) nterms = int(input("How many terms? ")) if nterms <= 0: print("Plese enter a positive integer") else: print("Fibonacci sequence:") for i in range(nterms): pr...
def recur_fibo(n): if n <= 1: return n else: return recur_fibo(n - 1) + recur_fibo(n - 2) nterms = int(input('How many terms? ')) if nterms <= 0: print('Plese enter a positive integer') else: print('Fibonacci sequence:') for i in range(nterms): print(recur_fibo(i))
# management canister interface `aaaaa-aa` # wrap basic interfaces provided by the management canister: # create_canister, install_code, canister_status, etc. class Management: pass
class Management: pass
''' XMODEM Protocol bytes ===================== .. data:: SOH Indicates a packet length of 128 (X/Y) .. data:: STX Indicates a packet length of 1024 (X/Y) .. data:: EOT End of transmission (X/Y) .. data:: ACK Acknowledgement (X/Y) .. data:: XON Enable out of band flow control (Z) .. data:: XOF...
""" XMODEM Protocol bytes ===================== .. data:: SOH Indicates a packet length of 128 (X/Y) .. data:: STX Indicates a packet length of 1024 (X/Y) .. data:: EOT End of transmission (X/Y) .. data:: ACK Acknowledgement (X/Y) .. data:: XON Enable out of band flow control (Z) .. data:: XOF...
def countingSort(arr): n = len(arr) max_of_arr = max(arr) count = [0 for i in range(max_of_arr+1)] for i in arr: count[i] += 1 ind = 0 for i in range(max_of_arr+1): c = count[i] while c: arr[ind] = i ind += 1 c -= 1 return arr n = ...
def counting_sort(arr): n = len(arr) max_of_arr = max(arr) count = [0 for i in range(max_of_arr + 1)] for i in arr: count[i] += 1 ind = 0 for i in range(max_of_arr + 1): c = count[i] while c: arr[ind] = i ind += 1 c -= 1 return arr ...
class VendoringError(Exception): """Errors originating from this package.""" class ConfigurationError(VendoringError): """Errors related to configuration handling.""" class RequirementsError(VendoringError): """Errors related to requirements.txt handling."""
class Vendoringerror(Exception): """Errors originating from this package.""" class Configurationerror(VendoringError): """Errors related to configuration handling.""" class Requirementserror(VendoringError): """Errors related to requirements.txt handling."""
# data config trainroot = '/data2/dataset/ICD15/train' testroot = '/data2/dataset/ICD15/test' output_dir = 'output/east_icd15' data_shape = 512 # train config gpu_id = '2' workers = 12 start_epoch = 0 epochs = 600 lr = 0.0001 lr_decay_step = 10000 lr_gamma = 0.94 train_batch_size_per_gpu = 14 i...
trainroot = '/data2/dataset/ICD15/train' testroot = '/data2/dataset/ICD15/test' output_dir = 'output/east_icd15' data_shape = 512 gpu_id = '2' workers = 12 start_epoch = 0 epochs = 600 lr = 0.0001 lr_decay_step = 10000 lr_gamma = 0.94 train_batch_size_per_gpu = 14 init_type = 'xavier' display_interval = 10 show_images_...
""" Module: motiv.version Description: contains constants defining the package version Note: - In case of a bugfix/hotfix increment BUILD_NUMBER - In case of adding a feature that modifies the package, but does not break interfaces, increment VERSION_MINOR - In case of introducing a change...
""" Module: motiv.version Description: contains constants defining the package version Note: - In case of a bugfix/hotfix increment BUILD_NUMBER - In case of adding a feature that modifies the package, but does not break interfaces, increment VERSION_MINOR - In case of introducing a change...
"""Defines current AXT versions and dependencies. Ensure UsageTrackerRegistry is updated accordingly when incrementing version numbers. """ # AXT versions RUNNER_VERSION = "1.4.1-alpha03" # stable 1.4.0 RULES_VERSION = "1.4.1-alpha03" # stable 1.4.0 MONITOR_VERSION = "1.5.0-rc01" # stable 1.4.0 ESPRESSO_VERSION = ...
"""Defines current AXT versions and dependencies. Ensure UsageTrackerRegistry is updated accordingly when incrementing version numbers. """ runner_version = '1.4.1-alpha03' rules_version = '1.4.1-alpha03' monitor_version = '1.5.0-rc01' espresso_version = '3.5.0-alpha03' core_version = '1.4.1-alpha03' androidx_junit_ve...
SERVER_HOST_1 = "127.0.0.1" SERVER_PORT_1 = 2779 SERVER_HOST_2 = "127.0.0.1" SERVER_PORT_2 = 2775
server_host_1 = '127.0.0.1' server_port_1 = 2779 server_host_2 = '127.0.0.1' server_port_2 = 2775
class Texture(object): def __init__(self): self.file_path = None self.file = None self.data = None def read(self, files): for file_path in files: self.file_path = file_path self.file = open(self.file_path, "rb") self.data = self.file.read() ...
class Texture(object): def __init__(self): self.file_path = None self.file = None self.data = None def read(self, files): for file_path in files: self.file_path = file_path self.file = open(self.file_path, 'rb') self.data = self.file.read() ...
class Flight: counter = 1 def __init__(self, origin, destination, duration): # Keep track of id number self.id = Flight.counter Flight.counter += 1 # Keep track of passengers self.passengers = [] # Details about flight self.origin = origin sel...
class Flight: counter = 1 def __init__(self, origin, destination, duration): self.id = Flight.counter Flight.counter += 1 self.passengers = [] self.origin = origin self.destination = destination self.duration = duration def print_info(self): print(f'...
### Model Architecture hyper parameters embedding_size = 32 # sequence_length = 500 sequence_length = 33 LSTM_units = 128 ### Training parameters batch_size = 64 epochs = 20 ### Preprocessing parameters # words that occur less than n times to be deleted from dataset N = 10 # test size in ratio, train...
embedding_size = 32 sequence_length = 33 lstm_units = 128 batch_size = 64 epochs = 20 n = 10 test_size = 0.2
result = 0 def solution(numbers, target): findNum(numbers, 0, 0, target) return result def findNum(numbers, index, acc, target): global result if len(numbers) == index: if acc == target: result += 1 return num = numbers[index] findNum(numbers, index + 1, acc - num, target) findNum(n...
result = 0 def solution(numbers, target): find_num(numbers, 0, 0, target) return result def find_num(numbers, index, acc, target): global result if len(numbers) == index: if acc == target: result += 1 return num = numbers[index] find_num(numbers, index + 1, acc - nu...
def find_the_secret(f): for x in f.__code__.co_consts: if isinstance(x,str) and len(x) == 32: return x return ''
def find_the_secret(f): for x in f.__code__.co_consts: if isinstance(x, str) and len(x) == 32: return x return ''
def swap(arr,i,j): arr[i],arr[j] = arr[j],arr[i] def partition(arr,l,r): pivot = arr[r] i = l-1 j = l for j in range(l,r): if arr[j] < pivot: i+=1 swap(arr,i,j) i+=1 swap(arr,i,r) return i def quickSort(arr,l,r): if l<r : newIndex = partition(arr,l,r) quickSort(arr,newIndex+1,r) quickSort(arr...
def swap(arr, i, j): (arr[i], arr[j]) = (arr[j], arr[i]) def partition(arr, l, r): pivot = arr[r] i = l - 1 j = l for j in range(l, r): if arr[j] < pivot: i += 1 swap(arr, i, j) i += 1 swap(arr, i, r) return i def quick_sort(arr, l, r): if l < r: ...
# app config APP_CONFIG=dict( SECRET_KEY="SECRET", WTF_CSRF_SECRET_KEY="SECRET", # Webservice config WS_URL="http://localhost:5057", # ws del modello in locale DATASET_REQ = "/dataset", OPERATIVE_CENTERS_REQ = "/operative-centers", OC_DATE_REQ = "/oc-date", OC_DATA_REQ = "/oc-data", PREDIC...
app_config = dict(SECRET_KEY='SECRET', WTF_CSRF_SECRET_KEY='SECRET', WS_URL='http://localhost:5057', DATASET_REQ='/dataset', OPERATIVE_CENTERS_REQ='/operative-centers', OC_DATE_REQ='/oc-date', OC_DATA_REQ='/oc-data', PREDICT_REQ='/predict', DATA_CHARSET='ISO-8859-1')
class Solution: def bestTeamScore(self, scores: List[int], ages: List[int]) -> int: """ TLE at the 132/148 test cases """ age_score = [(age, score) for age, score in zip(ages, scores)] age_score.sort(key = lambda x: x) age_score.append((0, 0)) # an artificial p...
class Solution: def best_team_score(self, scores: List[int], ages: List[int]) -> int: """ TLE at the 132/148 test cases """ age_score = [(age, score) for (age, score) in zip(ages, scores)] age_score.sort(key=lambda x: x) age_score.append((0, 0)) @functoo...
def sum(num1, num2): """ This function takes the sum of two numbers. Paramaters ---------- num1, float A number. num2, float A number. """ return num1 + num2 def product(num1, num2): """ This function takes the product of two numbers. """ return num1 * num2
def sum(num1, num2): """ This function takes the sum of two numbers. Paramaters ---------- num1, float A number. num2, float A number. """ return num1 + num2 def product(num1, num2): """ This function takes the product of two numbers. """ return num1 * num2
__all__ = ['__version__'] # major, minor, patch version_info = 1, 4, 0 # suffix suffix = None # version string __version__ = '.'.join(map(str, version_info)) + (f'.{suffix}' if suffix else '')
__all__ = ['__version__'] version_info = (1, 4, 0) suffix = None __version__ = '.'.join(map(str, version_info)) + (f'.{suffix}' if suffix else '')
#percorrendo itens do dicionario com for dicionario = {'chave1':'valor1','chave2':'valor2','chave3':3} for a,b in dicionario.items(): print(a,b)
dicionario = {'chave1': 'valor1', 'chave2': 'valor2', 'chave3': 3} for (a, b) in dicionario.items(): print(a, b)
# Data sources database( thermoLibraries = ['primaryThermoLibrary'], reactionLibraries = [], seedMechanisms = [], kineticsDepositories = ['training'], kineticsFamilies = 'default', kineticsEstimator = 'rate rules', ) # List of species species( label='ethane', reactive=True, structur...
database(thermoLibraries=['primaryThermoLibrary'], reactionLibraries=[], seedMechanisms=[], kineticsDepositories=['training'], kineticsFamilies='default', kineticsEstimator='rate rules') species(label='ethane', reactive=True, structure=smiles('CC')) species(label='O2', reactive=True, structure=smiles('[O][O]')) species...
#BEGIN_HEADER #END_HEADER class pranjan77ContigFilter: ''' Module Name: pranjan77ContigFilter Module Description: A KBase module: pranjan77ContigFilter ''' ######## WARNING FOR GEVENT USERS ####### # Since asynchronous IO can lead to methods - even the same method - # interruptin...
class Pranjan77Contigfilter: """ Module Name: pranjan77ContigFilter Module Description: A KBase module: pranjan77ContigFilter """ def __init__(self, config): pass
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyPandas(PythonPackage): """pandas is a fast, powerful, flexible and easy to use open source data analysis ...
class Pypandas(PythonPackage): """pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language.""" homepage = 'https://pandas.pydata.org/' pypi = 'pandas/pandas-1.2.0.tar.gz' maintainers = ['adamjstewart'] ...
""" Module with useful utilities. """ def escape_double_quotes(name): escaped_name = name.replace('"', '""') quoted_name = f'"{escaped_name}"' return quoted_name
""" Module with useful utilities. """ def escape_double_quotes(name): escaped_name = name.replace('"', '""') quoted_name = f'"{escaped_name}"' return quoted_name
a = float( input('give a number: ') ) b = float( input('give a number: ') ) print(a, '+', b, '=', a+b) print(a, '-', b, '=', a-b) print(a, '*', b, '=', a*b) print(a, '/', b, '=', a/b)
a = float(input('give a number: ')) b = float(input('give a number: ')) print(a, '+', b, '=', a + b) print(a, '-', b, '=', a - b) print(a, '*', b, '=', a * b) print(a, '/', b, '=', a / b)
class Menu: """ ## Steak N' Shake helpers with OOP This is a subset of Steak N' Shake menu that covers a. Burgers b. Chili Intallation: pip install -i https://test.pypi.org/simple/ Order Imports: from helper.menu import Burger, Chili, Menu Menu Methods: a...
class Menu: """ ## Steak N' Shake helpers with OOP This is a subset of Steak N' Shake menu that covers a. Burgers b. Chili Intallation: pip install -i https://test.pypi.org/simple/ Order Imports: from helper.menu import Burger, Chili, Menu Menu Methods: a....
# These are all the settings that are specific to a jurisdiction ############################### # These settings are required # ############################### OCD_JURISDICTION_ID = 'ocd-jurisdiction/country:us/state:il/place:chicago/government' OCD_CITY_COUNCIL_ID = 'ocd-organization/ef168607-9135-4177-ad8e-c1f7a48...
ocd_jurisdiction_id = 'ocd-jurisdiction/country:us/state:il/place:chicago/government' ocd_city_council_id = 'ocd-organization/ef168607-9135-4177-ad8e-c1f7a4806c3a' city_council_name = 'Sacramento City Council' legislative_sessions = ['2007', '2011', '2015'] city_name = 'Chicago' city_name_short = 'Chicago' city_vocab =...
"""***************************************************************************** * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
"""***************************************************************************** * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
{ "targets": [ { "target_name": "cld-c", "type": "static_library", "include_dirs": [ "internal", ], "sources": [ "internal/cldutil.cc", "internal/cldutil_shared.cc", "internal/compact_lang_det.cc", "internal/compact_lang_det_hint_code.cc", ...
{'targets': [{'target_name': 'cld-c', 'type': 'static_library', 'include_dirs': ['internal'], 'sources': ['internal/cldutil.cc', 'internal/cldutil_shared.cc', 'internal/compact_lang_det.cc', 'internal/compact_lang_det_hint_code.cc', 'internal/compact_lang_det_impl.cc', 'internal/debug.cc', 'internal/fixunicodevalue.cc'...
def handle(event, context): # This lambda function will be triggered by a CloudWatch cron-job. # Collect a list of BD phone numbers and the recipient name # from some file located in an s3 and store in `recipient` variable. # You can collect phone numbers from your google contacts. # Now, validate...
def handle(event, context): invalid_numbers = [{'name': 'Abdullah', 'phone': '+8819xxxxxxxx'}] is_valid = event['is_valid'] recipients = [{'name': 'Rayhan', 'phone': '+88018xxxxxxxx'}] message = event.get('message_body') if is_valid: response = {'action': 'send', 'recipients': recipients, 'm...
print('---------- If Condition ----------') a = 1 if a > 0: print('A is a positive number') print('---------- If Else ----------') a = -1 if a > 0: print('A is a positive number') else: print('A is a negative number') print('---------- If Elif Else ----------') a = 0 if a > 0: print('A is a positive n...
print('---------- If Condition ----------') a = 1 if a > 0: print('A is a positive number') print('---------- If Else ----------') a = -1 if a > 0: print('A is a positive number') else: print('A is a negative number') print('---------- If Elif Else ----------') a = 0 if a > 0: print('A is a positive num...
load( "@bazel_toolchains//rules:docker_config.bzl", "docker_toolchain_autoconfig", ) def _tensorflow_rbe_config(name, compiler, python_version, cuda_version = None, cudnn_version = None, tensorrt_version = None): base = "@ubuntu16.04//image" config_repos = [ "local_config_python", "loca...
load('@bazel_toolchains//rules:docker_config.bzl', 'docker_toolchain_autoconfig') def _tensorflow_rbe_config(name, compiler, python_version, cuda_version=None, cudnn_version=None, tensorrt_version=None): base = '@ubuntu16.04//image' config_repos = ['local_config_python', 'local_config_cc'] env = {'ABI_VERS...
# # PySNMP MIB module Unisphere-Data-COPS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-COPS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:23:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
def run(proj,OG): n1 = int(proj.parameters['n1']) OG.add("base","o") for i in range(n1): OG.add("level1",str(i),{},OG["base"]) OG.add("level2","o", {}, OG["base"] + OG["level1"])
def run(proj, OG): n1 = int(proj.parameters['n1']) OG.add('base', 'o') for i in range(n1): OG.add('level1', str(i), {}, OG['base']) OG.add('level2', 'o', {}, OG['base'] + OG['level1'])
if __name__ == '__main__': n = int(input()) arr = list(map(int, input().rstrip().split())) arr.reverse() for i in arr: print(i, end= " ")
if __name__ == '__main__': n = int(input()) arr = list(map(int, input().rstrip().split())) arr.reverse() for i in arr: print(i, end=' ')
# -*- coding: utf-8 -*- # Authors: Y. Jia <ytjia.zju@gmail.com> """ Given preorder and inorder traversal of a tree, construct the binary tree. https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/ """ # Definition for a binary tree node. class TreeNode(object): de...
""" Given preorder and inorder traversal of a tree, construct the binary tree. https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/ """ class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Sol...
class map_config: width=500 height=500 obstacle=[ {"shape":"rectangle","center":(60,70),"width":30,"height":40}, {"shape":"rectangle","center":(350,370),"width":20,"height":50}, {"shape":"circle","center":(250,250),"radius":50}, {"shape":"circle","center":(50,150),"radius":30...
class Map_Config: width = 500 height = 500 obstacle = [{'shape': 'rectangle', 'center': (60, 70), 'width': 30, 'height': 40}, {'shape': 'rectangle', 'center': (350, 370), 'width': 20, 'height': 50}, {'shape': 'circle', 'center': (250, 250), 'radius': 50}, {'shape': 'circle', 'center': (50, 150), 'radius': 3...
# Basic Sekeleton of Plan - Storing - At Particular Date - City where Tourist is supposed to be # And storing travelling period(starting and ending time of travel) on that day class SkeletonEvent: def __init__(self, planid, date, city, startingTime, endingTime, stayingHotel) -> None: self.planid = planid ...
class Skeletonevent: def __init__(self, planid, date, city, startingTime, endingTime, stayingHotel) -> None: self.planid = planid self.date = date self.city = city self.startingTime = startingTime self.endingTime = endingTime self.stayingHotel = stayingHotel
stock_dict = { 'GE': 'General Electric', 'CAT': 'Caterpillar', 'GM': 'General Motors' } purchases = [ ( 'GE', 100, '10-sep-2001', 48 ), ( 'CAT', 100, '1-apr-1999', 24 ), ( 'GM', 200, '1-jul-1998', 56 ), ( 'GM', 150, '3-jul-1998', 47 )...
stock_dict = {'GE': 'General Electric', 'CAT': 'Caterpillar', 'GM': 'General Motors'} purchases = [('GE', 100, '10-sep-2001', 48), ('CAT', 100, '1-apr-1999', 24), ('GM', 200, '1-jul-1998', 56), ('GM', 150, '3-jul-1998', 47)] total_portfolio_value = 0 for transaction in purchases: stock_ticker = transaction[0] n...
N, M, *C = map(int, open(0).read().split()) C.sort() for i in range(N): M -= C[i] if M <= 0: break if M >= 0: print(i + 1) elif M < 0: print(i)
(n, m, *c) = map(int, open(0).read().split()) C.sort() for i in range(N): m -= C[i] if M <= 0: break if M >= 0: print(i + 1) elif M < 0: print(i)
"""Lab 2: Lambda Expressions and Higher Order Functions""" # Lambda Functions def lambda_curry2(func): """ Returns a Curried version of a two-argument function FUNC. >>> from operator import add >>> curried_add = lambda_curry2(add) >>> add_three = curried_add(3) >>> add_three(5) 8 """ ...
"""Lab 2: Lambda Expressions and Higher Order Functions""" def lambda_curry2(func): """ Returns a Curried version of a two-argument function FUNC. >>> from operator import add >>> curried_add = lambda_curry2(add) >>> add_three = curried_add(3) >>> add_three(5) 8 """ '*** YOUR CODE H...
# # PySNMP MIB module ESI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ESI-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:06:33 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:23:15)...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ...
SEED1_DUNGEON = [ ' ', ' ', ' ', ' ...
seed1_dungeon = [' ', ' ', ' ', ' ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Given a source tree and a matching RPM spec file, runs `rpmbuild` inside the given image layer, and outputs a new layer with the resulting...
""" Given a source tree and a matching RPM spec file, runs `rpmbuild` inside the given image layer, and outputs a new layer with the resulting RPM(s) available in a pre-determined location: `/rpmbuild/RPMS`. """ load('//antlir/bzl:constants.bzl', 'REPO_CFG') load('//antlir/bzl:flavor_helpers.bzl', 'flavor_helpers') loa...
# TODO: Migrate templates to files TEMPLATE__INIT__ = """ \""" Django Environments {VERSION} \""" from .common import * try: from .__habitat__ import * print("Using %s environment" % ENVIRONMENT_NAME) if len(ENVIRONMENT_VERSION_CODE) > 0: VERSION += "." + ENVIRONMENT_VERSION_CODE except ImportErro...
template__init__ = '\n"""\nDjango Environments {VERSION}\n"""\nfrom .common import *\n\ntry:\n from .__habitat__ import *\n print("Using %s environment" % ENVIRONMENT_NAME)\n if len(ENVIRONMENT_VERSION_CODE) > 0:\n VERSION += "." + ENVIRONMENT_VERSION_CODE\nexcept ImportError:\n print("Environment st...
''' If an element in an MxN matrix is 0, set the entire row and column to 0 ''' def setZero(mat): m = len(mat) n = len(mat[0]) zero_rows = [] zero_cols = [] for i in range(m): for j in range(n): if mat[i][j] == 0 and i not in zero_rows and j not in zero_cols: mat...
""" If an element in an MxN matrix is 0, set the entire row and column to 0 """ def set_zero(mat): m = len(mat) n = len(mat[0]) zero_rows = [] zero_cols = [] for i in range(m): for j in range(n): if mat[i][j] == 0 and i not in zero_rows and (j not in zero_cols): ...
class CachePolicy(basestring): """ Cache Policy Name """ @staticmethod def get_api_name(): return "cache-policy"
class Cachepolicy(basestring): """ Cache Policy Name """ @staticmethod def get_api_name(): return 'cache-policy'
""" https://leetcode.com/problems/validate-binary-search-tree/ Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys grea...
""" https://leetcode.com/problems/validate-binary-search-tree/ Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys grea...
class Badge: def __init__(self,scale=1): self.scale=scale def gen_badge(self): return { "novice" : f""" <g xmlns="http://www.w3.org/2000/svg" transform="translate({str(345*self.scale)},15),scale(0.5)"> <path id="Selection_novice" fill="#52cd95" stroke="none" stroke-widt...
class Badge: def __init__(self, scale=1): self.scale = scale def gen_badge(self): return {'novice': f'\n <g xmlns="http://www.w3.org/2000/svg" transform="translate({str(345 * self.scale)},15),scale(0.5)">\n <path id="Selection_novice"\n fill="#52cd95" stroke="none" stroke-wi...
# # PySNMP MIB module ALTIGA-GLOBAL-REG (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-GLOBAL-REG # Produced by pysmi-0.3.4 at Mon Apr 29 17:05:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, constraints_union, value_range_constraint) ...
# -*- coding: utf-8 -*- class Modifier(object): def __init__(self): self.is_disable = False self.is_show_only = False self.is_debug = False self.is_transparent = False def turn_on_disable(self): self.is_disable = True def turn_off_disable(self): self.is_d...
class Modifier(object): def __init__(self): self.is_disable = False self.is_show_only = False self.is_debug = False self.is_transparent = False def turn_on_disable(self): self.is_disable = True def turn_off_disable(self): self.is_disable = False def tu...
# import libraries here ... # Stickbreak function def stickbreak(v): batch_ndims = len(v.shape) - 1 cumprod_one_minus_v = tf.math.cumprod(1 - v, axis=-1) one_v = tf.pad(v, [[0, 0]] * batch_ndims + [[0, 1]], "CONSTANT", constant_values=1) c_one = tf.pad(cumprod_one_minus_v, [[0, 0]] *...
def stickbreak(v): batch_ndims = len(v.shape) - 1 cumprod_one_minus_v = tf.math.cumprod(1 - v, axis=-1) one_v = tf.pad(v, [[0, 0]] * batch_ndims + [[0, 1]], 'CONSTANT', constant_values=1) c_one = tf.pad(cumprod_one_minus_v, [[0, 0]] * batch_ndims + [[1, 0]], 'CONSTANT', constant_values=1) return one...
def build_uri(asset_uri, site_uri): asset_uri = asset_uri.strip("..") if asset_uri.startswith("http"): return asset_uri separator = "" if not asset_uri.startswith("/"): separator = "/" return "%s%s%s" % (site_uri, separator, asset_uri) def join_uri(site_uri, file_path): return ...
def build_uri(asset_uri, site_uri): asset_uri = asset_uri.strip('..') if asset_uri.startswith('http'): return asset_uri separator = '' if not asset_uri.startswith('/'): separator = '/' return '%s%s%s' % (site_uri, separator, asset_uri) def join_uri(site_uri, file_path): return '...
# rotate a list N places to the left def rotate(n, l): return l[n:] + l[0:n] def test_rotate(): l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'] expected = ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'a', 'b', 'c'] assert rotate(3,l) == expected expected = ['j', 'k', 'a', 'b', ...
def rotate(n, l): return l[n:] + l[0:n] def test_rotate(): l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'] expected = ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'a', 'b', 'c'] assert rotate(3, l) == expected expected = ['j', 'k', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'] assert rot...
# Puzzle Input ---------- with open('Day04-Input.txt', 'r') as file: puzzle = file.read().split('\n\n') with open('Day04-Test01.txt', 'r') as file: test01 = file.read().split('\n\n') # Main Code ---------- # Convert the board string into a list def process_board(raw_board): new_board = [] for row in...
with open('Day04-Input.txt', 'r') as file: puzzle = file.read().split('\n\n') with open('Day04-Test01.txt', 'r') as file: test01 = file.read().split('\n\n') def process_board(raw_board): new_board = [] for row in raw_board.split('\n'): new_board += [row.split()] return new_board def find_n...
print("Hi, are you having trouble making a password?") print("let me help you!") number = input("give me a number from 1-3") password = number animal = input("do you prefer dogs or cats?") password = number + animal color=input("what is your favorite color?") password = color+number+animal book=input("ok, last question...
print('Hi, are you having trouble making a password?') print('let me help you!') number = input('give me a number from 1-3') password = number animal = input('do you prefer dogs or cats?') password = number + animal color = input('what is your favorite color?') password = color + number + animal book = input('ok, last ...