content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
LIMIT_STATEMENT = "LIMIT {last} OFFSET {offset}" SUBTREES = """ SELECT keyword_tree.fingerprint, keyword, library, status, arguments, call_index FROM keyword_tree JOIN tree_hierarchy ON tree_hierarchy.subtree=keyword_tree.fingerprint WHERE tree_hierarchy.fingerprint=%(fingerprint)s ORDER BY call_index::int; """ TEAM...
limit_statement = 'LIMIT {last} OFFSET {offset}' subtrees = '\nSELECT keyword_tree.fingerprint, keyword, library, status, arguments, call_index\nFROM keyword_tree\nJOIN tree_hierarchy ON tree_hierarchy.subtree=keyword_tree.fingerprint\nWHERE tree_hierarchy.fingerprint=%(fingerprint)s\nORDER BY call_index::int;\n' team_...
n = int(input()) space = n-1 for i in range(n): for k in range(space): print(" ",end="") for j in range(i+1): print("* ",end="") print() space -= 1
n = int(input()) space = n - 1 for i in range(n): for k in range(space): print(' ', end='') for j in range(i + 1): print('* ', end='') print() space -= 1
type = 'MMDetector' config = '/home/linkinpark213/Source/mmdetection/configs/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py' checkpoint = 'https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco/faster_rcnn_x101_64x4d_fpn_1x_coco_20200204-833ee192.pth' conf_...
type = 'MMDetector' config = '/home/linkinpark213/Source/mmdetection/configs/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py' checkpoint = 'https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco/faster_rcnn_x101_64x4d_fpn_1x_coco_20200204-833ee192.pth' conf_...
def add_voxelizer_parameters(parser): parser.add_argument( "--voxelizer_factory", choices=[ "occupancy_grid", "tsdf_grid", "image" ], default="occupancy_grid", help="The voxelizer factory to be used (default=occupancy_grid)" ) par...
def add_voxelizer_parameters(parser): parser.add_argument('--voxelizer_factory', choices=['occupancy_grid', 'tsdf_grid', 'image'], default='occupancy_grid', help='The voxelizer factory to be used (default=occupancy_grid)') parser.add_argument('--grid_shape', type=lambda x: tuple(map(int, x.split(','))), default...
def describe_pet(animal_type, pet_name='virgil'): """Display info about Virgil""" print(f"\nI have a {animal_type}.") print(f"My {animal_type}'s name is {pet_name.title()}") describe_pet('dog', 'virgil') describe_pet('hamster', 'harry') describe_pet(pet_name='garfield', animal_type='cat') describe_pet('dog...
def describe_pet(animal_type, pet_name='virgil'): """Display info about Virgil""" print(f'\nI have a {animal_type}.') print(f"My {animal_type}'s name is {pet_name.title()}") describe_pet('dog', 'virgil') describe_pet('hamster', 'harry') describe_pet(pet_name='garfield', animal_type='cat') describe_pet('dog'...
j = 1 while j <= 9: i = 1 while i <= j: print(f'{i}*{j}={i*j}' , end='\t') i += 1 j += 1 print()
j = 1 while j <= 9: i = 1 while i <= j: print(f'{i}*{j}={i * j}', end='\t') i += 1 j += 1 print()
# This Document class simulates the HTML DOM document object. class Document: def __init__(self, window): self.window = window self.created_elements_index = 0 # This property is required to ensure that every created HTML element can be accessed using a unique reference. def getE...
class Document: def __init__(self, window): self.window = window self.created_elements_index = 0 def get_element_by_id(self, id): return html__element(self.window, "document.getElementById('" + id + "')") def create_element(self, tagName): self.created_elements_index += 1 ...
LOAD_HUB_FROM_EXT_TEMP = """ insert into {{ params.hub_name }} select ext.* from {{ params.hub_name }}_ext ext left join {{ params.hub_name }} h on h.{{ params.pk_name }} = ext.{{ params.pk_name }} where h.{{ params.pk_name }} is null and ext.load_dtm::time > '{{ params.from_dtm }}'; """ LOAD_LINK_FR...
load_hub_from_ext_temp = "\ninsert into {{ params.hub_name }}\nselect\n ext.*\nfrom {{ params.hub_name }}_ext ext\nleft join {{ params.hub_name }} h\n on h.{{ params.pk_name }} = ext.{{ params.pk_name }}\nwhere\n h.{{ params.pk_name }} is null\n and ext.load_dtm::time > '{{ params.from_dtm }}';\n" load_li...
# Resample and tidy china: china_annual china_annual = china.resample('A').last().pct_change(10).dropna() # Resample and tidy us: us_annual us_annual = us.resample('A').last().pct_change(10).dropna() # Concatenate china_annual and us_annual: gdp gdp = pd.concat([china_annual,us_annual],join='inner',axis=1) ...
china_annual = china.resample('A').last().pct_change(10).dropna() us_annual = us.resample('A').last().pct_change(10).dropna() gdp = pd.concat([china_annual, us_annual], join='inner', axis=1) print(gdp.resample('10A').last())
train = dict( batch_size=10, num_workers=4, use_amp=True, num_epochs=100, num_iters=30000, epoch_based=True, lr=0.0001, optimizer=dict( mode="adamw", set_to_none=True, group_mode="r3", # ['trick', 'r3', 'all', 'finetune'], cfg=dict(), ), grad_acc_...
train = dict(batch_size=10, num_workers=4, use_amp=True, num_epochs=100, num_iters=30000, epoch_based=True, lr=0.0001, optimizer=dict(mode='adamw', set_to_none=True, group_mode='r3', cfg=dict()), grad_acc_step=1, sche_usebatch=True, scheduler=dict(warmup=dict(num_iters=0), mode='poly', cfg=dict(lr_decay=0.9, min_coef=0...
def simple_game(builder): return builder. \ room( name='the testing room', description= """ It's a room with a Pythonista writing test cases. There is a locked drawer with a key on top. You need to get to the production server room at t...
def simple_game(builder): return builder.room(name='the testing room', description="\n It's a room with a Pythonista writing test cases.\n There is a locked drawer with a key on top.\n You need to get to the production server room\n at the North exit, but management has s...
examples = [ { "file": "FILENAME", "info": [ { "turn_num": 1, "user": "USER QUERY", "system": "HUMAN RESPONSE", "HDSA": "HDSA RESPONSE", "MarCo": "MarCo RESPONSE", "MarCo vs. system": ...
examples = [{'file': 'FILENAME', 'info': [{'turn_num': 1, 'user': 'USER QUERY', 'system': 'HUMAN RESPONSE', 'HDSA': 'HDSA RESPONSE', 'MarCo': 'MarCo RESPONSE', 'MarCo vs. system': {'Readability': ['Tie', 'MarCo', 'System'], 'Completion': ['MarCo', 'MarCo', 'Tie']}}, ...]}]
# ____ _____ # | _ \ __ _ _ |_ _| __ __ _ ___ ___ _ __ # | |_) / _` | | | || || '__/ _` |/ __/ _ \ '__| # | _ < (_| | |_| || || | | (_| | (_| __/ | # |_| \_\__,_|\__, ||_||_| \__,_|\___\___|_| # |___/ # VERSION = (0...
version = (0, 0, 1) __version__ = '.'.join(map(str, VERSION))
A, B = map(int, input().split()) result = 0 for i in range(A, B + 1): if (A + B + i) % 3 == 0: result += 1 print(result)
(a, b) = map(int, input().split()) result = 0 for i in range(A, B + 1): if (A + B + i) % 3 == 0: result += 1 print(result)
# -*- coding: utf-8 -*- class Graph(object): r"""Graph. This class described the graph data structure. """ pass class DirectedGraph(Graph): r"""Directed Graph. This class described the directed graph data structure. The graph is described using a dictionary. graph = {node: [[paren...
class Graph(object): """Graph. This class described the graph data structure. """ pass class Directedgraph(Graph): """Directed Graph. This class described the directed graph data structure. The graph is described using a dictionary. graph = {node: [[parent nodes], [child nodes]]} ...
# Search in Rotated Sorted Array: https://leetcode.com/problems/search-in-rotated-sorted-array/ # There is an integer array nums sorted in ascending order (with distinct values). # Prior to being passed to your function, nums is rotated at an unknown pivot index k (0 <= k < nums.length) such that the resulting array ...
class Solution: def search(self, nums, target): (start, end) = (0, len(nums) - 1) while start <= end: mid = start + (end - start) // 2 if nums[mid] == target: return mid elif nums[mid] >= nums[start]: if target >= nums[start] and t...
def init_logger(logger_type, data): logger_profile = [] log_header = 'run_time,read_time,' # what sesnors are we logging? for k, v in data.items(): if(data[k]['device'] != ''): # check to see if our device is setup for kk, vv in data[k]['sensors'].items(): if(data[k][...
def init_logger(logger_type, data): logger_profile = [] log_header = 'run_time,read_time,' for (k, v) in data.items(): if data[k]['device'] != '': for (kk, vv) in data[k]['sensors'].items(): if data[k]['sensors'][kk]['read'] == True and data[k]['sensors'][kk]['log_on'] ==...
class Solution(object): def XXX(self, root): def dfs(node, num, ret): if node is None: return num num += 1 return max(dfs(node.left, num, ret), dfs(node.right, num, ret)) num -= 1 return dfs(root, 0, 0)
class Solution(object): def xxx(self, root): def dfs(node, num, ret): if node is None: return num num += 1 return max(dfs(node.left, num, ret), dfs(node.right, num, ret)) num -= 1 return dfs(root, 0, 0)
# Copyright 2012 Kevin Gillette. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. _ord = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" _table = dict((c, i) for i, c in enumerate(_ord)) def encode(n, len=0): out = "" while...
_ord = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_' _table = dict(((c, i) for (i, c) in enumerate(_ord))) def encode(n, len=0): out = '' while n > 0 or len > 0: out = _ord[n & 63] + out n >>= 6 len -= 1 return out def decode(input): n = 0 for c in inpu...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Send SMS to Visitor with leads', 'category': 'Website/Website', 'sequence': 54, 'summary': 'Allows to send sms to website visitor that have lead', 'version': '1.0', 'description': """All...
{'name': 'Send SMS to Visitor with leads', 'category': 'Website/Website', 'sequence': 54, 'summary': 'Allows to send sms to website visitor that have lead', 'version': '1.0', 'description': 'Allows to send sms to website visitor if the visitor is linked to a lead.', 'depends': ['website_sms', 'crm'], 'data': [], 'insta...
class User: def __init__(self,name): self.name=name def show(self): print(self.name) user =User("ada66") user.show()
class User: def __init__(self, name): self.name = name def show(self): print(self.name) user = user('ada66') user.show()
def merge(left, right): results = [] while(len(left) and len(right)): if left[0] < right[0]: results.append(left.pop(0)) print(left) else: results.append(right.pop(0)) print(right) return [*results, *left, *right] print(merge([3, 8, 12], [5, ...
def merge(left, right): results = [] while len(left) and len(right): if left[0] < right[0]: results.append(left.pop(0)) print(left) else: results.append(right.pop(0)) print(right) return [*results, *left, *right] print(merge([3, 8, 12], [5, 10,...
SIZE = 400 END_SCORE = 4000 GRID_LEN = 3 WINAT = 2048 GRID_PADDING = 10 CHROMOSOME_LEN = pow(GRID_LEN, 4) + 4*GRID_LEN*GRID_LEN + 1*(pow(GRID_LEN, 4)) TOURNAMENT_SELECTION_SIZE = 4 MUTATION_RATE = 0.4 NUMBER_OF_ELITE_CHROMOSOMES = 4 POPULATION_SIZE = 10 GEN_MAX = 10000 DONOTHINGINPUT_MAX = 5 BACKGROUND_COLOR_GAME = "...
size = 400 end_score = 4000 grid_len = 3 winat = 2048 grid_padding = 10 chromosome_len = pow(GRID_LEN, 4) + 4 * GRID_LEN * GRID_LEN + 1 * pow(GRID_LEN, 4) tournament_selection_size = 4 mutation_rate = 0.4 number_of_elite_chromosomes = 4 population_size = 10 gen_max = 10000 donothinginput_max = 5 background_color_game =...
#!/usr/bin/env python ''' ch8q2a1.py Function1 = obtain_os_version -- process the show version output and return the OS version (Version 15.0(1)M4) else return None. Looking for line such as: Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1) ''' def obtain_os_ver...
""" ch8q2a1.py Function1 = obtain_os_version -- process the show version output and return the OS version (Version 15.0(1)M4) else return None. Looking for line such as: Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1) """ def obtain_os_version(show_ver_file): ...
# 5 # / \ # 3 7 # / \ / \ # 2 4 6 8 tree = Node(5) insert(tree, Node(3)) insert(tree, Node(2)) insert(tree, Node(4)) insert(tree, Node(7)) insert(tree, Node(6)) insert(tree, Node(8)) # 5 3 2 4 7 6 8 preorder(tree)
tree = node(5) insert(tree, node(3)) insert(tree, node(2)) insert(tree, node(4)) insert(tree, node(7)) insert(tree, node(6)) insert(tree, node(8)) preorder(tree)
# Copyright (C) 2021 The Android Open Source 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 at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
def test(name, input_dims, input_values, paddings, mode, output_dims, output_values): t = input('t', ('TENSOR_FLOAT32', input_dims)) paddings = parameter('paddings', ('TENSOR_INT32', [len(input_dims), 2]), paddings) output = output('output', ('TENSOR_FLOAT32', output_dims)) model = model().Operation('MI...
class SemanticException(Exception): def __init__(self, message, token=None): if token is None: super(SemanticException, self).__init__(message) else: super(SemanticException, self).__init__(message + ': ' + token.__str__())
class Semanticexception(Exception): def __init__(self, message, token=None): if token is None: super(SemanticException, self).__init__(message) else: super(SemanticException, self).__init__(message + ': ' + token.__str__())
keys = { "x" :"x", "y" :"y", "l" :"left", "left" :"left", "r" :"right", "right" :"right", "t" :"top", "top" :"top", "b" :"bottom", "bottom":"bottom", "w" :"width", "width" :"width", "h" :"height", "height":"height", "a" :"align", "align" :"align", "d" :"dock", "dock" :"dock" } align_values_rev...
keys = {'x': 'x', 'y': 'y', 'l': 'left', 'left': 'left', 'r': 'right', 'right': 'right', 't': 'top', 'top': 'top', 'b': 'bottom', 'bottom': 'bottom', 'w': 'width', 'width': 'width', 'h': 'height', 'height': 'height', 'a': 'align', 'align': 'align', 'd': 'dock', 'dock': 'dock'} align_values_reversed = {'TopLeft': 'tl,lt...
# this contains some predefined pair outputs . def fixedpair(inp): if inp == "who?": pair = "I am TS3000." elif inp == "who ?" : pair = "I m bitch" return pair
def fixedpair(inp): if inp == 'who?': pair = 'I am TS3000.' elif inp == 'who ?': pair = 'I m bitch' return pair
class PlanCircuit(APIObject, IDisposable): """ An object that represents an enclosed area in a plan view within the Autodesk Revit project. """ def Dispose(self): """ Dispose(self: APIObject,A_0: bool) """ pass def GetPointInside(self): """ GetPointInside(self: PlanCircu...
class Plancircuit(APIObject, IDisposable): """ An object that represents an enclosed area in a plan view within the Autodesk Revit project. """ def dispose(self): """ Dispose(self: APIObject,A_0: bool) """ pass def get_point_inside(self): """ GetPointInside(self: PlanCircuit) -> ...
''' 05 - Putting a list of dates in order Much like numbers and strings, date objects in Python can be put in order. Earlier dates come before later ones, and so we can sort a list of date objects from earliest to latest. What if our Florida hurricane dates had been scrambled? We've gone ahead and shuffl...
""" 05 - Putting a list of dates in order Much like numbers and strings, date objects in Python can be put in order. Earlier dates come before later ones, and so we can sort a list of date objects from earliest to latest. What if our Florida hurricane dates had been scrambled? We've gone ahead and shuffl...
_base_ = ['./rretinanet_obb_r50_fpn_1x_dota_v3.py'] # switch data path in '../_base_/datasets/dota1_0.py' angle_version = 'v3' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_...
_base_ = ['./rretinanet_obb_r50_fpn_1x_dota_v3.py'] angle_version = 'v3' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='RResize', img_scale=(1024, 1024)), dict(type='...
# O(n) time | O(n) space # Iterative solution 2 def spiralTraverse(array): result = [] startRow, endRow = 0, len(array) - 1 startCol, endCol = 0, len(array[0]) - 1 while startRow <= endRow and startCol <= endCol: for col in range(startCol, endCol + 1): result.append(array[startRow][...
def spiral_traverse(array): result = [] (start_row, end_row) = (0, len(array) - 1) (start_col, end_col) = (0, len(array[0]) - 1) while startRow <= endRow and startCol <= endCol: for col in range(startCol, endCol + 1): result.append(array[startRow][col]) for row in range(start...
class MinStack: def __init__(self): """ initialize your data structure here. """ self.stack = [] self.helper = [] def push(self, x: int) -> None: self.stack.append(x) if not self.helper or x <= self.helper[-1]: self.helper.append(x) def p...
class Minstack: def __init__(self): """ initialize your data structure here. """ self.stack = [] self.helper = [] def push(self, x: int) -> None: self.stack.append(x) if not self.helper or x <= self.helper[-1]: self.helper.append(x) def ...
"""Return empty resources block.""" def GenerateConfig(_): return """resources:"""
"""Return empty resources block.""" def generate_config(_): return 'resources:'
for i in range(5): ans = 0 coins = [] for i in range(int(input())): coins.append(int(input())) avg = sum(coins) // len(coins) for i in coins: ans += abs(avg - i) print(ans // 2)
for i in range(5): ans = 0 coins = [] for i in range(int(input())): coins.append(int(input())) avg = sum(coins) // len(coins) for i in coins: ans += abs(avg - i) print(ans // 2)
""" Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two's complement method is used. Note: All letters in hexadecimal (a-f) must be in lowercase. The hexadecimal string must not contain extra leading 0s. If the number is zero, it is represented by a single zero character '0';...
""" Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two's complement method is used. Note: All letters in hexadecimal (a-f) must be in lowercase. The hexadecimal string must not contain extra leading 0s. If the number is zero, it is represented by a single zero character '0';...
app_name = 'app004' urlpatterns = [ ]
app_name = 'app004' urlpatterns = []
# # PySNMP MIB module ZHONE-DISMAN-TRACEROUTE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-DISMAN-TRACEROUTE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:41:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
# Given a list of intervals, # merge all the overlapping intervals to produce a list that has only mutually exclusive intervals. # Example: # Intervals: [[1,4], [2,5], [7,9]] # Output: [[1,5], [7,9]] # Explanation: Since the first two intervals [1,4] and [2,5] overlap, we merged them into one [1,5]. # O(N) for merg...
class Interval: def __init__(self, start, end) -> None: self.start = start self.end = end def print_interval(self): print('[' + str(self.start) + ',' + str(self.end) + ']', end='') def merge_intervals(arr): intervals = [] for i in arr: intervals.append(interval(i[0], i...
class AlignmentType: @property def _alignment_type(self): return self.record_type
class Alignmenttype: @property def _alignment_type(self): return self.record_type
""" Write a function called sed that takes as arguments a pattern string, a replacement string, and two filenames; it should read the first file and write the contents into the second file (creating it if necessary). If the pattern string appears anywhere in the file, it should be replaced with the replacement strin...
""" Write a function called sed that takes as arguments a pattern string, a replacement string, and two filenames; it should read the first file and write the contents into the second file (creating it if necessary). If the pattern string appears anywhere in the file, it should be replaced with the replacement strin...
def reverse_number(n): r = 0 while n > 0: r *= 10 r += n % 10 n //= 10 return r def isPrime(n): flag = False if(n > 1): for i in range(2, n): if(n % i == 0): flag = True break return flag n = int(input()) flag = Fals...
def reverse_number(n): r = 0 while n > 0: r *= 10 r += n % 10 n //= 10 return r def is_prime(n): flag = False if n > 1: for i in range(2, n): if n % i == 0: flag = True break return flag n = int(input()) flag = False if...
# # PySNMP MIB module HPN-ICF-L4RDT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-L4RDT-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:39:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ...
""" file access support """ def backup_one_line(fd): """ Moves the file pointer to right after the previous newline in an ASCII file @param fd : @type fd : file descriptor Notes ===== It ignores the current character in case it is a newline. """ index = -2 c = "" while c != "\n": fd.seek...
""" file access support """ def backup_one_line(fd): """ Moves the file pointer to right after the previous newline in an ASCII file @param fd : @type fd : file descriptor Notes ===== It ignores the current character in case it is a newline. """ index = -2 c = '' while c != '\n': ...
""" Error types """ class AlreadyBoundError(Exception): """ Raised if a factory is already bound to a name. """ pass class CyclicGraphError(Exception): """ Raised if a graph has a cycle. """ pass class LockedGraphError(Exception): """ Raised when attempting to create a c...
""" Error types """ class Alreadybounderror(Exception): """ Raised if a factory is already bound to a name. """ pass class Cyclicgrapherror(Exception): """ Raised if a graph has a cycle. """ pass class Lockedgrapherror(Exception): """ Raised when attempting to create a comp...
""" Ratiorg got statues of different sizes as a present from CodeMaster for his birthday, each statue having an non-negative integer size. Since he likes to make things perfect, he wants to arrange them from smallest to largest so that each statue will be bigger than the previous one exactly by 1. He may need some addi...
""" Ratiorg got statues of different sizes as a present from CodeMaster for his birthday, each statue having an non-negative integer size. Since he likes to make things perfect, he wants to arrange them from smallest to largest so that each statue will be bigger than the previous one exactly by 1. He may need some addi...
# -*- coding: utf-8 -*- # @Time : 2021/1/3 # @Author : handsomezhou DB_SUFFIX = "db" DB_SUFFIX_WITH_FULL_STOP = ".db"
db_suffix = 'db' db_suffix_with_full_stop = '.db'
t = int(input()) while t: N = int(input()) A = list(map(int, input().split())) l = [] for i in range(N): for j in range(i+1, N): l.append(A[i]+A[j]) c = l.count(max(l)) print(c/len(l)) t = t-1
t = int(input()) while t: n = int(input()) a = list(map(int, input().split())) l = [] for i in range(N): for j in range(i + 1, N): l.append(A[i] + A[j]) c = l.count(max(l)) print(c / len(l)) t = t - 1
# # 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 writing, software # ...
email = 'test@example.com' displayname = 'john smith' id = '1324' idp = 'https://test.idp' class Testshibwrapper(object): def __init__(self, app, mail=EMAIL): self.app = app self.mail = mail def __call__(self, environ, start_response): environ['mail'] = self.mail environ['disp...
def remove_reads_in_other_fastq(input_fastq, remove_fastq, out_file_name): out = open(out_file_name, "w") # Get seq ids to remove remove_ids = set() i = 0 for line in open(remove_fastq): if i % 500000 == 0: print(i) i += 1 if line.startswith("@"): rem...
def remove_reads_in_other_fastq(input_fastq, remove_fastq, out_file_name): out = open(out_file_name, 'w') remove_ids = set() i = 0 for line in open(remove_fastq): if i % 500000 == 0: print(i) i += 1 if line.startswith('@'): remove_ids.add(line) i = 0 ...
magic_number = 3 #Your code here... while True: guess = int(input("Enter a guess: ")) if guess == magic_number: print("You got it!") break elif guess > magic_number: print("Too high!") else: print("Too low!")
magic_number = 3 while True: guess = int(input('Enter a guess: ')) if guess == magic_number: print('You got it!') break elif guess > magic_number: print('Too high!') else: print('Too low!')
# -*- coding: utf-8 -*- """Chart.js script.""" JS_SCRIPT = r''' /*! * Chart.js * http://chartjs.org/ * Version: 2.7.1 * * Copyright 2017 Nick Downie * Released under the MIT license * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md */ !function(t){if("object"==typeof exports&&"undefined"!=typeof modu...
"""Chart.js script.""" js_script = '\n/*!\n * Chart.js\n * http://chartjs.org/\n * Version: 2.7.1\n *\n * Copyright 2017 Nick Downie\n * Released under the MIT license\n * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md\n */\n!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports...
## Shorty ## Copyright 2009 Joshua Roesslein ## See LICENSE ## @url burnurl.com class Burnurl(Service): def _test(self): # all we can test is shrink turl = self.shrink('http://test.com') if turl.startswith('http://burnurl.com'): return True else: return Fals...
class Burnurl(Service): def _test(self): turl = self.shrink('http://test.com') if turl.startswith('http://burnurl.com'): return True else: return False def shrink(self, bigurl): resp = request('http://burnurl.com/', {'url': bigurl, 'output': 'plain'}) ...
def pairs(digits): for i in range(len(digits) - 1): yield digits[i], digits[i+1] yield digits[-1], digits[0] def halfway(digits): half = len(digits) // 2 for i in range(half): yield digits[i], digits[half+i] for i in range(half, len(digits)): yield digits[i], digits[i-hal...
def pairs(digits): for i in range(len(digits) - 1): yield (digits[i], digits[i + 1]) yield (digits[-1], digits[0]) def halfway(digits): half = len(digits) // 2 for i in range(half): yield (digits[i], digits[half + i]) for i in range(half, len(digits)): yield (digits[i], digi...
"""Define objects for CTFlex""" # def eligible(team): # """Determine eligibility of team # # This function is used by CTFlex. # """ # return (team.standing == team.GOOD_STANDING # and team.country == team.US_COUNTRY # and team.background == team.SCHOOL_BACKGROUND)
"""Define objects for CTFlex"""
error_map = { "abecoando": "abencoando", "abigos": "amigos", "abilidade": "habilidade", "abilidades": "habilidades", "abisurdo": "absurdo", "abitual": "habitual", "abrcs": "abracos", "abrou": "abriu", "abss": "abracos", "abussda": "abusada", "abussdo": "abusado", "accept": "aceito", "account":...
error_map = {'abecoando': 'abencoando', 'abigos': 'amigos', 'abilidade': 'habilidade', 'abilidades': 'habilidades', 'abisurdo': 'absurdo', 'abitual': 'habitual', 'abrcs': 'abracos', 'abrou': 'abriu', 'abss': 'abracos', 'abussda': 'abusada', 'abussdo': 'abusado', 'accept': 'aceito', 'account': 'conta', 'acessor': 'asses...
def test_barcamp_add_without_login(client): """test adding a barcamp""" resp = client.post('/b/add', data=dict( name = "Barcamp 1", description = "this is barcamp 1", slug = "barcamp1", size = "10", start_date = "17.8.2012", end_date = "17.9.2012", loca...
def test_barcamp_add_without_login(client): """test adding a barcamp""" resp = client.post('/b/add', data=dict(name='Barcamp 1', description='this is barcamp 1', slug='barcamp1', size='10', start_date='17.8.2012', end_date='17.9.2012', location='Aachen')) assert resp.headers['Location'] == 'http://example.o...
""" Entradas Salario bruto-->float-->salario Salidas Salario nuevo-->float-->sueldo """ #Entrada salario=float(input("Digite el salario bruto: ")) #Caja negra sueldo=0 if(salario<900000): sueldo=salario*0.15+salario#float else: sueldo=salario*0.12+salario#float #Salida print("Su nuevo salario es de:",sueldo)
""" Entradas Salario bruto-->float-->salario Salidas Salario nuevo-->float-->sueldo """ salario = float(input('Digite el salario bruto: ')) sueldo = 0 if salario < 900000: sueldo = salario * 0.15 + salario else: sueldo = salario * 0.12 + salario print('Su nuevo salario es de:', sueldo)
''' There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node. You are given a 2D integer array edges where each edges[i] = [ui, vi] indicates...
""" There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node. You are given a 2D integer array edges where each edges[i] = [ui, vi] indicates...
def Agente_corredor_ex_9(): def __init__(self): self.cur = 1 def invoca(self): pos = 0 if pos == 0: if(self.cur == 0): return "fica parado" if(self.cur > pos and self.cur > 1): self.cur = self.cur - 1 return "andar-" if...
def agente_corredor_ex_9(): def __init__(self): self.cur = 1 def invoca(self): pos = 0 if pos == 0: if self.cur == 0: return 'fica parado' if self.cur > pos and self.cur > 1: self.cur = self.cur - 1 return 'andar-' if ...
[ { "created_at": "Mon Feb 12 03:41:30 +0000 2018", "id": 962894403256901632, "text": "RT @JonAcuff: Dear Olympics commentators, at the beginning of each figure skating couple please let us know if the couple loves each other\u2026", "user.screen_name": "h0llaJess" }, { ...
[{'created_at': 'Mon Feb 12 03:41:30 +0000 2018', 'id': 962894403256901632, 'text': 'RT @JonAcuff: Dear Olympics commentators, at the beginning of each figure skating couple please let us know if the couple loves each other…', 'user.screen_name': 'h0llaJess'}, {'created_at': 'Mon Feb 12 03:41:30 +0000 2018', 'id': 9628...
""" Module: 'micropython' on esp32 1.9.4 """ # MCU: (sysname='esp32', nodename='esp32', release='1.9.4', version='v1.9.4 on 2018-05-11', machine='ESP32 module with ESP32') # Stubber: 1.2.0 def alloc_emergency_exception_buf(): pass def const(): pass def heap_lock(): pass def heap_unlock(): pass def k...
""" Module: 'micropython' on esp32 1.9.4 """ def alloc_emergency_exception_buf(): pass def const(): pass def heap_lock(): pass def heap_unlock(): pass def kbd_intr(): pass def mem_info(): pass def opt_level(): pass def qstr_info(): pass def schedule(): pass def stack_use():...
class BaseMetric(object): name = None def get_name(self): return self.name class ValueMetric(BaseMetric): value = None def get_value(self): return self.value class LineChartMetric(BaseMetric): x = [] y = [] xlabel = 'X Label' ylabel = 'Y Label' def get_values(...
class Basemetric(object): name = None def get_name(self): return self.name class Valuemetric(BaseMetric): value = None def get_value(self): return self.value class Linechartmetric(BaseMetric): x = [] y = [] xlabel = 'X Label' ylabel = 'Y Label' def get_values(sel...
nouns = ['account', 'achiever', 'acoustics', 'act', 'action', 'activity', 'actor', 'addition', 'adjustment', 'advertisement', 'advice', 'aftermath', 'afternoon', 'afterthought', 'agreement', 'air', 'airplane', 'airport', 'alarm', 'amount', 'amusement', 'anger', 'angle', 'animal', 'answer', 'ant', 'ant...
nouns = ['account', 'achiever', 'acoustics', 'act', 'action', 'activity', 'actor', 'addition', 'adjustment', 'advertisement', 'advice', 'aftermath', 'afternoon', 'afterthought', 'agreement', 'air', 'airplane', 'airport', 'alarm', 'amount', 'amusement', 'anger', 'angle', 'animal', 'answer', 'ant', 'ants', 'apparatus', '...
__author__ = 'shukkkur' ''' https://codeforces.com/problemset/problem/580/A ''' n = int(input()) values = list(map(int, input().split())) records = [] count = 1 for i in range(len(values)-1): if values[i] <= values[i+1]: count += 1 else: records.append(count) ...
__author__ = 'shukkkur' '\nhttps://codeforces.com/problemset/problem/580/A\n' n = int(input()) values = list(map(int, input().split())) records = [] count = 1 for i in range(len(values) - 1): if values[i] <= values[i + 1]: count += 1 else: records.append(count) count = 1 records.append(c...
# coding=utf-8 global DEBUG_ON # Turn debug ON/OF (True/False) DEBUG_ON = False global LEVEL_SYSTEM # Settings for leveling system LEVEL_SYSTEM = { '1': {'cap': 0, 'multiplier': 1}, '2': {'cap': 10, 'multiplier': 1}, '3': {'cap': 100, 'multiplier': 2}, '4': {'cap': 500, 'multiplier': 2}, '5': {'cap': 1000, 'mul...
global DEBUG_ON debug_on = False global LEVEL_SYSTEM level_system = {'1': {'cap': 0, 'multiplier': 1}, '2': {'cap': 10, 'multiplier': 1}, '3': {'cap': 100, 'multiplier': 2}, '4': {'cap': 500, 'multiplier': 2}, '5': {'cap': 1000, 'multiplier': 3}, '6': {'cap': 2000, 'multiplier': 3}, '7': {'cap': 5000, 'multiplier': 3},...
def find_loop_size(target): loop_size = 0 c = 1 while True: loop_size += 1 c *= 7 c = c % 20201227 if c == target: return loop_size def transform_loop(public, loop_size): c = 1 for _ in range(loop_size): c *= public c = c % 20201227 re...
def find_loop_size(target): loop_size = 0 c = 1 while True: loop_size += 1 c *= 7 c = c % 20201227 if c == target: return loop_size def transform_loop(public, loop_size): c = 1 for _ in range(loop_size): c *= public c = c % 20201227 re...
# Fiona Nealon, 2018-04-07 # A function called factorial() which takes a single input and returns it's factorial def factorial(upto): # Create a variable that will become the answer multupto = 1 # Loop through numbers i from 1 to upto for i in range(1, upto + 1): # Multiply ans by i, changing ans to that...
def factorial(upto): multupto = 1 for i in range(1, upto + 1): multupto = multupto * i return multupto print('The multiplication of the values from to 1 to 5 inclusive is', factorial(5)) print('The multiplication of the values from to 1 to 7 inclusive is', factorial(7)) print('The multiplication of ...
""" Target Commands """ def retrieve(args): pass def create(args): pass def start(args): pass def stop(args): pass def delete(args): pass
""" Target Commands """ def retrieve(args): pass def create(args): pass def start(args): pass def stop(args): pass def delete(args): pass
''' 348. Design Tic-Tac-Toe Medium 271 21 Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the following rules: A move is guaranteed to be valid and is placed on an empty block. Once a winning condition is reached, no more moves is allowed. A player who succeeds in placin...
""" 348. Design Tic-Tac-Toe Medium 271 21 Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the following rules: A move is guaranteed to be valid and is placed on an empty block. Once a winning condition is reached, no more moves is allowed. A player who succeeds in placin...
EXPECTED = {'Foo': {'extensibility-implied': False, 'imports': {}, 'object-classes': {}, 'object-sets': {}, 'tags': 'AUTOMATIC', 'types': {'A': {'restricted-to': [('min', 'max')], 'type': 'Constants'}, 'B': {'restricted-to': ['unkn...
expected = {'Foo': {'extensibility-implied': False, 'imports': {}, 'object-classes': {}, 'object-sets': {}, 'tags': 'AUTOMATIC', 'types': {'A': {'restricted-to': [('min', 'max')], 'type': 'Constants'}, 'B': {'restricted-to': ['unknown'], 'type': 'Constants'}, 'C': {'restricted-to': [('zero', 'max')], 'type': 'Constants...
# Code on Python 3.7.4 # Working @ Dec, 2020 # david-boo.github.io # Define both number and length (13). Then, just check every substring of length 13 and store and print maximum. num = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545...
num = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629...
class cesarToTxtClass: def __init__(self, cesar, offset=None): self.cesar = cesar.decode("utf-8").upper() self.alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".decode("utf-8") if offset != None: self.offset = offset def processCesarWithOffset(self): decrypted = "" fo...
class Cesartotxtclass: def __init__(self, cesar, offset=None): self.cesar = cesar.decode('utf-8').upper() self.alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.decode('utf-8') if offset != None: self.offset = offset def process_cesar_with_offset(self): decrypted = '' ...
# Topic - Functions: Examples and Exercises # CST1101-OLXX Spr-2021 WK07CL12 Review # by Professor Patrick PaSlattery@CityTech.CUNY.edu ### VOID FUNCTION print("Example of a void function for its side effects") # a simple function which prints whatever argument it receives def print_void(argument): """T...
print('Example of a void function for its side effects') def print_void(argument): """This void function prints the value passed in as an argument""" print('Your value is:', argument) print_this = input('What content should we use as an argument to print_void()? > ') print_void(print_this) print() wait = input...
class queue: def __init__(self): self.main = [] self.max_c = 10 def deque(self): del self.main[-1] def enque(self,val): if len(self.main) == self.max_c: self.deque() self.main.insert(0,val) else: self.main.insert(0,val) def show(self): return self.main def __getitem__(self,index): retu...
class Queue: def __init__(self): self.main = [] self.max_c = 10 def deque(self): del self.main[-1] def enque(self, val): if len(self.main) == self.max_c: self.deque() self.main.insert(0, val) else: self.main.insert(0, val) d...
__author__ = 'Edwin Cowart, Kevin McDonough' # The URL that the Test Cases are received from as HTML TEST_CASES_URL = "http://www.ccs.neu.edu/home/tonyg/cs4500/6.html" GEN_TEST_STR = 'test_*.py' # JSON Directory Names JSON_STREAM_DIR = "json_streams" JSON_SITUATION_DIR = "json_situations" JSON_FEEDING_6_DIR = "json...
__author__ = 'Edwin Cowart, Kevin McDonough' test_cases_url = 'http://www.ccs.neu.edu/home/tonyg/cs4500/6.html' gen_test_str = 'test_*.py' json_stream_dir = 'json_streams' json_situation_dir = 'json_situations' json_feeding_6_dir = 'json_feedings_6' json_feeding_7_dir = 'json_feedings_7' json_feeding_dir = 'json_feedin...
def calcular(a, b): if (a > b): total = a * b elif (a == b): total = a * (b + 2) else: total = a print(total) calcular(10, 10)
def calcular(a, b): if a > b: total = a * b elif a == b: total = a * (b + 2) else: total = a print(total) calcular(10, 10)
def write_moment1_hybrid( cube, rms=None, channel_correlation=None, outfile=None, errorfile=None, overwrite=True, unit=None, return_products=True, strict_vfield=None, broad_vfield=None, broad_signal=None, vfield_prior=None, vfield_prior_res=None, ...
def write_moment1_hybrid(cube, rms=None, channel_correlation=None, outfile=None, errorfile=None, overwrite=True, unit=None, return_products=True, strict_vfield=None, broad_vfield=None, broad_signal=None, vfield_prior=None, vfield_prior_res=None, vfield_reject_thresh='30km/s', mom0_thresh_for_mom1=2.0, context=None): ...
class Ray: def __init__(self, origin, direction): self.origin = origin self.direction = direction.normalize()
class Ray: def __init__(self, origin, direction): self.origin = origin self.direction = direction.normalize()
board = [[7,8,0,4,0,0,1,2,0], [6,0,0,0,7,5,0,0,9], [0,0,0,6,0,1,0,7,8], [0,0,7,0,4,0,2,6,0], [0,0,1,0,5,0,9,3,0], [9,0,4,0,6,0,0,0,5], [0,7,0,3,0,0,0,1,2], [1,2,0,0,0,7,4,0,0], [0,4,9,2,0,6,0,0,7]] def solve(): if (checkBoar...
board = [[7, 8, 0, 4, 0, 0, 1, 2, 0], [6, 0, 0, 0, 7, 5, 0, 0, 9], [0, 0, 0, 6, 0, 1, 0, 7, 8], [0, 0, 7, 0, 4, 0, 2, 6, 0], [0, 0, 1, 0, 5, 0, 9, 3, 0], [9, 0, 4, 0, 6, 0, 0, 0, 5], [0, 7, 0, 3, 0, 0, 0, 1, 2], [1, 2, 0, 0, 0, 7, 4, 0, 0], [0, 4, 9, 2, 0, 6, 0, 0, 7]] def solve(): if check_board(): return...
def main() -> None: N = int(input()) assert 2 <= N <= 100 graph = [[] for _ in range(N)] for _ in range(N - 1): u, v = map(int, input().split()) assert 1 <= u <= N assert 1 <= v <= N assert u != v u -= 1 v -= 1 graph[u].append(v) graph...
def main() -> None: n = int(input()) assert 2 <= N <= 100 graph = [[] for _ in range(N)] for _ in range(N - 1): (u, v) = map(int, input().split()) assert 1 <= u <= N assert 1 <= v <= N assert u != v u -= 1 v -= 1 graph[u].append(v) graph[v]...
#!/usr/bin/env python3 """ This script is used for course notes. Author: Erick Marin Date: 12/19/2020 """ data = input("This will come from STDIN: ") print("Now we write it to STDOUT: " + data) # Generating a standard error (type) by concatenating a string with an integer print("Now we generate an error to STDERR: "...
""" This script is used for course notes. Author: Erick Marin Date: 12/19/2020 """ data = input('This will come from STDIN: ') print('Now we write it to STDOUT: ' + data) print('Now we generate an error to STDERR: ' + data + 1)
class FontSizeConverter(TypeConverter): """ Converts font size values to and from other type representations. FontSizeConverter() """ def CanConvertFrom(self,*__args): """ CanConvertFrom(self: FontSizeConverter,context: ITypeDescriptorContext,sourceType: Type) -> bool Determines if conver...
class Fontsizeconverter(TypeConverter): """ Converts font size values to and from other type representations. FontSizeConverter() """ def can_convert_from(self, *__args): """ CanConvertFrom(self: FontSizeConverter,context: ITypeDescriptorContext,sourceType: Type) -> bool Determines if ...
""" Statistical models - standard `regression` models - `GLS` (generalized least squares regression) - `OLS` (ordinary least square regression) - `WLS` (weighted least square regression) - `GLASAR` (GLS with autoregressive errors model) - `GLM` (generalized linear models) - robust statistical models - ...
""" Statistical models - standard `regression` models - `GLS` (generalized least squares regression) - `OLS` (ordinary least square regression) - `WLS` (weighted least square regression) - `GLASAR` (GLS with autoregressive errors model) - `GLM` (generalized linear models) - robust statistical models - ...
# Merge Sort def merge(left, right): result = [] i = j = 0 while i < len(left) and j < len(right): if left[i] < right[j]: result.append(left[i]) i += 1 else: result.append(right[j]) j += 1 result += left[i:] def mergeSort(arr): if len...
def merge(left, right): result = [] i = j = 0 while i < len(left) and j < len(right): if left[i] < right[j]: result.append(left[i]) i += 1 else: result.append(right[j]) j += 1 result += left[i:] def merge_sort(arr): if len(arr) <= 1: ...
# -*- coding: utf-8 -*- """Top-level package for pfr_api.""" __author__ = """Alex Adamson""" __email__ = 'alex.b.adamson@gmail.com' __version__ = '0.1.0'
"""Top-level package for pfr_api.""" __author__ = 'Alex Adamson' __email__ = 'alex.b.adamson@gmail.com' __version__ = '0.1.0'
# Chess Dictionary Validator Practice Project # Chapter 5 - Dictionary and Structuing Data (Automate the Boring Stuff with Python) # Developer: Valeriy B. def chess_dictionary_validator(inp): # Creating a blank chess dictionary chess_dictionary = dict() # Creating a chess board chess_board = list...
def chess_dictionary_validator(inp): chess_dictionary = dict() chess_board = list() for number in range(1, 9): for character in range(97, 105): chess_board.append(chr(character) + str(number)) chess_dictionary['chess_board'] = chess_board chess_pieces = ['king', 'queen', 'rook', ...
begin_unit comment|'# Copyright (c) 2011 Citrix Systems, Inc.' nl|'\n' comment|'#' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at'...
begin_unit comment | '# Copyright (c) 2011 Citrix Systems, Inc.' nl | '\n' comment | '#' nl | '\n' comment | '# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl | '\n' comment | '# not use this file except in compliance with the License. You may obtain' nl | '\n' comment | '# a copy ...
# https://leetcode.com/problems/arithmetic-slices/ class Solution: def numberOfArithmeticSlices(self, nums: list[int]) -> int: arithmetic_slices = 0 if len(nums) <= 2: return arithmetic_slices last_diff = nums[1] - nums[0] last_increment = 0 for idx in range(2, l...
class Solution: def number_of_arithmetic_slices(self, nums: list[int]) -> int: arithmetic_slices = 0 if len(nums) <= 2: return arithmetic_slices last_diff = nums[1] - nums[0] last_increment = 0 for idx in range(2, len(nums)): curr_diff = nums[idx] - n...
n,m=map(int,input().split());r=0 while n>0: r+=n;n//=m print(r)
(n, m) = map(int, input().split()) r = 0 while n > 0: r += n n //= m print(r)
def main(ws, clients): print("The number of clients is: {}".format(len(clients))) count = 0 while not ws.closed and count < 5: message = ws.receive() ws.send(message) count += 1 ws.close()
def main(ws, clients): print('The number of clients is: {}'.format(len(clients))) count = 0 while not ws.closed and count < 5: message = ws.receive() ws.send(message) count += 1 ws.close()
#!/usr/bin/env python def getpi(listb): lista=[] listcc=[] for i in listb: temp=i/180*3.14 lista.append((temp,i)) listcc.append(temp) return lista def getangle(listb): lista=[] for i in listb: temp=i/3.14*180 lista.append((i,temp)) return lista def get...
def getpi(listb): lista = [] listcc = [] for i in listb: temp = i / 180 * 3.14 lista.append((temp, i)) listcc.append(temp) return lista def getangle(listb): lista = [] for i in listb: temp = i / 3.14 * 180 lista.append((i, temp)) return lista def get...
class EthJsonRpcError(Exception): pass class ConnectionError(EthJsonRpcError): pass class BadStatusCodeError(EthJsonRpcError): pass class BadJsonError(EthJsonRpcError): pass class BadResponseError(EthJsonRpcError): pass
class Ethjsonrpcerror(Exception): pass class Connectionerror(EthJsonRpcError): pass class Badstatuscodeerror(EthJsonRpcError): pass class Badjsonerror(EthJsonRpcError): pass class Badresponseerror(EthJsonRpcError): pass
class ActionEnum(enumerate): """ Enum for action space """ BUY = 1 SELL = -1 HOLD = 0 EXIT = 3 def form_action(action): """ Form action from action space """ r = 0.0 if action <= -0.5: r =-(action + 0.5) * 2 return ActionEnum.SELL, r, "SELL" elif acti...
class Actionenum(enumerate): """ Enum for action space """ buy = 1 sell = -1 hold = 0 exit = 3 def form_action(action): """ Form action from action space """ r = 0.0 if action <= -0.5: r = -(action + 0.5) * 2 return (ActionEnum.SELL, r, 'SELL') elif a...
doc=""" #Enrich Quality baseq-SNV qc_enrich ./bam ./bedfile ./out #Alignment baseq-SNV run_bwa -1 Read1M.P457.1.fq.gz -2 Read1M.P457.2.fq.gz -g hg38 -n Test -o Test.bam -t 10 #MarkDuplicate baseq-SNV run_markdup -b Test.bam -m Test.marked.bam #bqsr baseq-SNV run_bqsr -m Test.marked.bam -g hg38 -q Test.marked.bqsr.ba...
doc = '\n#Enrich Quality\nbaseq-SNV qc_enrich ./bam ./bedfile ./out\n\n#Alignment\nbaseq-SNV run_bwa -1 Read1M.P457.1.fq.gz -2 Read1M.P457.2.fq.gz -g hg38 -n Test -o Test.bam -t 10\n\n#MarkDuplicate\nbaseq-SNV run_markdup -b Test.bam -m Test.marked.bam\n\n#bqsr\nbaseq-SNV run_bqsr -m Test.marked.bam -g hg38 -q Test.mar...
# http://norvig.com/mayzner.html character_frequencies = { 'a': 8.04, 'c': 3.34, 'b': 1.48, 'e': 12.49, 'd': 3.82, 'g': 1.87, 'f': 2.40, 'i': 7.57, 'h': 5.05, 'k': 0.54, 'j': 0.16, 'm': 2.51, 'l': 4.07, 'o': 7.64, 'n': 7.23, 'q': 0.12, 'p': 2.14, ...
character_frequencies = {'a': 8.04, 'c': 3.34, 'b': 1.48, 'e': 12.49, 'd': 3.82, 'g': 1.87, 'f': 2.4, 'i': 7.57, 'h': 5.05, 'k': 0.54, 'j': 0.16, 'm': 2.51, 'l': 4.07, 'o': 7.64, 'n': 7.23, 'q': 0.12, 'p': 2.14, 's': 6.51, 'r': 6.28, 'u': 2.73, 't': 9.28, 'w': 1.68, 'v': 1.05, 'y': 1.66, 'x': 0.23, 'z': 0.09, ' ': 19.1...
# type this to run tests # 'python -m nose FILENAME -v' # 'nosetests FILENAME -v' def test_case01(): assert 'aaa'.upper() == 'AAA'
def test_case01(): assert 'aaa'.upper() == 'AAA'
""" Metroclima database CLI tool Project information """ __title__ = 'metroclima' __description__ = 'A simple Python tool to retrieve information from ' \ 'the Porto Alegre city\'s Metroclima database.' __url__ = 'https://github.com/jonathadv/metroclima-dump' __version__ = '1.0.0' __author__ = 'Jona...
""" Metroclima database CLI tool Project information """ __title__ = 'metroclima' __description__ = "A simple Python tool to retrieve information from the Porto Alegre city's Metroclima database." __url__ = 'https://github.com/jonathadv/metroclima-dump' __version__ = '1.0.0' __author__ = 'Jonatha Daguerre Vasconcelos'...
# https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ # # algorithms # Easy (48.15%) # Total Accepted: 222,749 # Total Submissions: 462,569 # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # se...
class Solution(object): def sorted_array_to_bst(self, nums): """ :type nums: List[int] :rtype: TreeNode """ length = len(nums) if length == 0: return None if length == 1: return tree_node(nums[0]) middle = length / 2 no...