content
stringlengths
7
1.05M
def validate_genome(genome, *args, **kwargs): if len(set(e.innov for e in genome.edges)) != len(genome.edges): raise ValueError('Non-unique edge in genome edges.') if len(set(n.innov for n in genome.nodes)) != len(genome.nodes): raise ValueError('Non-unique node in genome node.') for e in ...
""" https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/ One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as #. _9_ / \ 3 2 / \ / \ ...
print("enter the two number") n1,n2=map(int,input().split()) print("press + for add") print("press - for subb") print("press * for mul") print("press / for div") e=input() if e == "+": print(n1+n2) elif e == "-": print(n1-n2) elif e == "*": print(n1*n2) elif e == "/": print(n1/n2) else: print("you e...
class UndefinedMetricWarning(UserWarning): """Warning used when the metric is invalid .. versionchanged:: 0.18 Moved from sklearn.base. """ class ConvergenceWarning(UserWarning): """Custom warning to capture convergence problems Examples -------- >>> import numpy as np >>> im...
recipes,available = {'flour': 500, 'sugar': 200, 'eggs': 1}, {'flour': 1200, 'sugar': 1200, 'eggs': 5, 'milk': 200} print(min([available.get(k,0) // recipes[k] for k in recipes]))
informação = input('Digite algo:') print('Valor primitivo é ',type(informação)) print('É alfanumérico?',informação.isalnum()) print('É alpha?',informação.isalpha()) print('É numérico?',informação.isnumeric()) print('É apenas espaços?',informação.isspace())
# Program to calculate the gross pay of a worker hours_worked = input("Enter the hours worked:\n") rate = input("Enter the payment rate:\n ") pay = int(hours_worked)*float(rate) print(pay)
# # PySNMP MIB module A3COM-HUAWEI-QINQ-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-QINQ-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:52:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
def handle_request(): print("hello world!") return "hello world!" if __name__ == '__main__': handle_request()
# ShortTk DownlaodRealeses shell lib Copyright (c) Boubajoker 2021. All right reserved. Project under MIT License. __version__ = "0.0.1 Alpha A-1" __all__ = [ "librairy", "shell", "librairy shell", "downlaod shell lib" ]
class Solution(object): def productExceptSelf(self, nums): """ :type nums: List[int] :rtype: List[int] """ answer = [] _len = len(nums) prod = 1 for i in range(_len): answer.append(prod) prod *= nums[i] prod = 1 ...
string = "Emir Nazira Zarina Aijana Sultan Danil Adis" string = string.replace('Emir', 'Baizak') string = string.replace('Nazira', 'l') print(string)
A, B, C = map(int, input().split()) if A == B: print(C) elif A == C: print(B) else: print(A)
###### Birthday Cake Candles def birthdayCakeCandles(ar): blown_candle=0 maxi=max(ar) for i in ar: if i==maxi: blown_candle+=1 print(blown_candle) birthdayCakeCandles([3,2,1,3])
i = 1 j = 7 while(i<10): for x in range(3): print("I=%d J=%d" %(i,j)) j += -1 i += 2 j = i + 6
def check_matrix(mat): O_win = 0 X_win = 0 if mat[:3].count('O') == 3: O_win += 1 if mat[:3].count('X') == 3: X_win += 1 if mat[3:6].count('O') == 3: O_win += 1 if mat[3:6].count('X') == 3: X_win += 1 if mat[6:].count('O') == 3: O_win += 1 if mat[6...
#!/usr/bin/env python3 class Error(Exception): '''Base class for exceptions''' def __init__(self, msg=''): self.message = msg Exception.__init__(self, msg) def __repr__(self): return self.message class InterpolationError(Error): '''Base class for interpolation-related excep...
class ActionListener: def __init__(self, function): self.function = function def execute(self): if self.function is not None: self.function()
""" Amazon Aurora Labs for MySQL AWS Lambda function to expand directory requests to an index.html file for CloudFront NOTICE: For testing only, the actual code is inline in the CloudFormation template (see ../../../template/site.yml). Dependencies: none License: This sample code is made available under the MIT-0 li...
class Ansvar: def __init__(self, id, name, strength, beskrivelse): self.id = id self.name = name self.strength = strength self.description = beskrivelse
""" time: c space: c """ class Solution: def groupStrings(self, strings: List[str]) -> List[List[str]]: ans = collections.defaultdict(list) for s in strings: tmp = [] for c in s: tmp.append((ord(s[0]) - ord(c))%26) ans[tuple(tmp)].append(s) ...
#!/bin/python3 # author: Jan Hybs def hex2rgb(hex): """ method will convert given hex color (#00AAFF) to a rgb tuple (R, G, B) """ h = hex.strip('#') return tuple(int(h[i:i + 2], 16) for i in (0, 2, 4)) def rgb2hex(rgb): """ method will convert given rgb tuple (or list) to a hex ...
""" https://leetcode.com/problems/largest-number-at-least-twice-of-others/ In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as every other number in the array. If it is, return the index of the largest element, otherwis...
def metric(grams): """ Converts grams to kilograms if grams are greater than 1,000. """ grams = int(grams) if grams >= 1000: kilograms = 0 kilograms = grams / 1000.0 # If there is no remainder, convert the float to an integer # so that the '.0' is removed. if not (gra...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: Register class RegisterStatus(object): Success = 0 FailUnknown = 1 FailUserNameConflicted = 2
class Solution: def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ # longest substring without repeating char seen = {} left, ans = 0, 0 for idx, ch in enumerate(s): if ch in seen: left = max(left, seen[...
word1 = input() word2 = txt = input()[::-1] if(word1 == word2): print("YES") else: print("NO")
# MIT License # Copyright (C) Michael Tao-Yi Lee (taoyil AT UCI EDU) # A descriptor class class PositiveAttr(object): def __init__(self, name): self.name = name self.parent = None def __get__(self, instance, cls): print("get called", instance, cls) return instance.__dict__[sel...
class Solution: def licenseKeyFormatting(self, s: str, k: int) -> str: s = s.replace('-', '').upper()[::-1] return '-'.join(s[i:i + k] for i in range(0, len(s), k))[::-1]
""" request_interceptor.py ~~~~~~ Created By : Pankaj Suthar """ def intercept_request(request): """ intercept_request :param request: Flask Request Object :return: updated request """ pass
class Solution: def rotate(self, nums: List[int], k: int) -> None: if not nums: return step = k % len(nums) self.swap(nums, 0, len(nums) - step - 1) self.swap(nums, len(nums)-step, len(nums) - 1) self.swap(nums, 0, len(nums) - 1) def swap(self, nums, left, ri...
""" List / Array Iterable """ numbers = [] print(type(numbers)) # adding elements # append adds at the last index (value) numbers.append(10) numbers.append(45) print(numbers) # insert (index, value) numbers.insert(0, 45) print(numbers) # remoing an element # pop (no arg) --> removes from last index # remove(value) ...
""" Given a sorted list of integers, find all the unique triplets which sum up to the given target. Note: Each triplet must be a tuple having elements (input[i], input[j], input[k]), such that i < j < k. The ordering of unique triplets within the output list does not matter. Example: Input : [1,2,3,4,5,6,7] Target: 1...
#!/usr/bin/env python #------------------------------------------------------------------------------- # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: #--------------------------------...
# reads from the console two numbers a and b, calculates and prints the face of a rectangle with sides a and b a = int(input()) b = int(input()) print(a * b)
a = [] a.append(2) for i in range(1,36): sum,dem,cnt = 0,0,9; for j in range(i): cnt = 9*(10**(j//2)) sum += cnt a.append(a[i-1]+sum) t = int(input()) for i in range(t): n = int(input()) print(a[n])
""" The main entrypoint to our CLI """ def main(): """ The main entrypoint to our CLI """ print("sumgraph!")
class ResponseBuilder(object): def __init__(self, status_code: int, result = None): """Builder for the response""" self.status_code = status_code self.result = result def get_response(self): return { 'result': self.result, 'status_code': self.status_code ...
c_num = int(input()) a_num = 1 b_num = 1 # O(n**2) while a_num < c_num: while b_num < c_num: if (a_num**2 + b_num**2) == c_num**2: print(a_num, b_num) b_num += 1 b_num = 1 a_num += 1 # Bisa pakai yang atas atau yang bawah # O(n**2) # for a in range(1, c_num): # for b in ra...
num = int(input("Enter a number: \t")) pow = int(input("Enter Power: \t")) sum = 1 i = 1 while(i<=pow): sum=sum*num i+=1 print(num,"to the power",pow,"is",sum)
items = [] def enqueue(item): items.append(item) def dequeue(): if len(items) > 0: items.pop(0) enqueue(5) enqueue(11) enqueue('Jones') enqueue(45) print(items) dequeue() print(items) dequeue() print(items)
# Mathematics > Number Theory > Number of zero-xor subsets # How many subsets with zero xor are here? # # https://www.hackerrank.com/challenges/number-of-subsets/problem # https://www.hackerrank.com/contests/infinitum10/challenges/number-of-subsets # challenge id: 4731 # MOD = 1000000007 # la réponse est 2^(2^n - n) ...
class Sampling_InfinteLoopWrapper: def __init__(self, sampling_algo): self.sampling_algo = sampling_algo def get(self): return self.sampling_algo.current() def move_next(self): if not self.sampling_algo.move_next(): self.sampling_algo.reset() assert self.sam...
''' /** * This is the solution of No. 69 problem in the LeetCode, * the website of the problem is as follow: * https://leetcode-cn.com/problems/sqrtx * <p> * The description of problem is as follow: * ========================================================================================================== * 实现 ...
##################################### # Installation module for autorecon ##################################### # XXX: Expects seclists to be in /usr/share/seclists # AUTHOR OF MODULE NAME AUTHOR="ypcrts" # DESCRIPTION OF THE MODULE DESCRIPTION="This module will install/update autorecon - a multi-threaded network re...
# -*- coding: UTF-8 -*- lan = 15 for a in range(5): lan *= 10 print(lan)
def almost_equal(obj1, obj2, exclude_paths=[]): def almost_equal_helper(x, y, path): if isinstance(x, dict): if not isinstance(y, dict): print(f"At path {path}, obj1 was of type dict while obj2 was not") return False if not set(x.keys()) == set(y.key...
table = [] n, m = map(int, input().split()) for i in range(n): row = list(map(int, input().split())) table.append(row) k = int(input()) table.sort(key=lambda x: x[k]) for row in table: print(*row)
#--- Exercício 1 - Impressão de dados com a função Print #--- Imprima textos com seu nome, sobrenome e idade #--- Cada informação deve ser impressa em uma linha diferente nome=(input('Digite seu nome:')) sobrenome=(input('Digite seu sobrenome:')) idade=int(input('Digite sua idade:')) print('Nome:',nome) print('Sobren...
def appearance(str, word): count = 0 count = str.count(word) if(count == 0): print(word, "appeared", count, "time") elif(count < 2): print(word, "appeared", count, "time") else: print(word, "appeared", count ,"times") str = "Emma is good developer. Emma is a writer" word = "ádasdasd" appearance(str, word)
class Company: def __init__(self): self.ticker = '' self.name = '' self.rating = '' self.rating_date = '' self.piotroski_f_score = '0.0' self.base_link = '' self.p_e = '0.0' self.p_bv = '0.0' self.p_bv_g = '0.0' self.p_s = '0.0' ...
"""All the key sequences""" # If you add a binding, add something about your setup # if you can figure out why it's different # Special names are for multi-character keys, or key names # that would be hard to write in a config file # TODO add PAD keys hack as in bpython.cli # fmt: off CURTSIES_NAMES = { b' ': ...
__version__ = '0.3.0' __author__ = 'Ian Dennis Miller' __email__ = 'iandennismiller@gmail.com' __url__ = 'http://diamond-methods.org/puppet-diamond.html'
__author__ = 'Pat and Tony' #abstract class for the Observer interface class Observer(object): #must be implemented in all subclasses def notify(self, msg): pass
def solution(N, A): result = [0] * N max_num, max_counter = 0, 0 for num in A: if num == N + 1: max_counter = max_num else: result[num-1] = max(result[num-1], max_counter) result[num-1] += 1 max_num = max(max_num, result[num-1]) for ...
def can_build(env, platform): return env["tools"] and env["module_raycast_enabled"] def configure(env): pass
''' A test suite of unit tests for the plantpredict-python package. It is assumed that the plantpredict package is in the python path, and `mock` is installed. Note: mock could not be installed through conda, used pip instead. To run all tests, from the `tests` directory, do: ``` python -m unittest discover -v ``` ...
#!/usr/bin/env python # -*- coding: utf-8 -* number = 10 # 10をnumberにコピー print(number) # numberを表示
class Animal: fur_color = "Orange" def speak(self): raise NotImplementedError def eat(self): pass def chase(self): pass class HouseCat(Animal): def speak(self): print("Meeeeowwww") cat = HouseCat() cat.speak()
class Solution: def reverseVowels(self, s): """ :type s: str :rtype: str """ vowels=[] for c in s: if c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='O' or c=='U': vowels.append(c) st='' ...
class ModelExecutionContext: """ This class represents the execution context of a model. It will contain information like correlation id, etc... that the model might need to use during execution. """ def __init__(self, correlation_id, process, online=False): """ Initial...
"""Constants for the Hassio Info integration.""" DOMAIN = "hassio_info" TITLE = "Supervisor+"
#// 26 bits block id, 8 bits shift distance, 4 bits last key byte, 5 bits storage, 21 bits value print( " DELME sz 1751672936 keysz 26728 b 9816750e idx 422567") def prt(b): print( " block id ", b >> 38 ) print( " shift ", (b >> 30) & 0xFF ) print( " key ", (b >> 26) & 0xF ) print( " storage ", (b >...
#Websites to crawling For the News Paper, with white list and black list WhiteListURLS = { 'Hoy': 'http://hoy.com.do/encuestas/', 'Listin Diario': 'https://www.listindiario.com/encuestas', 'La Informacion': 'http://www.lainformacion.com.do/modulos/encuestas/encuestas_anteriores.php?idEnc=744', 'La Bazuc...
class headless_download(object): ROBOT_LIBRARY_VERSION = 1.0 def __init__(self): pass def enable_download_in_headless_chrome(self, driver, download_dir): """ there is currently a "feature" in chrome where headless does not allow file download: https://bugs.chromium.org/p/c...
def mod_brightness(colour, modifier): red = min(int(((colour & 0xff0000) >> 16) * modifier), 0xff) green = min(int(((colour & 0x00ff00) >> 8) * modifier), 0xff) blue = min(int((colour & 0x0000ff) * modifier), 0xff) return red << 16 | green << 8 | blue def int_scale_flag(flag_name, max_size)...
# -*- coding:utf-8 -*- ''' f(0)=1 1:f(1)=1~f(0)=1 2:f(2)=1~f(1)+2~f(0)=2 3:1~f(2)+2~f(1)+3~f(0) = 2 + 1 + 1 4:1~f(3)+2~f(2)+3~f(1)+4~f(0) n:1~f(n-1)+2~f(n-2)+3~f(n-3)+……+(n-1)~f(1)+n~f(0) f(n)=f(n-1)+f(n-2)+...+f(1)+f(0) ''' class Solution: def listSum(self,fn): s = 0 for i in range(len(fn)): ...
def Musical_era_question_1(): score_number = 0 what_key_str = "minor" #print ("Can you identify this key?") a=input("Can you identify this key? \n Question 1: What is the key of this song?") #import audio file of We're Going Wrong here if "minor" in a: score_number = 1 return sco...
#!/usr/bin/env python # # Copyright 2014 - 2016 The BCE Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the license.txt file. # _MAJOR = 1 _MINOR = 5 _REVISION = 1097 def get_version(): """Get BCE version. :rtype : (int, int, int) :ret...
class ParserException(Exception): """ParserException Generic exception for parser errors Extends: Exception """ pass class NoRouteException(Exception): """NoRouteException Generic exception for route not found errors Extends: Exception """ pass
ten_things = "Apples Oranges Crows Telephone Light Sugar" print ("Wait there are not 10 things in that list. Let's fix that.") stuff = ten_things.split(' ') more_stuff = ["Day", "Night", "Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"] while len (stuff) != 10: next_one = more_stuff.pop() pri...
password = "hellodave" # Condiciones # if len(password) <= 10: # print("Tu password no funciona") # Mayusculas tiene_mayusculas = False for char in password: if char.isupper(): tiene_mayusculas = True special_chars = ['.', ',', ';', ':', '*', '@', '%', '/'] tiene_car_esp = False for c in password:...
#Задание 1 #1.Определите является ли строка записью числа a="789" print(a.isdigit()) #2.Посчитайте сколько у вас пробелов в строке. print("a s d fg".count(" ")) #3.Посчитайте сколько у вас символов точки '.' в строке. print("abc..rt..".count(".")) '''4.Создайте строку "Homework". Преобразуйте её в с...
def _generate_variables(repository_ctx, build_info): repository_ctx.template( "generate_variables.py", repository_ctx.path(Label("//support/bazel:generate_variables.py")), {}, ) python_interpreter = repository_ctx.attr.python_interpreter if repository_ctx.attr.python_interpreter...
class dictRules: """ A special class for getting and setting multiple dictionaries simultaneously. This class is not meant to be instantiated on its own, but rather in response to a slice operation on UniformDictList. """ def __init__(parent, slice): self.parent = parent self.ra...
""" A minimal UF implementation. """ class UnionFind: """ Typical DSU implementation with path-compression and union by rank. Requires members to be able to be used as indexes. """ def __init__(self, iterable=None): self.parent = list(iterable or []) self.rank = [0] * len(self...
def check_bc(self, p=None): # check that boundary conditions are satisfied if self.nconstraints == 0: # no boundary conditions return True if p is None: # use random parameter vector p = np.random.randn(self.dof) coeff = self.get_block_coeff(p) lhs = np.polyval(...
_exports = [ "all_resources", "carbon_per_mmbtu", "carbon_per_mwh", "carbon_resources", "clean_resources", "label2type", "nox_per_mwh", "renewable_resources", "so2_per_mwh", "type2color", "type2hatchcolor", "type2label", ] type2color = { "wind": "xkcd:green", "so...
# Exercício Python 011: # Faça um programa que leia a largura e a altura de uma parede em metros, # calcule a sua área e a quantidade de tinta necessária para pintá-la, # sabendo que cada litro de tinta pinta uma área de 2 metros quadrados. l = float(input('Digite a largura da parede: ')) h = float(input('Digite a altu...
""" PPO algorithm implementation """ class Model(object): """ PPO algorithm """
def extractWolfieTranslation(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'The amber sword' in item['tags']: return buildReleaseMessageWithType(item, 'The Amber Sword', vol, chp, frag=frag, po...
def is_divisible(num, divs): return all([num % div == 0 for div in divs]) # MAIN start = int(input('Start of range: ')) end = int(input('End of range: ')) divs = list( map( lambda i: int(i), input('Type in the divisors, separated by commas: ').split(',') ) ) divisibles = [n for n in range(start, end) if is_div...
#!/usr/bin/env python # vim: set ts=4 sw=4 et: class Controller(object): """ Encapsulates the control logic for each stage of flight within its own controller class. """ def __init__(self, commander, vehicle): self.commander = commander self.vehicle = vehicle def enter(self): ...
# -*- coding: utf-8 -*- """ 2027. Minimum Moves to Convert String https://leetcode.com/problems/minimum-moves-to-convert-string/ Example 1: Input: s = "XXX" Output: 1 Explanation: XXX -> OOO We select all the 3 characters and convert them in one move. Example 2: Input: s = "XXOX" Output: 2 Explanation: XXOX -> OOO...
coordinates_E0E1E1 = ((126, 114), (126, 116), (126, 117), (126, 118), (127, 114), (127, 120), (128, 114), (128, 115), (128, 119), (128, 121), (129, 105), (129, 108), (129, 115), (129, 120), (129, 121), (130, 101), (130, 103), (130, 104), (130, 109), (130, 120), (130, 121), (131, 101), (131, 105), (131, 106), (131, 10...
"""08_arithmetic_operations.py.""" a = 15 b = 2 sum = a + b difference = a - b product = a * b division = a / b remainder = a % b print(f'{a} + {b} = {sum}') # 15 + 2 = 17 print(f'{a} - {b} = {difference}') # 15 - 2 = 13 print(f'{a} * {b} = {product}') # 15 * 2 = 30 print(f'{a} / {b} = {division}') # 15 / 2 = 7.5...
# -*- coding: utf-8 -*- # @Author: 何睿 # @Create Date: 2019-02-03 09:02:18 # @Last Modified by: 何睿 # @Last Modified time: 2019-02-03 09:02:18 class Solution: def singleNumber(self, nums): """ :type nums: List[int] :rtype: List[int] """ res = [0, 0] ...
cumprimentar = ['Oi', 'Olá', 'Oi, tudo bem?', 'Olá, como vai?'] como_esta = ['Estou bem, e você?', 'Comigo está tudo ótimo, e como vai você?'] humano_bem = ['Que bom, como posso ajudá-lo?', 'Ótimo, gostaria de ajuda?'] dnd = ['De nada', 'Estarei aqui se precisar'] piadas = ['O que o tomate foi fazer no banco? Tirar...
with open('input.txt', 'r') as file: start, stop = file.read().split('-') start = int(start) stop = int(stop) result_1 = 0 result_2 = 0 for pword in range(start, stop): isdouble = False num = [int(i) for i in str(pword)] if num == sorted(num): counts = {str(pword).count(x) for x in str(pword)}...
#print("Hello World") #temperature = int(input("What is the temperature outside?")) #if temperature > 80: #print("Turn on the AC.") #else: #print("Open the Windows.") score = int(input("What is your test score?")) if score >= 90: print('Your grade is an A.') elif score>= 80: print('Your grade is a B'...
class ZenviaTokenNotFound(Exception): pass class ZenviaUrlNotFound(Exception): pass class InvalidArgument(Exception): pass
# DESCRIPTION # Given a non-negative integer num represented as a string, # remove k digits from the number so that the new number is the smallest possible. # Note: # The length of num is less than 10002 and will be ≥ k. # The given num does not contain any leading zero. # EXAMPLE 1: # Input: num = "1432219", k = 3 # ...
def _check_box_size(size): if int(size) <= 0: raise ValueError(f"Invalid box size. Must be larger than 0") def _check_border(size): if int(size) <= 0: raise ValueError(f"Invalid border value. Must be larger than 0") class QRCode: def __init__(self, box_size=10, border=2): _check_...
n = int(input()) cnt = 0 for i in range(2,11): n2 = n L = [] while(n2 > 0): L.append(n2%i) n2//=i if L == L[::-1]: print(i,end=" ") for k in L: print(k, end = "") print() cnt+=1 if cnt == 0: print("NIE")
# # PySNMP MIB module TIMETRA-BSX-NG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-BSX-NG-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:17:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
'''Finding the Square Root of an Integer Find the square root of the integer without using any Python library. You have to find the floor value of the square root. For example if the given number is 16, then the answer would be 4. If the given number is 27, the answer would be 5 because sqrt(5) = 5.196 whose floor va...
# HAND INITIALIZATION # # Interwał (w sekundach), z jakim sprawdzana będzie obecność dłoni w InitBox CHECKING_FOR_HAND_INTERVAL = 1 # # Ile razy z rzędu musi zostać znaleziona dłoń w InitBox (powiązane z interwałem powyżej) HOW_MANY_TIMES_HAND_MUST_BE_FOUND = 5 # # Minimalna wartość odległości z sensorów Kinect, aby ...
class Solution: def scoreOfParentheses(self, S: str) -> int: sLen = len(S) if sLen == 0: return 0 elif sLen == 1: # throw out error message pass return 0 else: sList = [] bgnIdx = 0 num = 0 ...
class Solution: def firstUniqChar(self, s: str) -> int: dicti = {} for char in s: if char not in dicti: dicti[char] = 0 dicti[char] += 1 for index, char in enumerate(s): if dicti[char] == 1: return index return -...
# noinspection PyUnusedLocal # friend_name = unicode string def hello(friend_name): if not isinstance(friend_name, str): raise ValueError("Invalid input") return f"Hello, {friend_name}!"