content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class JobPair(object): def __init__(self, failed_job, passed_job): self.failed_job = failed_job self.passed_job = passed_job self.build_system = 'NA' def __str__(self): content = ' -> '.join([str(self.failed_job), str(self.passed_job)]) return 'JobPair(' + content + ')'...
class Jobpair(object): def __init__(self, failed_job, passed_job): self.failed_job = failed_job self.passed_job = passed_job self.build_system = 'NA' def __str__(self): content = ' -> '.join([str(self.failed_job), str(self.passed_job)]) return 'JobPair(' + content + ')'...
def disable_autoreload(): pass def enable_autoreload(): pass def reload(): pass runtime = None def set_next_stack_limit(): pass def set_rgb_status_brightness(): pass
def disable_autoreload(): pass def enable_autoreload(): pass def reload(): pass runtime = None def set_next_stack_limit(): pass def set_rgb_status_brightness(): pass
folders = ['1-EastRiver', '2-DryCreek','3-SagehenCreek','4-AndrewsForest','5-Baltimore', '6-BonanzaCreek','7-CaliforniaCurrentEcosystem','8-CentralArizona','9-Coweeta','10-FloridaCoastalEverglades', '11-GeorgiaCoastalEcosystems','12-HarvardForest','13-HubbardBrook','14-JornadaBasin','15-Kellog...
folders = ['1-EastRiver', '2-DryCreek', '3-SagehenCreek', '4-AndrewsForest', '5-Baltimore', '6-BonanzaCreek', '7-CaliforniaCurrentEcosystem', '8-CentralArizona', '9-Coweeta', '10-FloridaCoastalEverglades', '11-GeorgiaCoastalEcosystems', '12-HarvardForest', '13-HubbardBrook', '14-JornadaBasin', '15-Kellogg', '16-KonzaPr...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: self.res=0 self.helper(root) ...
class Solution: def diameter_of_binary_tree(self, root: TreeNode) -> int: self.res = 0 self.helper(root) return self.res def helper(self, root): if not root: return 0 l = self.helper(root.left) r = self.helper(root.right) self.res = max(self....
def func(sum1,no,arr): if(sum1==0): return True if(no<0): return False if(sum1>=arr[no]+arr[no-1]): return func(sum1-arr[no]-arr[no-1],no-2,arr) if(sum1>=arr[no]): temp1=func(sum1-arr[no],no-2,arr) temp2=func(sum1-arr[no-1],no-2,arr) return temp1 or temp2 ...
def func(sum1, no, arr): if sum1 == 0: return True if no < 0: return False if sum1 >= arr[no] + arr[no - 1]: return func(sum1 - arr[no] - arr[no - 1], no - 2, arr) if sum1 >= arr[no]: temp1 = func(sum1 - arr[no], no - 2, arr) temp2 = func(sum1 - arr[no - 1], no - ...
def test_function(isim, soyisim, bos_deger="degiscemmi", sinif="5"): print("isim", isim) print("soyisim", soyisim) print("bos_deger", bos_deger) print("sinif", sinif) if __name__ == '__main__': sinif = "4" test_function("emin", "aktas", sinif=sinif)
def test_function(isim, soyisim, bos_deger='degiscemmi', sinif='5'): print('isim', isim) print('soyisim', soyisim) print('bos_deger', bos_deger) print('sinif', sinif) if __name__ == '__main__': sinif = '4' test_function('emin', 'aktas', sinif=sinif)
def trainee_option(option, trainee_obj, param_list): ''' Menu driven switcher for trainee ''' # Assuming paramList as follows = [cursor, sessionId, date, traineeId] switcher = { 0: trainee_obj.view_session_details(paramList[2]), 1: trainee_obj.join_session(paramList[1]), 2: trainee...
def trainee_option(option, trainee_obj, param_list): """ Menu driven switcher for trainee """ switcher = {0: trainee_obj.view_session_details(paramList[2]), 1: trainee_obj.join_session(paramList[1]), 2: trainee_obj.session_feedback(paramList[1]), 3: trainee_obj.leave_application(paramList[1])} return switch...
# Created by MechAviv # ID :: [4000004] # Hidden Street : Explorer Video sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.playURLVideoByScript("http://nxcache.nexon.net/maplestory/video/yt/adventurer.html") sm.setTemporarySkillSet(0) sm.setInGameDirectionMode...
sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.playURLVideoByScript('http://nxcache.nexon.net/maplestory/video/yt/adventurer.html') sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(False, True, False, False) sm.warp(4000005, 0)
def similarity(x, y): return len(x.intersection(y)) / len(x.union(y)) def print_positive_similarities(docdict): doclist = list(docdict.items()) for i, val_x in enumerate(doclist): key_x, x = val_x for j, val_y in enumerate(doclist[i:]): key_y, y = val_y if key_x != ...
def similarity(x, y): return len(x.intersection(y)) / len(x.union(y)) def print_positive_similarities(docdict): doclist = list(docdict.items()) for (i, val_x) in enumerate(doclist): (key_x, x) = val_x for (j, val_y) in enumerate(doclist[i:]): (key_y, y) = val_y if ke...
#Credits to stackoverflow for the number check function! def is_number(s): try: int(s) return True except ValueError: return False
def is_number(s): try: int(s) return True except ValueError: return False
def get_warnings(connection): warnings = connection.show_warnings() if warnings: print('warnings:', warnings) def get_script_from_file(filename): f = open(filename, 'r') script = f.read() f.close() return script def get_report(mysql, script): conn = mysql.connect() get_warnin...
def get_warnings(connection): warnings = connection.show_warnings() if warnings: print('warnings:', warnings) def get_script_from_file(filename): f = open(filename, 'r') script = f.read() f.close() return script def get_report(mysql, script): conn = mysql.connect() get_warnings...
# File: panorama_consts.py # Copyright (c) 2016-2021 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) PAN_ERR_REPLY_FORMAT_KEY_MISSING = "None '{key}' missing in reply from device" PAN_ERR_REPLY_NOT_SUCCESS = "REST call returned '{status}'" PAN_ERR_UNABLE_TO_PARSE_REPLY = "Un...
pan_err_reply_format_key_missing = "None '{key}' missing in reply from device" pan_err_reply_not_success = "REST call returned '{status}'" pan_err_unable_to_parse_reply = 'Unable to parse reply from device' pan_succ_test_connectivity_passed = 'Test connectivity passed' pan_err_test_connectivity_failed = 'Test connectiv...
class Solution: def subarrayBitwiseORs(self, A: List[int]) -> int: curr = set() total = set() for a in A: curr = {a | x for x in curr} | {a} total |= curr return len(total)
class Solution: def subarray_bitwise_o_rs(self, A: List[int]) -> int: curr = set() total = set() for a in A: curr = {a | x for x in curr} | {a} total |= curr return len(total)
#!/usr/bin/env python # iterate over the characters in a line and count duplicates and triplicates def set_match(): doubleBool = False trippleBool = False doubles = 0 tripples = 0 seen = set() doubleSet = set() trippleSet = set() with open("puzzle_input_02.txt") as f: while True: c = f.read(...
def set_match(): double_bool = False tripple_bool = False doubles = 0 tripples = 0 seen = set() double_set = set() tripple_set = set() with open('puzzle_input_02.txt') as f: while True: c = f.read(1) if not c: print('End of file') ...
# More interesting topology # A --- B --- C # | # D --- E --- F # | | | # G --- H --- J topo = { 'A' : ['B'], 'B' : ['A', 'C', 'E'], 'C' : ['B'], 'D' : ['E', 'G'], 'E' : ['B', 'D', 'F', 'H'], 'F' : ['E', 'J'], 'G' : ['D', 'H'], 'H' : ['E', 'G...
topo = {'A': ['B'], 'B': ['A', 'C', 'E'], 'C': ['B'], 'D': ['E', 'G'], 'E': ['B', 'D', 'F', 'H'], 'F': ['E', 'J'], 'G': ['D', 'H'], 'H': ['E', 'G', 'J'], 'J': ['F', 'H']}
_base_ = [ '../universenet/models/universenet50_2008s.py', '../_base_/datasets/coco_detection_mini_mstrain_320_640.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py' ] data = dict(samples_per_gpu=16) # lr=0.01 for total batch size 16 (1 GPU * 16 samples_per_gpu) # lr=0.04 for total...
_base_ = ['../universenet/models/universenet50_2008s.py', '../_base_/datasets/coco_detection_mini_mstrain_320_640.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'] data = dict(samples_per_gpu=16) optimizer = dict(type='SGD', lr=0.04, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(_d...
class Solution: def XXX(self, x: int) -> bool: s=str(x) if s==s[::-1]:return True return False
class Solution: def xxx(self, x: int) -> bool: s = str(x) if s == s[::-1]: return True return False
__title__ = "SimpleReg" __author__ = "Michael Ebner" __email__ = "michael.ebner.14@ucl.ac.uk" __license__ = "BSD-3-Clause" __summary__ = "SimpleReg is a research-focused toolkit that provides " \ "tools helpful for (medical) image registration and processing." __uri__ = "https://github.com/gift-surg/SimpleReg" __ve...
__title__ = 'SimpleReg' __author__ = 'Michael Ebner' __email__ = 'michael.ebner.14@ucl.ac.uk' __license__ = 'BSD-3-Clause' __summary__ = 'SimpleReg is a research-focused toolkit that provides tools helpful for (medical) image registration and processing.' __uri__ = 'https://github.com/gift-surg/SimpleReg' __version__ =...
class DisableCSRFMiddleware(object): # def __init__(self, get_response): # self.get_response = get_response def __call__(self, request): setattr(request, '_dont_enforce_csrf_checks', True) response = self.get_response(request) return response # from django.utils.deprecat...
class Disablecsrfmiddleware(object): def __call__(self, request): setattr(request, '_dont_enforce_csrf_checks', True) response = self.get_response(request) return response
IMAGE_PATH="./images/" BASE_IMAGE="IMG_0573.JPG" ALIGNMENT_DETECTOR="SIFT" #SIFT or SURF ALIGNMENT_FEATURE_NUM=2000 ALIGNMENT_DISTANCE=0.7 HIST_MATCHING=True LAP_KERNEL_SIZE=3 SLIDE_WINDOW_SIZE=100 SLIDE_WINDOW_STEP=10 DENOISE=False
image_path = './images/' base_image = 'IMG_0573.JPG' alignment_detector = 'SIFT' alignment_feature_num = 2000 alignment_distance = 0.7 hist_matching = True lap_kernel_size = 3 slide_window_size = 100 slide_window_step = 10 denoise = False
num1 = 0 num2 = 0 factor_num1 = 0 factor_num2 = 0 fact = 0 flag = 1 while flag: flag = 0 try: num1 = int(input("Enter the Number: ")) num2 = int(input("Enter the Number: ")) if num1 <= 0: print("Number cannot be Zero") flag = 1 elif num2 <=0:...
num1 = 0 num2 = 0 factor_num1 = 0 factor_num2 = 0 fact = 0 flag = 1 while flag: flag = 0 try: num1 = int(input('Enter the Number: ')) num2 = int(input('Enter the Number: ')) if num1 <= 0: print('Number cannot be Zero') flag = 1 elif num2 <= 0: ...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( a , n , k ) : result = 0 for i in range ( n ) : if ( a [ i ] != 1 and a [ i ] > k ) : r...
def f_gold(a, n, k): result = 0 for i in range(n): if a[i] != 1 and a[i] > k: result = result + min(a[i] % k, k - a[i] % k) else: result = result + k - a[i] return result if __name__ == '__main__': param = [([3, 7, 27, 32, 36, 37, 44, 48, 50, 64, 86], 5, 10), ([-2...
''' Create a program that prompts the user ten times for a test score between 60 and 100. Each time a score is generated, your program should display what is the grade of that score. ''' def determineLetterGrade(score): grade = 'invalid' if score < 60: grade = 'F' elif score >= 60 and score < 70: grade = '...
""" Create a program that prompts the user ten times for a test score between 60 and 100. Each time a score is generated, your program should display what is the grade of that score. """ def determine_letter_grade(score): grade = 'invalid' if score < 60: grade = 'F' elif score >= 60 and score <...
class Headers: message_type: bytes network: bytes priority: bytes frmt: bytes sender: bytes mrh: bytes recipient: bytes def __init__(self, message_type: bytes = b'\x00', network: bytes = b'\x00', priority: bytes = b'\x00', frmt: bytes = b'\x00', ...
class Headers: message_type: bytes network: bytes priority: bytes frmt: bytes sender: bytes mrh: bytes recipient: bytes def __init__(self, message_type: bytes=b'\x00', network: bytes=b'\x00', priority: bytes=b'\x00', frmt: bytes=b'\x00', sender: bytes=b'\x00\x00\x00', mrh: bytes=b'\x00\...
print("*********Program for Student Information*********") D = dict() n = int(input('How many student record you want to store?? ')) # Add student information # to the dictionary for i in range(0, n): x, y = input( "Enter the complete name (First and last name) of student: ").split() z = i...
print('*********Program for Student Information*********') d = dict() n = int(input('How many student record you want to store?? ')) for i in range(0, n): (x, y) = input('Enter the complete name (First and last name) of student: ').split() z = input('Enter contact number: ') m = input('Enter Marks: ') D...
def search2Dmatrix(arr, target): m = len(arr) n = len(arr[0]) row = -1 for i in range(0, m): if arr[i][0] <= target and arr[i][n-1] >= target: row = i break if row == -1: return False for i in range(0, len(arr[row])): if arr[row][i] == target: ...
def search2_dmatrix(arr, target): m = len(arr) n = len(arr[0]) row = -1 for i in range(0, m): if arr[i][0] <= target and arr[i][n - 1] >= target: row = i break if row == -1: return False for i in range(0, len(arr[row])): if arr[row][i] == target: ...
# syntax_style for the console must be one of the supported styles from # pygments - see here for examples https://help.farbox.com/pygments.html palettes = { 'dark': { 'folder': 'dark', 'background': 'rgb(38, 41, 48)', 'background_darker': 'rgb(33, 36, 42)', # 2% darker than background ...
palettes = {'dark': {'folder': 'dark', 'background': 'rgb(38, 41, 48)', 'background_darker': 'rgb(33, 36, 42)', 'foreground': 'rgb(65, 72, 81)', 'primary': 'rgb(90, 98, 108)', 'secondary': 'rgb(134, 142, 147)', 'highlight': 'rgb(106, 115, 128)', 'text': 'rgb(240, 241, 242)', 'icon': 'rgb(209, 210, 212)', 'warning': 'rg...
_base_ = [ '../../../_base_/datasets/imagenet/rsb_a2_sz224_8xbs256.py', '../../../_base_/default_runtime.py', ] # model settings model = dict( type='MixUpClassification', pretrained=None, alpha=[0.1, 1.0,], # RSB setting mix_mode=["mixup", "cutmix",], mix_args=dict( attentivemix=di...
_base_ = ['../../../_base_/datasets/imagenet/rsb_a2_sz224_8xbs256.py', '../../../_base_/default_runtime.py'] model = dict(type='MixUpClassification', pretrained=None, alpha=[0.1, 1.0], mix_mode=['mixup', 'cutmix'], mix_args=dict(attentivemix=dict(grid_size=32, top_k=None, beta=8), automix=dict(mask_adjust=0, lam_margin...
expected_output = { "vrf": { "default": { "neighbor": { "192.168.2.65": { "address_family": { "ipv4 unicast": { "advertised": { "0.0.0.0": { ...
expected_output = {'vrf': {'default': {'neighbor': {'192.168.2.65': {'address_family': {'ipv4 unicast': {'advertised': {'0.0.0.0': {'index': {1: {'status_codes': 'r>i', 'next_hop': '10.250.6.1', 'origin_codes': 'i', 'metric': 0, 'localprf': 300, 'weight': 0, 'path': '65000'}}}, '10.0.0.0': {'index': {1: {'status_codes'...
#!/usr/bin/python # precedence.py print (3 + 5 * 5) print ((3 + 5) * 5) print (2 ** 3 * 5) print (not True or True) print (not (True or True))
print(3 + 5 * 5) print((3 + 5) * 5) print(2 ** 3 * 5) print(not True or True) print(not (True or True))
DOWNLOADING_COUNT = '''SELECT COUNT(*) as c FROM url WHERE status='downloading' AND is_valid_url='true' AND download_count > 0 AND file_size <= {file_size} {domains} {dates} {big_dates}''' NEWLY_DATE = '''SELECT url_date FROM url ORDE...
downloading_count = "SELECT COUNT(*) as c\n FROM url\n WHERE status='downloading' AND is_valid_url='true' AND\n download_count > 0 AND\n file_size <= {file_size} {domains} {dates} {big_dates}" newly_date = 'SELECT url_date FROM url ORDER ...
# coding=utf-8 __author__ = 'mlaptev' if __name__ == "__main__": a, b, c, d = [int(input()) for _ in range(4)] # print top row print(' \t', end='') for x in range(c, d+1): print(x, end='\t') print() for y in range(a, b+1): print(y, end='\t') for x in range(c, d+1): ...
__author__ = 'mlaptev' if __name__ == '__main__': (a, b, c, d) = [int(input()) for _ in range(4)] print(' \t', end='') for x in range(c, d + 1): print(x, end='\t') print() for y in range(a, b + 1): print(y, end='\t') for x in range(c, d + 1): print(x * y, end='\t'...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/2/12 14:08 # @Author : Baimohan/PH # @Site : https://github.com/BaiMoHan # @File : in_test.py # @Software: PyCharm my_tuple = ('haha', 20, 666) print(20 in my_tuple) print(666 in my_tuple) print(7 in my_tuple) print(8 not in my_tuple)
my_tuple = ('haha', 20, 666) print(20 in my_tuple) print(666 in my_tuple) print(7 in my_tuple) print(8 not in my_tuple)
if __name__ == "__main__": print(pow(2,38)) #answer : 274877906944
if __name__ == '__main__': print(pow(2, 38))
stack,stack2=[],[] for i in input(): if i in '+-': while stack2!=[] and stack2[-1]!='(': stack.append(stack2.pop()) stack2.append(i) elif i in '*/': while stack2!=[] and stack2[-1] not in '(+-': stack.append(stack2.pop()) stack2.append(i) elif i=='(': stack2.append(i) elif i==')': while stack2[-1]...
(stack, stack2) = ([], []) for i in input(): if i in '+-': while stack2 != [] and stack2[-1] != '(': stack.append(stack2.pop()) stack2.append(i) elif i in '*/': while stack2 != [] and stack2[-1] not in '(+-': stack.append(stack2.pop()) stack2.append(i) ...
class Review: def __init__(self, product_id, user_id, profile_name, helpfulness, score, time, summary, text): self.product_id = product_id self.user_id = user_id self.profile_name = profile_name self.helpfulness = helpfulness self.score = score self.t...
class Review: def __init__(self, product_id, user_id, profile_name, helpfulness, score, time, summary, text): self.product_id = product_id self.user_id = user_id self.profile_name = profile_name self.helpfulness = helpfulness self.score = score self.time = time ...
async def calc_primes(n): res = [] def is_prime(num): if num in [1, 3, 5, 7]: return True if num % 2 == 0: return False for div in range(3, num): if i % div == 0: return False return True for i in range(3, n): if i...
async def calc_primes(n): res = [] def is_prime(num): if num in [1, 3, 5, 7]: return True if num % 2 == 0: return False for div in range(3, num): if i % div == 0: return False return True for i in range(3, n): if is...
data = ( ' ', # 0x00 'a', # 0x01 '1', # 0x02 'b', # 0x03 '\'', # 0x04 'k', # 0x05 '2', # 0x06 'l', # 0x07 '@', # 0x08 'c', # 0x09 'i', # 0x0a 'f', # 0x0b '/', # 0x0c 'm', # 0x0d 's', # 0x0e 'p', # 0x0f '"', # 0x10 'e', # 0x11 '3', # 0x12 'h', ...
data = (' ', 'a', '1', 'b', "'", 'k', '2', 'l', '@', 'c', 'i', 'f', '/', 'm', 's', 'p', '"', 'e', '3', 'h', '9', 'o', '6', 'r', '^', 'd', 'j', 'g', '>', 'n', 't', 'q', ',', '*', '5', '<', '-', 'u', '8', 'v', '.', '%', '[', '$', '+', 'x', '!', '&', ';', ':', '4', '\\', '0', 'z', '7', '(', '_', '?', 'w', ']', '#', 'y', '...
n = int(input()) ar = [int(ar_temp) for ar_temp in input().split(' ')] def partition(ar, l, r): j = l pivot = ar[r] for i in range(l, r): if ar[i] <= pivot: ar[i], ar[j] = ar[j], ar[i] j += 1 ar[r], ar[j] = ar[j], ar[r] return j def quick_sort(ar, l, r)...
n = int(input()) ar = [int(ar_temp) for ar_temp in input().split(' ')] def partition(ar, l, r): j = l pivot = ar[r] for i in range(l, r): if ar[i] <= pivot: (ar[i], ar[j]) = (ar[j], ar[i]) j += 1 (ar[r], ar[j]) = (ar[j], ar[r]) return j def quick_sort(ar, l, r): ...
src = ['board.c', 'mico_spi.c'] component = aos_board_component('board_mk3165', 'stm32f4xx', src) component.add_prebuilt_libs('MiCO.3165.GCC.a') global_macros = Split(''' HSE_VALUE=26000000 STDIO_UART=0 RHINO_CONFIG_TICK_TASK=0 RHINO_CONFIG_WORKQUEUE=0 ''') component.add_global_macros(*global_macr...
src = ['board.c', 'mico_spi.c'] component = aos_board_component('board_mk3165', 'stm32f4xx', src) component.add_prebuilt_libs('MiCO.3165.GCC.a') global_macros = split('\n HSE_VALUE=26000000\n STDIO_UART=0\n RHINO_CONFIG_TICK_TASK=0\n RHINO_CONFIG_WORKQUEUE=0\n') component.add_global_macros(*global_macros) a...
# Problem: https://www.hackerrank.com/challenges/s10-the-central-limit-theorem-3/problem # Score: 30 # inputs mean = 500 std = 80 n = 100 z = 1.96 # characteristics of sample mean = mean std = std / n**(1/2) # Find the 95% interval print(round(mean - std * z, 2)) print(round(mean + std * z, 2))
mean = 500 std = 80 n = 100 z = 1.96 mean = mean std = std / n ** (1 / 2) print(round(mean - std * z, 2)) print(round(mean + std * z, 2))
default_app_config = "uploads.apps.TusUploadConfig" __version__ = "1.21.2" tus_api_version = "1.0.0" tus_api_version_supported = ["1.0.0"] tus_api_extensions = [ "creation", "creation-defer-length", "termination", "checksum", "expiration", ] tus_api_checksum_algorithms = [ "md5", "sha1", ...
default_app_config = 'uploads.apps.TusUploadConfig' __version__ = '1.21.2' tus_api_version = '1.0.0' tus_api_version_supported = ['1.0.0'] tus_api_extensions = ['creation', 'creation-defer-length', 'termination', 'checksum', 'expiration'] tus_api_checksum_algorithms = ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha5...
with open('log.txt') as f: print('data in log.txt:') while True: # try to read the next line line = f.readline() # see if there is any text if line: # if there is another line, print it print(line.strip()) else: # we're reached the end...
with open('log.txt') as f: print('data in log.txt:') while True: line = f.readline() if line: print(line.strip()) else: break
#!/usr/bin/env python3 def read_chars(): return frozenset(input().strip()) for _ in range(int(input())): print(''.join(sorted(read_chars() ^ read_chars())))
def read_chars(): return frozenset(input().strip()) for _ in range(int(input())): print(''.join(sorted(read_chars() ^ read_chars())))
n = int(input()) s = set(map(int, input().split())) for i in range(int(input())): cmd = input().split() if ( cmd[0] == 'remove'): s.remove(int(cmd[1])) elif(cmd[0]=='discard'): s.discard(int(cmd[1])) else: s.pop() sum = 0 for i in s: sum+=i print(sum)
n = int(input()) s = set(map(int, input().split())) for i in range(int(input())): cmd = input().split() if cmd[0] == 'remove': s.remove(int(cmd[1])) elif cmd[0] == 'discard': s.discard(int(cmd[1])) else: s.pop() sum = 0 for i in s: sum += i print(sum)
esqueleto = ''' .-. (o.o) |=| __|__ //.=|=.\\ // .=|=. \\ \\ .=|=. // \\(_=_)// (:| |:) || || () () || || || || l42 ==' '== ''' # alguma passo ### tem uma batalha com a pirata ### vamos usar random pra ver se morre ou nao # outro passo print(esqueleto)
esqueleto = "\n .-.\n (o.o)\n |=|\n __|__\n //.=|=.\\\n // .=|=. \\\n \\ .=|=. //\n \\(_=_)//\n (:| |:)\n || ||\n () ()\n || ||\n || ||\nl42 ==' '==\n" print(esqueleto)
class DataSetLoader: def __init__(self, filename): self.filename = filename def load(self): array = [] with open(self.filename, 'r') as ins: for line in ins: array.append([line.rstrip()[2:], line[0]]) return array
class Datasetloader: def __init__(self, filename): self.filename = filename def load(self): array = [] with open(self.filename, 'r') as ins: for line in ins: array.append([line.rstrip()[2:], line[0]]) return array
class Queue: def __init__(self): self.queue = [] # Removes and returns top most item in Queue def pop(self): if self.queue: popped = self.queue.pop(0) return popped print("Queue empty; can't pop on an empty Queue") return None # Adds item to top ...
class Queue: def __init__(self): self.queue = [] def pop(self): if self.queue: popped = self.queue.pop(0) return popped print("Queue empty; can't pop on an empty Queue") return None def push(self, item): self.queue.append(item) def peek...
# String first_name = 'Santa' # Int my_number = 1 # String my_str_number = '1' print(first_name, type(first_name)) print(my_number, type(my_number)) print(my_str_number, type(my_str_number)) # Bool is_true = True is_false = False
first_name = 'Santa' my_number = 1 my_str_number = '1' print(first_name, type(first_name)) print(my_number, type(my_number)) print(my_str_number, type(my_str_number)) is_true = True is_false = False
s1 = 'HelloBrother' print(s1.isalpha()) # -- ISA1 s2 = "Hello Brother" print(s2.isalpha()) # -- ISA2 s3 = "indigo@1234" print(s3.isalpha()) # -- ISA3 s4 = "Dial100" print(s4.isalpha()) # -- ISA4 s5 = "#1234" print(s5.isalpha()) # -- ISA5 s_5 = "Hello()" print(s_5.isalpha()) # -- ISA6 s6 = "!Hello" print(s6...
s1 = 'HelloBrother' print(s1.isalpha()) s2 = 'Hello Brother' print(s2.isalpha()) s3 = 'indigo@1234' print(s3.isalpha()) s4 = 'Dial100' print(s4.isalpha()) s5 = '#1234' print(s5.isalpha()) s_5 = 'Hello()' print(s_5.isalpha()) s6 = '!Hello' print(s6.isalpha()) s7 = '@Hello' print(s7.isalpha()) s8 = '\\$Hello' print(s8.is...
# md5 : 3b83c49b5a250a95183dcbbb384b45f4 # sha1 : bf958e340b1c2550d23260223aec2b185f6c5035 # sha256 : 5672603ec8282cbf7c1bd54221d439aacfd0e3d9b6b37dfba66e8e94b2fab2a3 ord_names = { 5: b'BeginPanningFeedback', 6: b'EndPanningFeedback', 12: b'UpdatePanningFeedback', 37: b'BeginBufferedAnimation', 38:...
ord_names = {5: b'BeginPanningFeedback', 6: b'EndPanningFeedback', 12: b'UpdatePanningFeedback', 37: b'BeginBufferedAnimation', 38: b'BeginBufferedPaint', 39: b'BufferedPaintClear', 40: b'BufferedPaintInit', 41: b'BufferedPaintRenderAnimation', 42: b'BufferedPaintSetAlpha', 47: b'DrawThemeBackgroundEx', 51: b'BufferedP...
''' Fuzzy Clause class. Used in Fuzzy rule ''' class FuzzyClause(): ''' A fuzzy clause of the type 'variable is set' used in fuzzy IF ... THEN ... rules clauses can be antecedent (if part) or consequent (then part) ''' def __init__(self, variable, f_set, degree=1): ''' initialization of the fuzzy clause ...
""" Fuzzy Clause class. Used in Fuzzy rule """ class Fuzzyclause: """ A fuzzy clause of the type 'variable is set' used in fuzzy IF ... THEN ... rules clauses can be antecedent (if part) or consequent (then part) """ def __init__(self, variable, f_set, degree=1): """ initialization of the fuzz...
class Solution: def maximumTime(self, time: str) -> str: time = list(time) if time[0] == '?' and time[1] == '?': time[0] = '2' time[1] = '3' if time[0] == '?': if time[1] > '3': time[0] = '1' else: time[0] = '2' ...
class Solution: def maximum_time(self, time: str) -> str: time = list(time) if time[0] == '?' and time[1] == '?': time[0] = '2' time[1] = '3' if time[0] == '?': if time[1] > '3': time[0] = '1' else: time[0] = '2...
SECRET_KEY = 'not_empty' SITE_ID = 1 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { ...
secret_key = 'not_empty' site_id = 1 databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} templates = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': {'context_processors': ['django.template.context_processors.debug', 'django.temp...
# 005.py jeju = {'melon' : 5000, 'apple' : 2500, 'banana' : 3000,} print(dir(jeju)) ''' ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter...
jeju = {'melon': 5000, 'apple': 2500, 'banana': 3000} print(dir(jeju)) "\n['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__...
#fibonacci with lists def fib_list(n): list = [0] * (n + 1) list[0] = 0 list[1] = 1 for i in range(2, n + 1): list[i] = list[i-1] + list[i-2] return list[n] #fibonacci with tail recursion def fib_tail(n, a = 0, b = 1): if n == 0: return a else: return ...
def fib_list(n): list = [0] * (n + 1) list[0] = 0 list[1] = 1 for i in range(2, n + 1): list[i] = list[i - 1] + list[i - 2] return list[n] def fib_tail(n, a=0, b=1): if n == 0: return a else: return fib_tail(n - 1, b, a + b) def memoize(f): memo = {} def he...
''' Created on 8 May 2017 @author: Janion ''' class NegativeNumberAdjuster(object): OPEN_BRACKET = "(" CLOSE_BRACKET = ")" PLUS = "+" MINUS = "-" MULTIPLY = "*" DIVIDE = "/" MODULO = "%" POWER = "^" OPERATIONS = [PLUS, MINUS, MULTIPLY, DIVIDE, POWER] PLACE_HOLDER = "|...
""" Created on 8 May 2017 @author: Janion """ class Negativenumberadjuster(object): open_bracket = '(' close_bracket = ')' plus = '+' minus = '-' multiply = '*' divide = '/' modulo = '%' power = '^' operations = [PLUS, MINUS, MULTIPLY, DIVIDE, POWER] place_holder = '|' spac...
class Node: def __init__(self, idd, xx, yy, dem = 0, st = 0, profit = 0): self.x = xx self.y = yy self.id = idd self.isRouted = False self.st = st self.demand = dem self.profit = profit def load_model(file_name): all_nodes = [] all_lines = list(open(f...
class Node: def __init__(self, idd, xx, yy, dem=0, st=0, profit=0): self.x = xx self.y = yy self.id = idd self.isRouted = False self.st = st self.demand = dem self.profit = profit def load_model(file_name): all_nodes = [] all_lines = list(open(file_n...
precalc = [None] * 25 ms = [1] total = 1 def S(N): global total if N == -1: return 0 print("S("+str(N)+")") if precalc[N] != None: total += precalc[N] ms.append(total) return precalc[N] res = S(N-1) + 1 + (N+2)+ S(N-1) total += S(N-1) ms.append(total) tota...
precalc = [None] * 25 ms = [1] total = 1 def s(N): global total if N == -1: return 0 print('S(' + str(N) + ')') if precalc[N] != None: total += precalc[N] ms.append(total) return precalc[N] res = s(N - 1) + 1 + (N + 2) + s(N - 1) total += s(N - 1) ms.append(t...
def matrixMultiplication(arr, n): dp = [[-1]* (len(arr)+1) for i in range (len(arr)+1)] def helper(arr, i, j): if i == j : return 0 if dp[i][j] != -1 : return dp[i][j] ans = float('inf') for k in range (i , j): tempAns = helper(ar...
def matrix_multiplication(arr, n): dp = [[-1] * (len(arr) + 1) for i in range(len(arr) + 1)] def helper(arr, i, j): if i == j: return 0 if dp[i][j] != -1: return dp[i][j] ans = float('inf') for k in range(i, j): temp_ans = helper(arr, i, k) + ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019-05-18 10:55 # @Author : minp # @contact : king101125s@gmail.com # @Site : # @File : cons.py # @Software: PyCharm api_name = {'realtime_code','realtime_quotes'} token = 'df6592c4f63cdc4600e6aa1267d3d0f51cdaddcf4c9d554d9b395090'
api_name = {'realtime_code', 'realtime_quotes'} token = 'df6592c4f63cdc4600e6aa1267d3d0f51cdaddcf4c9d554d9b395090'
#!/usr/bin/python3 # -*- coding: utf-8 -*- def main(): numbers = [0,1,2,3,4] doubled_numbers = [] for number in numbers: doubled_numbers.append(number * 2) print(doubled_numbers) # the same as above doubled_numbers = [number * 2 for number in numbers] print(doubled_numbers) doubled_numbers = [...
def main(): numbers = [0, 1, 2, 3, 4] doubled_numbers = [] for number in numbers: doubled_numbers.append(number * 2) print(doubled_numbers) doubled_numbers = [number * 2 for number in numbers] print(doubled_numbers) doubled_numbers = [number * 2 for number in range(5)] print(...
def escreva(txt): tam = len(txt) + 4 print('-'*tam) print(f' {txt}') print('-'*tam) escreva(str(input('Digite um texto: ')))
def escreva(txt): tam = len(txt) + 4 print('-' * tam) print(f' {txt}') print('-' * tam) escreva(str(input('Digite um texto: ')))
description = 'FRM II 5.5 T superconducting magnet' group = 'plugplay' includes = ['alias_B', 'alias_sth'] tango_base = 'tango://%s:10000/box/' % setupname devices = { 'B_%s' % setupname: device('nicos.devices.tango.Actuator', description = 'The magnetic field', tangodevice = tango_base + 'magne...
description = 'FRM II 5.5 T superconducting magnet' group = 'plugplay' includes = ['alias_B', 'alias_sth'] tango_base = 'tango://%s:10000/box/' % setupname devices = {'B_%s' % setupname: device('nicos.devices.tango.Actuator', description='The magnetic field', tangodevice=tango_base + 'magnet/field', abslimits=(-5.555, ...
class Board: def __init__(self, numbers): self.unmarked = set() self.columns = [5]*5 self.rows = [5]*5 self.positions = dict() for i in range(len(numbers)): for j in range(len(numbers[i])): self.positions[numbers[i][j]] = [i, j] sel...
class Board: def __init__(self, numbers): self.unmarked = set() self.columns = [5] * 5 self.rows = [5] * 5 self.positions = dict() for i in range(len(numbers)): for j in range(len(numbers[i])): self.positions[numbers[i][j]] = [i, j] ...
def main(): s = list(input().strip()) s.append('.') k = int(input()) cur_res = 0 max_res = 0 l, r = 0, 0 curr_holes = 0 while r < len(s): r += 1 if s[r - 1] == 'X': max_res = max(max_res, r - l) # print(l, r, max_res) else: curr...
def main(): s = list(input().strip()) s.append('.') k = int(input()) cur_res = 0 max_res = 0 (l, r) = (0, 0) curr_holes = 0 while r < len(s): r += 1 if s[r - 1] == 'X': max_res = max(max_res, r - l) else: curr_holes += 1 if curr...
class stature(): def __init__(self, ObjA, ObjB): self.ObjA = ObjA self.ObjB = ObjB def __add__(self, other): return self.ObjB + other def __sub__(self, other): return self.ObjB - other def __mul__(self, other): return self.ObjB * other def __truediv__(self, other): return self.ObjB / other ...
class Stature: def __init__(self, ObjA, ObjB): self.ObjA = ObjA self.ObjB = ObjB def __add__(self, other): return self.ObjB + other def __sub__(self, other): return self.ObjB - other def __mul__(self, other): return self.ObjB * other def __truediv__(self,...
class BalsamLauncherError(Exception): pass class BalsamTransitionError(Exception): pass class TransitionNotFoundError(BalsamTransitionError, ValueError): pass class MPIEnsembleError(Exception): pass
class Balsamlaunchererror(Exception): pass class Balsamtransitionerror(Exception): pass class Transitionnotfounderror(BalsamTransitionError, ValueError): pass class Mpiensembleerror(Exception): pass
# Description # You have planned a dinner with your friends today. It's the right # time to add them to your program. You need to be sure how # many friends are joining you for dinner including you. # The idea is to take names from user input. Store them in a # dictionary # For example, if five friends are joining...
class Billsplitter: def __init__(self): self.n = None self.friends = {} def take_friends(self): print('Enter the number of friends joining (including you):') self.n = int(input()) if self.n > 0: print('Enter the name of every friend (including you), each on ...
class FileMetadata: def __init__( self, file_type: str, file_id: str, file_name: str ): self.file_type = file_type self.file_id = file_id self.filename = file_name
class Filemetadata: def __init__(self, file_type: str, file_id: str, file_name: str): self.file_type = file_type self.file_id = file_id self.filename = file_name
# "Chef and Numbers" # Aldew # Difficulty: Cakewalk T = int(input()) for _ in range(T): n = int(input()) arr = map(int, input().split()) d = {} prev_x = None # create a dictionary with alues for each type for x in arr: add = False # new value if x not in d: ...
t = int(input()) for _ in range(T): n = int(input()) arr = map(int, input().split()) d = {} prev_x = None for x in arr: add = False if x not in d: d[x] = 1 add = True elif x != prev_x: d[x] += 1 add = True if add: ...
def main(a,b): for i in range(b): print(a) main("Hello",5)
def main(a, b): for i in range(b): print(a) main('Hello', 5)
# # PySNMP MIB module HMLLDP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HMLLDP-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:32:40 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:...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ...
# test with when context manager raises in __enter__/__exit__ class CtxMgr: def __init__(self, id): self.id = id def __enter__(self): print("__enter__", self.id) if 10 <= self.id < 20: raise Exception('enter', self.id) return self def __exit__(self, a, b, c): ...
class Ctxmgr: def __init__(self, id): self.id = id def __enter__(self): print('__enter__', self.id) if 10 <= self.id < 20: raise exception('enter', self.id) return self def __exit__(self, a, b, c): print('__exit__', self.id, repr(a), repr(b)) if...
# # PySNMP MIB module DEVSERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DEVSERVER-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:42:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(device,) = mibBuilder.importSymbols('ANIROOT-MIB', 'device') (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_...
#!/usr/bin/python def binary_search(alist, item): if len(alist) == 0: return False else: mid = len(alist)//2 if alist[mid] == item: return True else: if alist[mid] > item: return binary_search(alist[mid+1:], item) else: ...
def binary_search(alist, item): if len(alist) == 0: return False else: mid = len(alist) // 2 if alist[mid] == item: return True elif alist[mid] > item: return binary_search(alist[mid + 1:], item) else: return binary_search(alist[:mid], ...
def remove_token_files(parser, logic, logging, args=0): if args: if "hid" not in args.keys() or "f" not in args.keys(): parser.print("Not all parameter set") return hid = args["hid"] filenames = args["f"] for h in hid: error = logic.remove_token_fi...
def remove_token_files(parser, logic, logging, args=0): if args: if 'hid' not in args.keys() or 'f' not in args.keys(): parser.print('Not all parameter set') return hid = args['hid'] filenames = args['f'] for h in hid: error = logic.remove_token_fi...
def get_level_map(): level_map = [ ' ', ' ', ' XXXXX ', ' ', ' P ', 'XXXX XX ', 'XX X XXXX XX XX ', ' X ...
def get_level_map(): level_map = [' ', ' ', ' XXXXX ', ' ', ' P ', 'XXXX XX ', 'XX X XXXX XX XX ', ' X XXXX XX XXX ', ' XXXXX XXXXXX XX XXXX', 'XXXXXXXX XXXXXX XX...
# countdown.py # # counts down from larger input value to smaller # CSC 110 # Fall 2011 first = int(input('Enter a number: ')) second = int(input('Enter another number: ')) # figure out which is larger. That's where we start. if first <= second: start = second stop = first else: start = first stop = ...
first = int(input('Enter a number: ')) second = int(input('Enter another number: ')) if first <= second: start = second stop = first else: start = first stop = second print('\n') for val in range(start, stop - 1, -1): print(val) print('BLAST OFF')
def convert_bytes(bytes): bytes = float(bytes) if bytes is None: return '0' if bytes >= 1099511627776: terabytes = bytes / 1099511627776 size = '%.2fT' % terabytes elif bytes >= 1073741824: gigabytes = bytes / 1073741824 size = '%.2fG' % gigabytes elif bytes >...
def convert_bytes(bytes): bytes = float(bytes) if bytes is None: return '0' if bytes >= 1099511627776: terabytes = bytes / 1099511627776 size = '%.2fT' % terabytes elif bytes >= 1073741824: gigabytes = bytes / 1073741824 size = '%.2fG' % gigabytes elif bytes >...
class PyBitrix24Error(Exception): pass class PBx24RequestError(PyBitrix24Error): pass class PBx24ArgumentError(PyBitrix24Error, ValueError): pass class PBx24AttributeError(PyBitrix24Error, AttributeError): pass
class Pybitrix24Error(Exception): pass class Pbx24Requesterror(PyBitrix24Error): pass class Pbx24Argumenterror(PyBitrix24Error, ValueError): pass class Pbx24Attributeerror(PyBitrix24Error, AttributeError): pass
load("//ruby/private:constants.bzl", "RULES_RUBY_WORKSPACE_NAME") def _get_interpreter_label(repository_ctx, ruby_sdk): # TODO(yugui) Support windows as rules_nodejs does return Label("%s//:ruby" % ruby_sdk) def _get_bundler_label(repository_ctx, ruby_sdk): # TODO(yugui) Support windows as rules_nodejs does r...
load('//ruby/private:constants.bzl', 'RULES_RUBY_WORKSPACE_NAME') def _get_interpreter_label(repository_ctx, ruby_sdk): return label('%s//:ruby' % ruby_sdk) def _get_bundler_label(repository_ctx, ruby_sdk): return label('%s//:bundler/exe/bundler' % ruby_sdk) def _get_bundler_lib_label(repository_ctx, ruby_sd...
DATA_NAME = "accel_ms2_xyz" LABEL_NAME = "gesture" # label name (you should keep "negative" in the end of the list) labels = ["ring", "slope", "negative"] # data split configuration # note that train_ratio + valid_ratio + test_ratio = 1 train_ratio = 0.6 valid_ratio = 0.3 data_split_random_seed = 30 # model configur...
data_name = 'accel_ms2_xyz' label_name = 'gesture' labels = ['ring', 'slope', 'negative'] train_ratio = 0.6 valid_ratio = 0.3 data_split_random_seed = 30 model = 'CNN' seq_length = 64 epochs = 50 steps_per_epoch = 1000 batch_size = 64
# problem link: https://leetcode.com/problems/restore-ip-addresses/ class Solution: def restoreIpAddresses(self, s: str) -> List[str]: ans = [] def dfs(prev_s, later_s, i): # i means the order of the segment in the IP address if later_s == "": # illegal case ...
class Solution: def restore_ip_addresses(self, s: str) -> List[str]: ans = [] def dfs(prev_s, later_s, i): if later_s == '': return if i == 4: if later_s[0] == '0' and len(later_s) > 1: return elif 0 <= int...
# Global variables # Colors WHITE = (255, 255, 255) GREY = (200, 200, 200) BLACK = (0, 0, 0) GREEN = (0, 255, 0) RED = (255, 0, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) ORANGE = (255, 140, 0) # Screen dimensions SCREEN_WIDTH = 800 SCREEN_HEIGHT = 800 # Number of columns/rows COL_NUM = 1 ROW_NUM = 1 # Color cell...
white = (255, 255, 255) grey = (200, 200, 200) black = (0, 0, 0) green = (0, 255, 0) red = (255, 0, 0) blue = (0, 0, 255) yellow = (255, 255, 0) orange = (255, 140, 0) screen_width = 800 screen_height = 800 col_num = 1 row_num = 1 cell_change = WHITE dijkstra_steps = [] dijkstra_animate = False dijkstra_fail = False st...
def add_no_lote(lote, inicio, fim, size): lista = list(range(inicio, fim+1)) i = 0 j = 0 while (i < size and j < len(lista)): if (lote[i] == lista[j]): lote.insert(i, lista[j]) j += 1 i += 1 while(j < len(lista)): lote.append(lista[j]) j += 1...
def add_no_lote(lote, inicio, fim, size): lista = list(range(inicio, fim + 1)) i = 0 j = 0 while i < size and j < len(lista): if lote[i] == lista[j]: lote.insert(i, lista[j]) j += 1 i += 1 while j < len(lista): lote.append(lista[j]) j += 1 ...
def output_processing(dic): dic1 = {} for key, value in dic.items(): l1 = [0]*2 if key[0] == 0.0: l1[0] = 'a' elif key[0] == 1.0: l1[0] = 'b' elif key[0] == 2.0: l1[0] = 'c' elif key[0] == 3.0: l1[0] = 'd' if key[1] ...
def output_processing(dic): dic1 = {} for (key, value) in dic.items(): l1 = [0] * 2 if key[0] == 0.0: l1[0] = 'a' elif key[0] == 1.0: l1[0] = 'b' elif key[0] == 2.0: l1[0] = 'c' elif key[0] == 3.0: l1[0] = 'd' if key...
def xor_shift_period(word_size, x, a, b, c): max_int = 2**word_size if max_int > 2**16: result = [0] * 2**16 print('WARNING: Resorting to heuristic method for large word_size. Accuracy not guaranteed') else: result = [0] * max_int for _ in range(2**word_size): x ^= ((x << a) % max_int) x ^= x >> b x ^= ...
def xor_shift_period(word_size, x, a, b, c): max_int = 2 ** word_size if max_int > 2 ** 16: result = [0] * 2 ** 16 print('WARNING: Resorting to heuristic method for large word_size. Accuracy not guaranteed') else: result = [0] * max_int for _ in range(2 ** word_size): x ^...
# class Tree: # def __init__(self, val, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def solve(self, root): bfs = deque([root]) while bfs: is_leaf = not bfs[0].left and not bfs[0].right for i in ran...
class Solution: def solve(self, root): bfs = deque([root]) while bfs: is_leaf = not bfs[0].left and (not bfs[0].right) for i in range(len(bfs)): cur = bfs.popleft() if (not cur.left and (not cur.right)) != is_leaf: return F...
# set this to the full path to the dashvend respository checkout DASHVEND_DIR = '/home/pi/dashvend' # note: also update paths in: # bin/.init.d.dashvend # bin/_dashvend_control.sh # bin/dashvend_screens.screenrc # bin/show_screen_number.sh # set your dashcore dir location DASHCORE_DIR = "/home/pi/.dashcore" ...
dashvend_dir = '/home/pi/dashvend' dashcore_dir = '/home/pi/.dashcore' mainnet = True vending_cost = 0.001
x = 's' if x == 'abc': print('same') elif x == 'ddd': print('ddd') else: print('not same')
x = 's' if x == 'abc': print('same') elif x == 'ddd': print('ddd') else: print('not same')
load("@io_bazel_rules_docker//container:container.bzl", lib_push = "container_push") tags_to_push = ["release", "latest", "beta"] def container_push(registry, repository): [ lib_push( name = tag, format = "Docker", image = ":image", registry = registry, ...
load('@io_bazel_rules_docker//container:container.bzl', lib_push='container_push') tags_to_push = ['release', 'latest', 'beta'] def container_push(registry, repository): [lib_push(name=tag, format='Docker', image=':image', registry=registry, repository=repository, tag=tag) for tag in tags_to_push]
contador = 1 print(contador) while contador < 1000: contador += 1 print(contador)
contador = 1 print(contador) while contador < 1000: contador += 1 print(contador)
class Config(object): Bool = 1 String = 2 Int = 3 Hex = 4 class Enum(object): def __init__(self, enum_dict): self._enum_dict = enum_dict class FormatString(object): def __init__(self, holders=None): # TODO: implement pass def __init__(...
class Config(object): bool = 1 string = 2 int = 3 hex = 4 class Enum(object): def __init__(self, enum_dict): self._enum_dict = enum_dict class Formatstring(object): def __init__(self, holders=None): pass def __init__(self, conf_dict): pass
# https://leetcode.com/problems/convert-bst-to-greater-tree/submissions/ # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def convertBST(self, root: TreeNode) -> TreeN...
class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def convert_bst(self, root: TreeNode) -> TreeNode: self.sum = 0 def inverted_inorder(node): if node: invert...
def outter(): def inner(): print("inner") inner() outter()
def outter(): def inner(): print('inner') inner() outter()
bases = ["A", "C", "T", "G"] rootLength = 10 gen = 3 # mutations = 1 # mutationCode
bases = ['A', 'C', 'T', 'G'] root_length = 10 gen = 3
#!/usr/bin/python3 RPC_CORE_HOST = "bitcoincore" RPC_CORE_PORT = 8332 RPC_CORE_USER = "swapper" RPC_CORE_PASSWORD = "swapper" ZMQ_CORE_PORT = 28332 RPC_ELECTRUM_HOST = "electrum" RPC_ELECTRUM_PORT = 30000 RPC_ELECTRUM_USER = "swapper" RPC_ELECTRUM_PASSWORD = "swapper" BITCOIN_CALLBACK_PATH = "/bitcoincallback" BITCOI...
rpc_core_host = 'bitcoincore' rpc_core_port = 8332 rpc_core_user = 'swapper' rpc_core_password = 'swapper' zmq_core_port = 28332 rpc_electrum_host = 'electrum' rpc_electrum_port = 30000 rpc_electrum_user = 'swapper' rpc_electrum_password = 'swapper' bitcoin_callback_path = '/bitcoincallback' bitcoin_callback_endpoint =...
ageman = 0 namemans = '' f = 0 ages = 0 for person in range(1, 5): print('|{}|'.format(person)) name = str(input('Name:')).strip() age = int(input('Age:')) gender = str(input('Gender [M|F]:')).strip().upper() ages += age mean_ages = ages / 4 if person == 1 and gender == 'M': n...
ageman = 0 namemans = '' f = 0 ages = 0 for person in range(1, 5): print('|{}|'.format(person)) name = str(input('Name:')).strip() age = int(input('Age:')) gender = str(input('Gender [M|F]:')).strip().upper() ages += age mean_ages = ages / 4 if person == 1 and gender == 'M': namemans...
#!/usr/bin/python # ''' blueline_follower.py dec 7 2019 shaun bowman v0.1 Purpose: consume signals from KmeansMsg topic, containing blueline data in image domain (pixels) output desired steering command in radians to intersect blue line at lookahead point '''
""" blueline_follower.py dec 7 2019 shaun bowman v0.1 Purpose: consume signals from KmeansMsg topic, containing blueline data in image domain (pixels) output desired steering command in radians to intersect blue line at lookahead point """