content
stringlengths
7
1.05M
notice =""" Font Generator Program ----------------------------------- | Copyright 2022 by Joel C. Alcarez | | [joelalcarez1975@gmail.com] | |-----------------------------------| | We make absolutely no warranty | | of any kind, expressed or implied | |-----------------------------------| | Contact ...
class Solution: def arrangeCoins(self, n: int) -> int: l, r = 1, 2 ** 16 while l <= r: m = (l + r) // 2 c = self._count(m) if c <= n and self._count(m + 1) > n: return m elif c > n: r = m - 1 else: ...
""" from keras.layers import Input from keras.engine.topology import Layer import scipy as sci import numpy as np from scipy.stats import bernoulli import random class DropConnect(Layer): def __init__(self, input_dim, output_dim, p): self.train = True self.prob = p or 0.5 if self.prob >=...
""" Write a Python program to replace dictionary values with their sum. """ def sum_math_v_vi_average(list_of_dicts): for d in list_of_dicts: n1 = d.pop('V') n2 = d.pop('VI') d['V+VI'] = (n1 + n2)/2 return list_of_dicts student_details= [ {'id' : 1, 'subject' : 'math', 'V' : 70, 'VI' ...
class Node: def __init__(self, data) -> None: self.data = data self.next = None class LinkedList: def __init__(self, head=None) -> None: self.head = Node(head) def pushTop(self, val): newNode = Node(val) current = self.head if not current.data: ...
# noinspection PyShadowingBuiltins,PyUnusedLocal def compute(x, y): return x+y a = 2 b = 3 print(compute(a,b))
#!/usr/bin/env python3 #-*- coding: utf-8 -*- L = list(map(lambda x: 2 **x, range(7))) X = 5 obj = 2 ** X if obj in L: print('at index', L.index(obj)) else: print(X, 'not found')
# Copyright (c) 2015 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. """ Classes in this package define additional actions that need to be taken to run a test under some kind of runtime error detection tool. The interface ...
''' Created on Dec 12, 2014 @author: MP '''
def get_data(fold=0): return (MImageItemList.from_df(df, path=TRAIN+"/train", cols='image_id') .split_by_idx(df.index[df.split == fold].tolist()) .label_from_df(cols=['prim_gleason','secon_gleason']) .transform(get_transforms(flip_vert=True,max_rotate=15),size=sz,padding_mode='zeros') .datab...
legend = [ ("Analog", "analog"), ("I2C", "i2c"), ("GPIO", "gpio"), ("Touch", "touch"), ("PWM", "pwm"), ("Power", "pwr"), ("Ground", "gnd"), ] # Pinlabels left_header = [ [ ("0", "gpio"), ("A0", "analog"), ("MISO", "comms"), ], [ ("1", "gpio"), ...
# Ctrl+K+C to comment a line, Ctrl+K+U to uncomment a line first_name = input("What is your first name? ") last_name = input("What is your last name? ") print(first_name + last_name) print("Hello " + first_name.capitalize() + " " + last_name.capitalize()) print() sentence = "The dog is named Daisy" print(sentence.uppe...
class BingoBoardPlace: def __init__(self, number: int): self.number = number self.selected: bool = False class BingoBoard: # 5x5 grid # data must include rows and columns -> [ [0, 0, 0], [0, 0, 0], [0, 0, 0] ] def __init__(self, data: []): self.data = [] self.chosen_num...
velocidadkms = 0 velocidadms = 0 distancia = float(input("ingrese la distancia recorrida en km")) tiempo = float(input("ingrese el tiempo transcurrido en h")) velocidadkms= distancia/tiempo print("La velocidad en km/h es: ", velocidadkms) velocidadms = (velocidadkms)*10/36 print("La velocidad en m/s es: ", velocidadms)...
def decode(cipher, rails): cipher_len = len(cipher) rail = [['\n' for i in range(len(cipher)) ] for j in range(rails)] is_going_down = False row, col = 0,0 for i in range(len(cipher)): if row == 0: is_going_down = True elif row == rails -1: is_going_d...
#!/usr/bin/env python3 class Solution: def canConstruct(self, ransomNote: str, magazine: str) -> bool: a = list(ransomNote) b = list(magazine) try: for i in a: b.remove(i) return True except: return False
#!/usr/bin/python3 #------------------------------------------------------------------------------ # First Solution #------------------------------------------------------------------------------ class Solution: def trap(self, height): """ :type height: List[int] :rtype: int """ ...
__author__ = 'raymond' class TradingDataRowParser: def __init__(self, spacing): self.spacing = spacing def split_by_ticker_symbol(self, row): for ticker_start_index in range(0, len(row), self.spacing): yield row[ticker_start_index:ticker_start_index + self.spacing], ticker_start_index
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 # # MDAnalysis --- https://www.mdanalysis.org # Copyright (c) 2006-2020 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # # Released under t...
""" 419. Roman to Integer https://www.lintcode.com/problem/roman-to-integer/description """ class Solution: """ @param s: Roman representation @return: an integer """ def romanToInt(self, s): # write your code here CHAR_TO_DIGIT = { "I": 1, "V": 5, ...
def check(num1, num2, num3): total = num1 + num2 + num3 for i in range(2, total): if total % i == 0 : return False return True def solution(nums): answer = 0 for i in range(0, len(nums) - 2): for j in range(i+1, len(nums) - 1): for k in range(j+1, len(nums)): ...
# -*- coding: utf-8 -*- __version__ = '0.5.3' __project__ = 'diamond-patterns' __author__ = 'Ian Dennis Miller' __email__ = 'iandennismiller@gmail.com' __url__ = 'https://diamond-patterns.readthedocs.io/' __repo__ = 'https://github.com/iandennismiller/diamond-patterns/' __copyright__ = '2019 Ian Dennis Miller'
def data(): return """<?xml version='1.0' encoding='UTF-8'?> <TrainingCenterDatabase xmlns:ns2="http://www.garmin.com/xmlschemas/UserProfile/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://www.garmin.com/xmlschemas/ProfileExtension/v1" xmlns:ns...
def foto(filma, kadruSkaits, skaits, izmers): cenaVienam = 0 kadruSkaits = 0 if C-41 == "KRĀSU NEGATĪVAJĀM": cenaVienam = 1 elif MB == "MELNBALTAJĀM FILMĀM": cenaVienam = 2,25 elif NONE == "NAV JĀATTIĪSTA": cenaVienam = 0 pasutijumaCena = cenaVienam * skaits if pas...
"""https://open.kattis.com/problems/baconeggsandspam""" def solveDay(orders: dict) -> str: ans = [] for k in sorted(orders.keys()): res = str(k) + " " res += " ".join(sorted(orders[k])) ans.append(res) return "\n" + "\n".join(ans) + "\n" if __name__ == '__main__': ans = "" ...
class AisiklError(Exception): '''The base class for AIS, REST-related exceptions.''' def __init__(self, *args, **kwargs): super().__init__(*args) for key, value in kwargs.items(): setattr(self, key, value) class AISParseError(AisiklError): '''We couldn't parse or properly pro...
class factorial: def find_fact(self,n): res = 1 if n < 0: return -1 elif n == 0: return 1 else: for i in range(1,n+1): res = res*i return res
def Gray2Binary(n): m = 0 while n: m ^= n n >>= 1 return m print(Gray2Binary(4))
class Entitlement_Manager: @staticmethod def fetch_entitlements(client,entitlement_type): conversions = { "skin_level": "e7c63390-eda7-46e0-bb7a-a6abdacd2433", "skin_chroma": "3ad1b2b2-acdb-4524-852f-954a76ddae0a", "agent": "01bb38e1-da47-4e6a-9b3d-945fe4655707", ...
# Flask settings DEBUG = False # Flask-restplus settings RESTPLUS_MASK_SWAGGER = False # Application settings # API metadata API_TITLE = 'Model Asset Exchange Server' API_DESC = 'An API for serving models' API_VERSION = '0.1' # default model MODELNAME = 'ssrnet_3_3_3_64_1.0_1.0.h5' DEFAULT_MODEL_PATH = 'assets/{}'....
# find the ceil and floor value of a no. in a sorted array n = int(input()) a = [] for i in range(n): a.append(int(input())) d = int(input()) l = 0 h = n-1 ceil = 0 floor = 0 while(l<=h): mid = (l+h)//2 if a[mid]<d: l = mid+1 ceil=a[mid] elif a[mid]>d: h = mid-1 floor=a[...
_base_ = ['./masktrack_rcnn_r50_fpn_12e_youtubevis2019.py'] model = dict( detector=dict( backbone=dict( type='ResNeXt', depth=101, groups=64, base_width=4, init_cfg=dict( type='Pretrained', checkpoint='open-mmlab://r...
LOG_FILE = '/var/lib/pgadmin/pgadmin.log' SQLITE_PATH = '/var/lib/pgadmin/pgadmin.db' SESSION_DB_PATH = '/var/lib/pgadmin/sessions' STORAGE_DIR = '/var/lib/pgadmin/storage' SERVER_MODE = True ALLOW_SAVE_PASSWORD = True
# Copyright 2016 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. { 'variables': { # This turns on e.g. the filename-based detection of which # platforms to include source files on (e.g. files ending in # _mac...
''' 1. 我们说过现在的 Python 可以计算很大很大的数据,但是...... 真正的大数据计算可是要靠刚刚的硬件滴,不妨写一个小代码,让你的计算机为之崩溃? ''' # 不推荐运行嗷 count = 100 for i in range(1 , 100): count **= i print(count)
# Converts an RGB color value to HSL. Conversion formula # adapted from http://en.wikipedia.org/wiki/HSL_color_space. # Assumes r, g, and b are contained in the set [0, 255] and # returns h, s, and l in the set [0.0, 1.0]. # # @param {number} r The red color value # @param {number} g The green color v...
''' def candies(n, arr): count = 0 for i in range(n): even = True sum_even = 0 sum_odd = 0 for j in range(n): if i == j: continue if even: sum_even += arr[j] even = False else: s...
class Queue: #Constructor def __init__(self): self.queue = list() self.maxSize = 8 self.head = 0 self.tail = 0 #Adding elements def enqueue(self,data): #Checking if the queue is full if self.size() >= self.maxSize: return ("Queue Full") ...
class Defaults(object): window_size = 7 filter_nums = [100, 100, 100] filter_sizes = [3, 4, 5] hidden_sizes = [1200] hidden_activation = 'relu' max_vocab_size = 1000000 optimizer = 'adam' learning_rate = 1e-4 epochs = 20 iobes = True # Map tags to IOBES on input max_tokens...
def average_weight(file_name): min_value=45 max_value=125 average=0 count_number=0 with open(file_name,"r") as FILE: list1=list(FILE.read().split()) for i in list1: i=int(i) if(min_value<=i<=max_value): average+=i count_number+=1 if...
#Python program to illustrate # combining else with while count = 0 while (count < 3): count = count + 1 print("Hello Geek") else: print("In Else Block")
DEFAULT_IMAGETYPES = {'jpg', 'png', 'apng', 'bmp', 'jpeg', 'gif', 'svg', 'webp'} ZIP_TYPES = {'zip', 'cbz'} RAR_TYPES = {'rar', 'cbr'} _7Z_TYPES = {'7z', 'cb7'} ASSETS = { 'styles.css', 'scripts.js', 'zenscroll.js', 'menu.svg', 'menu-light.svg', 'scroll.svg', 'scroll-light.svg', 'roboto-...
# Create a function taking a positive integer as its parameter and returning a string containing the Roman Numeral representation of that integer. # Modern Roman numerals are written by expressing each digit separately starting with the left most digit and skipping any digit with a value of zero. In Roman numerals 199...
print('='*28) print('Tabuada de um número inteiro') print('='*28) n = int(input('Insira um número: ')) print(f'{n}x1: {n*1}') print(f'{n}x2: {n*2}') print(f'{n}x3: {n*3}') print(f'{n}x4: {n*4}') print(f'{n}x5: {n*5}') print(f'{n}x6: {n*6}') print(f'{n}x7: {n*7}') print(f'{n}x8: {n*8}') print(f'{n}x9: {n*9}') print(f'{n...
#!/usr/bin/env python3 name = input("Hi! What’s your name? ") age = input("How old are you ") print("Nice to meet you " + name + "!") print("So, you are already " + str(age) + " years old, " + name + "!")
# -*- coding: utf-8 -*- """ Editor: Zhao Xinlu School: BUPT Date: 2018-04-25 Function: 2D区域检索--动态规划 """ class NumMatrix(object): def __init__(self, matrix): """ :type matrix: List[List[int]] """ if not matrix or len(matrix) == 0: return rows = len(matrix) ...
def greet_user(): """Display a simple greeting!""" print("Hello!") greet_user() def greet_user(username): print("Hello, " + username + "!") greet_user('Jamey') def make_pizza(topping='bacon'): #"""Make a single-topping pizza.""" print("Have a " + topping + " pizza!") make_pizza() make_pizza('pepperon...
a=0 b=1 n=10 print(1) for i in range(n): c=a+b a=b b=c print(c)
def solution(arr): big_paper = [[0 for _ in range(100)] for _ in range(100)] y, x, c, r = arr[0] for i in range(y-1, y+r+1): for j in range(x-1, x+c+1): if i == y-1 or i == y+r or j == x-1 or j == x+c: big_paper[i][j] = 2 else: big_paper[i][j]...
# Advent of Code 2015 # # From https://adventofcode.com/2015/day/5 # VOWELS = set('aeiou') PAIRS = {x * 2 for x in 'abcdefghijklmnopqrstuvwxyz'} NAUGHTY = {'ab', 'cd', 'pq', 'xy'} def part1_check(string_): if sum(string_.count(v) for v in VOWELS) >= 3: pairs = set(string_[i:i + 2] for i in range(len(stri...
BORDOR_LEFT = "CURSOR_REACH_LEFT" BORDOR_RIGHT = "CURSOR_REACH_RIGHT" BORDOR_TOP = "CURSOR_REACH_TOP" BORDOR_BOTTOM = "CURSOR_REACH_BOTTOM"
msg1 = 'Digite um número inteiro: ' nD = int(input(msg1)) msg2 = ''' Escolha uma das bases para conversão: [ 1 ] converter para BINÁRIO [ 2 ] converter para OCTAL [ 3 ] converter para HEXADECIMAL''' print(msg2) msg3 = 'Sua opção: ' opção = int(input(msg3)) if opção == 1: out = bin(nD)[2:] msg4 = '{} convertido...
# # @lc app=leetcode id=226 lang=python3 # # [226] Invert Binary Tree # # https://leetcode.com/problems/invert-binary-tree/description/ # # algorithms # Easy (66.70%) # Likes: 4930 # Dislikes: 72 # Total Accepted: 670.1K # Total Submissions: 997K # Testcase Example: '[4,2,7,1,3,6,9]' # # Given the root of a bina...
number=int(input('What is your number? ')) prime=True for fac in range(2, number): if int(number)%fac==0 and not number==2: prime=False if prime==True and not number<2: print('The number is prime.') else: print('The number is not prime.')
class Process: """ Parent for all cellular processes. """ def __init__(self, name, model): self.name = name self.model = model def update(self): """ Has to be implemented by child class. """ pass
# Source : https://leetcode.com/problems/check-if-numbers-are-ascending-in-a-sentence/ # Author : foxfromworld # Date : 30/11/2021 # First attempt class Solution: def areNumbersAscending(self, s: str) -> bool: curr = 0 for token in s.split(' '): if token.isdigit(): #if toke...
class SquareRoot: @staticmethod def square_root(a): c = pow(a, 0.5) return c
# HS08TEST amt,bal=map(float,input().split()) if(int(amt)%5==0): if(amt<=(bal-0.5)): print("{:.2f}".format(bal-0.5-amt)) else: print("{:.2f}".format(bal)) else: print("{:.2f}".format(bal))
class DatabaseObject: def __init__(self): self.mongodb_id = None @classmethod def from_database_object(cls, database_obj): """ Returns the database object directly from a MongoDB data object. """ obj = cls() for key, value in database_obj.items(): ...
class Error(Exception): """Base class for exceptions in this module.""" pass class MultiFaceError(Error): """Exception raised for more than one face in the input file. """ def __init__(self, filename): self.filename = filename class NoDirError(Error): def __init__(self, dirName): ...
""" 更新时间:2020-08-27 版本说明: 1、seldom:1.6.0 2、poium:0.6.3 3、Python:3.7.4 """
class UrlManager: def __init__(self): self.pending_urls = set() self.crawled_urls = set() def has_pending_url(self): return len(self.pending_urls) != 0 def add_url(self, url): if url is None or len(url) == 0: return if url in self.crawled_urls: ...
def explore_next_node(self, node): # maybe there are no paths to discover if not self.unknownPaths: # and not self.unseenNodes print("Every node discovered. Exploring finished.") return None # creat graphToSearch graphList = {} for key, value in self.pa...
# let the library to know how many jobs it has to allocate GRID_SEARCH_CV_PARAMS = { "n_jobs" : 4, "cv" : 10 } VERBOSE = True VERBOSITY = 1 POS_NEG_DATASET_DIR = "./data/Positve_negative_sentences/" HAM_SPAM_DATASET_DIR = "./data/Ham_Spam_comments/" TRAINING_DIR= "Training/" TEST_DIR = "Test/"
first_name = input() second_name = input() delimiter = input() print(f"{first_name}{delimiter}{second_name}")
''' @author: Sergio Rojas @contact: rr.sergio@gmail.com -------------------------- Contenido bajo Atribución-NoComercial-CompartirIgual 3.0 Venezuela (CC BY-NC-SA 3.0 VE) http://creativecommons.org/licenses/by-nc-sa/3.0/ve/ Creado en abril 21, 2016 ''' #Problema 5.2 #------------- x = 'abc' def f(): return x pr...
def succ(Z): return Z+1 def pred(Z): if Z>=1: return Z-1 else: return 0 """ Sesion 8-E8: 8. Dado el siguiente programa while, calculense: F(1)(x), F(2)(x,y), F(3)(x,y,z). Ademas, construyase una secuencia de computacion con entrada (0,2,1) begin while (X1>X4) do begin X2:=X2+X2...
""" RTCM Protocol payload definitions Created on 14 Feb 2022 Information sourced from RTCM STANDARD 10403.3 © 2016 RTCM :author: semuadmin """ # pylint: disable=too-many-lines, line-too-long # attribute names holding size of MSM repeating groups NSAT = "NSat" NSIG = "NSig" NCELL = "_NCell" NBIAS = "_NBias" # ****...
# encoding:utf-8 save_problem_schema = { 'type': 'object', 'properties': { 'title': {'type': 'string'}, 'content': {'type': 'string'}, 'time_limit': {'type': 'integer'}, 'memory_limit': {'type': 'integer'}, 'difficulty' : {'type': 'string'}, 'case_list': {'type':...
def main(grains): return { 'states': ['vim'], 'pillars': {} }
""" Cardinal numbers """ class Aleph(object): """ Transfinite cardinal number Aleph(k). The cardinality of the set of all integers is Aleph(0). Aleph(0) is bigger than any natural numbers (cardinality of finite sets). Alephs are ordered as Aleph(0) < Aleph(1) < ... """ def __init__(self, ...
class A: def __init__(self): self.x = 1 def _foo(self): print(self.x) a = A() a._foo() print(a.x)
# for data acquisition: numberOfChannels = 8 samplingRate = 500.0 # for preprocessing: lowBandPassFreq = 2.0 highBandPassFreq = 100.0 lowBandStopFreq = 49 highBandStopFreq = 51 # for feature calculation: windowSize = 0.15 # in s -> 150ms = 0.15s samplesPerWindow = int(windowSize / (1. / samplingRate)) windowShift = ...
# a module # define the function def showState(state): if(state == True): print("On") else: print("Off")
# -*- coding: utf-8 -*- """ Created on Sun Jan 26 13:19:04 2020 @author: Pedro """ #""" #exercise 1 for a in range(2,11,2): print(a) print("Goodbye!") #""" #""" #exercise 2 print("Hello!") for b in range(10,1,-2): print(b) #""" #""" #exercise 3 end = 6 result = 0 for c in...
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Restaurant20to50, obj[4]: Distance # {"feature": "Coupon", "instances": 8147, "metric_value": 0.4722, "depth": 1} if obj[0]>1: # {"feature": "Distance", "instances": 5903, "metric_value": 0.4599, "depth": 2} if obj[4]<=2: # ...
# Shallow Copy meta.append(arr) # Deep Copy meta.append(arr[:])
def solve(data): result = 0 for lines in data: dimensions = list(map(int, lines.split('x'))) l = dimensions[0] w = dimensions[1] h = dimensions[2] dimensions[0] = l * w dimensions[1] = w * h dimensions[2] = h * l smallest_side = min(dimensions...
# coding: utf8 """ 题目链接: https://leetcode.com/problems/spiral-matrix/description. 题目描述: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], ...
person_schema = { "fname": {'type': 'string'}, "lname": {'type': 'string'}, "person_id": {'type': 'number'}, "timestamp": {'type': 'string'} }
#coding=utf-8 def filter_idx(idx): #有其它疾病出现,不显示正常心电图 if 4 in idx and len(idx) > 1: idx.remove(4) return idx
alphabet_number = { 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def maxPathSum(self, root: TreeNode) -> int: self.res = float('-inf') def dfs(root): if not root: ...
times = ('Palmeiras', 'Flamengo', 'Internacional', 'Grêmio', 'São Paulo', 'Atlético Mineiro', 'Atlético-PR', 'Cruzeiro', 'Botafogo', 'Santos', 'Bahia', 'Corinthians', 'Fluminense', 'Ceará', 'Vasco da Gama', 'Sport Recife', 'América-MG', 'Chapecoense', 'Vitória', 'Paraná') print('=' * 100) print(f'Os 5 prim...
class Solution: def reverse(self, x: int) -> int: if x >= 2 ** 31 - 1 or x <= -2 ** 31: return 0 else: strg = str(x) if x >= 0: revst = strg[::-1] else: temp = strg[1:] temp2 = temp[::-1] ...
def dx(ux, u, nx, dx, order): # summation-by-parts finite difference operators for first derivatives du/dx m = nx-1 # second order accurate case if order==2: # calculate partial derivatives on the boundaries:[0, m] with one-sided difference operators ux[0, :] = (u[1, :] - u[0,...
set_example={"ATGCT","ATAGTATA","ATGCT"} #set will remove the duplicate members print(set_example) set_example={"YC1","YC2","YC3","YC3"} print(set_example) t_cell_epitopes={"LPVLQV","FGDSVE","VEKGVLPQLEQ","ARTAPH","EIPVA"} b_cell_epitopes={"ARTAPH","IQYG","EIPVA"} #all the available epitopes #union operation all_e...
''' Compute number of permutations containing specified number of descents Status: Accepted ''' def memoize(user_function): """Memoization decorator for user function of 1+ parameters""" class Memodict(dict): """Memoization performs user function call on dict miss""" def __getitem__(self, *k...
MOCK_ENTRIES = [{ "symbol": "GE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various se...
#from swagger_server.models.configurations import Configurations #from swagger_server.models.configuration import Configuration class GuardAgentSecurityContext(object): class __GuardAgentSecurityContext: def __init__(self): # self._time_between_probes=Configuration("time_between_probes", "int", "Tim...
s = str(__import__('sys').stdin.readline().strip()).replace("()","0") res = 0 sticker = 0 for x in s: if x == "(": sticker += 1 elif x == "0": res += sticker else: sticker -= 1 res += 1 print(res)
# # PySNMP MIB module VMWARE-VA-AGENTCAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VMWARE-VA-AGENTCAP-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:35:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
''' 1. True y 2. False y 3. False y 4. True y 5. True y 6. False n 7. False y 8. True y 9. False y 10. False y 11. True y 12. False y 13. True y 14. False y 15. False y 16. True n 17. True y 18. True y 19. False y 20. False y '''
#哈姆雷特统计 def getText(): txt=open(r"wxPython_Kiss\assets\Hamlet.txt","r",encoding="utf-8").read() txt=txt.lower() for ch in '!"@#$%&()+-*/,.:;<=>?[\\]^_‘{|}~': txt=txt.replace(ch," ") return txt hamletTxt=getText() words=hamletTxt.split() counts={} for word in words: counts[word]=counts.get(wo...
# # Copyright (c) 2009-2020 Tom Keffer <tkeffer@gmail.com> # # See the file LICENSE.txt for your rights. # """A very small wview schema.""" # ============================================================================= # This is a very severely restricted schema that includes only the basics. It # is useful for...
def palm_pilot(general, dev, msg) : code = 13 prio = 800 prio += adjust_prio(general, dev, msg) keys=list(); keys.append('Bottom of Cesar Chavez (LHS)') keys.append('South Hall entrance 1') if ( disallowed(general, dev) or not contains(dev, keys) ) : return (0, 0, 0, '', '') if ( dev['Bottom of Cesar Chavez ...
{ "targets": [ { "target_name": "addon", "sources": [ "src/logql.cc" ], "libraries": [ "<!(pwd)/logql.so" ] } ] }
def Articles(): articles = [ { 'id': 1, 'title': 'Article One', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut...
def removeDuplicates(s: str) -> str: i = 0 while i < len(s)-1: if s[i] == s[i+1]: s = s[i+2:] if s==0 else s[:i]+s[i+2:] i = 0 if i==0 else i-1 else: i+=1 return s print(removeDuplicates("gnyogdbncigrwnjjtqtyregqyhkinjxgzmkpxskloxjcensflhhxlpfkrcmuctrr...
#! /usr/bin/python # -*- coding:utf-8 -*- """ Author: AsherYang Email: ouyangfan1991@gmail.com Date: 2018/5/8 Desc: 网络返回的基础码,对应解释 返回码以6位数字标识 000001 --> 表示成功 100000 - 199999 --> 预留字段 2xx --> 错误码 一般错误以 "fail_xxx_xxx" 形式 非法权限操作以 "illegal_xxx_xxx" 形式 """ # -------------------------------------------------------...