content
stringlengths
7
1.05M
#!/usr/bin/python3 ############## # Load input # ############## rules = dict() with open("input.txt", "r") as f: initial_state = f.readline().strip().split(" ")[2] f.readline() for line in f.readlines(): rules[line.split(" => ")[0]] = line.strip().split(" => ")[1] ############## # Solution 1 # ##...
a = int(input("Please enter the first number: ")) b = int(input("Please enter the second number: ")) count = 0 for i in range(a, b + 1): if i % 2 == 0: count += i print(count)
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: domainbounds.py # # Tests: libsim - connecting to simulation and retrieving data from it. # mesh - 3D rectilinear mesh # # Programmer: Kathleen Biagas # Date: June 17, 2014 #...
__author__ = 'Devon Evans dle4qw' def main(): greeting('hello') def greeting(msg): print(msg) if __name__=='__main__': main()
""" Module: 'uasyncio.core' on esp8266 v1.9.4 """ # MCU: (sysname='esp8266', nodename='esp8266', release='2.2.0-dev(9422289)', version='v1.9.4-8-ga9a3caad0 on 2018-05-11', machine='ESP module with ESP8266') # Stubber: 1.1.2 class CancelledError: '' DEBUG = 0 class EventLoop: '' def call_at_(): pas...
## emails ## from_email = "" to_email = "" smtp = ""
class Item: ''' Component defines entity as an item ''' def __init__(self, use_function=None, targeting=False, targeting_message=None, **kwargs): self.use_function = use_function self.targeting = targeting self.targeting_message = targeting_message self.function_kwargs = ...
class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. n=4:0,0->0,3;1,0->0,2;3,0->0,0;0,1->1,3;2,2->2,1;3,2->2,0; n:[i,j]->[j,n+1-i];[j,n+1-i]->[n+1-i,n+1-j];[n+1-i,n+1-j]->[n+1-...
# # # "3 is not equal to 5". # Save the above proposition in ans1 using the # # == or != operator. # # ans1 = None # # # "21 is a number greater than 5*10." # Save the above proposition in ans2 using # # # or < operator. # # ans2 = None # # # "5/3 share is greater than or equal to 1". # Save the above proposition in...
""" SeleniumBase constants are stored in this file. """ class Environment: # Usage Example => "--env=qa" => Then access value in tests with "self.env" QA = "qa" STAGING = "staging" DEVELOP = "develop" PRODUCTION = "production" MASTER = "master" LOCAL = "local" TEST = "test" class Fil...
#Configuration details of user uname = "Guru HariHaraun" email = "guru@gmail.com" district_id = 560 # The 506 is the district code for trichy. vaccine_type = "COVAXIN" # Either user COVISHIED or COVAXIN All should be in UPPERCASE fee_type ="Free" # The fee type should be Paid or Free All should be in UPPERCASE a...
gitignore = """ # Dolphin .directory # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usuall...
# 7из49 + Выигрышные номера последних 4 тиражей def test_7x49_winning_numbers_last_4_draws(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_game_7x49() app.ResultAndPrizes.click_winning_numbers_of_the_last_4_draws() app.ResultAndPrizes.button_get_report_winners() ...
# A P I - K E Y S # --------------- keys = ['XXXX'] # S F T P - S E R V E R # --------------------- hostname = 'XXXX' username = 'XXXX' password = 'XXXX' path = 'XXXX' # P O R T - C O D E #------------------ port_num = 'XXXX'
# # Copyright (c) 2013-2018 Quarkslab. # This file is part of IRMA project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License in the top-level directory # of this distribution and at: # # http:...
''' Author: Justin Muirhead ''' room = 0 rooms = [ 'Hall', 'Hall2', 'Courtyard', 'Hall3', 'Kitchen', 'Hall4', 'Hall5', 'Bedroom', 'CheeseRoom' ] desc = [ 'Hall with carpet', 'Hall with paintings', 'Courtyard with paving stones', 'Hallway with plants', 'Kitchen has old moldy food', 'Hallway has ra...
def fqname_for(cls: type) -> str: """ Returns the fully qualified name of ``cls``. Parameters ---------- cls The class we are interested in. Returns ------- str The fully qualified name of ``cls``. """ return f"{cls.__module__}.{cls.__qualname__}"
def main(): n = int(input()) *s, = map(int, input().split()) *t, = map(int, input().split()) inf = 1 << 60 for i in range(2 * n): i %= n j = (i + 1) % n t[j] = min( t[j], t[i] + s[i], ) print(*t, sep='\n') main()
inp = int(input()) sum = 0 for i in range(1, inp + 1): sum += i print(sum)
#!/usr/bin/env python3 if __name__ == '__main__': mark_1 = int(input('Enter the first number: ')) mark_2 = int(input('Enter the second number: ')) mark_3 = int(input('Enter the third number: ')) mark_4 = int(input('Enter the fourth number: ')) mark_5 = int(input('Enter the fifth number: ')) ...
def sieve_of_sundaram(n): res = [] if n > 2: res.append(2) n = int((n - 1) / 2) table = [0] * (n + 1) for i in range(1, n + 1): j = i while (i + j + 2 * i * j) <= n: table[i + j + 2 * i * j] = 1 j += 1 for i in range(1, n + 1): if tabl...
class FastLRUCache(object): __slots__ = ['__key2value', '__max_size', '__weights'] def __init__(self, max_size: int): self.__max_size = max_size self.__key2value = {} # key->value self.__weights = [] # keys ordered in LRU def __update_weight(self, key): try: s...
weight = int(input("enter your weight ---> " )) unit = input("(L)bs or (K)g ---> ") if unit.upper() == "K": weight_lbs = weight / 0.45 print("your weight in lbs is --->", weight_lbs) elif unit.upper() == "L": weight_kg = weight * 0.45 print("your weight in kg is --->", weight_kg)
#!/usr/bin/env python3 class ExtraComputationWarning(UserWarning): """ Warning thrown when a GP model does extra computation that it is not designed to do. This is mostly designed for :obj:`~gpytorch.variational.UnwhitenedVariationalStrategy`, which should cache most of its solves up front. """ ...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None """ Slicing an array is expensive. It's better to pass bounds of array into recursive calls! """ class Solution: def sortedArrayToBST(self, nums): """ ...
while True: correto = True try: expressao = input() parenteses_aberto = [] for e in expressao: if e == '(': parenteses_aberto.append(e) if e == ')': if len(parenteses_aberto) > 0: parenteses_aberto.pop() else: ...
""" Copyright (c) 2020 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writin...
# Fibannci-ser def recur_fibo(n): if n <= 1: return n else: return(recur_fibo(n-1) + recur_fibo(n-2)) nterms = int(input("How many terms? ")) if nterms <= 0: print("Plese enter a positive integer") else: print("Fibonacci sequence:") for i in range(nterms): pr...
""" 里氏替换原则 父类出现的地方子类一定能够出现 """ class Database: def connect(self): pass def close_connect(self): pass def execute(self): pass def command(self): pass def insert(self, **kwargs): pass def select(self, username: str): pass def upda...
# Marcelo Campos de Medeiros # ADS UNIFIP # REVISÃO DE PYTHON # AULA 14 LAÇO DE REPETIÇÃO WHILE ---> GUSTAVO GUANABARA ''' Faça um Programa que leia o sexo de uma pessoas, mas só aceite os valores "M" ou "F". caso esteja errado peça a digitação novamente até ter um valor correto. ''' print('='*30) print('{:*^30}'.form...
# management canister interface `aaaaa-aa` # wrap basic interfaces provided by the management canister: # create_canister, install_code, canister_status, etc. class Management: pass
''' XMODEM Protocol bytes ===================== .. data:: SOH Indicates a packet length of 128 (X/Y) .. data:: STX Indicates a packet length of 1024 (X/Y) .. data:: EOT End of transmission (X/Y) .. data:: ACK Acknowledgement (X/Y) .. data:: XON Enable out of band flow control (Z) .. data:: XOF...
km = float(input('Qual a distância da viagem? ')) print('Você está prestes a começar uma viagem de {}Km.') if km < 200: print('Você deverá pagar R${}'.format(km * 0.5)) else: print('Você deverá pagar R${}'.format(km * 0.45))
def countingSort(arr): n = len(arr) max_of_arr = max(arr) count = [0 for i in range(max_of_arr+1)] for i in arr: count[i] += 1 ind = 0 for i in range(max_of_arr+1): c = count[i] while c: arr[ind] = i ind += 1 c -= 1 return arr n = ...
class VendoringError(Exception): """Errors originating from this package.""" class ConfigurationError(VendoringError): """Errors related to configuration handling.""" class RequirementsError(VendoringError): """Errors related to requirements.txt handling."""
# data config trainroot = '/data2/dataset/ICD15/train' testroot = '/data2/dataset/ICD15/test' output_dir = 'output/east_icd15' data_shape = 512 # train config gpu_id = '2' workers = 12 start_epoch = 0 epochs = 600 lr = 0.0001 lr_decay_step = 10000 lr_gamma = 0.94 train_batch_size_per_gpu = 14 i...
n1 = float(input('Digite o primeiro valor: ')) n2 = float(input('Digite o segundo valor: ')) opcao = 0 while opcao != 5: print(''' [1] Somar [2] Multiplicar [3] Maior [4] Novos números [5] Sair do programa''') opcao = int(input('Digite a opção desejada: ')) if opcao == 1: soma ...
""" Module: motiv.version Description: contains constants defining the package version Note: - In case of a bugfix/hotfix increment BUILD_NUMBER - In case of adding a feature that modifies the package, but does not break interfaces, increment VERSION_MINOR - In case of introducing a change...
"""Defines current AXT versions and dependencies. Ensure UsageTrackerRegistry is updated accordingly when incrementing version numbers. """ # AXT versions RUNNER_VERSION = "1.4.1-alpha03" # stable 1.4.0 RULES_VERSION = "1.4.1-alpha03" # stable 1.4.0 MONITOR_VERSION = "1.5.0-rc01" # stable 1.4.0 ESPRESSO_VERSION = ...
SERVER_HOST_1 = "127.0.0.1" SERVER_PORT_1 = 2779 SERVER_HOST_2 = "127.0.0.1" SERVER_PORT_2 = 2775
class Texture(object): def __init__(self): self.file_path = None self.file = None self.data = None def read(self, files): for file_path in files: self.file_path = file_path self.file = open(self.file_path, "rb") self.data = self.file.read() ...
class Flight: counter = 1 def __init__(self, origin, destination, duration): # Keep track of id number self.id = Flight.counter Flight.counter += 1 # Keep track of passengers self.passengers = [] # Details about flight self.origin = origin sel...
# Super Hero class Hero: def __init__(self, gender, age): self.gender = gender self.age = age self.poderes = [""] self.debilidad = [""] def __str__(self): return f'Mi Super Heroe es {self.gender} y tiene {self.age} años de edad con los siguientes poderes: {"".join(self.p...
### Model Architecture hyper parameters embedding_size = 32 # sequence_length = 500 sequence_length = 33 LSTM_units = 128 ### Training parameters batch_size = 64 epochs = 20 ### Preprocessing parameters # words that occur less than n times to be deleted from dataset N = 10 # test size in ratio, train...
result = 0 def solution(numbers, target): findNum(numbers, 0, 0, target) return result def findNum(numbers, index, acc, target): global result if len(numbers) == index: if acc == target: result += 1 return num = numbers[index] findNum(numbers, index + 1, acc - num, target) findNum(n...
soma = 0 quant = 0 while True: num = int(input('Digite um número: ')) if num == 999: break quant = quant + 1 soma = soma + num print(f'Você digitou {quant} números e a soma entre eles foi {soma}.')
def find_the_secret(f): for x in f.__code__.co_consts: if isinstance(x,str) and len(x) == 32: return x return ''
def swap(arr,i,j): arr[i],arr[j] = arr[j],arr[i] def partition(arr,l,r): pivot = arr[r] i = l-1 j = l for j in range(l,r): if arr[j] < pivot: i+=1 swap(arr,i,j) i+=1 swap(arr,i,r) return i def quickSort(arr,l,r): if l<r : newIndex = partition(arr,l,r) quickSort(arr,newIndex+1,r) quickSort(arr...
# app config APP_CONFIG=dict( SECRET_KEY="SECRET", WTF_CSRF_SECRET_KEY="SECRET", # Webservice config WS_URL="http://localhost:5057", # ws del modello in locale DATASET_REQ = "/dataset", OPERATIVE_CENTERS_REQ = "/operative-centers", OC_DATE_REQ = "/oc-date", OC_DATA_REQ = "/oc-data", PREDIC...
class Solution: def bestTeamScore(self, scores: List[int], ages: List[int]) -> int: """ TLE at the 132/148 test cases """ age_score = [(age, score) for age, score in zip(ages, scores)] age_score.sort(key = lambda x: x) age_score.append((0, 0)) # an artificial p...
def sum(num1, num2): """ This function takes the sum of two numbers. Paramaters ---------- num1, float A number. num2, float A number. """ return num1 + num2 def product(num1, num2): """ This function takes the product of two numbers. """ return num1 * num2
__all__ = ['__version__'] # major, minor, patch version_info = 1, 4, 0 # suffix suffix = None # version string __version__ = '.'.join(map(str, version_info)) + (f'.{suffix}' if suffix else '')
#percorrendo itens do dicionario com for dicionario = {'chave1':'valor1','chave2':'valor2','chave3':3} for a,b in dicionario.items(): print(a,b)
# Data sources database( thermoLibraries = ['primaryThermoLibrary'], reactionLibraries = [], seedMechanisms = [], kineticsDepositories = ['training'], kineticsFamilies = 'default', kineticsEstimator = 'rate rules', ) # List of species species( label='ethane', reactive=True, structur...
#BEGIN_HEADER #END_HEADER class pranjan77ContigFilter: ''' Module Name: pranjan77ContigFilter Module Description: A KBase module: pranjan77ContigFilter ''' ######## WARNING FOR GEVENT USERS ####### # Since asynchronous IO can lead to methods - even the same method - # interruptin...
# The sum of the squares of the first ten natural numbers is, # 1^2 + 2^2 + ... + 10^2 = 385 # The square of the sum of the first ten natural numbers is, # (1 + 2 + ... + 10)^2 = 55^2 = 3025 # Hence the difference between the sum of the squares of the first ten natural # numbers and the square of the sum is 3025 − 385...
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyPandas(PythonPackage): """pandas is a fast, powerful, flexible and easy to use open source data analysis ...
""" Module with useful utilities. """ def escape_double_quotes(name): escaped_name = name.replace('"', '""') quoted_name = f'"{escaped_name}"' return quoted_name
a = float( input('give a number: ') ) b = float( input('give a number: ') ) print(a, '+', b, '=', a+b) print(a, '-', b, '=', a-b) print(a, '*', b, '=', a*b) print(a, '/', b, '=', a/b)
class Menu: """ ## Steak N' Shake helpers with OOP This is a subset of Steak N' Shake menu that covers a. Burgers b. Chili Intallation: pip install -i https://test.pypi.org/simple/ Order Imports: from helper.menu import Burger, Chili, Menu Menu Methods: a...
# These are all the settings that are specific to a jurisdiction ############################### # These settings are required # ############################### OCD_JURISDICTION_ID = 'ocd-jurisdiction/country:us/state:il/place:chicago/government' OCD_CITY_COUNCIL_ID = 'ocd-organization/ef168607-9135-4177-ad8e-c1f7a48...
"""***************************************************************************** * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
{ "targets": [ { "target_name": "cld-c", "type": "static_library", "include_dirs": [ "internal", ], "sources": [ "internal/cldutil.cc", "internal/cldutil_shared.cc", "internal/compact_lang_det.cc", "internal/compact_lang_det_hint_code.cc", ...
#MousePressed def setup(): size(240, 120) strokeWeight(30) def draw(): background(204) stroke(102) line(40, 0, 70, height) if mousePressed == True: # outra opção seria 'if mousePressed:', ou seja, a comparação não é obrigatória stroke(0) else: stroke(255) line(0, 7...
def handle(event, context): # This lambda function will be triggered by a CloudWatch cron-job. # Collect a list of BD phone numbers and the recipient name # from some file located in an s3 and store in `recipient` variable. # You can collect phone numbers from your google contacts. # Now, validate...
print('---------- If Condition ----------') a = 1 if a > 0: print('A is a positive number') print('---------- If Else ----------') a = -1 if a > 0: print('A is a positive number') else: print('A is a negative number') print('---------- If Elif Else ----------') a = 0 if a > 0: print('A is a positive n...
load( "@bazel_toolchains//rules:docker_config.bzl", "docker_toolchain_autoconfig", ) def _tensorflow_rbe_config(name, compiler, python_version, cuda_version = None, cudnn_version = None, tensorrt_version = None): base = "@ubuntu16.04//image" config_repos = [ "local_config_python", "loca...
# # PySNMP MIB module Unisphere-Data-COPS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-COPS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:23:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
def run(proj,OG): n1 = int(proj.parameters['n1']) OG.add("base","o") for i in range(n1): OG.add("level1",str(i),{},OG["base"]) OG.add("level2","o", {}, OG["base"] + OG["level1"])
if __name__ == '__main__': n = int(input()) arr = list(map(int, input().rstrip().split())) arr.reverse() for i in arr: print(i, end= " ")
# -*- coding: utf-8 -*- # Authors: Y. Jia <ytjia.zju@gmail.com> """ Given preorder and inorder traversal of a tree, construct the binary tree. https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/ """ # Definition for a binary tree node. class TreeNode(object): de...
class map_config: width=500 height=500 obstacle=[ {"shape":"rectangle","center":(60,70),"width":30,"height":40}, {"shape":"rectangle","center":(350,370),"width":20,"height":50}, {"shape":"circle","center":(250,250),"radius":50}, {"shape":"circle","center":(50,150),"radius":30...
# Basic Sekeleton of Plan - Storing - At Particular Date - City where Tourist is supposed to be # And storing travelling period(starting and ending time of travel) on that day class SkeletonEvent: def __init__(self, planid, date, city, startingTime, endingTime, stayingHotel) -> None: self.planid = planid ...
stock_dict = { 'GE': 'General Electric', 'CAT': 'Caterpillar', 'GM': 'General Motors' } purchases = [ ( 'GE', 100, '10-sep-2001', 48 ), ( 'CAT', 100, '1-apr-1999', 24 ), ( 'GM', 200, '1-jul-1998', 56 ), ( 'GM', 150, '3-jul-1998', 47 )...
N, M, *C = map(int, open(0).read().split()) C.sort() for i in range(N): M -= C[i] if M <= 0: break if M >= 0: print(i + 1) elif M < 0: print(i)
"""Lab 2: Lambda Expressions and Higher Order Functions""" # Lambda Functions def lambda_curry2(func): """ Returns a Curried version of a two-argument function FUNC. >>> from operator import add >>> curried_add = lambda_curry2(add) >>> add_three = curried_add(3) >>> add_three(5) 8 """ ...
"""HTML character entity references.""" __all__ = ['html5', 'name2codepoint', 'codepoint2name', 'entitydefs'] name2codepoint = {'AElig': 198, 'Aacute': 193, 'Acirc': 194, 'Agrave': 192, 'Alpha': 913, 'Aring': 197, 'Atilde': 195, 'Auml': 196, 'Beta': 914, 'Ccedil': 199, 'Chi': 935, 'Dagger': 8225, 'Delta': 916, ...
lista, ent = [], float(input()) # Cria a lista e pede oi número inicial for x in range(100): lista.append('{:.4f}'.format(ent)) # Add o número na lista print("N[{}] = {}" .format(x, lista[x])) # Mostra a posição e o valor ent /= 2 # Devide pela...
# # PySNMP MIB module ESI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ESI-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:06:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)...
SEED1_DUNGEON = [ ' ', ' ', ' ', ' ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Given a source tree and a matching RPM spec file, runs `rpmbuild` inside the given image layer, and outputs a new layer with the resulting...
# TODO: Migrate templates to files TEMPLATE__INIT__ = """ \""" Django Environments {VERSION} \""" from .common import * try: from .__habitat__ import * print("Using %s environment" % ENVIRONMENT_NAME) if len(ENVIRONMENT_VERSION_CODE) > 0: VERSION += "." + ENVIRONMENT_VERSION_CODE except ImportErro...
#!/usr/bin/python # -*- coding: utf-8 -*- gn = "http://www.geonames.org/ontology#" stb_base = 'https://enrich.acdh.oeaw.ac.at/entityhub/site/' URL_geonames = stb_base + "geoNames_%s/query" wgs84_pos = "http://www.w3.org/2003/01/geo/wgs84_pos#" gnd_geo = "http://www.opengis.net/ont/geosparql#" stb_find = stb_base + u'{...
''' If an element in an MxN matrix is 0, set the entire row and column to 0 ''' def setZero(mat): m = len(mat) n = len(mat[0]) zero_rows = [] zero_cols = [] for i in range(m): for j in range(n): if mat[i][j] == 0 and i not in zero_rows and j not in zero_cols: mat...
class CachePolicy(basestring): """ Cache Policy Name """ @staticmethod def get_api_name(): return "cache-policy"
""" https://leetcode.com/problems/validate-binary-search-tree/ Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys grea...
class Badge: def __init__(self,scale=1): self.scale=scale def gen_badge(self): return { "novice" : f""" <g xmlns="http://www.w3.org/2000/svg" transform="translate({str(345*self.scale)},15),scale(0.5)"> <path id="Selection_novice" fill="#52cd95" stroke="none" stroke-widt...
# # PySNMP MIB module ALTIGA-GLOBAL-REG (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-GLOBAL-REG # Produced by pysmi-0.3.4 at Mon Apr 29 17:05:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
''' Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number. Example: create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]]) # => returns "(123) 456-7890" The returned format must be correct in order to com...
# -*- coding: utf-8 -*- class Modifier(object): def __init__(self): self.is_disable = False self.is_show_only = False self.is_debug = False self.is_transparent = False def turn_on_disable(self): self.is_disable = True def turn_off_disable(self): self.is_d...
# -*- coding: utf-8 -*- """ Editor: Zhao Xinlu School: BUPT Date: 2018-04-01 算法思想:中序序列与后序序列重构二叉树--递归 """ # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def buildTree(self, inorde...
# import libraries here ... # Stickbreak function def stickbreak(v): batch_ndims = len(v.shape) - 1 cumprod_one_minus_v = tf.math.cumprod(1 - v, axis=-1) one_v = tf.pad(v, [[0, 0]] * batch_ndims + [[0, 1]], "CONSTANT", constant_values=1) c_one = tf.pad(cumprod_one_minus_v, [[0, 0]] *...
def build_uri(asset_uri, site_uri): asset_uri = asset_uri.strip("..") if asset_uri.startswith("http"): return asset_uri separator = "" if not asset_uri.startswith("/"): separator = "/" return "%s%s%s" % (site_uri, separator, asset_uri) def join_uri(site_uri, file_path): return ...
# rotate a list N places to the left def rotate(n, l): return l[n:] + l[0:n] def test_rotate(): l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'] expected = ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'a', 'b', 'c'] assert rotate(3,l) == expected expected = ['j', 'k', 'a', 'b', ...
# Puzzle Input ---------- with open('Day04-Input.txt', 'r') as file: puzzle = file.read().split('\n\n') with open('Day04-Test01.txt', 'r') as file: test01 = file.read().split('\n\n') # Main Code ---------- # Convert the board string into a list def process_board(raw_board): new_board = [] for row in...
print("Hi, are you having trouble making a password?") print("let me help you!") number = input("give me a number from 1-3") password = number animal = input("do you prefer dogs or cats?") password = number + animal color=input("what is your favorite color?") password = color+number+animal book=input("ok, last question...
# settings.py # sdNum = subdomain number # p1 = spatial bandwidth # p2 = temporal bandwidth # p3 = spatial resolution # p4 = temporal resolution # p5 = number of points threshold (T1) # p6 = buffer ratio threshold (T2) # dir1 = point files (resulting from decomposition) # dir2 = time files (resulting from de...
# -*- coding: utf-8 -*- """ pip_services_runtime.State ~~~~~~~~~~~~~~~~~~~~~~~~~~ Component state enumeration :copyright: Digital Living Software Corp. 2015-2016, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ class State(object): """ State in lifec...
class AutoTrackConfig: hog_cell_size=4 hog_n_dim=31 gray_cell_size=4 cn_use_for_gray=False cn_cell_size=4 cn_n_dim=10 search_area_shape = 'square' # the shape of the samples search_area_scale = 5.0 # the scaling of the target size to get the search area ...
# # PySNMP MIB module TPLINK-DHCPSERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-DHCPSERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:17:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...