content
stringlengths
7
1.05M
""" You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Ex: ...
# -*- coding: utf-8 -*- class MissingField(Exception): TEMPLATE = "[!] WARNING: mandatory field %s missing from capture" def __init__(self, value): super().__init__(self.TEMPLATE % value) class XmlWrapper(object): def __init__(self, layer): self.layer = layer @property def ty...
#!/usr/bin/env python nodes = {} with open('file2.txt', 'r') as file: for line in file: parent = line.split(')')[0].strip() children = [] try: children = line.split('->')[1].strip().split(', ') nodes[parent] = children except: nodes[parent] = chil...
a = [] n = int(input()) for i in range(n): temp = input() if temp not in a: a.append(temp) print(len(a))
class Store: def __init__(self): self.init() def add(self, target): self.targets.append(target) self.look_up_by_output[target.output] = target def init(self): self.targets = [] self.look_up_by_output = {} self.intermediate_targets = [] STORE = Store()
# каждая буква хранит количество вариатов раскладок из n элементов, раскладка перебирается с буквы X # | a: 0 X | b: 0 | c: 0 X | d: 0 | # | 0 0 | 0 X | 0 | 0 0 X | n, k = [int(q) for q in input().split()] hole = [] for i in range(k): x, y = [int(q) for q in input().split()] hole.append(2*(...
wort = deltat*UA/M/Cp glycol = deltat*UA/mj/cpj A = np.array([[1 - wort, wort], [glycol,1 - glycol]])
def result(num): if num % 3 == 0 and num % 5 == 0: return 'FizzBuzz' elif num % 3 == 0: return 'Fizz' elif num % 5 == 0: return 'Buzz' else: return num for n in range(1,100): print(result(n))
population = 100 # car car_sizes = [40, 80] car_color = (50, 50, 0) car_frame = 6
device = ['RTR02'] mode = 'jsnapy_pre' playbook_summary = 'Jsnapy pre' custom_def = False jsnapy_test = ['test_rsvp','test_bgp']
__version__ = '0.0.1' # Version synonym VERSION = __version__
def extractSilentfishHomeBlog(item): ''' Parser for 'silentfish.home.blog' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('RMS', 'Reincarnation of Master Su', ...
""" This module contains various dicts used in naruhodo. """ ProDict = { 'demonstrative-loc': ["ここ", "そこ", "あそこ", "こっち", "そっち", "あっち", "こちら", "そちら", "あちら"], 'demonstrative-obj': ["これ", "それ", "あれ", "そう", "こう", "こんな", "そんな", "あんな"], 'personal1st': ["私", "わたし", "俺", "おれ", "オレ", "僕", "ぼく", "僕ら", "ぼくら", "ボク", ...
x = 10 print(x == 2) # prints out false since 10 is not equal to 2 print(x == 3) # prints out False since 10 is not equal to 3 print(x < 3) # prints out false since 10 is not less than 3 print(x>3) # prints out true since 10 is greater than 3
List1 = [[0,1,2,3,4,5,6,7,8,9],[0,1,2,3,4,5,6,7,8,9]] print (List1[1],[1]) List2 = [1,1] print (List1[List2]) # Does not work
# Author: btjanaka (Bryon Tjanaka) # Problem: (UVa) 787 while True: try: line = input() except: break nums = list(map(int, line.split()[:-1])) mx = nums[0] for i in range(len(nums)): for j in range(i, len(nums)): prod = 1 for k in range(i, j + 1): ...
print ('-=-' * 10) print (' \033[1mWelcome to text analyzer\033[m') print ('-=-' * 10) phrase = str(input('\033[1;37mType a phrase\033[m: ' )).strip() print ('\033[1;37mThe phrase that was written was\033[m \033[1;32m{}\033[m'.format(phrase)) print ('-=-' * 13) print ('\033[1mThe number of words are\033[m \033[1;32m...
class box: def __init__(self,lst): self.height = lst[0] self.width = lst[1] self.breadth = lst[2] print("Creating a Box!") sum1 = self.height * self.width * self.breadth print(f"Volume of the box is {sum1} cubic units.") print("Box 1") b1 = box([10,10,10]) ...
"""Global mapping of repository:tag to image digests used by the container_pull macro This mapping is intended to protect against the container_pull upstream API deficiency where when a tag AND a digest are specified, the tag is ignored. It is easy to trip over updating the tag and forgetting to updatee the digest and...
#Input a variable x and check for Negative, Positive or Zero Number x = int(input("Enter a number: ")) if x < 0: print("Negative") elif x == 0: print("Zero") elif x > 0: print("Positive")
# part of requirement 1 # Asks for a file name and tries to find it and adds a file extention to the # input name. If it is not found, tell and try again untill it is found def enterFile(): # initialisation notFound = True # while the file isn't found, keep asking for a filename while notFound: ...
expected_output = { "instance_id": { 4100: {"lisp": 0}, 8188: { "lisp": 0, "site_name": { "site_uci": { "any-mac": { "last_register": "never", "up": "no", "who_last_reg...
load( "@io_bazel_rules_dotnet//dotnet/private:context.bzl", "dotnet_context", ) load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetLibrary", "DotnetResource", ) load( "@io_bazel_rules_dotnet//dotnet/private:rules/runfiles.bzl", "CopyRunfiles", ) def _unit_test(ctx): do...
# -*- python -*- load( "@local_config_cuda//cuda:build_defs.bzl", "cuda_default_copts", "if_cuda", "if_cuda_is_configured", ) def register_extension_info(**kwargs): pass def _make_search_paths(prefix, levels_to_root): return ",".join( [ "-rpath,%s/%s" % (prefix, "/".join(...
WORD = 0 CLASSIFICATION = 1 LINE = 2 MARK = '$' TOP = -1 SUBTOP = -2 class Syntactic: def __init__(self, lexical_input=['token', 'classification', 1]): self.lexical_input = lexical_input[::-1] self.success = False self._last_read = [] self._symbols_table = [] self._symbol_a...
""" Polimorfizm. """ class Zwierz: def __init__(self, nazwa, dzwiek): self.nazwa = nazwa self.dzwiek = dzwiek def __repr__(self): return "nazwa : %s dzwiek : %s" % (self.nazwa, self.dzwiek) def get_dzwiek(self): return self.dzwiek def get_typ(self): print("Z...
load("@bazel_skylib//lib:paths.bzl", "paths") load( "//ruby/private:providers.bzl", "RubyLibrary", ) def _transitive_srcs(deps): return struct( srcs = [ d[RubyLibrary].transitive_ruby_srcs for d in deps if RubyLibrary in d ], incpaths = [ d[RubyLibrary].ruby_incpaths for...
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud 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 limitation the rights to use, copy, modify, merge, p...
# 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 # distributed under t...
n = int(input("Enter a number: ")) statement = "is a prime number." for x in range(2,n): if n%x == 0: statement = 'is not a prime number.' print(n,statement)
def main(): a, b = map(int, input().split()) if 1 <= a and a <= 9 and 1 <= b and b <= 9: print(a * b) else: print(-1) if __name__ == '__main__': main()
print('='*10+' LOJAS AMERICANAS '+'='*10) compras = float(input('Preço das compras: R$')) print('FORMAS DE PAGAMENTO') print('[ 1 ] à vista') print('[ 2 ] à vista cartão') print('[ 3 ] 2x no cartão') print('[ 4 ] 3x ou mais no cartão') opção = int(input('Qual é a opção? ')) if opção == 1: print('Sua compra...
# # PySNMP MIB module Nortel-Magellan-Passport-DataIsdnMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-DataIsdnMIB # Produced by pysmi-0.3.4 at Wed May 1 14:26:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # U...
# Similar to test1, but this time B2 attempt to define base1_1. Since base1_1 # is already defined in B1 and F derives from both B1 and B2, this results # in an error. However, when building for B2 instead of F, defining base1_1 # should be OK. expected_results = { "f": { "desc": "attempt to redefine param...
#!/usr/bin/env python # Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module defines constants used for the sumo-carla co-simulation. """ ...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: MNN class STORAGE_TYPE(object): BUFFER = 0 UNIFORM = 1 IMAGE = 2
def drop_duplicates_in_input(untokenized_dataset): indices_to_keep = [] id_to_idx = {} outputs = [] for i, (id_, output) in enumerate(zip(untokenized_dataset["id"], untokenized_dataset["output"])): if id_ in id_to_idx: outputs[id_to_idx[id_]].append(output) continue ...
soma = 0 cont = 0 for n in range(1, 501, 2): if n % 3 == 0: cont += 1 soma += n print('A soma de todos os %i valores solicitados é igual a: %i' % (cont, soma))
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None # class Solution: # def preorderTraversal(self, root: TreeNode) -> List[int]: # return [root.val] + self.preorderTraversal(root.left) + self.preorderTraver...
class Solution: def findLucky(self, arr: List[int]) -> int: """Hash table. Running time: O(n) where n is the length of arr. """ d = {} for a in arr: d[a] = d.get(a, 0) + 1 res = -1 m = 0 for k, v in d.items(): if k == v and k >...
# There is only data available for one day. def run_SC(args): raise Exception() if __name__ == '__main__': run_SC({})
def min(a, b): if a > b: return b elif b > a: return a else: return a print(min(2, 2)) def max(a, b): if a >= b: return a elif b > a: return b def test1(a,b,c): if a == b: print("a is equal to b") elif b == c: print("a is not e...
INSTALLED_APPS = [ 'hooked', ] SECRET_KEY = 'nFG*WM(K7C9iun%Qy9G6De9XDZB$?4?Rj8KMBY[#7cue4#.Uj8'
#Exercicio 10 crie um programa que leia quanto dinheiro uma pessoa tem na #carteira e mostre quantos dólares ela pode comprar. carteira = float(input('O valor em carteira: ')) dolar = 1 reais = 3.27 wallet = carteira * (reais * dolar) print("O valor de ${} dólares vale ${} totalizando um montante de ${} dólares...
#!/usr/bin/env python3 # coding=utf-8 # author: @netmanchris # -*- coding: utf-8 -*- """ This module contains contains a single function to return the current version of the pyhpeimc library. The function should return the current value the library and should be updated with every new version """ def version(): ...
# data TARGET_FILE = '/cl/work/shusuke-t/BioIE/data/multi_label_corpus/longest_match/' test_data = TARGET_FILE + 'test_conllform.txt' toy_data = TARGET_FILE + 'toy.txt' # dict PROTEIN = '/cl/work/shusuke-t/BioIE/2019_03_05_keywords/protein.tsv' GENE = '/cl/work/shusuke-t/BioIE/2019_03_05_keywords/gene.tsv' #ENZYME = '...
""" Programming for linguists Implementation of the data structure "Binary Search Tree" """ class EmptyError (Exception): """ Custom Error """ class NoNodeError (Exception): """ Custom Error """ class Node: """ Node Data Structure """ def __init__(self, data): self...
# 2413 - Busca na Internet # https://www.urionlinejudge.com.br/judge/pt/problems/view/2413 def main(): print(int(input()) * 4) if __name__ == "__main__": main()
def bulk_chunks(actions, docs_per_chunk=300, bytes_per_chunk=None): """ Return groups of bulk-indexing operations to send to :meth:`~pyelasticsearch.ElasticSearch.bulk()`. Return an iterable of chunks, each of which is a JSON-encoded line or pair of lines in the format understood by ES's bulk API. ...
# Exercício 4.2 - Escreva um programa que pergunte a velocidade do carro de um # usuário. Caso ultrapasse 80 km/h, exiba uma mensagem dizendo que o usuário # foi multado. Nesse caso, exiba o valor da multa, cobrando R$ 5 por km acima de # 80 km/h. velocidade = int(input('\nInforme a velocidade do veículo (em KM/h): ')...
filename_top_left = "cmu_top_left.txt" filename_top_right = "cmu_top_right.txt" filename_bottom_left = "cmu_bottom_left.txt" filename_bottom_right = "cmu_bottom_right.txt" filename_output = "cmu.txt" n_rows = 100 out = open(filename_output,"w") def getRows(file): rows = [] for line in file: if(li...
class RawSerialisation: """ A "serialiser" that just does nothing, only returning raw `bytes` (and making sure that bytes is indeed the type that is being sent/received). """ mimetype = 'application/octet-stream' @staticmethod def dumps(o): if isinstance(o, (list, tuple)): ...
#creating prompts name = input("What is your name?") age = int(input("How old are you?")) true_false = bool(input("True or False: Is this statement true?")) print("My name is " + str(name)) print("My age is " + str(age)) print ("I will be " + str(age + 1) + " this year") print("This statement is " + str(true_false))
class Solution(object): def XXX(self, head): """ :type head: ListNode :rtype: ListNode """ # 思路:创建hash表,保留前一个位置的游标,用来删除节点 hash_list = [] ptr = head while ptr != None: if ptr.val not in hash_list: hash_list.append(pt...
def main(): s1 = input() # String. s1 = dict.fromkeys(s1) # Convert it to dictionary to remove duplicates. if len(s1) % 2 == 0: print("CHAT WITH HER!") else: print("IGNORE HIM!") if __name__ == "__main__": main()
numero = int(input('Escreva um número inteiro: ')) d = numero * 2 t = numero * 3 r = numero ** (1/2) print('Número escolhido: ', numero) print('O dobro do número escolhido é {}, o triplo é {} e sua raiz quadrada é {}.'.format(d, t, r))
class Bike(object): def __init__(self, description, condition, sale_price, cost=0): # Different initial values for every new instance self.description = description self.condition = condition self.sale_price = sale_price self.cost = cost # Same initial value for ever...
def service_category(): """ServiceCategory https://www.hl7.org/fhir/valueset-service-category.html Demographics and other administrative information about an individual or animal receiving care or other health-related services. This value set is used in the following places: CodeSystem: This ...
"""Exception classes.""" class StructureParserException(Exception): """Exception to signal errors when parsing PDB/mmCIF files.""" pass class MatrixReadingException(Exception): """Exception to signal error when reading matrices from file."""
input_template = keras.layers.Input(shape=[None,1,16]) input_search = keras.layers.Input(shape=[47,1,16]) def x_corr_map(inputs): input_template = inputs[0] input_search = inputs[1] input_template = tf.transpose(input_template, perm=[1,2,0,3]) input_search = tf.transpose(input_search, perm=[1,2,0,3]) ...
# kittystuff: what do cats care about class KittyStuff: def __init__(self): self.lives = 9 self.enemies = [] self.enemies.append('dog') self.happiness = 0 def purr(self, happiness_level=0): purring = 'purr' for i in range(0, happiness_level): purring...
output_columns = ['PheWAS Code', 'PheWAS Name', 'p-val', '\"-log(p)\"', 'beta', 'Conf-interval beta', 'cpt'] imbalance_colors = { 0: 'white', 1: 'deepskyblue', -1: 'red' } m = len(fm[0]) p_values = n...
class Solution: def primePalindrome(self, N: int) -> int: if 8 <= N <= 11: return 11 def isPrime(num): if num < 2 or num % 2 == 0: return num == 2 return all(num % i for i in range(3, int(num**0.5) + 1, 2)) for i in range(1, 100000...
class Solution: def hasPath(self, maze: List[List[int]], start: List[int], destination: List[int]) -> bool: m = len(maze) n = len(maze[0]) dirs = [0, 1, 0, -1, 0] seen = set() def isValid(x: int, y: int) -> bool: return 0 <= x < m and 0 <= y < n and maze[x][y] == 0 def dfs(i: int, j: ...
# https://www.codewars.com/kata/550f22f4d758534c1100025a/ def dirreduc(arr): DIRECT = { "NORTH": "SOUTH", "SOUTH": "NORTH", "EAST": "WEST", "WEST": "EAST", } i = 0 while i + 1 < len(arr) and len(arr) >= 2: if arr[i] == DIRECT[arr[i + 1]]: arr.pop(i) ...
"""weight dict definitions""" weights_sanctum_of_domination = { 'pw_ba_1': 0.000, 'pw_sa_1': 0.055, 'pw_na_1': 0.570, 'lm_ba_1': 0.000, 'lm_sa_1': 0.050, 'lm_na_1': 0.205, 'hm_ba_1': 0.000, 'hm_sa_1': 0.000, 'hm_na_1': 0.000, 'pw_ba_2': 0.020, 'pw_sa_2': 0.020, 'pw_na_2'...
examples_list = [ 'hello_world', 'many_to_one', 'many_to_one_options', 'many_to_one_to_self', 'many_to_many', 'many_to_many_options', 'many_to_many_to_self', 'one_to_one', 'multiple_many_to_one', 'raw_sql', 'multiple_databases', 'table_inheritance', 'meta...
# Projeto: VemPython/exe035 # Autor: rafael # Data: 15/03/18 - 15:16 # Objetivo: TODO Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas podem ou não # formar um triangulo print('DE DOER ESSE TRIANGULO\n') a = float(input('Informe a primeira Reta: ')) b = float(input('Informe a segu...
# encoding: UTF-8 # __slots__ # __slots__变量可以限定自定义类型的对象只能绑定某些属性 # __slots__的限定只对当前类的对象生效,对子类并不起任何作用 class Person(object): # 限制Person对象只能绑定_name, _age 和 _gender 属性 __slots__ = ('_name', '_age', '_gender') def __init__(self, name, age): self._name = name self._age = age @property def name(self): return se...
Votes = [] count = 0 while True: try: N = int(input('')) Votes = list(map(int, input().split())) for i in Votes: if i == 1: count += 1 if count >= (2 * len(Votes)) / 3: print('impeachment') count = 0 else: print('acusacao arquivada') count = 0 ...
a = float(input("Triangle base: ")) h = float(input("Triangle height: ")) calc = (a * h) / 2 print(float(calc))
''' Base environment definitions See docs/api.md for api documentation ''' class AECEnv: def __init__(self): pass def step(self, action): raise NotImplementedError def reset(self): raise NotImplementedError def seed(self, seed=None): pass def observe(self, agen...
""" Problem Description: Cody is Professor at Zing University. He teaches English there. During his first class, he found the students are very talkative. So,he decided to divide the class into two sections, A & B such that the difference between the strength of two sections is minimum. Print the strength of two sec...
class CredentialAPI(): """Wraps credential API.""" def __init__(self, session): """intialiaze a new Credential API""" self.session = session def get_credentials(self, provider_name): """Get a tuple of containing credentials for the supplied provider, chosen at random""" res...
somatorio = 0 qtdnum = 0 for c in range(1, 501): if c % 3 == 0 and c % 2 != 0: somatorio += c qtdnum = qtdnum + 1 print(somatorio) print(qtdnum)
"""GeoNet NZ Volcanic Alert Level constants.""" ATTR_ACTIVITY = "activity" ATTR_HAZARDS = "hazards" ATTR_LEVEL = "level" ATTR_VOLCANO_ID = "volcanoID" ATTR_VOLCANO_TITLE = "volcanoTitle" ATTRIBUTION = "GeoNet Geological hazard information for New Zealand" URL = "https://api.geonet.org.nz/volcano/val"
def point_compare(a, b): if is_point(a) and is_point(b): return a[0] - b[0] or a[1] - b[1] #def is_point(p): # try: # float(p[0]), float(p[1]) # except (TypeError, IndexError): # return False is_point = lambda x : isinstance(x,list) and len(x)==2 class Strut(list): def __init__(self,...
N = int(input()) h = N // 3600 N = N - h * 3600 m = N // 60 N = N - m * 60 print('{}:{}:{}'.format(h, m, N))
julia = "Julia", "Roberts", 1967, "Duplicity", 2009, "Actress", "Atlanta, Georgia" name, surname, birth_year, movie, movie_year, profession, birth_place = julia ######### (a, b, c, d) = (1, 2, 3) # ValueError: need more than 3 values to unpack ######### def add(x, y): return x + y print(add(3, 4)) z = (5, 4) pri...
#website compile doctype = "html" lang = "en-US" author = "Angelo Carrabba" self.keywords = [] spacing = 0 class webPage(): def __init__(self): self.pageName = "" self.title = "" self.styleSheets = [] self.scripts = [] self.description = "" self.menu = "" def p...
""" In a factory a printer prints labels for boxes. For one kind of boxes the printer has to use colors which, for the sake of simplicity, are named with letters from a to m. The colors used by the printer are recorded in a control string. For example a "good" control string would be aaabbbbhaijjjm meaning that the pr...
""" PASSENGERS """ numPassengers = 30645 passenger_arriving = ( (7, 8, 5, 10, 6, 4, 3, 6, 2, 0, 1, 1, 0, 11, 2, 11, 4, 5, 7, 6, 2, 2, 5, 2, 0, 0), # 0 (8, 9, 5, 4, 5, 3, 4, 5, 3, 4, 2, 1, 0, 15, 9, 4, 2, 5, 2, 5, 3, 3, 4, 0, 2, 0), # 1 (5, 6, 6, 8, 5, 1, 5, 4, 5, 3, 2, 0, 0, 3, 8, 4, 4, 10, 5, 4, 2, 1, 3, 2, 0,...
''' ret, thresh = cv2.threshold(img.copy(), 75, 255, cv2.THRESH_BINARY_INV) contours, _ = cv2.findContours( thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) preprocessed_digits = [] for c in contours: x, y, w, h = cv2.boundingRect(c) # Creating a rectangle around the...
# License MIT (https://opensource.org/licenses/MIT). # Copyright 2015-2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev> # Copyright 2015 Veronika veryberry <https://github.com/veryberry> # Copyright 2016 Ilmir Karamov <https://it-projects.info/team/ilmir-k> # Copyright 2016 Alex Comba <https://github.com/...
items = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] for x in items: print(x) for x in "1234567890": print(x) input("are you ready to go?") for x in range(999999999): print(x)
#Node class Node(object): def __init__(self, content, next=None): self.content = content self.next = next #Stack LIFO class Stack(object): def __init__(self): self.head = None self.top = None self.next = None #isEmpty? def isEmpty(self): return sel...
# # @lc app=leetcode.cn id=434 lang=python3 # # [434] 字符串中的单词数 # # https://leetcode-cn.com/problems/number-of-segments-in-a-string/description/ # # algorithms # Easy (29.68%) # Total Accepted: 4.5K # Total Submissions: 15.3K # Testcase Example: '"Hello, my name is John"' # # 统计字符串中的单词个数,这里的单词指的是连续的不是空格的字符。 # # 请注意...
# Listas, dicionários (objetos mutáveis) # Tuplas, strings, números, True, False, None (Imutável) # Problema de parametro mutavel em função """ def lista_de_cliente(clientes_iteravel, lista=[]): lista.extend(clientes_iteravel) return lista clientes1 = lista_de_cliente(['joão', 'Maria', 'Eduardo']) clientes2 ...
# number = 90 # # running = True # # while running: # # guess = int(input('Enter an integer:')) # # if guess == number: # print('Congratulations, You guessed it!') # # running = False # # elif guess < number: # print('No , it is a little higher than that.') # # else : # # ...
# Abhishek Parashar # counting zeroes in an array t= int(input()) while(t>0): n=int(input()) a=list(map(int,input().split())) count=0 for i in a: if(i==0): count=count+1 print(count) t=t-1
# coding=UTF-8 # ex:ts=4:sw=4:et=on # ------------------------------------------------------------------------- # Copyright (C) 2014 by Mathijs Dumon <mathijs dot dumon at gmail dot com> # # mvc is a framework derived from the original pygtkmvc framework # hosted at: <http://sourceforge.net/projects/pygtkmvc/> # # ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 2017-12-20 @author: liuqun ''' class AlipayClientConfig(object): def __init__(self, sandbox_debug=False): # 开发者应用id self._app_id = '' # 请求签名类型,推荐RSA2 self._sign_type = 'RSA2' # 开发者应用私钥 self._app_private...
class ACCUMULATE_METHODS: Execute = "execute" ExecuteAddCredits = "add-credits" ExecuteCreateAdi = "create-adi" ExecuteCreateDataAccount = "create-data-account" ExecuteCreateKeyBook = "create-key-book" ExecuteCreateKeyPage = "create-key-page" ExecuteCreateToken = "create-token" ExecuteCr...
class Dragons: def __init__(self, strength, rewards): self.strength = strength self.rewards = rewards def shell_sort(arr): n = len(arr) gap = n//2 while gap > 0: for i in range(gap,n): temp = arr[i] j = i while j >= gap and arr[j-gap].strength > temp.st...
s=input() s=s.strip('0') if s==s[::-1]: print("Yes") else: print("No")
""" 242 valid anagram easy hash 20210604 Given two strings s and t, return true if t is an anagram of s, and false otherwise. """ class Solution: def isAnagram(self, s: str, t: str) -> bool: hash = {} for c in s: if c not in hash: hash[c] = 1 else: ...
# O(nW) def knapsack_no_repetition(w, v, W): table = [] l = len(w) for i in range(l + 1): table.append([]) for cap in range(W+1): if i == 0 or cap == 0: table[-1].append(0) else: if w[i-1] > cap: table[-1].append(table[i-1][ca...
def convert(s: str, numRows: int) -> str: if numRows == 1: return s rows = [] current_row = 0 going_down = False for i in range(0, min(numRows, len(s))): rows.append("") for char in s: rows[current_row] += char if (current_row == 0 or current_row == numRows - 1)...
class Solution(object): # @param A : tuple of integers # @param B : integer # @return a list of integers def twoSum(self, A, B): dp = dict() for i, a in enumerate(A): if a in dp: return dp[a] + 1, i + 1 if B - a not in dp: dp[B - a...
load("//testsuite:testsuite.bzl", "jflex_testsuite") jflex_testsuite( name = "SemcheckTest", srcs = [ "SemcheckTest.java", ], data = [ "semcheck.flex", "semcheck-flex.output", ], deps = [ "//jflex/src/main/java/jflex/exceptions", ], )