content
stringlengths
7
1.05M
print(min(1, 2, 3, 4, 0, 2, 1)) print(max([1, 4, 9, 2, 5, 6, 8])) print(abs(-99)) print(abs(42)) print(sum([1, 2, 3, 4, 5]))
def Setup(Settings,DefaultModel): # set1-test_of_models_against_datasets/osm299.py Settings["experiment_name"] = "set1_Img_model_versus_datasets_299px" Settings["graph_histories"] = ['together'] #['all','together',[],[1,0],[0,0,0],[]] # 5556x_minlen30_640px 5556x_minlen20_640px 5556x_reslen20_299px 5...
xs = ( x and x for x in range(10) if x and x )
Scale.default = "chromatic" Root.default = 2 Clock.bpm = 120 drp = [0, 7, 12, 17, 21, 26] std = [0, 5, 10, 15, 19, 24] p1 >> play( "<Vs>< n >", sample = 2, ).every(5, "stutter", 2, dur=3) p2 >> play( "{ ppP[pP][Pp]}", sample = PRand(5), rate = PRand([0.5, 1, 2]), ) a1 >> karp( oct = PRand(...
# The count-and-say sequence is the sequence of integers with the first five terms as following: # 1. 1 # 2. 11 # 3. 21 # 4. 1211 # 5. 111221 # 1 is read off as "one 1" or 11. # 11 is read off as "two 1s" or 21. # 21 is read off as "one 2, then one 1" or 1211. # Given an integer n where 1 ≤ n ≤ 30...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ aws_default_parameters.py This module holds default parameters and/or objects to be used by the AWS ATS. """ # Defaults to use when accessing services on the main AWS SysLink instance. DEFAULT_AWS_SYSLINK_ACCESS_DATA = { 'name': 'systemlink-jenkins.aws.natinst.com'...
def solveMeFirst(a, b): return a + b print(solveMeFirst(1, 2))
numero = float(input('Digite um número: ')) dobro = numero*2 triplo = numero*3 raiz_quad = pow(numero,1/2) print('Em relação ao número {}:\n' 'O dobro é {}\n' 'O triplo é {}\n' 'A raiz quadrada é {}'.format(numero, dobro, triplo, raiz_quad))
""" https://leetcode.com/problems/univalued-binary-tree/ A binary tree is univalued if every node in the tree has the same value. Return true if and only if the given tree is univalued. Example 1: Input: [1,1,1,1,1,null,1] Output: true Example 2: Input: [2,2,2,5,2] Output: false Note: The number of nodes in ...
# -*- coding: utf-8 -*- # @Author: David Hanson # @Date: 2021-01-30 23:30:31 # @Last Modified by: David Hanson # @Last Modified time: 2021-01-31 13:41:39 counter = 0 def inception(): global counter print(counter) if counter > 3: return "done!" counter += 1 return inception() inception(...
class Vehicle(): def __init__(self, wheels, max_weight, max_volume): self.wheels = wheels self.speed = 0 self._packages = [] self.max_weight = max_weight self.max_volume = max_volume def accelerate(self, amount): self.speed += amount def add_packages(self, packages): if not isinstan...
#!/usr/bin/env python # -*- coding: utf-8 -*- def neues_konto(inhaber, kontonummer, kontostand, max_tagesumsatz=1500): return { "Inhaber" : inhaber, "Kontonummer" : kontonummer, "Kontostand" : kontostand, "MaxTagesumsatz" : max_tagesumsatz, "UmsatzHeute" : 0 ...
class Citizen: """A not-so-simple example Class""" def __init__(self, first_name, last_name): self.first_name = str(first_name) self.last_name= str(last_name) def full_name(self): return self.first_name + ' ' + self.last_name greeting = 'For the glory of Python!' x = Citizen(...
class InvalidFileNameError(Exception): """Occurs when an invalid file name is provided.""" def __init__(self, name): self.name = name
def first_recurring(data): seen = [] for index in data: if index not in seen: seen.append(index) else: return index return "All unique characters." data = [1, 2, 3, 3, 2, 1, 3] print("first_recurring():", first_recurring(data))
class Matrix: def __init__(self, matrix_string): self.matrix = [[int(a) for a in line.split()] for line in matrix_string.splitlines()] def row(self, row): return (self.matrix.copy())[row-1] def column(self, col): #return [self.matrix[k][col-1] for k in enumerate(len(self.matrix))] ...
number = input() def get_sums(number): return [sum(list(map(int, filter(lambda x: int(x) % 2 == 0, number)))), sum([int(x) for x in number if int(x) % 2 == 1])] result = get_sums(number) print(f"Odd sum = {result[1]}, Even sum = {result[0]}")
""" Package version. """ __version__ = '1.0.2'
#!/usr/bin/python3 Rectangle = __import__('6-rectangle').Rectangle my_rectangle_1 = Rectangle(2, 4) my_rectangle_2 = Rectangle(2, 4) print("{:d} instances of Rectangle".format(Rectangle.number_of_instances)) del my_rectangle_1 print("{:d} instances of Rectangle".format(Rectangle.number_of_instances)) del my_rectangle_...
def export_users(users, workbook, mimic_upload=False): data_prefix = 'data: ' if mimic_upload else 'd.' user_keys = ('user_id', 'username', 'is_active', 'name', 'groups') user_rows = [] fields = set() for user in users: user_row = {} for key in user_keys: if key == 'usern...
#!python3 # 5. Программа запрашивает у пользователя строку чисел, разделенных пробелом. # При нажатии Enter должна выводиться сумма чисел. # Пользователь может продолжить ввод чисел, разделенных пробелом и снова нажать Enter. # Сумма вновь введенных чисел будет добавляться к уже подсчитанной сумме. # Но если вместо чи...
'''[Question 10952] ''' # import sys # while True: # try: # a, b = map(int, sys.stdin.readline().split()) # print(a+b) # except: # break ''' Fail [Question 1110] ''' # import sys # copy = n = int(sys.stdin.readline()) # count = 0 # while True: # a = copy//10 # b = copy%10 # ...
def get_input(): numbers_dict = {} command = str(input()) while command != "Search": try: number = int(input()) except ValueError: print('The variable number must be an integer') command = str(input()) continue numbers_dict[command] = n...
class Solution: """ @param A: An integer array @param k: A positive integer (k <= length(A)) @param target: An integer @return: An integer """ def kSum(self, A, k, target): pass
def max_sub_array(nums, max_sum=None, current_sum=0, current_index=0): """ Returns the max subarray of the given list of numbers. Returns 0 if nums is None or an empty list. Time Complexity: O(n) Space Complexity: O(1) """ if nums == None: return 0 if len(nums) == 0...
"""Collection of utilities""" def with_metaclass(meta, *bases): """Create a base class with a metaclass. Code taken from six (https://pypi.python.org/pypi/six). """ # This requires a bit of explanation: the basic idea is to make a dummy # metaclass for one level of class instantiation that replace...
class DictValidator: def __init__(self): directives = [seg.strip().replace("\n", "").strip() for seg in self.__doc__.split("@")] v_name = "__SPEC_%s" % (self.__class__.__name__.upper()) globals().update({ v_name: self, }) self.directives = directives self...
#!/usr/bin/python def web_socket_do_extra_handshake(request): request.ws_protocol = 'foobar' def web_socket_transfer_data(request): pass
""" Helpers. """ def _clean_readme(content): """ Clean instructions such as ``.. only:: html``. :param content: content of an rst file :return: cleaned content """ lines = content.split("\n") indent = None less = None rows = [] for i, line in enumerate(lines): sline = l...
# Definition for a binary tree node. class TreeNode(object): def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution(object): def sortedArrayToBST(self, nums): """ :type nums: List[int] :rtype: TreeNode...
# # This file contains constants and methods for configurations in the # TinkerSpaceCommand server. # CONFIG_NAME_EXTERNAL_ID = "externalId" CONFIG_NAME_NAME = "name" CONFIG_NAME_DESCRIPTION = "description" CONFIG_NAME_MEASUREMENT_TYPE = "measurementType" CONFIG_NAME_MEASUREMENT_UNIT = "measurementUnit" CONFIG_N...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def pseudoPalindromicPaths (self, root: TreeNode) -> int: counter = [0] * 10 self.cnt = 0 ...
__version__ = "0.3.3" def version(): return __version__
""" Aim: From a list of integers, check and return a set of integers whose sum will be equal to the target value K. """ # Main Recursive function to find the desired Subset Sum def Subset_Sum(li, target, ans=[]): # Base Cases if target == 0 and ans != []: return ans elif li == []: ...
def get_steam_transaction_fee() -> float: # Reference: https://support.steampowered.com/kb_article.php?ref=6088-UDXM-7214#steamfee steam_transaction_fee = 0.05 return steam_transaction_fee def get_game_specific_transaction_fee() -> float: # Reference: https://support.steampowered.com/kb_article.php?...
registry = {} def access(key): return registry[key]
#!/usr/bin/env python # encoding: utf-8 """Group Polls 2 # Polls """ class d: """Group Question 2 ## Choice [/questions/{question_id}/choices/{choice_id}] + Parameters + question_id: 1 (required, number) - ID of the Question in form of an integer + choice_id: 1 (required, number) - ID of ...
# https://en.bitcoin.it/wiki/Secp256k1 _p = 115792089237316195423570985008687907853269984665640564039457584007908834671663 _n = 115792089237316195423570985008687907852837564279074904382605163141518161494337 _a = 0 _b = 7 _gx = int("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", 16) _gy = int("483ada...
# Print the result of 9 / 2 print(9 / 2) # Print the result of 7 * 5 print(7 * 5) # Print the remainder of 5 divided by 2 using % print(5 % 2)
# print the tuples for the conflict_table inputs def print_lines(l): for e in l: l2 = l[:] l2.remove(e) for f in l2: l3 = l2[:] l3.remove(f) for g in l3: l4 = l3[:] l4.remove(g) for h in l4: ...
# COLORS BLACK = (0, 0, 0) # Black WHITE = (255, 255, 255) # White YELLOW = (255, 255, 0) # Yellow RED = (255, 0, 0) # SCREEN WIDTH, HEIGHT = (1000, 800) # Screen dims SCREEN_DIMS = (WIDTH, HEIGHT) CENTER = (WIDTH // 2, HEIGHT // 2) # GAME OPTIONS FPS = 60 PLAYER_SPEED = 1.01 PLAYER_COORD = [ (CENTER[0] - 10, C...
class Pomodorer: """Clase que representa la interfaz de comunicacion de un sistema pomodoro""" def __init__(self, event_system): self._report = [[]] self.event_system = event_system def run_pomodoro(self): pass def get_report(self): agg = [] for series i...
def hexal_to_decimal(s): """ s in form 0X< hexal digits> returns int in decimal""" s = s[2:] s = s[::-1] s = list(s) for i, e in enumerate(s): if s[i] == "A": s[i] = "10" if s[i] == "B": s[i] = "11" if s[i] == "C": s[i] = "12" if s[i] == "D": s[i] = "13" if s[i] == "E": s[i] = "14" if s[i] == "F": s[i...
n1 = float(input('qual a primeira nota do aluno?: ')) n2 = float(input('qual a segunda nota do aluno?: ')) media = (n1 + n2)/2 if media < 5.0: print('a media do aluno foi {}, aluno REPROVADO!'.format(media)) elif media >=5 and media <=6.9: print('a media do aluno foi {}, aluno em RECUPERAÇÃO!'.format(media)) el...
bole=True n=0 while n<=30: n=n+1 print(f'ola turma{n}') break print('passou')
#from cryptomath import * #import Cryptoalphabet as ca #alpha = ca.Cryptoalphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ") def affine_encode(plaintext, a, b): process = "" cipherFinal = "" modulusValue = len(alphabet) #removes punctuation from plaintext for s in plaintext: if s!= '.' and s!= ',' and s!= ' ' and s!= '!' an...
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") results = dict() def solution(N): # write your code in Python 3.6 # 1000000 if N in results: return results[N] else: result = f_series(N) results[N] = result return result def f...
def isgore(a,b): nbr1=int(a+b) nbr2=int(b+a) return nbr1>=nbr2 def largest_number(a): res = "" while len(a)!=0: mx=0 for x in a: if isgore(str(x),str(mx)): mx=x res+=str(mx) a.remove(mx) return res n = int(input()) a = list(map(int,...
class Converter(object): """Base class for all converters.""" def convert_state(self, s, info=None): """Convert state to be consumable by the neural network. Base implementation returns original state. Parameters ---------- s : obj State as it is received...
weight=1 a = _State('hh', 'naziv') def run(): @_spawn(_name='haha') def _(): #with _while(1): _label('a') _goto('a') _label('b') p1=nazadp.picked() p2=napredp.picked() sleep(0.1) @_do def _(): # print('drzi ', hex(p1.val), hex(p2.val)) print('drzi ', p1.val, p2.val) _goto('b') for i in ran...
name = 'Abid' age = 25 salary = 15.5 # Earning in Ks print(name, age, salary) print(' My name is ' + name + ' and my age is ' + str(age) + ' and I earn ' + str(salary) + 'K per month')
class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' lista = list() espacios = 0 print(bcolors.BOLD, "Programa que calcula la longitud de un ...
def create_rooted_spanning_tree(G, root): def s_rec(root, S): for node in G[root]: if node in S: if root not in S[node]: S.setdefault(root, {})[node] = 'red' S[node][root] = 'red' else: S.setdefault(root, {})[nod...
# -*- coding: utf-8 -*- def test1(): print("test1") def test2(): print("test2")
# -*- coding: utf-8 -*- """ 14. Longest Common Prefix 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 1: 输入: ["flower","flow","flight"] 输出: "fl" 示例 2: 输入: ["dog","racecar","car"] 输出: "" 解释: 输入不存在公共前缀。 说明: 所有输入只包含小写字母 a-z 。 解题思路: 选择一个字符最短的作为参考,然后迭代strs 列表中的所有字符是否和最短字符里的字符一一对应,如不对应 跳出循环,返回当前0-当前下标的字符 """ class...
# This is an AWESOME LIBRARY. # You can use its AWESOME CLASSES to do Great Things. # The author however DOESN'T allow you to CHANGE the source code and taint it with Pyro decorators! class WeirdReturnType(object): def __init__(self, value): self.value = value class AwesomeClass(object): def method(...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 3 17:27:00 2019 @author: war-machince """ docker_path = './' NFS_path_AoA = docker_path NFS_path = docker_path save_NFS = docker_path
class Song: def __init__(self, name, lenght, single): self.name = name self.lenght = lenght self.single = single def get_info(self): return f"{self.name} - {self.lenght}"
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-06 Last_modify: 2016-03-06 ****************************************** ''' ''' Given preorder and inorder traversal of a ...
class BaseEngine(object): database = '' def __init__(self, databaseName="epubdb"): self.databaseName = databaseName self.databasePath = "databases/" + databaseName self.open() pass def open(self): ''' Opens the database for reading ''' p...
a, b, c = [int(x) for x in input().split()] if a >= b >= c: print(c, b, a, sep='\n') elif a >= c >= b: print(b, c, a, sep='\n') elif b >= a >= c: print(c, a, b, sep='\n') elif b >= c >= a: print(a, c, b, sep='\n') elif c >= a >= b: print(b, a, c, sep='\n') elif c >= b >= a: print(a, b, c, sep='...
class ListNode: def __init__(self, x): self.x = x self.val = x self.next = None class PointNode: def __init__(self, x, y): self.x = x self.y = y # Definition for singly-linked list with a random pointer. class RandomListNode: def __init__(self, x): self.labe...
""" These classes are used to represent the objects drawn on a drawing layer. **Note** These calsses should be kept picklable to be sent over a Pipe Not to be confused with classes in Detection.* . In addition to coordinates thse also store color, alpha and other displaying parameters """ class Line(object): d...
class OTMSConfig(object): MYSQL_DATABASE_USER = 'root' MYSQL_DATABASE_PASSWORD = '' MYSQL_DATABASE_DB = 'otms' MYSQL_DATABASE_PORT = '3308' MYSQL_DATABASE_HOST = 'localhost'
# # Simple Image # # Copyright 2017, Adam Edwards # # 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 a...
class Solution: def myPow(self, x: float, n: int) -> float: """ Implement pow(x, n), which calculates x raised to the power n (x^n). Note: - -100.0 < x < 100.0 - n is a 32-bit signed integer, within the range [−2^31, 2^31 − 1] >>> Solution().myPow(2.0, 10) 1...
[ { 'date': '2011-01-01', 'description': 'Ano Novo', 'locale': 'pt-PT', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2011-03-08', 'description': 'Carnaval', 'locale': 'pt-PT', 'notes': '', 'region': '', ...
class Scene(object): """ Base class for all Scene objects Contains the base functionalities and the functions that all derived classes need to implement """ def __init__(self): self.build_graph = False # Indicates if a graph for shortest path has been built self.floor_body_ids = []...
''' Created on 09.03.2019 @author: Nicco ''' class act_base(object): ''' providing all the methods to connect to the simulator, and plan ''' def __init__(self, params): ''' Constructor '''
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold(s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s ...
# DROP TABLES songplay_table_drop = "DROP TABLE IF EXISTS songplays" user_table_drop = "DROP TABLE IF EXISTS users" song_table_drop = "DROP TABLE IF EXISTS songs" artist_table_drop = "DROP TABLE IF EXISTS artsts" time_table_drop = "DROP TABLE IF EXISTS time" # CREATE TABLES one facts table and four dimensions tables ...
msg = "\nU cannot do it with the zero under there!!!" def mean(num_list): if len(num_list)== 0: raise Exception(msg) else: return sum(num_list)/len(num_list) def mean2(num_list): try: return sum(num_list)/len(num_list) except ZeroDivisionError as detail: raise ZeroDivisionError(detail.__str__() + msg) e...
# where output is the value per line # loop through the values # print the value of the letter plus the next letter for n number of times # n = a number (1-10) that represents how many characters are in a line # once you have printed n number of times, '\n' output = '' #for value in range(65, 91, 1): for i in range...
""" Task Given an integer, n, perform the following conditional actions: If is odd, print Weird If is even and in the inclusive 2 range 5 of to , print Not Weird If is even and in the inclusive 6 range of 20 to , print Weird If is even and greater than 20, print Not Weird """ n = int(input("Write a number: "))...
#!/usr/bin/env python3 N, T = list(map(int, input().strip().split(' '))) width = list(map(int, input().strip().split(' '))) for _ in range(T): i, j = list(map(int, input().strip().split(' '))) print(min(width[i:j + 1]))
# Task # Apply your knowledge of the .add() operation to help your friend Rupal. # Rupal has a huge collection of country stamps. She decided to count the # total number of distinct country stamps in her collection. She asked for # your help. You pick the stamps one by one from a stack of N country stamps. # Find the t...
class Window(object): def __init__(self, win_id, name, geom=None, d_num=None): self.win_id = win_id self.name = name self.geom = geom self.children = [] self.desktop_number = d_num return def __repr__(self): """ An inheritable string representatio...
def add_numbers(x, y): """ add two numbers and return the result""" return x + y def subtract_numbers(x, y): if x > y: return x - y elif x < y: return y - x else: return 0
# solution by erine_y, py3 bijectiveNumeration = lambda n, d: d[n//100]+"%03d"%~(~-n%99) """ You need to label a set of indices; ideally something a little more human friendly than just a number. What was decided was to use a character, or set of characters, hyphenated with a two digit number. Example For n = 134 a...
def get_profile(name: str, age: int, *args, **kwargs): if len(list(args)) > 5: raise ValueError if not isinstance(age, int): raise ValueError profile = dict(name=name, age=age,) if args: profile.update(sports=sorted(list(args))) if kwargs: profile.update(awards=kwarg...
class Klasse: def __init__(self, wert): self.attribut = wert def print_attribut(self): print(self.attribut) def main(): a = Klasse(3) b = Klasse(12) a.attribut = -a.attribut b.print_attribut()
def ngram(s, num): res = [] slen = len(s) - num + 1 for i in range(slen): ss = s[i:i+num] res.append(ss) return res def diff_ngram(sa, sb, num): a = ngram(sa, num) b = ngram(sb, num) r = [] cnt = 0 for i in a: for j in b: if i == j: cnt += 1 r.append(i) return cnt / l...
# Time: O(nlogn) # Space: O(1) class Interval(object): def __init__(self, s=0, e=0): self.start = s self.end = e def __repr__(self): return "[{}, {}]".format(self.start, self.end) class Solution(object): def merge(self, intervals): """ :type intervals: List[Inter...
def uninstall(distro, purge=False): packages = [ 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', 'radosgw', ] extra_remove_flags = [] if purge: extra_remove_flags.append('--purge') distro.packager.remove( packages, extra_remove...
class Solution: def isPrefixOfWord(self, sentence: str, searchWord: str) -> int: sentence = sentence.split() k = len(searchWord) for i, word in enumerate(sentence): if word[:k] == searchWord: return i+1 return -1
class GenderParity: """ Gender parity metric from https://github.com/decompositional-semantics-initiative/DNC. """ def __init__(self): self.same_preds = 0.0 self.diff_preds = 0.0 def get_metric(self, reset=False): if self.same_preds + self.diff_preds == 0: retur...
# # PySNMP MIB module WLSX-WLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WLSX-WLAN-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:36:48 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...
'''3. Peça ao usuário para digitar um número e imprima o fatorial de n.''' number = int(input('Enter a number: ')) mul = fac = number while fac != 0: print(fac, end=' ') fac = fac - 1 mul = fac * (fac -1)
def set_age(name, age): if not 0 < age < 120: raise ValueError('年龄超过范围') print('%s is %d years old.' % (name, age)) def set_age2(name, age): assert 0 < age < 120, '年龄超过范围' print('%s is %d years old.' % (name, age)) if __name__ == '__main__': set_age('bob', 23) set_age2('bob', 223)
# -*- coding: utf-8 -*- """ Created on Fri Jul 5 21:40:27 2019 @author: Abhishek Mukherjee """ #Size of set A ~~~ M M=list(map(int, input())) #list A listA=list(map(int, input().split())) #Size of set B ~~~ N N=list(map(int, input())) #list B listB=list(map(int, input().split())) #Set A setA=...
''' Faça um programa que solicite três números inteiros do usuário e imprima a soma destes. ''' lista = [] for i in range(3): numero = int(input('Digite um número: ')) lista.append(numero) print(sum(lista))
class Salsa: def __init__(self,r=20): assert r >= 0 self._r = r # number of rounds self._mask = 0xffffffff # 32-bit mask def __call__(self,key=[0]*32,nonce=[0]*8,block_counter=[0]*8): assert len(key) == 32 assert len(nonce) == 8 assert len(block_counter) == 8 # init state k ...
def parentheses_balance_stack_check(expression): open_list, close_list, stack = ['[', '{', '('], [']', '}', ')'], [] for i in expression: if i in open_list: stack.append(i) elif i in close_list: pos = close_list.index(i) if len(stack) > 0 and open_list[pos] == stack[len(stack) - 1]: ...
# -*- coding: utf-8 -*- #%% configs VOCdatasetConfig= { 'rootDir': "D:\GitHubRepos\ML_learning\VOC2007", 'imageFolder': "JPEGImages", 'imageExtension': ".jpg", 'annotationFolder': "Annotations", 'annotationExtension': ".xml", 'trainCasesPath': "ImageSets\Segmentation\\train.txt", 'valCase...
def get_sunday_count(): sunday_count = 0 for i in range(1901, 2000): for j in range(1, 12): for k in range(1, get_number_of_days(j, i)): if j == 2000: c = 20 else: c = 19 f = k + ((13 * j - 1) / 5) + ((i ...
""" Definition of SegmentTreeNode: class SegmentTreeNode: def __init__(self, start, end, max): self.start, self.end, self.max = start, end, max self.left, self.right = None, None """ class Solution: """ @param root: The root of segment tree. @param start: start value. @param end: en...
""" 0068. Text Justification Hard Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when n...
# # PySNMP MIB module PCUBE-SE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PCUBE-SE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:11:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
# coding=utf-8 """ This package provides a session authentication for TheTVDB. """
lista = [] cadastro = {} qtd = tot_idade = 0 lista_mulheres = [] cadastro_mulheres = {} lista_velhos = [] cadastro_velhos = {} while True: cadastro['nome'] = str(input('Nome: ')).strip() cadastro['sexo'] = str(input('Sexo [M/F]: ')).strip().upper()[0] while cadastro['sexo'] not in 'MF': print('ERRO!...