content
stringlengths
7
1.05M
""" PDB Writer ========== """ class PdbWriter: """ A writer class for ``.pdb`` files. Examples -------- *Writing to a File with a Unit Cell* This writer can write to a file with the unit cell included for periodic molecules. Note that this always assumes P1 space group. .. test...
obj = { "type": "push", "targets": [ "stream", "android", "ios" ], "push":{ "type": "sms_changed", "source_device_iden": "ujzEgGbqE7UsjuPC94UrhA", "notifications": [{ "thread_id": "316", "title": "부계", "body": "ㅁ", "timestamp":1648564069 } ] } ...
class BaseParser: @classmethod def parse(cls, headers, entries): violations = [] for entry in entries: tokens = cls.parse_entry(headers, entry) violations.extend(cls.process_tokens(tokens)) return violations @classmethod def parse_entry(cls, headers, ent...
# This is where you store your creds to your wifi, and your API key for Openweathermap.org. # Rename this file to secrets.py before use and enter your wifi / api details. secrets = { 'ssid' : 'my_wifi', # Wifi Name to connect to 'password' : 'mypassword123', # Wifi Password 'timezone' ...
# config.py cfg = { 'name': 'YuFaceDetectNet', #'min_sizes': [[32, 64, 128], [256], [512]], #'steps': [32, 64, 128], 'min_sizes': [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]], 'steps': [8, 16, 32, 64], 'variance': [0.1, 0.2], 'clip': False, 'loc_weight': 1.0, 'gpu_train': Tru...
# ---------------------------------------------------------------------- # Copyright (c) 2014 Rafael Gonzalez. # # See the LICENSE file for details # ---------------------------------------------------------------------- class DiscreteValueError(ValueError): '''Discrete Value is not in range''' def __str__(sel...
# Бинго 75 + Результаты нескольких тиражей def test_bingo75_results_for_several_draws(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_game_bingo75() app.ResultAndPrizes.click_results_for_several_draws() app.ResultAndPrizes.click_ok_for_several_draws_modal_window() ...
# LOCAL DEVELOPMENT CONFIG FILE # More config options: https://flask.palletsprojects.com/en/1.1.x/config/ # Flask specific values TESTING = True APPLICATION_ROOT = "/" PREFERRED_URL_SCHEME = "http" # Custom values # Possible logging levels: # CRITICAL - FATAL - ERROR - WARNING - INFO - DEBUG - NOTSET LOGGER_LEVEL = "...
# -*- coding: utf-8 -*- """ Sveetoy Demo project to build with Optimus ``__version__`` define the Sass library version, not the demonstration project. """ __version__ = "0.9.1"
#DayDayUpQ4.py def dayUp(df): dayup = 1 for i in range(365): if i % 7 in [6,0]: dayup = dayup*(1-0.01) else: dayup = dayup*(1+df) return dayup dayfactor = 0.01 while dayUp(dayfactor) < 37.78: dayfactor += 0.001 print("工作日的努力参数是:{:.3f}".format(dayfactor))
""" Ejercicio 07 Dada una cantidad en metros, se requiere que la convierta a pies y pulgadas, considerando lo siguiente: 1 metro = 39.27 pulgadas; 1 pie = 12 pulgadas. Entradas Metros --> Float --> M Salidas Pies --> Float --> P_I Pulgadas --> Float--> P_U """ # Instrucciones al usuario print("Para conocer cual es la...
class Equipamento(): def __init__(self, id, numeroEquipamento, marca, modelo, situacao): self.id = id self.numeroEquipamento = numeroEquipamento self.marca=marca self.modelo = modelo self.situacao = situacao def atualizar(self, dados): try: id = dados...
def is_prime(a): if a % 2 == 0: print("Brawo!!") return ":)" return ":(" x = is_prime(4) print(x)
PERMISSIONS = ( # 'notify', # leads to unsupported access form 'friends', 'photos', 'audio', 'video', 'stories', 'pages', 'status', 'notes', # 'messages', # available only after moderation 'wall', 'offline', 'docs', 'groups', 'notifications', 'stats', ...
# -*- coding: utf-8 -*- """ Pipe Catalogue Data - Single Steel Pipe by LOGSTOR Created on Mon Nov 2 20:14:25 2020 @author: Hakan İbrahim Tol, PhD References: [1] LOGSTOR, Product Catalogue Version 2018.12. https://www.logstor.com/media/6115/product-catalogue-uk-201812.pdf """ def LayerDiameters(DN,I...
a = {} b = 123 c = '' d = {} print(a) e = 123.456 f = [1, "2", "3.14", False, {}, [4, "5", {}, True]] g = (1, "2", True, None)
def parse_string(input, vars={}): for var in vars: input = input.replace(f"${var}$", vars[var]) return input
""" Algorithm for calculating the most cost-efficient sequence for converting one string into another. The only allowed operations are --- Cost to copy a character is copy_cost --- Cost to replace a character is replace_cost --- Cost to delete a character is delete_cost --- Cost to insert a character is insert_c...
class ListSecure(list): def get(self, index, default=None): try: return self.__getitem__(index) except IndexError: return default
class Solution: def firstUniqChar(self, s: str) -> int: count = collections.Counter(s) for indx, ch in enumerate(s): if count[ch] < 2: return indx return -1
def bitcoinToEuros(bitcoin_amount, bitcoin_value_euros): euros_value=bitcoin_amount*bitcoin_value_euros return euros_value bitcoin_to_euros=25000 valor_bitcoin=bitcoinToEuros(1,bitcoin_to_euros) print(valor_bitcoin) if valor_bitcoin<=30000: print("el valor esta por debajo de 30000", valor_bitcoin)
# Code generated by font-to-py.py. # Font: DejaVuSans.ttf version = '0.26' def height(): return 12 def max_width(): return 12 def hmap(): return False def reverse(): return False def monospaced(): return False def min_ch(): return 32 def max_ch(): return 126 _font =\ b'\x06\x00\x02\x...
splitString ="The string has been\nsplit over\nserveral\nlines" print(splitString) # \n movex next string to next line tabbedString = "1\t2\t3\t4\t5\t6\t7\t8\t9" print(tabbedString) # \t moves next string with an tab space # for multiple special charecters print('The pet shop owner said, "No, no, \'e\'s uh,...he\'s r...
def primeFactors(n): prime_list=[2,3,5,7, 11, 13, 17, 19, 23, 29 , 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 , 73, 79, 83, 89, 97,101,103,107,109,113 ,127,131,137,139,149,151,157,163,167,173 ,179,181,191,193,197,199,211,223,227,229 ,233,239,241,251,257,263,269,271,277,281 ,283,293,307,311,313,317,331,337,347,349...
foods = ['bacon', 'tuna', 'ham', 'sausages', 'beef'] for f in foods: print(f) print(len(f))
base = [2.7, 3.1, 3.5, 3.8] def calculate(n: int): return [n+2.7, n+3.1, n+3.5, n+3.8] def solve(n: list): result = [] for roll in n: for numeral in calculate(roll): result.append(round(numeral, 1)) return list(dict.fromkeys(result)) print(solve(base))
a: int def Main() -> int: return a
def read_file(filepath): with open(filepath) as f: for line in f.readlines(): yield line.strip() def solution(): grid = [[0 for x in range(1000)] for y in range(1000)] grid_summary = {} overlapped_square_count = 0 for line in read_file("input.txt"): claim_id, rect_detai...
# -*- coding: utf-8 -*- """Curriculum Learning""" __authors__ = ['Georgios Pligoropoulos'] DEFAULT_SEED = 16011984 # Default random number generator seed if none provided.
def Value_Investing(self, training_data, testing_data=""): if testing_data == "": percent_taken = 30 index = ((100 - percent_taken) / 100) * len(training_data) testing_data = training_data[index:] return 0
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: if len(s) <= 1: return len(s) longest = 1 i = 1 curr = s[0] while i < len(s): if s[i] in curr: longest = max(longest, len(curr)) idx = curr.find(s[i]) ...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved. # # This source code is licensed under the Shuup Commerce Inc - # SELF HOSTED SOFTWARE LICENSE AGREEMENT executed by Shuup Commerce Inc, DBA as SHUUP® # and the Licensee. def schema_serializer_c...
"""Example OneDrive for Office365 local settings file. Copy this file to local.py and change these settings. """ ONEDRIVE_OAUTH_AUTH_ENDPOINT = 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize' ONEDRIVE_OAUTH_TOKEN_ENDPOINT = 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token' ONE...
t = int(input()) while t: N = int(input()) S = list(input()) R = list(input()) if S.count('1') == R.count('1'): print('YES') else: print('NO') t = t-1
#!/usr/bin/env python """ Contains modules for platform-specific methods. """
class TreeNode(): def __init__(self, x): self.val = x self.left = None self.right = None def __repr__(self): return '<TreeNode {}>'.format(self.val) def path_sum(root, target_sum): """ Given a binary tree and a sum, determine if the tree has a root-to-leaf path suc...
class UnknownOSException(Exception): pass class ChromeError(Exception): pass
# -*- coding: utf-8 -*- """ email: zhangmeng.lee@foxmail.com """ class JsonToMDTable: md_text = [] def __init__(self, data, bonus_values=list(), bonus_titles=list()): """ 根据json自动生成 MarkDown格式参数列表 :param data: 此时data为python的dict/list :param bonus_titles: 除['args', 'type']之...
def read_matrix(): r, c = [int(n) for n in input().split(', ')] matrix = [] for _ in range(r): row = [int(n) for n in input().split(', ')] matrix.append(row) return matrix matrix = read_matrix() total_sum = 0 for el in matrix: total_sum += sum(el) print(total_sum) print(matrix)
# -*- coding: utf-8 -*- """Top-level package for Redmine to JIRA Importers plugin.""" __author__ = """Michele Cardone""" __email__ = 'michele.cardone82@gmail.com' __version__ = '0.10.0'
class ViewBackgroundLightHandler(object): def __init__(self, viewOptions, grid, action): self.viewOptions = viewOptions self.action = action self.action.checkable = True self.action.connect("triggered()", self._onChecked) # background was 0,0,0 (black). now charcoal ...
class Clickomania: def __init__(self, N, M, K, state): self.row = N self.column = M self.color = K self.score = 0 self.state = state #This make a copy from the state def clone(self): NewClickomania = Clickomania(self.row, self.column, self.color, self.state...
f1 = open("name.txt") print(f1.tell()) print(f1.readline()) print(f1.tell()) print(f1.readline()) print(f1.tell()) print(f1.readline()) print(f1.tell()) print(f1.readline()) print(f1.tell()) print(f1.readline()) print(f1.tell()) print(f1.readline()) print(f1.tell()) f1.close()
class Square: def __init__(self, side): self.side = side def __str__(self): return 'A square with side %s' % self.side
# Time: O(n) # Space: O(1) class Solution(object): def isLongPressedName(self, name, typed): """ :type name: str :type typed: str :rtype: bool """ i = 0 for j in range(len(typed)): if i < len(name) and name[i] == typed[j]: i += 1 ...
""" Given a m * n matrix of ones and zeros, return how many square submatrices have all ones. Example 1: Input: matrix = [ [0,1,1,1], [1,1,1,1], [0,1,1,1] ] Output: 15 Explanation: There are 10 squares of side 1. There are 4 squares of side 2. There is 1 square of side 3. Total number of squares = 10 + 4 +...
SLACK_HOOK = { 'url' : '', 'port': 443, 'method': 'POST', 'channel': '', 'headers': { 'Content-Type': 'application/json' } } GITHUB_TOKEN = "" REPO_TOPIC = "" GITHUB_ORG = ""
workers = 2 bind = '127.0.0.1:8000' workers = 1 timeout = 60 errorlog = '/usr/local/apps/blog-nestor/nblog.gunicorng.error' accesslog = '/usr/local/apps/blog-nestor/nblog.gunicorng.access'
pay = 1 pay = 2 pay = 3 over
class Solution(object): def subsetsWithDup(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ nums.sort() self.nums, self.length = nums, len(nums) return [[]] + self.subsetHelper(0) def subsetHelper(self, start): r...
def gcd(i, j): for n in reversed(range(max(i, j)+1)): if i % n == 0 and j % n == 0: return n def is_coprime(i, j): return gcd(i, j) == 1 def totient(m): n = 0 for i in reversed(range(m+1)): if is_coprime(m, i): n = n + 1 return n def test_totient(): ...
print("Strings, (c) Verloka Vadim 2018\n\n\n") S1 = "Hello, {0}, how are you{1}" print(S1.format("Vadim", "?")) print("{:<20}".format("left")) print("{:>20}".format("right")) print("{:^20}".format("right")) print("{:*<20}".format("left")) print("{:*>20}".format("right")) print("{:*^20}".format("right")) print("{:1...
# Time: O(n) # Space: O(1) class Solution(object): lookup = {'0':'0', '1':'1', '6':'9', '8':'8', '9':'6'} # @param {string} num # @return {boolean} def isStrobogrammatic(self, num): n = len(num) for i in range((n+1) / 2): if num[n-1-i] not in self.lookup or \ ...
# -*- coding: utf-8 -*- # 循环 # for循环 names = ['Michael', 'Bob', 'Tracy'] for name in names: print(name) # 计算1+2+...+100 # 利用range()函数 sum = 0 for x in range(101): sum = sum + x print(sum) # while循环 n = 0 while n < 10: n = n + 1 print(n) n = 0 while n < 10: n = n + 1 if n % 2 == 0: continue print(n)
[2,1,3] [5,1,4,null,null,3,6] [2,1,4,null,null,3,6] [2,1,4,null,null,8,6] [] [1, 1, 1] [0, 1] [0, 1, 3] [10,5,15,null,null,6,20] [10,5,15,3,11,12,20] [3,null,30,10,null,null,15,null,45] [3,null,30,10,null,null,15,null,19]
load("//tools/bzl:maven_jar.bzl", "maven_jar") AWS_SDK_VER = "2.16.19" AWS_KINESIS_VER = "2.3.4" JACKSON_VER = "2.10.4" def external_plugin_deps(): maven_jar( name = "junit-platform", artifact = "org.junit.platform:junit-platform-commons:1.4.0", sha1 = "34d9983705c953b97abb01e1cd04647f4727...
""" Constants for use in the game """ SHIPS = "Ships" SYSTEMS = "SolarSystems" LOCATION = "Location" STATUS = "Status" HYPERLANES = "Hyperlanes" STARS = "Stars" PLANETS = "Planets" NAME = "Name" STATE = "State" POLL = "Poll" LIST = "List" SHIP = "Ship" MOVE = "Move" OBSERVE = "Observe" SUCCESS = "Success" RESULT_OBJEC...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def increasingBST(self, root): new_head = TreeNode(-1) self.rearrange(new_head, root) return new_head.right def rearr...
expected_output = { "track": { "1": { "type": "Interface", "instance": "Ethernet1/4", "subtrack": "IP Routing", "state": "DOWN", "change_count": 1, "last_change": "3w5d", "tracked_by": { ...
# # Exemplo de como usar os comandos Break e Continue # def loopBreak(): for x in range(5, 10): if x == 7: break print ("O valor de x é : ", x) # loopBreak() def loopContinue(): for x in range(5,10): if x == 7: continue print ("O valor d...
scores = {'AA': 10, 'BB': 20, "CC": 30} print("AA score:", scores['AA']) print("Before BB score:", scores['BB']) scores['BB'] = 100 print("After BB score:", scores["BB"]) age = {1, 2, 3} print(age)
def mySqrt(x): if(x==0): return 0 right = x left = 0 if right <=2 : return 1 if right > 10: left == 10 if (right > 2): while left <= right: m = (left+right)//2 if (m * m == x): return m if m * m < x: ...
''' Count Numbers with Unique Digits Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excluding [11,22,33,44,55,66,77,88,99]) ''' class Solution(object): def countNumbe...
class JwtAuthorizationTicket: def __init__(self, accessToken, refreshToken): self.access_token = accessToken self.refresh_token = refreshToken class JwtAuthorizationTicketHolder: def set_ticket(self, ticket): pass def get_ticket(self): pass class TransientJwtAuthorizat...
"""Screen""" SCREENSIZE = [640, 640] SCREENXMIDDLE = SCREENSIZE[0] // 2 CELLSIZE = 32 BOARDBEGINNINGX = 5 BOARDBEGINNINGY = 4 PIECECHOOSEPLACEY = 15 PIECECHOOSEPLACEX1 = 1 PIECECHOOSEPLACEX2 = 7 PIECECHOOSEPLACEX3 = 13 MAINMENUBUTTONPLACEY1 = 150 MAINMENUBUTTONPLACEY2 = 280 MAINMENUBUTTONPLACEY3 = 410 """Game loop...
class Cart: def __init__(self): self._contents = dict() def __repr__(self): return "{0} {1}".format(Cart, self.__dict__) def process(self, order): if order.add: if not order.item in self._contents: self._contents[order.item] = 0 ...
a = input('digite algo: ') print ('O tipo primitivo é:', type(a)) print('Só tem espaços?', a.isspace()) print('é um numeri?', a.isnumeric()) print('é alfabetico ? ', a.isalpha()) print('é alfanumerico?', a.isalnum()) print('Esta em maiúsculas ? ', a.isupper()) print('Esta em minusculas ?', a.islower()) print('esta cap...
SCHEMA = { 'REFERENCE': { 'gender': 'Gender', 'ethnicity': 'Ethnicity', 'economic_status': 'Economic Status', 'enrolled_8th': '8th Grade (FY 2009)', 'enrolled_9th': 'Enrolled in 9th Grade (FY 2010)', 'enrolled_9th_percent': '% Enrolled in 9th Grade (FY 2010)', ...
data = ( 'ddwim', # 0x00 'ddwib', # 0x01 'ddwibs', # 0x02 'ddwis', # 0x03 'ddwiss', # 0x04 'ddwing', # 0x05 'ddwij', # 0x06 'ddwic', # 0x07 'ddwik', # 0x08 'ddwit', # 0x09 'ddwip', # 0x0a 'ddwih', # 0x0b 'ddyu', # 0x0c 'ddyug', # 0x0d 'ddyugg', # 0x0e 'ddyugs...
# 复制源自https://tool.g3w.cn/jrxy/ flowCss="""<style type="text/css"> .bg-lv1[data-v-09009c6b] { background-color: #f4f4f4 } .bg-lv2[data-v-09009c6b] { background-color: #f9f9f9 } .bg-lv3[data-v-09009c6b] { ...
def lcs(str1, str2): if not str1 or not str2: return "" x, xs, y, ys = str1[0], str1[1:], str2[0], str2[1:] if x == y: return x + lcs(xs, ys) else: return max(lcs(str1, ys), lcs(xs, str2), key=len) def ascii_deletion_distance(str1, str2): sub = lcs(str1,str2) x,y,= sum([o...
class Version: __version = "0.3.0" __release_date = "2020-09-01" __compatible_version = ("0.3.0",) def __str__(self): return self.__version def get_compatible(self): return self.__compatible_version def get_release_date(self): return self.__release_date def ge...
print('Irei gerar uma PA') x = int(input('qual o primeiro termo? ')) y = int(input("Qual a razão? ")) n = x w = 1 while w <= 10: print('{} ->'.format(n), end='') n += y w += 1 j = 1 while j != 0: j = int(input('\n quantos numero a mais quer mostrar? ')) + w while w < j: print('{} ->'.format(...
class SimulationResult: def __init__(self, initialTileList, coordinateList, moves, attackStrategy): self.initialTileList = initialTileList self.coordinateList = coordinateList self.moves = moves self.attackStrategy = attackStrategy def SimulationResultString(self): ...
""" Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-value...
ALPHA = dict({ ('A', 'A'): 0, ('C', 'C'): 0, ('G', 'G'): 0, ('T', 'T'): 0, ('A', 'C'): 110, ('C', 'A'): 110, ('A', 'G'): 48, ('G', 'A'): 48, ('A', 'T'): 94, ('T', 'A'): 94, ('C', 'G'): 118, ('G', 'C'): 118, ('C', 'T'): 48, ('T', 'C'): 48, ('G', 'T'): 110, ...
# # PySNMP MIB module Dell-BRIDGEMIBOBJECTS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Dell-BRIDGEMIBOBJECTS-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:55:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
""" Hosoya triangle (originally Fibonacci triangle) is a triangular arrangement of numbers, where if you take any number it is the sum of 2 numbers above. First line is always 1, and second line is always {1 1}. This printHosoya function takes argument n which is the height of the triangle (number of lines). For ...
def enumerate_states(n_states, state_len, state, results): if n_states > 0: for sym in ('x', 'o', '_'): enumerate_states(n_states - 1, state_len, state + sym, results) if len(state) == state_len: results.append(state) state_len = 9 results = [] enumerate_states(state_len, state_...
class Token(object): Name = 'name' String = 'string' Number = 'number' Operator = 'operator' Boolean = 'boolean' Undefined = 'undefined' Null = 'null' Regex = 'regex' EOF = '(end)' LITERALS = [String, Number, Boolean, Regex, Null, Undefined] def __init__(self, source, type,...
super_value = '<value>' class Program: def __init__(self) -> None: self.ty_list = [] self.types = {} self.data_list = [] self.data = {} self.func_list = [] self.functions = {} def __str__(self) -> str: result = ".TYPE\n" for ty in self.ty_list...
class ExternalID: def __init__(self, config, connection): self._config = config self._connection = connection def get(self): return self._connection.get(url='/organisation/external-id') def create(self, data): return self._connection.post(url='/organisation/external-id', pay...
result = 0 ROWS = 6 COLUMNS = 50 screen = [[0 for _ in range(COLUMNS)] for __ in range(ROWS)] with open("input.txt", "r") as input: for line in input: line = line.strip() parsing = line.split() if parsing[0] == "rect": [x, y] = [int(n) for n in parsing[1].split("x")] ...
expected_output = { 'switch': { "1": { 'fan': { "1": { 'state': 'ok' }, "2": { 'state': 'ok' }, "3": { 'state': 'ok' } }, ...
DEBUG=False SQLALCHEMY_ECHO=False SQLALCHEMY_DATABASE_URI="sqlite:///:memory:" SQLALCHEMY_TRACK_MODIFICATIONS=False # FLASK_ADMIN_SWATCH="cerulean" MQTT_CLIENT_ID="shelfie_server" # MQTT_BROKER_URL="mosquitto" # MQTT_BROKER_PORT=1883 # MQTT_USERNAME="mosquitto_userid" # MQTT_PASSWORD="mosquitto_password" MQTT_KEEPALIVE...
# -*- coding: utf-8 -*- sehirler = ["Ankara","İstabul","İzmir"] for sehir in sehirler: if sehir == "İstanbul": # != demek şehir ankaradan farklıysa demek (eşit değilse),== (eşittir işareti) continue #sadece sadece istanbul için kod yazmaz break # break kırar devamını yazdırmaz break döngüyü biti...
VERSION = "0.0.1" # Application ENVADMIN_DB_NAME = "envadmin.json" DEFAULT_TABLE = "__default"
class Solution: def closestValue(self, root: TreeNode, target: float) -> int: upper = root.val lower = root.val while root : if target > root.val : lower = root.val root = root.right elif target < root.val : upper = ro...
# Engine class Engine(object): def __init__(self, room_map): self.room_map = room_map def play(self): current_room = self.room_map.opening_room() last_room = self.room_map.next_room('finished') while current_room != last_room: next_room_name = current_room.enter() ...
#!/usr/bin/env python # _*_ coding:utf-8 _*_ class Solution(object): def isValid(self, s): if not s: return True length = len(s) if length % 2 == 1: return False l = [''] * length last = -1 for c in s: if c == '(' or c == '{' or ...
lr = 0.0001 dropout_rate = 0.5 max_epoch = 3136 #3317 batch_size = 4096 w = 19 u = 9 glimpse_hidden = 128 bp_hidden = 128 glimpse_out = 128 nGlimpse = 7 lstm_cell_size = 128 action_hidden_1 = 256 action_hidden_2 = 256
contestsData={}; individualData={} while True: data=input() if data!="no more time": dataList=data.split(" -> ") username=dataList[0]; contest=dataList[1]; pts=dataList[2] contestFound=False; userFound=False for j in contestsData: if j==contest: ...
# Escreva um programa em que, dadas duas datas fornecidas # pelo usuário (uma de cada vez), mostre na tela a data mais # recente. Cada data deve ser lida por partes: primeiro o dia, # depois o mês e, por último, o ano (nesta ordem, cada leitura por vez). # Perceba que serão, portanto, três leituras para cada uma das du...
nome = 'Seu nome é Katia' idade = 33 peso = 72.2 print(nome, 'tem', idade, 'anos de idade', 'e pesa', peso)
""" Various string parsers. """ def floatArgs(s, cnt=None, failWith=None): """ Parse a comma-delimited list of floats. Args: s - the string to parse cnt - if set, the required number of floats. failWith - if set, a string to flesh out error strings. Returns: a...
# Copyright 2019 Katteli Inc. # TestFlows.com Open-Source Software Testing Framework (http://testflows.com) # # 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/lice...
# # PySNMP MIB module HPNSASCSI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPNSASCSI-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:42:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
""" Q104 Max Depth of Binary Tree Easy Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Note: A leaf is a node with no children. """ # Definition for a binary tree node. class TreeNode: def __init__(se...
# Refaça o DESAFIO 9, mostrando a tabuada de um número que o usuário escolher, só que agora utilizando um laço for. num = int(input('Digite um número para ver sua tabuada: ')) for c in range(1, 11): print('{} x {:2} = {}'.format(num, c, num*c))
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/3/13 20:49 # @Author : Steve Wu # @Site : # @File : util.py # @Software: PyCharm # @Github : https://github.com/stevehamwu # find word def find_word(keyword, sentence, start=0, end=-1, strict=False): """ word: str 'abc' sentence: lis...