content
stringlengths
7
1.05M
include("common.py") damnScission = [ ruleGMLString("""rule [ ruleID "DAMN Scission" left [ edge [ source 0 target 10 label "=" ] edge [ source 10 target 13 label "-" ] edge [ source 13 target 14 label "-" ] edge [ source 13 target 15 label "-" ] ] context [ # DAMN node [ id 0 label "C" ] edge [ s...
# Doris Zdravkovic, March, 2019 # Solution to problem 5. # python primes.py # Input of a positive integer n = int(input("Please enter a positive integer: ")) # Prime number is always greater than 1 # Reference: https://docs.python.org/3/tutorial/controlflow.html # If entered number is greater than 1, for every numbe...
#!/usr/bin/python ''' This file is part of SNC Copyright (c) 2014-2021, Richard Barnett Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitati...
'''Crie um programa que leia o nome de uma cidade diga se ela começa ou não com o nome “SANTO''' #Minha resolução entendi = input('''Aqui vamos encontrar a palavra "santos" em qualquer posição dentro da variavel. Aperte qualquer botão para continuar: ''') cidade = str(input('Qual o nome da sua cidade: ')).strip() sant...
#Shape of small l: def for_l(): """printing small 'l' using for loop""" for row in range(6): for col in range(3): if col==1 or row==0 and col!=2 or row==5 and col!=0: print("*",end=" ") else: print(" ",end=" ") print() def...
''' Este ejercicio es para modelar empleados de una fábrica de isótopos ''' class Person(object): def __init__(self, name, age, employee, _id): self.name = name, self.age = age, self._id = _id, self.employee = employee def employ_status(self): if self.employee: ...
def get_menu_choice(): def print_menu(): # Your menu design here print(" _ _ _____ _____ _ _ ") print("| \ | | ___|_ _| / \ _ __| |_ ") print("| \| | |_ | | / _ \ | '__| __|") print("| |\ | _| | | / ___ \| | | |_ ") print("|_| \_...
conversion = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} roman_letter_order = dict((letter, ind) for ind, letter in enumerate('IVXLCDM')) minimal_num_of_letter_needed_for_each_digit = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 2, '5': 1, '6': 2, '7': 3, '8...
# Write a for loop using range() to print out multiples of 5 up to 30 inclusive for mult in range(5, 31, 5): # prints out multiples of 5 up to 30 inclusive print(mult)
"""Module for request errors""" REQUEST_ERROR_DICT = { 'invalid_request': 'Invalid request object', 'not_found': '{} not found', 'invalid_credentials': 'Invalid username or password', 'already_exists': '{0} or {1} already exists', 'exists': '{0} already exists', 'invalid_provided_date': 'Invali...
# # PySNMP MIB module CISCO-SWITCH-HARDWARE-CAPACITY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SWITCH-HARDWARE-CAPACITY-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:13:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using...
class Solution(object): def constructRectangle(self, area): """ :type area: int :rtype: List[int] """ L = int(math.sqrt(area)) while True: W = area // L if W * L == area: return [W, L] L -= 1
#/usr/bin/env python3 GET_PHOTOS_PATTERN = "https://www.flickr.com/services/rest?method=flickr.people.getPhotos&api_key={}&user_id={}&format=json&page={}&per_page={}" FIND_USER_BY_NAME_METHOD = "https://www.flickr.com/services/rest?method=flickr.people.findbyusername&api_key={}&username={}&format={}" GET_PHOTO_COMMENT...
# 打印输出从文件读取的所有行额字符串 f = open('hello.txt') # 打开(文本+读取模式) while True: line = f.readline() if not line: # 没有读取到内容(达到了结尾) break print(line, end='') f.close() # 关闭
class Font(object): # no doc @staticmethod def AvailableFontFaceNames(): """ AvailableFontFaceNames() -> Array[str] """ pass Bold = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: Bold(self: Font) -> bool """ FaceName = property...
def sayhi(): print("hello") def chat(): print("This is a calculator") def exit(): print("Thank you") def mul(n1,n2): return n1*n2 def add(n1,n2): return n1+n2 def sub(n1,n2): return n1-n2 def div(n1,n2): return n1/n2 sayhi() chat() i = int(input("Enter a number:- ")) j = int(input(...
''' m18 - maiores de 18 h - homens m20 - mulheres menos de 20 ''' m18 = h = m20 = 0 while True: print('-'*25) print('CADSTRE UMA PESSOA') print('-'*25) idade = int(input('Idade: ')) if idade > 18: m18 += 1 while True: sexo = str(input('Sexo: [M/F] ')).upper() i...
bootstrap_url="http://agent-resources.cloudkick.com/" s3_bucket="s3://agent-resources.cloudkick.com" pubkey="etc/agent-linux.public.key" branding_name="cloudkick-agent"
def binary_search(arr, num): lo, hi = 0, len(arr)-1 while lo <= hi: mid = (lo+hi)//2 if num < arr[mid]: hi = mid-1 elif num > arr[mid]: lo = mid+1 elif num == arr[mid]: print(num, 'found in array.') break if lo > hi: pri...
"""Configuration for HomeAssistant connection""" # pylint: disable=too-few-public-methods class HomeAssistantConfig: """Data structure for holding Home-Assistant server configuration.""" def __init__(self, url, token): self.url = url self.token = token
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # TODO(borenet): This module belongs in the recipe engine. Remove it from this # repo once it has been moved. DEPS = [ 'recipe_engine/json', 'recipe_e...
command = '/home/billerot/Git/alexa-flask/venv/bin/gunicorn' pythonpath = '/home/billerot/Git/alexa-flask' workers = 3 user = 'billerot' bind = '0.0.0.0:8088' logconfig = "/home/billerot/Git/alexa-flask/conf/logging.conf" capture_output = True timeout = 90
# def minsteps1(n): # memo = [0] * (n + 1) # def loop(n): # if n > 1: # if memo[n] != 0: # return memo[n] # else: # memo[n] = 1 + loop(n - 1) # if n % 2 == 0: # memo[n] = min(memo[n], 1 + loop(n // 2)) # ...
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Codec: def serialize(self, root): ans = "" queue = [root] while queue: node = queue.pop(0) if node: ans += str(node.val) ...
def f(x): return x, x + 1 for a in b, c: f(a)
class Proxy: def __init__(self, obj): self._obj = obj # Delegate attribute lookup to internal obj def __getattr__(self, name): return getattr(self._obj, name) # Delegate attribute assignment def __setattr__(self, name, value): if name.startswith('_'): super().__...
rolls = [6, 5, 3, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] soma = 0 # for r in rolls: # soma += r # for twice in range(0, 3): # soma +=rolls[twice] # if soma == 10: # rolls[2] *= 2 # print(rolls) # # print(twice) # print(rolls) # print(rolls[0]) # row = [i for i in rolls] # print(rolls) for i...
def dfs(node,parent): currsize=1 for child in tree[node]: if child!=parent: currsize+=dfs(child,node) subsize[node]=currsize return currsize n=int(input()) tree=[[]for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a,b=a-1,b-1 tree[a].append(b) tre...
''' Contains Hades gamedata ''' # Based on data in Weaponsets.lua HeroMeleeWeapons = { "SwordWeapon": "Stygian Blade", "SpearWeapon": "Eternal Spear", "ShieldWeapon": "Shield of Chaos", "BowWeapon": "Heart-Seeking Bow", "FistWeapon": "Twin Fists of Malphon", "GunWeapon": "Adamant Rail", } # B...
class Property(object): def __init__(self, **kwargs): self.background = "#FFFFFF" self.candle_hl = dict() self.up_candle = dict() self.down_candle = dict() self.long_trade_line = dict() self.short_trade_line = dict() self.long_trade_tri = dict() sel...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ **Project Name:** MakeHuman **Product Home Page:** http://www.makehumancommunity.org/ **Github Code Home Page:** https://github.com/makehumancommunity/ **Authors:** Thanasis Papoutsidakis **Copyright(c):** MakeHuman Team 2001-2019 **Licensi...
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'chromium', 'isolate', 'recipe_engine/properties', ] def RunSteps(api): api.chromium.set_config('chromium') api.isolate.compare_build_a...
p1 = int(input('Primeiro termo: ')) p = p1 r = int(input('Razão: ')) while p1 < (p + r*10): print(p1, '->', end=' ') p1 += r print('Fim')
''' # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail ''' # Write your code here def arr(): return [] def bfs(g,a,b,n): ...
class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s rows = [''] * min(numRows, len(s)) cur_row = 0 goind_down = False for c in s: rows[cur_row] += c if cur_row == 0 or cur_row == numRows - 1: goi...
class LowPassFilter(object): def __init__(self, lpf_constants): self.tau = lpf_constants[0] self.ts = lpf_constants[1] self.a = 1. / (self.tau / self.ts + 1.) self.b = self.tau / self.ts / (self.tau / self.ts + 1.); self.last_val = 0. self.ready = False def get...
class Solution(object): def XXX(self, s): """ 用消除法解这道题目 :type s: str :rtype: int """ d = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900} sum = 0 while len(s) > 0...
''' Problem Statement : Write a function that returns the boolean True if the given number is zero, the string "positive" if the number is greater than zero or the string "negative" if it's smaller than zero. Problem Link : https://edabit.com/challenge/2TdPmSpLpa8NWh6m9 ''' def equilibrium(x): return not x or ('negati...
"""https://leetcode.com/problems/rectangle-area/ https://www.youtube.com/watch?v=zGv3hOORxh0&list=WL&index=6 You're given 2 overlapping rectangles on a plane (2 rectilinear rectangles in a 2D plane.) For each rectangle, you're given its bottom-left and top-right points How would you find the area of their overlap? (to...
""" Resource optimization functions. """ #from scipy.optimize import linprog def allocate(reservations, total=1.0): """ Allocate resources among slices with specified and unspecified reservations. Returns a new list of values with the following properties: - Every value is >= the corresponding input...
class Solution: def findShortestSubArray(self, nums): first, count, res, degree = {}, {}, 0, 0 for i, num in enumerate(nums): first.setdefault(num, i) count[num] = count.get(num, 0) + 1 if count[num] > degree: degree = count[num] re...
class StitchSubclusterSelectorBase(object): """ Subclasses of this class are used to make choice which subclusters will be stitched next based on criteria. """ def __init__(self, *args, **kwargs): pass def select(self, dst, src, stitched, is_intra=False): raise NotImplementedError ...
DISCORD_API_BASE_URL = "https://discord.com/api" DISCORD_AUTHORIZATION_BASE_URL = DISCORD_API_BASE_URL + "/oauth2/authorize" DISCORD_TOKEN_URL = DISCORD_API_BASE_URL + "/oauth2/token" DISCORD_OAUTH_ALL_SCOPES = [ "bot", "connections", "email", "identify", "guilds", "guilds.join", "gdm.join", "messages.read",...
CSRF_ENABLED = True SECRET_KEY = 'blabla' DOCUMENTDB_HOST = 'https://mongo-olx.documents.azure.com:443/' DOCUMENTDB_KEY = 'hJJaII1eaMs2wUHNqvjDkzRF3wOz24x8x/J7+Zfw2D91KM/LTjNXcVg8WgMV2JiaNGuTnsnInSmO8jrqDRGw/g==' DOCUMENTDB_DATABASE = 'olxDB' DOCUMENTDB_COLLECTION = 'rentals' DOCUMENTDB_DOCUMENT = 'rent-doc'
class Solution: def numMovesStones(self, a: int, b: int, c: int) -> List[int]: temp = [a,b,c] temp.sort() d1, d2 = temp[1] - temp[0], temp[2] - temp[1] if d1 == 1 and d2 == 1: return [0, 0] elif d1 == 1 or d2 == 1: return [1, max(d1, ...
class EmptyLayerError(Exception): """ Represent empty layers accessing. """ def __init__(self, message="Unable to access empty layers."): super(EmptyLayerError, self).__init__(message)
class Solution: def longestCommonPrefix(self, strs) -> str: if(not strs or len(strs) == 0): return '' res = strs[0] for i in range(len(strs)): fi = 0 se = 0 while(fi < len(res) and se < len(strs[i]) and res[fi] == strs[i][se]): ...
class GST_Company(): def __init__(self, gstno, rate,pos,st): self.GSTNO = gstno self.RATE = rate self.POS=pos self.ST=st self.__taxable = 0.00 self.__cgst = 0.00 self.__sgst = 0.00 self.__igst = 0.00 self.__cess = 0 self.__total = 0.00 ...
"""Results gathered from tests. Copyright (c) 2019 Red Hat Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program ...
parameters = { # Add entry for each state variable to check; number is tolerance "alpha": 0.0, "b": 0.0, "d1c": 0.0, "d1t": 0.0, "d2": 0.0, "fb1": 0.0, "fb2": 0.0, "fb3": 0.0, "nstatev": 0, "phi0_12": 0.0, }
class Stack: def __init__(self): self.queue = [] def enqueue(self, element): self.queue # [3,2,1] def dequeue(self): queue_helper = [] while len(self.queue) != 1: x = self.queue.pop() queue_helper.append(x) temp = self.queue.pop() ...
class SRTError(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg class SRTLoginError(SRTError): def __init__(self, msg="Login failed, please check ID/PW"): super().__init__(msg) class SRTResponseError(SRTError): def __init__(self, msg): ...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. # version_info = (0, 15, 0) __version__ = '%s.%s.%s' % (version_info[0], version_info[1], version_info[2]) EXTENSION_VERSION = '^0.15.0'
"""File Handling.""" # my_file = open('data.txt', 'r') """ with open('data.txt', 'r') as data: print(f'File name: {data.name}') # for text_line in data.readlines(): # print(text_line, end='') for line in data: print(line, end='') """ """ lines = ["This is line 1", "This is lin...
depositoI = int(input("Insira o valor do depósito inicial: ")) juros = int(input("Qual a taxa de juros? (ex 2.11%): ")) montanteAtual = depositoI for x in range(25): print("No mês: " + str(x) + ", o total acumulado é de: " + str("%.2f" % montanteAtual) + ". E o lucro com juros: " + str("%.2f" % (montanteAtual - dep...
#!/usr/bin/env python log_dir = os.environ['LOG_DIR'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ[...
test = { 'name': 'scheme-def', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (def f(x y) (+ x y)) f scm> (f 2 3) 5 scm> (f 10 20) 30 """, 'hidden': False, 'locked': False }, ...
# -*- coding: utf-8 -*- def env_comment(env,comment=''): if env.get('fwuser_info') and not env['fwuser_info'].get('lock'): env['fwuser_info']['comment'] = comment env['fwuser_info']['lock'] = True
balance = 320000 annualInterestRate = 0.2 monthlyInterestRate = (annualInterestRate) / 12 epsilon = 0.01 lowerBound = balance / 12 upperBound = (balance * (1 + monthlyInterestRate)**12) / 12 ans = (upperBound + lowerBound)/2.0 newBalance = balance while abs(0 - newBalance) >= epsilon: newBalance = balance for i...
# DO NOT LOAD THIS FILE. Targets from this file should be considered private # and not used outside of the @envoy//bazel package. load(":envoy_select.bzl", "envoy_select_google_grpc", "envoy_select_hot_restart") # Compute the final copts based on various options. def envoy_copts(repository, test = False): posix_op...
class lazy_property(object): """ meant to be used for lazy evaluation of an object attribute. property should represent non-mutable data, as it replaces itself. From: http://stackoverflow.com/a/6849299 """ def __init__(self, fget): self.fget = fget self.func_name = fget.__name__...
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_header(pluginname, "django")
class AverageMeter: """ Class to be an average meter for any average metric like loss, accuracy, etc.. """ def __init__(self): self.value = 0 self.avg = 0 self.sum = 0 self.count = 0 self.reset() def reset(self): self.value = 0 self.avg = 0 ...
class Solution: def checkString(self, s: str) -> bool: a_indices = [i for i, x in enumerate(s) if x=='a'] try: if a_indices[-1] > s.index('b'): return False except: pass return True
""" 99 / 99 test cases passed. Runtime: 32 ms Memory Usage: 14.8 MB """ class Solution: def toGoatLatin(self, sentence: str) -> str: vowel = ['a', 'e', 'i', 'o', 'u'] ans = [] for i, word in enumerate(sentence.split()): if word[0].lower() in vowel: ans.append(word...
# -*- coding: utf-8 -*- """ Histogram Entities. @author Hao Song (songhao@vmware.com) """
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #Author:Winston.Wang print('--------------------继承----------------------') #定义一个Aniaml类 class Animal(object): def run(self): print('Animal 动物类') #定义Dog类继承自Animal class Dog(Animal): def run(self): print('Dog run.....') #定义Cat类 class Cat(Animal): def run(self): pri...
class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. """ # Transpose for i in range(len(matrix)): for j in range(i+1,len(matrix)): matrix[j]...
# [Job Adv] (Lv.30) Way of the Bandit darkMarble = 4031013 job = "Night Lord" sm.setSpeakerID(1052001) if sm.hasItem(darkMarble, 30): sm.sendNext("I am impressed, you surpassed the test. Only few are talented enough.\r\n" "You have proven yourself to be worthy, I shall mold your body into a #b...
# -*- coding: utf-8 -*- """ db_normalizer.csv_handler ----------------------------- Folder for the CSV toolbox. :authors: Bouillon Pierre, Cesari Alexandre. :licence: MIT, see LICENSE for more details. """
INDEX_HEADER_SIZE = 16 INDEX_RECORD_SIZE = 41 META_HEADER_SIZE = 32 kMinMetadataRead = 1024 kChunkSize = 256 * 1024 kMaxElementsSize = 64 * 1024 kAlignSize = 4096
#!/usr/bin python dec1 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" enc1 = "EICTDGYIYZKTHNSIRFXYCPFUEOCKRNEICTDGYIYZKTHNSIRFXYCPFUEOCKRNEI" dec2 = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" enc2 = "FJDUEHZJZALUIOTJSGYZDQGVFPDLSOFJDUEHZJZALUIOTJSG" with open("krypton7", 'r') as handle: ...
# -*- coding: utf-8 -*- class IRI: MAINNET_COORDINATOR = ''
MAX_FACTOR = 20 # avoid weirdness with python's arbitary integer precision MAX_WAIT = 60 * 60 # 1 hour class Backoff(): def __init__(self, initial=None, base=2, exp=2, max=MAX_WAIT, attempts=None): self._attempts = attempts self._initial = initial self._start = base self._max = m...
def main(): decimal = str(input()) number = float(decimal) last = int(decimal[-1]) if last == 7: number += 0.02 elif last % 2 == 1: number -= 0.09 elif last > 7: number -= 4 elif last < 4: number += 6.78 print(f"{number:.2f}") if __name__ == "__main__...
# # オセロ(リバーシ) 6x6 # N = 6 # 大きさ EMPTY = 0 # 空 BLACK = 1 # 黒 WHITE = 2 # 白 STONE = ['□', '●', '○'] #石の文字 # # board = [0] * (N*N) # def xy(p): # 1次元から2次元へ return p % N, p // N def p(x, y): # 2次元から1次元へ return x + y * N # リバーシの初期画面を生成する def init_board(): board = [EMPTY] * (N*N) c = N//2 board[p...
print("Hi, I'm a module!") raise Exception( "This module-level exception should also not occur during freeze" )
GENCONF_DIR = 'genconf' CONFIG_PATH = GENCONF_DIR + '/config.yaml' SSH_KEY_PATH = GENCONF_DIR + '/ssh_key' IP_DETECT_PATH = GENCONF_DIR + '/ip-detect' CLUSTER_PACKAGES_PATH = GENCONF_DIR + '/cluster_packages.json' SERVE_DIR = GENCONF_DIR + '/serve' STATE_DIR = GENCONF_DIR + '/state' BOOTSTRAP_DIR = SERVE_DIR + '/bootst...
class Solution: def isStrobogrammatic(self, num: str) -> bool: rotated = ['0', '1', 'x', 'x', 'x', 'x', '9', 'x', '8', '6'] l = 0 r = len(num) - 1 while l <= r: if num[l] != rotated[ord(num[r]) - ord('0')]: return False l += 1 r -= 1 return True
# -*- coding: utf-8 -*- """ Created on Tue Feb 1 16:43:37 2022 @author: LENOVO """ list = [] n = 1 #valores del 1 al 100 while n <= 100: #bucle de numeros de 1 al 100 c = 1 # div x = 0 #contador div while c <= n: if n % c == 0: x = x + 1 c = c + 1 if x == 2: list...
# -*- coding: utf-8 -*- """ Copyright (c) 2016, René Tanczos <gravmatt@gmail.com> (Twitter @gravmatt) The MIT License (MIT) Class to create dynamic objects. Project on github https://github.com/gravmatt/py-dynamic """ __author__ = 'Rene Tanczos' __version__ = '0.1' __license__ = 'MIT' class Dynamic: def __init_...
""" برای درست کردن مدل ها در جنگو داریم 1=داخل هر app فایل models.py را باز میکنیم models.py 2= و یک کلاس را بسازیم که از کلاس models.Model ارث بری میکند class topic(model,Model): topic_name=models.CharFeild( max_length = 264 , unique = True ) 3= معمولن همه ی کلاس ها به شکل استرینگ نوع...
# coding: utf-8 COLORS = { 'green': '\033[22;32m', 'boldblue': '\033[01;34m', 'purple': '\033[22;35m', 'red': '\033[22;31m', 'boldred': '\033[01;31m', 'normal': '\033[0;0m' } class Logger: def __init__(self): self.verbose = False @staticmethod def _print_msg(msg: str, col...
# # PySNMP MIB module INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:44:05 2019 # On host DAVWANG4-M-1475 platform Darwin version...
class Solution: def repeatedNTimes(self, A: List[int]) -> int: counter = 0 N = len(A) / 2 for a in A: a_count = A.count(a) if a_count == N: return a counter += a_count if counter == N: return A[0] ...
class BitConverter(object): """ Converts base data types to an array of bytes,and an array of bytes to base data types. """ @staticmethod def DoubleToInt64Bits(value): """ DoubleToInt64Bits(value: float) -> Int64 Converts the specified double-precision floating point number to a...
def extraerVector(matrizPesos, i, dimVect): vectTemp = [] for j in range(dimVect - 1): vectTemp.append(matrizPesos[i][j]) return vectTemp
async def handler(event): # flush history data await event.kv.flush() # string: bit 0 v = await event.kv.setbit('string', 0, 1) if v != 0: return {'status': 503, 'body': 'test1 fail!'} # string: bit 1 v = await event.kv.setbit('string', 0, 1) if v != 1: return {'status'...
''' Copyright 2013 CyberPoint International, LLC. All rights reserved. Use and disclosure prohibited except as permitted in writing by CyberPoint. libpgm exception handler Charlie Cabot Sept 27 2013 ''' class libpgmError(Exception): pass class bntextError(libpgmError): pass
def bold(func): def wrapper(): return "<b>" + func() + "</b>" return wrapper def italic(func): def wrapper(): return "<i>" + func() + "</i>" return wrapper # 装饰器函数是自底向上的顺序 @bold @italic def formatted_text(): return '格式化文本!' print(formatted_text())
# In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method # for computing the greatest common divisor (GCD) of two integers (numbers), the largest number # that divides them both without a remainder. def gcd_by_subtracting(m, n): """ Computes the greatest common divisor of two n...
class CachedLoader(object): items = {} @classmethod def load_compose_definition(cls, loader: callable): return cls.cached('compose', loader) @classmethod def cached(cls, name: str, loader: callable): if name not in cls.items: cls.items[name] = loader() return...
print("Welcome to Byeonghoon's Age Calculator. This program provide your or someone's age at the specific date you are enquiring.") current_day = int(input("Please input the DAY you want to enquire (DD):\n")) while current_day < 1 or current_day > 31: print("!", current_day, "is not existing date. Please check your...
class AuthSession(object): def __init__(self, session): self._session = session def __enter__(self): return self._session def __exit__(self, *args): self._session.close()
""" Problem 7: What is the 10 001st prime number? """ def is_prime(n): for i in range(2, n // 2 + 1): if n % i == 0: return False return True class Prime: def __init__(self): self.curr = 1 def __next__(self): new_next = self.curr + 1 while not is_...
# Given the array candies and the integer extraCandies, where candies[i] represents the number of candies that the # ith kid has. # # For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the # greatest number of candies among them. Notice that multiple kids can hav...
_base_ = './cascade_rcnn_s50_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py' model = dict( backbone=dict( stem_channels=128, depth=101, init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://resnest101')))
description = 'setup for the poller' group = 'special' sysconfig = dict(cache = 'mephisto17.office.frm2') devices = dict( Poller = device('nicos.services.poller.Poller', alwayspoll = ['tube_environ', 'pressure'], blacklist = ['tas'] ), )
# Asking Question print ("How old are you?"), age = input() print ("How tall are you?") height = input() print ("How much do you weigh?") weight = input() print ("So You are %r years old, %r tall and %r heavy."%(age, height , weight) )
__copyright__ = 'Copyright (C) 2019, Nokia' class TestPythonpath2(object): ROBOT_LIBRARY_SCOPE = "GLOBAL" def __init__(self): self.name = 'iina' self.age = 10 def get_name2(self): return self.name