content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# TESTS FOR COLOURABLE # graph with no vertices g0 = Graph(0) print(str(colourable(g0)) + "... should be TRUE") # graph with one vertice (no edge) g1 = Graph(1) g1.matrix[0][0] = True print(str(colourable(g1)) + "... should be FALSE") # graph with one vertice (and edge) g2 = Graph(1) print(str(colourable(g2)) + ".....
g0 = graph(0) print(str(colourable(g0)) + '... should be TRUE') g1 = graph(1) g1.matrix[0][0] = True print(str(colourable(g1)) + '... should be FALSE') g2 = graph(1) print(str(colourable(g2)) + '... should be TRUE') g3 = graph(2) print(str(colourable(g3)) + '... should be TRUE') g4 = graph(2) g4.matrix[0][0] = True pri...
class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: nums.sort() ret = set() for i, v in enumerate(nums): j, k = i + 1, len(nums) - 1 while j < k: if nums[j] + nums[k] == -v: ret.add((v, nums[j], nums[k])) if nums[j] + nums[k] > -v: k -= 1...
class Solution: def three_sum(self, nums: List[int]) -> List[List[int]]: nums.sort() ret = set() for (i, v) in enumerate(nums): (j, k) = (i + 1, len(nums) - 1) while j < k: if nums[j] + nums[k] == -v: ret.add((v, nums[j], nums[k]))...
''' (C) Copyright 2021 Steven; @author: Steven kangweibaby@163.com @date: 2021-06-30 '''
""" (C) Copyright 2021 Steven; @author: Steven kangweibaby@163.com @date: 2021-06-30 """
with open('day13/input.txt', 'r') as file: timestamp = int(file.readline()) data = str(file.readline()).split(',') data_1 = [int(x) for x in data if x != 'x'] res = sorted([(x - timestamp % x, x) for x in data_1], key=lambda x: x[0]) data_2 = [(int(x), data.index(x)) for x in data if x != 'x'] superbus_t...
with open('day13/input.txt', 'r') as file: timestamp = int(file.readline()) data = str(file.readline()).split(',') data_1 = [int(x) for x in data if x != 'x'] res = sorted([(x - timestamp % x, x) for x in data_1], key=lambda x: x[0]) data_2 = [(int(x), data.index(x)) for x in data if x != 'x'] superbus_time = d...
#O(n) Space and time Complexity # Maintain a frequency map as {prefix_Sum:frequency of this prefix sum} # While looping the array: #0. hash_map[current_prefix_sum] += 1 #1. If (current_prefix_sum - k) exists in the map, it means there is a subarray found hence increment the counter. class Solution: def subarraySu...
class Solution: def subarray_sum(self, nums: List[int], k: int) -> int: d = {} D[0] = 1 s = 0 c = 0 for i in range(len(nums)): s = s + nums[i] if s - k in D: c += D[s - k] if s in D: D[s] += 1 el...
# Here's a challenge for you to help you practice # See if you can fix the code below # print the message # There was a single quote inside the string! # Use double quotes to enclose the string print("Why won't this line of code print") # print the message # There was a mistake in the function name print('This line ...
print("Why won't this line of code print") print('This line fails too!') print('I think I know how to fix this one') name = input('Please tell me your name: ') print(name)
POST_ACTIONS = [ 'oauth.getAccessToken', 'oauth.getRequestToken', 'oauth.verify', 'comment.digg', 'comment.bury', 'shorturl.create', 'story.bury', 'story.digg', ]
post_actions = ['oauth.getAccessToken', 'oauth.getRequestToken', 'oauth.verify', 'comment.digg', 'comment.bury', 'shorturl.create', 'story.bury', 'story.digg']
N = input() before = "" count = 1 for s in N: if before == -1: before = s else: if before == s: count += 1 if count >= 3: print("Yes") exit() else: before = s count = 1 print("No")
n = input() before = '' count = 1 for s in N: if before == -1: before = s elif before == s: count += 1 if count >= 3: print('Yes') exit() else: before = s count = 1 print('No')
class Optimizer: pass class RandomRestartOptimizer(Optimizer): def __init__(self, N=10): self.N=N
class Optimizer: pass class Randomrestartoptimizer(Optimizer): def __init__(self, N=10): self.N = N
AUTH_USER_MODEL = 'users.User' AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validat...
auth_user_model = 'users.User' auth_password_validators = [{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'}, {'NAME': 'django.contr...
class AlgorithmConfigurationProvider: def __init__(self, chromosome_config, left_range_number, right_range_number, population_number, epochs_number, selection_amount, elite_amount, selection_method, is_maximization): self.__chromosome_config = chromosome_config self.__left_range_...
class Algorithmconfigurationprovider: def __init__(self, chromosome_config, left_range_number, right_range_number, population_number, epochs_number, selection_amount, elite_amount, selection_method, is_maximization): self.__chromosome_config = chromosome_config self.__left_range_number = left_range...
def get_ids_and_classes(tag): attrs = tag.attrs if 'id' in attrs: ids = attrs['id'] if isinstance(ids, list): for subitem in ids: yield subitem else: yield ids if 'class' in attrs: classes = attrs['class'] if isinstance(classes...
def get_ids_and_classes(tag): attrs = tag.attrs if 'id' in attrs: ids = attrs['id'] if isinstance(ids, list): for subitem in ids: yield subitem else: yield ids if 'class' in attrs: classes = attrs['class'] if isinstance(classes,...
def testHasMasterPrimary(nodeSet, up): masterPrimaryCount = 0 for node in nodeSet: masterPrimaryCount += int(node.monitor.hasMasterPrimary) assert masterPrimaryCount == 1
def test_has_master_primary(nodeSet, up): master_primary_count = 0 for node in nodeSet: master_primary_count += int(node.monitor.hasMasterPrimary) assert masterPrimaryCount == 1
################################### # File Name : dir_normal_func.py ################################### #!/usr/bin/python3 def normal_func(): pass if __name__ == "__main__": p = dir(normal_func()) print ("=== attribute ===") print (p)
def normal_func(): pass if __name__ == '__main__': p = dir(normal_func()) print('=== attribute ===') print(p)
dividendo=int(input("Dividendo: ")) divisor=int(input("Divisor: ")) if dividendo>0 and divisor>0: cociente=0 residuo=dividendo while (residuo>=divisor): residuo-=divisor cociente+=1 print(residuo) print(cociente)
dividendo = int(input('Dividendo: ')) divisor = int(input('Divisor: ')) if dividendo > 0 and divisor > 0: cociente = 0 residuo = dividendo while residuo >= divisor: residuo -= divisor cociente += 1 print(residuo) print(cociente)
class FunctionMetadata: def __init__(self): self._constantReturnValue = () def setConstantReturnValue(self, value): self._constantReturnValue = (value,) def hasConstantReturnValue(self): return self._constantReturnValue def getConstantReturnValue(self): return self._co...
class Functionmetadata: def __init__(self): self._constantReturnValue = () def set_constant_return_value(self, value): self._constantReturnValue = (value,) def has_constant_return_value(self): return self._constantReturnValue def get_constant_return_value(self): retur...
# https://www.codewars.com/kata/578553c3a1b8d5c40300037c/train/python # Given an array of ones and zeroes, convert the equivalent binary value # to an integer. # Eg: [0, 0, 0, 1] is treated as 0001 which is the binary representation of 1. # Examples: # Testing: [0, 0, 0, 1] ==> 1 # Testing: [0, 0, 1, 0] ==> 2 # Tes...
def binary_array_to_number(arr): total = 0 i = 1 for num in arr[::-1]: total += i * num i *= 2 return total
class Solution: def rob(self, nums: List[int]) -> int: def rob(l: int, r: int) -> int: dp1 = 0 dp2 = 0 for i in range(l, r + 1): temp = dp1 dp1 = max(dp1, dp2 + nums[i]) dp2 = temp return dp1 if not nums: return 0 if len(nums) < 2: return nums...
class Solution: def rob(self, nums: List[int]) -> int: def rob(l: int, r: int) -> int: dp1 = 0 dp2 = 0 for i in range(l, r + 1): temp = dp1 dp1 = max(dp1, dp2 + nums[i]) dp2 = temp return dp1 if not num...
array = ['a', 'b', 'c'] def decorator(func): def newValueOf(pos): if pos >= len(array): print("Oops! Array index is out of range") return func(pos) return newValueOf @decorator def valueOf(index): print(array[index]) valueOf(10)
array = ['a', 'b', 'c'] def decorator(func): def new_value_of(pos): if pos >= len(array): print('Oops! Array index is out of range') return func(pos) return newValueOf @decorator def value_of(index): print(array[index]) value_of(10)
numero = 5 fracao = 6.1 online = True texto = "Armando"
numero = 5 fracao = 6.1 online = True texto = 'Armando'
maior = 0 pos = 0 for i in range(1, 11): val = int(input()) if val > maior: maior = val pos = i print('{}\n{}'.format(maior, pos))
maior = 0 pos = 0 for i in range(1, 11): val = int(input()) if val > maior: maior = val pos = i print('{}\n{}'.format(maior, pos))
COUNT = 100 class Stack: def __init__(self, value): self.value = value; self.next = None def test(): top = None for i in range(0, COUNT): curr = Stack(f'Hello #{i}') curr.next = top top = curr print(stackSize(top)) def stackSize(stack): size = 0 if s...
count = 100 class Stack: def __init__(self, value): self.value = value self.next = None def test(): top = None for i in range(0, COUNT): curr = stack(f'Hello #{i}') curr.next = top top = curr print(stack_size(top)) def stack_size(stack): size = 0 if st...
''' Author: Maciej Kaczkowski 26.03-13.04.2021 ''' # configuration file with constans, etc. # using "reversi convention" - black has first move, # hence BLACK is Max player, while WHITE is Min player WHITE = -1 BLACK = 1 EMPTY = 0 # player's codenames RANDOM = 'random' ALGO = 'minmax' # min-max parameters MAX_DEPT...
""" Author: Maciej Kaczkowski 26.03-13.04.2021 """ white = -1 black = 1 empty = 0 random = 'random' algo = 'minmax' max_depth = 4 northeast = (-1, 1) north = (-1, 0) northwest = (-1, -1) west = (0, -1) southwest = (1, -1) south = (1, 0) southeast = (1, 1) east = (0, 1)
def replace_string_in_file(filepath, searched, replaced): with open(filepath) as f: file_source = f.read() # replace all occurences replace_string = file_source.replace(searched, replaced) with open(filepath, "w") as f: f.write(replace_string)
def replace_string_in_file(filepath, searched, replaced): with open(filepath) as f: file_source = f.read() replace_string = file_source.replace(searched, replaced) with open(filepath, 'w') as f: f.write(replace_string)
class Fail(Exception): pass class InvalidArgument(Fail): pass
class Fail(Exception): pass class Invalidargument(Fail): pass
# -*- coding: utf-8 -*- def main(): n = int(input()) a = list(map(int, input().split())) inf = 1 << 30 ans = inf for bit in range(1 << n - 1): candidate = 0 inner = 0 for j in range(n): inner |= a[j] if (bit >> j) & 1: candidate ^=...
def main(): n = int(input()) a = list(map(int, input().split())) inf = 1 << 30 ans = inf for bit in range(1 << n - 1): candidate = 0 inner = 0 for j in range(n): inner |= a[j] if bit >> j & 1: candidate ^= inner inner = ...
# Addition and subtraction print(5 + 5) print(5 - 5) # Multiplication and division print(3 * 5) print(10 / 2) # Exponentiation print(4 ** 2) # Modulo print(18 % 7)
print(5 + 5) print(5 - 5) print(3 * 5) print(10 / 2) print(4 ** 2) print(18 % 7)
#!/usr/bin/env python # -*- coding: utf-8 -*- '''A simple module to store the user's style preferences.''' INDENT_PREFERENCE = {'indent': ' '} def get_indent_preference(): '''str: How the user prefers their indentation. Default: " ".''' return INDENT_PREFERENCE['indent'] def register_indent_prefere...
"""A simple module to store the user's style preferences.""" indent_preference = {'indent': ' '} def get_indent_preference(): """str: How the user prefers their indentation. Default: " ".""" return INDENT_PREFERENCE['indent'] def register_indent_preference(text): """Set indentation that will be used...
''' StaticRoute Genie Ops Object Outputs for IOSXE. ''' class StaticRouteOutput(object): # 'show ipv4 static route' output showIpv4StaticRoute = { 'vrf': { 'VRF1': { 'address_family': { 'ipv4': { 'routes': { ...
""" StaticRoute Genie Ops Object Outputs for IOSXE. """ class Staticrouteoutput(object): show_ipv4_static_route = {'vrf': {'VRF1': {'address_family': {'ipv4': {'routes': {'2.2.2.2/32': {'route': '2.2.2.2/32', 'next_hop': {'next_hop_list': {1: {'index': 1, 'active': True, 'next_hop': '10.1.2.2', 'outgoing_interfac...
''' Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input st...
""" Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input st...
datos= [0,0,0,0,0,0,0,0,0,0,0,0,0 ,1,1,1,1,1,1,1,1,1,1 ,2,2,2,2,2,2,2 ,3,3,3,3,3,3 ,4,4] def media(datos): return sum(datos)/len(datos) def mediana(datos): if(len(datos)%2 == 0): return (datos[int(len(datos)/2)] + datos[int((len(datos)+1)/2)]) / 2 else: retu...
datos = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4] def media(datos): return sum(datos) / len(datos) def mediana(datos): if len(datos) % 2 == 0: return (datos[int(len(datos) / 2)] + datos[int((len(datos) + 1) / 2)]) / 2 else: ...
while True: b=input().split() X,M=b X=int(X) M=int(M) if(X==0 and M==0): break else: E=X*M print(E)
while True: b = input().split() (x, m) = b x = int(X) m = int(M) if X == 0 and M == 0: break else: e = X * M print(E)
first = ['Bucky', 'Tom', 'Taylor'] last = ['Roberts', 'Hanks', 'Swift'] names = zip(first, last) for a, b in names: print(a, b)
first = ['Bucky', 'Tom', 'Taylor'] last = ['Roberts', 'Hanks', 'Swift'] names = zip(first, last) for (a, b) in names: print(a, b)
'''To find Symmetric Difference between two Sets.''' #Example INPUT: ''' 4 2 4 5 9 4 2 4 11 12 ''' #OUTPUT: (Symmetric difference in ascending order) ''' 5 9 11 12 ''' #Code n=int(input()) a=[int(i) for i in input().split()] m=int(input()) b=[int(i) for i in input().split()] a1=set(a) b1=set(b) t=...
"""To find Symmetric Difference between two Sets.""" '\n4\n2 4 5 9\n4\n2 4 11 12\n' '\n5\n9\n11\n12\n' n = int(input()) a = [int(i) for i in input().split()] m = int(input()) b = [int(i) for i in input().split()] a1 = set(a) b1 = set(b) t = a1.union(b1) f = t - a1.intersection(b1) tt = list(f) tt.sort() for i in tt: ...
class EditorFactory(object): __registeredEditors = [] def __init__(self): super(EditorFactory, self).__init__() @classmethod def registerEditorClass(cls, widgetClass): cls.__registeredEditors.append(widgetClass) @classmethod def constructEditor(cls, valueController, parent=...
class Editorfactory(object): __registered_editors = [] def __init__(self): super(EditorFactory, self).__init__() @classmethod def register_editor_class(cls, widgetClass): cls.__registeredEditors.append(widgetClass) @classmethod def construct_editor(cls, valueController, parent...
def rev(j): rev = 0 while (j > 0): remainder = j % 10 rev = (rev * 10) + remainder j = j // 10 return rev def emirp(j): if j <= 1: return False else: for i in range(2, rev(j)): if j % i == 0 or rev(j) % i == 0: print(j, "Is not e...
def rev(j): rev = 0 while j > 0: remainder = j % 10 rev = rev * 10 + remainder j = j // 10 return rev def emirp(j): if j <= 1: return False else: for i in range(2, rev(j)): if j % i == 0 or rev(j) % i == 0: print(j, 'Is not emirp n...
x = 0 y = 0 def setup(): size(400, 400) def draw(): global x, y background(255) ellipse(x, y, 30, 30) x += (mouseX - x) / 10 y += (mouseY - y) / 10
x = 0 y = 0 def setup(): size(400, 400) def draw(): global x, y background(255) ellipse(x, y, 30, 30) x += (mouseX - x) / 10 y += (mouseY - y) / 10
def parse_from_file(filename, parser): with open(filename,"r") as f: string=f.read() args=parser.parse_args(string.split()) return args
def parse_from_file(filename, parser): with open(filename, 'r') as f: string = f.read() args = parser.parse_args(string.split()) return args
#Problem Set 02 print('Problem Set 02') # Problem 01 (20 points) print('\nProblem 1') cases = [70, 75, 126, 144, 170] cases_latest = None #TODO Replace # Problem 02 (20 points) print('\nProblem 2') tests = None #TODO Replace tests_last_three = None #TODO Replace tests_reverse = None #TODO Replace # Problem 03 ...
print('Problem Set 02') print('\nProblem 1') cases = [70, 75, 126, 144, 170] cases_latest = None print('\nProblem 2') tests = None tests_last_three = None tests_reverse = None print('\nProblem 3') vaccines = ' 39,896-41,826-44,154-46,458-48,634-50,090 ' vaccines_list = None print('\nProblem 4') dates = ['January 31st...
class Mesh: def __init__(self): self.vertexs = [] def setName(self, name): self.name = name def addVertex(self, x, y, z): self.vertexs.append([x, y, z]) def read(self): print(self.name) print(self.vertexs) def getVertexs(self): return self.vertexs ...
class Mesh: def __init__(self): self.vertexs = [] def set_name(self, name): self.name = name def add_vertex(self, x, y, z): self.vertexs.append([x, y, z]) def read(self): print(self.name) print(self.vertexs) def get_vertexs(self): return self.vert...
#!/usr/bin/env python3 class RunfileFormatError(Exception): pass class RunfileNotFoundError(Exception): def __init__(self, path): self.path = path class TargetNotFoundError(Exception): def __init__(self, target=None): self.target = target class TargetExecutionError(Exception): de...
class Runfileformaterror(Exception): pass class Runfilenotfounderror(Exception): def __init__(self, path): self.path = path class Targetnotfounderror(Exception): def __init__(self, target=None): self.target = target class Targetexecutionerror(Exception): def __init__(self, exit_cod...
count= 0 fname= input("Enter the file name:") if fname== "na na boo boo": print("NA NA BOO BOO TO YOU- You have been punk'd") exit() else: try: fhand= open(fname) except: print("File cannot be opened", fname) exit() for line in fhand: if line.startswith("Subj...
count = 0 fname = input('Enter the file name:') if fname == 'na na boo boo': print("NA NA BOO BOO TO YOU- You have been punk'd") exit() else: try: fhand = open(fname) except: print('File cannot be opened', fname) exit() for line in fhand: if line.startswith('Subject'): ...
input_data = input() symbols = {} def count_symbols(data): for symbol in data: if symbol not in symbols: symbols[symbol] = 0 symbols[symbol] += 1 return dict(sorted(symbols.items(), key=lambda s: s[0])) def print_data(symbols): for symbol, count in symbols.items(): pri...
input_data = input() symbols = {} def count_symbols(data): for symbol in data: if symbol not in symbols: symbols[symbol] = 0 symbols[symbol] += 1 return dict(sorted(symbols.items(), key=lambda s: s[0])) def print_data(symbols): for (symbol, count) in symbols.items(): pr...
def userinfo(claims, user): claims["name"] = user.username claims["preferred_username"] = user.username return claims
def userinfo(claims, user): claims['name'] = user.username claims['preferred_username'] = user.username return claims
#%% 6-misol lst=list(input().split()) lst=[int(i) for i in lst] print(lst) k=0 son=list() for i in range(len(lst)-1): if lst[i]>lst[i+1]: if son!=[]: son.append(lst[i]) print(*son) son=list() k+=1 #%% 7-misol son=int(input("son=")) list1=list() while son!=0: ...
lst = list(input().split()) lst = [int(i) for i in lst] print(lst) k = 0 son = list() for i in range(len(lst) - 1): if lst[i] > lst[i + 1]: if son != []: son.append(lst[i]) print(*son) son = list() k += 1 son = int(input('son=')) list1 = list() while son != 0:...
class Utils(object): ''' keep values between -180 and 180 degrees input and output parameters are in degrees ''' def normalize_angle(self, degrees: float) -> float: degrees = degrees % 360 if degrees > 180: return degrees - 360 return degrees
class Utils(object): """ keep values between -180 and 180 degrees input and output parameters are in degrees """ def normalize_angle(self, degrees: float) -> float: degrees = degrees % 360 if degrees > 180: return degrees - 360 return degrees
# The following is an implementation of the hex helper # from Electrum - lightweight Bitcoin client, which is # subject to the following license. # # Copyright (C) 2011 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation fil...
class Hexxer: bfh = bytes.fromhex @classmethod def bh2u(self, x: bytes) -> str: return x.hex() @classmethod def rev_hex(self, s: str) -> str: return self.bh2u(self.bfh(s)[::-1]) @classmethod def int_to_hex(self, i: int, length: int=1) -> str: if not isinstance(i, i...
num = input("Please enter a num: ") while not num.isdigit(): num = input("Please enter a num: ") print("Your num: %s" % num)
num = input('Please enter a num: ') while not num.isdigit(): num = input('Please enter a num: ') print('Your num: %s' % num)
class ModulationException(Exception): pass class EncodingException(ModulationException): pass class DecodingException(ModulationException): pass
class Modulationexception(Exception): pass class Encodingexception(ModulationException): pass class Decodingexception(ModulationException): pass
class RedisMock(): def __init__(self): self.incoming_queue = [] self.in_progress_queue = [] def brpoplpush(self, *args): if self.incoming_queue: item = self.incoming_queue.pop(0) self.in_progress_queue.append(item) return item else: ...
class Redismock: def __init__(self): self.incoming_queue = [] self.in_progress_queue = [] def brpoplpush(self, *args): if self.incoming_queue: item = self.incoming_queue.pop(0) self.in_progress_queue.append(item) return item else: ...
def solve(matrix, target): possible_results = [] for r, row in enumerate(matrix): start = 0 end = len(row) - 1 while start <= end: mid = (start + end) // 2 if row[mid] == target: possible_results.append((r + 1) * 1009 + mid + 1) ...
def solve(matrix, target): possible_results = [] for (r, row) in enumerate(matrix): start = 0 end = len(row) - 1 while start <= end: mid = (start + end) // 2 if row[mid] == target: possible_results.append((r + 1) * 1009 + mid + 1) b...
class Solution: def pivotIndex(self, nums: List[int]) -> int: for i in range(0, len(nums)): if sum(nums[:i]) == sum(nums[i+1:]): return i return -1
class Solution: def pivot_index(self, nums: List[int]) -> int: for i in range(0, len(nums)): if sum(nums[:i]) == sum(nums[i + 1:]): return i return -1
class Solution: def longestOnes(self, A: List[int], K: int) -> int: maxLen = zero = start = 0 for i, a in enumerate(A): if a == 0: zero += 1 while zero > K: if A[start] == 0: zero -= 1 start += 1 ...
class Solution: def longest_ones(self, A: List[int], K: int) -> int: max_len = zero = start = 0 for (i, a) in enumerate(A): if a == 0: zero += 1 while zero > K: if A[start] == 0: zero -= 1 start += 1 ...
# Fill all this out with your information patreon_client_id = None patreon_client_secret = None patreon_creator_refresh_token = None patreon_creator_access_token = None patreon_creator_id = None patreon_redirect_uri = None
patreon_client_id = None patreon_client_secret = None patreon_creator_refresh_token = None patreon_creator_access_token = None patreon_creator_id = None patreon_redirect_uri = None
# Initialize Global Variables VERSION = '1.4' TITLE = 'RO:X Next Generation - Auto Fishing version' PID = '' SCREEN_WIDTH = 0 SCREEN_HEIGHT = 0 IS_ACTIVE = False HOLD = True FRAME = None PREV_TIME = 0 CURRENT_TIME = 0 LIMIT = 0 LOOP = 0 IS_FISHING = True LAST_CLICK_TIME = 0 COUNT = 0 BOUNDING_BOX = {'top': 0, 'left...
version = '1.4' title = 'RO:X Next Generation - Auto Fishing version' pid = '' screen_width = 0 screen_height = 0 is_active = False hold = True frame = None prev_time = 0 current_time = 0 limit = 0 loop = 0 is_fishing = True last_click_time = 0 count = 0 bounding_box = {'top': 0, 'left': 0, 'width': 240, 'height': 250}...
class Node: next_node = None data = 0 def __init__(self, value): self.data = value def run(input_data): if input_data is None or input_data.next_node is None: return False input_data.data = input_data.next_node.data input_data.next_node = input_data.next_node.next_node retu...
class Node: next_node = None data = 0 def __init__(self, value): self.data = value def run(input_data): if input_data is None or input_data.next_node is None: return False input_data.data = input_data.next_node.data input_data.next_node = input_data.next_node.next_node retu...
# File to automate the conversion of the glosary to txt file text_file = open("glossory.txt", "r") glossory = text_file.readlines() word = [] deffinition = [] for i in range(len(glossory)): if (i % 2) == 0: word.append(glossory[i]) else: deffinition.append(glossory[i]) word[:] = [line.rstrip(...
text_file = open('glossory.txt', 'r') glossory = text_file.readlines() word = [] deffinition = [] for i in range(len(glossory)): if i % 2 == 0: word.append(glossory[i]) else: deffinition.append(glossory[i]) word[:] = [line.rstrip('\n') for line in word] deffinition[:] = [line.rstrip('\n') for li...
class CronExecutor(object): def __init__(self): # cron cache key is {<Date String YYY-mm-dd>: {<timestamp>: [<string command 1>...]} self._cache = {}
class Cronexecutor(object): def __init__(self): self._cache = {}
# connect-4 # Define the board's Width and Height as constant WIDTH = 7 HEIGHT = 6 def init_board(): b = [] for x in range(0, WIDTH): b.append([]) for y in range(0, HEIGHT): b[x].append(0) return b def player1_move(board, x, y): board[x][y] = 1 def player2_move(board, ...
width = 7 height = 6 def init_board(): b = [] for x in range(0, WIDTH): b.append([]) for y in range(0, HEIGHT): b[x].append(0) return b def player1_move(board, x, y): board[x][y] = 1 def player2_move(board, x, y): board[x][y] = 2 def print_board(board): for y in r...
class _BaseStateError(BaseException): '''Base class for state-related exceptions. Accepts only one param which must be a list of strings.''' def __init__(self, message=None): message = message or [] if not isinstance(message, list): raise TypeError('{} takes a list of errors not ...
class _Basestateerror(BaseException): """Base class for state-related exceptions. Accepts only one param which must be a list of strings.""" def __init__(self, message=None): message = message or [] if not isinstance(message, list): raise type_error('{} takes a list of errors no...
# # PySNMP MIB module EATON-EPDU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EATON-EPDU-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:44:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint) ...
# -*- coding: utf-8 -*- # URI Judge - Problema 1013 a, b, c = map(int, input().split()) if a > (b and c): print(str(a) + " eh o maior") elif b > c: print(str(b) + " eh o maior") else: print(str(c) + " eh o maior")
(a, b, c) = map(int, input().split()) if a > (b and c): print(str(a) + ' eh o maior') elif b > c: print(str(b) + ' eh o maior') else: print(str(c) + ' eh o maior')
#reg add HKEY_CURRENT_USER\Console /v VirtualTerminalLevel /t REG_DWORD /d 0x00000001 /f colors = {\ 'OKBLUE' : '\033[94m', 'OKGREEN' : '\033[92m', 'WARNING' : '\033[93m', 'RED' : '\033[1;31;40m', } def colorText(text): for color in colors: text = text.replace("[[" + color + "]...
colors = {'OKBLUE': '\x1b[94m', 'OKGREEN': '\x1b[92m', 'WARNING': '\x1b[93m', 'RED': '\x1b[1;31;40m'} def color_text(text): for color in colors: text = text.replace('[[' + color + ']]', colors[color]) return text hola = '\n\n\n[[OKGREEN]] \n_ _ ____ _ _ ____ \n/ )( ( _ \\/ )( ( _ \\ /\\ /) /\\ /...
#function to check whether a number is in a given range. def test_range(n): if n in range(3,9): print( " %s is in the range"%str(n)) else : print("The number is outside the given range.") test_range(5)
def test_range(n): if n in range(3, 9): print(' %s is in the range' % str(n)) else: print('The number is outside the given range.') test_range(5)
ans = 0 for _ in range(5): a, b, c = sorted([int(x) for x in input().split()]) if a + b > c: ans += 1 print(ans)
ans = 0 for _ in range(5): (a, b, c) = sorted([int(x) for x in input().split()]) if a + b > c: ans += 1 print(ans)
def move_cars(current, final): if len(current) <= 1: return 0 if len(current) == 2 and current[0] == final[0]: return 0 moves = 0 for i, car in enumerate(current): if car == final[i]: if car == '_': # need to move car to this spot first ...
def move_cars(current, final): if len(current) <= 1: return 0 if len(current) == 2 and current[0] == final[0]: return 0 moves = 0 for (i, car) in enumerate(current): if car == final[i]: if car == '_': moves += 1 else: moves += 1 ...
def get_letter_frequency(word): chars_dict = {} for letter in word: if letter in chars_dict: chars_dict[letter] += 1 else: chars_dict[letter] = 1 return chars_dict def number_of_deletions(a, b): count = 0 chars_of_a = get_letter_frequency(a) chars_of_b = ...
def get_letter_frequency(word): chars_dict = {} for letter in word: if letter in chars_dict: chars_dict[letter] += 1 else: chars_dict[letter] = 1 return chars_dict def number_of_deletions(a, b): count = 0 chars_of_a = get_letter_frequency(a) chars_of_b = ...
# -*- coding: utf-8 -*- # Created at 03/10/2020 __author__ = 'raniys' class HomeData: home_url = "https://www.python.org/" search_text = "pycon"
__author__ = 'raniys' class Homedata: home_url = 'https://www.python.org/' search_text = 'pycon'
def get_db_uri(dbinfo): username = dbinfo.get('user') or "root" password = dbinfo.get('pwd') or "123456" host = dbinfo.get('host') or "localhost" port = dbinfo.get('port') or "3306" database = dbinfo.get('dbname') or "pythonixf" driver = dbinfo.get('driver') or "pymysql" dialect = dbinfo.get...
def get_db_uri(dbinfo): username = dbinfo.get('user') or 'root' password = dbinfo.get('pwd') or '123456' host = dbinfo.get('host') or 'localhost' port = dbinfo.get('port') or '3306' database = dbinfo.get('dbname') or 'pythonixf' driver = dbinfo.get('driver') or 'pymysql' dialect = dbinfo.get...
expected_output = { "vrf": { "L3VPN-1538": { "index": {1: {"address_type": "Interface", "ip_address": "192.168.10.254"}} } } }
expected_output = {'vrf': {'L3VPN-1538': {'index': {1: {'address_type': 'Interface', 'ip_address': '192.168.10.254'}}}}}
fib = {1: 1, 2: 1, 3: 2, 4: 3} print(fib.get(4, 0) + fib.get(7, 5)) ## get(4,0) is 3 because as you can see, 4:3, in the key 4, you can 3. ## Since there is not key 7, this will just equivalent to 5. ## 3 + 5 = 8 ## output is 8
fib = {1: 1, 2: 1, 3: 2, 4: 3} print(fib.get(4, 0) + fib.get(7, 5))
contPares = 0 print('Numeros pares: ',end='') for i in range(1,51): if i % 2 == 0: print(i, end=' ')
cont_pares = 0 print('Numeros pares: ', end='') for i in range(1, 51): if i % 2 == 0: print(i, end=' ')
__author__ = 'Meemaw' def isPalindrome(x, i): zacetek = 0 konec = len(x)-1 while zacetek <= konec: if x[zacetek] != x[konec]: return 0 zacetek+=1 konec-=1 return 1 vsota = 0 print("Please insert upper bound:") x = int(input()) for i in range(1,x+1): if isPalind...
__author__ = 'Meemaw' def is_palindrome(x, i): zacetek = 0 konec = len(x) - 1 while zacetek <= konec: if x[zacetek] != x[konec]: return 0 zacetek += 1 konec -= 1 return 1 vsota = 0 print('Please insert upper bound:') x = int(input()) for i in range(1, x + 1): if ...
class NestedIterator: def __init__(self, nestedList): self.l = [] self.i = 0 def search(l): for e in l: if e.isInteger(): self.l.append(e.getInteger()) else: search(e.getList()) search(nestedList) ...
class Nestediterator: def __init__(self, nestedList): self.l = [] self.i = 0 def search(l): for e in l: if e.isInteger(): self.l.append(e.getInteger()) else: search(e.getList()) search(nestedList) ...
#https://www.hackerrank.com/challenges/quicksort1 def partition(a, first, last): pivot = a[first] wall = last+1 for j in range(last, first,-1): if a[j] > pivot: wall -= 1 if j!=wall: a[j],a[wall] = a[wall], a[j] #saves time. in case lik [3,2,4,1] do its partition and s...
def partition(a, first, last): pivot = a[first] wall = last + 1 for j in range(last, first, -1): if a[j] > pivot: wall -= 1 if j != wall: (a[j], a[wall]) = (a[wall], a[j]) (a[wall - 1], a[first]) = (a[first], a[wall - 1]) return a n = int(input()) a = ...
prompt = input('Enter the file name: ') try: prompt = open(prompt) except: print('File cannot be opened:', prompt) exit() total = 0 count = 0 # reading through the file for line in prompt: if line.startswith("X-DSPAM-Confidence:"): # removes lines after and before a sentence line = line....
prompt = input('Enter the file name: ') try: prompt = open(prompt) except: print('File cannot be opened:', prompt) exit() total = 0 count = 0 for line in prompt: if line.startswith('X-DSPAM-Confidence:'): line = line.strip() pos = line.index(':') f_num = float(line[pos + 1:]) ...
SOLUTIONS = { "LC": [ [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], ], "WASTE": [ [0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0],...
solutions = {'LC': [[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]], 'WASTE': [[0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [...
number = [1,3,6,2,7,5,8,9,0] result = filter(lambda x:x>5,number) print("Number List",number) print("Number Smaller than 5 in the list are:",list(result))
number = [1, 3, 6, 2, 7, 5, 8, 9, 0] result = filter(lambda x: x > 5, number) print('Number List', number) print('Number Smaller than 5 in the list are:', list(result))
# # PySNMP MIB module NETGEAR-REF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETGEAR-REF-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:19:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ...
my_host = 'localhost' my_port = 10000 is_emulation = False emulator_host = '0.0.0.0' emulator_port = 4390 apis_web_host = '0.0.0.0' apis_web_budo_emulator_port = 43830 apis_web_api_server_port = 9999 #apis_log_group_address = 'FF02:0:0:0:0:0:0:1' apis_log_group_address = '224.2.2.4' apis_log_port = 8888 units = [...
my_host = 'localhost' my_port = 10000 is_emulation = False emulator_host = '0.0.0.0' emulator_port = 4390 apis_web_host = '0.0.0.0' apis_web_budo_emulator_port = 43830 apis_web_api_server_port = 9999 apis_log_group_address = '224.2.2.4' apis_log_port = 8888 units = [{'id': 'E001', 'name': 'E001', 'host': '0.0.0.0', 'dc...
def primes(): i, f = 2, 1 while True: if (f + 1) % i == 0: yield i f, i = f * i, i + 1
def primes(): (i, f) = (2, 1) while True: if (f + 1) % i == 0: yield i (f, i) = (f * i, i + 1)
mypass = input() if ("1234" or "qwerty" in mypass) or (len(mypass) < 8): print("Bad password") elif ("1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9" or "0") not in mypass: print("Bad password") else: print("Good password")
mypass = input() if ('1234' or 'qwerty' in mypass) or len(mypass) < 8: print('Bad password') elif ('1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' or '0') not in mypass: print('Bad password') else: print('Good password')
n, m = map(int, input().split()) matches = [] for i in range(m): matches.append(list(map(int, input().split()))) matches.sort(key=lambda container: container[1], reverse=True) count = 0 i = 0 j = 0 while i <= n and j < m: if matches[j][0] < n - i: i += matches[j][0] count += matches[j][0] * mat...
(n, m) = map(int, input().split()) matches = [] for i in range(m): matches.append(list(map(int, input().split()))) matches.sort(key=lambda container: container[1], reverse=True) count = 0 i = 0 j = 0 while i <= n and j < m: if matches[j][0] < n - i: i += matches[j][0] count += matches[j][0] * ma...
# 'guinea pig' is appended to the animals list animals.append('guinea pig') # Updated animals list print('Updated animals list: ', animals)
animals.append('guinea pig') print('Updated animals list: ', animals)
maze = ' ******* * **** * **** * *** *# *** *** *** *********' g = '' s = '' for i in range(0, len(maze)): g += maze[i] if (i+1)%8==0: g += s + '\n' s = '' print(g)
maze = ' ******* * **** * **** * *** *# *** *** *** *********' g = '' s = '' for i in range(0, len(maze)): g += maze[i] if (i + 1) % 8 == 0: g += s + '\n' s = '' print(g)
class Error(Exception): pass class FieldLookupError(Error): pass class BadValueError(Error): pass class DocumentClassRequiredError(Error): pass class FieldError(Error): pass
class Error(Exception): pass class Fieldlookuperror(Error): pass class Badvalueerror(Error): pass class Documentclassrequirederror(Error): pass class Fielderror(Error): pass
# pylint: disable=missing-docstring,too-few-public-methods class AbstractFoo: def kwonly_1(self, first, *, second, third): "Normal positional with two positional only params." def kwonly_2(self, *, first, second): "Two positional only parameter." def kwonly_3(self, *, first, second): ...
class Abstractfoo: def kwonly_1(self, first, *, second, third): """Normal positional with two positional only params.""" def kwonly_2(self, *, first, second): """Two positional only parameter.""" def kwonly_3(self, *, first, second): """Two positional only params.""" def kwon...
#paste your api_hash and api_id from my.telegram.org api_hash = "exxxxxxxxxx" api_id = xxxx entity = "tgcloud"
api_hash = 'exxxxxxxxxx' api_id = xxxx entity = 'tgcloud'
# Server Specific Configurations server = { 'port': '8558', 'host': '0.0.0.0' } # Pecan Application Configurations app = { 'root': 'vouch.controllers.root.RootController', 'modules': ['vouch'], 'debug': False, # this 'guess' also strips off the extension from the resource path. 'guess_cont...
server = {'port': '8558', 'host': '0.0.0.0'} app = {'root': 'vouch.controllers.root.RootController', 'modules': ['vouch'], 'debug': False, 'guess_content_type_from_ext': False} logging = {'loggers': {'vouch': {'level': 'DEBUG', 'handlers': ['console']}, 'keystonemiddleware': {'level': 'DEBUG', 'handlers': ['console']},...
def shakehand(): rest() i01.startedGesture() ##move arm and hand i01.setHandSpeed("left", 0.65, 0.65, 0.65, 0.65, 0.65, 1.0) i01.setHandSpeed("right", 0.65, 0.65, 0.65, 0.65, 0.65, 1.0) i01.setArmSpeed("right", 0.75, 0.85, 0.95, 0.85) i01.setArmSpeed("left", 0.75, 0.85, 0.95, 0.85) i01.setHeadSpeed(1.0,...
def shakehand(): rest() i01.startedGesture() i01.setHandSpeed('left', 0.65, 0.65, 0.65, 0.65, 0.65, 1.0) i01.setHandSpeed('right', 0.65, 0.65, 0.65, 0.65, 0.65, 1.0) i01.setArmSpeed('right', 0.75, 0.85, 0.95, 0.85) i01.setArmSpeed('left', 0.75, 0.85, 0.95, 0.85) i01.setHeadSpeed(1.0, 1.0) ...
# Copyright (c) 2013 Huan Do, http://huan.do class FrameContextManager(object): def __init__(self, frame, visitor): self.frame = frame self.visitor = visitor def __enter__(self): self.visitor.current_frame = self.frame return self.frame def __exit__(self, *_): sel...
class Framecontextmanager(object): def __init__(self, frame, visitor): self.frame = frame self.visitor = visitor def __enter__(self): self.visitor.current_frame = self.frame return self.frame def __exit__(self, *_): self.visitor.withdraw_frame()
# wczytanie napisow with open('../dane/NAPIS.TXT') as f: data = [] for word in f.readlines(): data.append(word[:-1]) # zbior slow rosnacych growing = [] # przejscie po slowach for word in data: # przejscie po literach i sprawdzenie czy aktualna wartosc ASCII litery jest wieksza niz poprzednej ...
with open('../dane/NAPIS.TXT') as f: data = [] for word in f.readlines(): data.append(word[:-1]) growing = [] for word in data: isgrowing = True prevnum = 0 for char in word: if prevnum >= ord(char): isgrowing = False break prevnum = ord(char) if i...
sum = lambda a, b : a + b print(sum(3,4)) def sum1(a, b): return a + b print(sum1(4, 5)) myList = [lambda a, b : a + b, lambda a, b : a * b] print(myList) print(myList[0]) print(myList[0](3, 4)) print(myList[1](3, 4))
sum = lambda a, b: a + b print(sum(3, 4)) def sum1(a, b): return a + b print(sum1(4, 5)) my_list = [lambda a, b: a + b, lambda a, b: a * b] print(myList) print(myList[0]) print(myList[0](3, 4)) print(myList[1](3, 4))
# pylint: disable=missing-docstring def baz(): # [disallowed-name] pass
def baz(): pass
# c:\Users\i341972\Desktop\git_repos\enaml\enaml\core\parse_tab\parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\x7f\xdd\xc1Pb\x9c\xa9\xeb\xac\xc9\xad\xb5=\x06\x80j' _lr_action_items = {'LPAR':([0,1,6,7,9,13,14,16,18,24,28,29,30,31,33,35,...
_tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\x7fÝÁPb\x9c©ë¬É\xadµ=\x06\x80j' _lr_action_items = {'LPAR': ([0, 1, 6, 7, 9, 13, 14, 16, 18, 24, 28, 29, 30, 31, 33, 35, 39, 42, 43, 44, 47, 49, 52, 54, 55, 57, 61, 63, 64, 65, 67, 72, 73, 74, 82, 83, 85, 86, 89, 90, 95, 96, 97, 102, 103, 104, 106, 109, 112, 116...
repeat = int(input()) for x in range(repeat): div1, div2, uplim = map(int, input().split()) divisor = div1 * div2 for i in range(divisor, uplim + 1, divisor): print(i) if x != repeat - 1: print()
repeat = int(input()) for x in range(repeat): (div1, div2, uplim) = map(int, input().split()) divisor = div1 * div2 for i in range(divisor, uplim + 1, divisor): print(i) if x != repeat - 1: print()
DFLT_TOURN_PART_NAME = 'Unknown' GANG_LEADER = 'Gang Leader' GROUP_NAMES = {'Thug 1': 'Thugs', 'Robber 1': 'Robbers'} SURNAME_PARTS = [ 'bai', 'cai', 'cao', 'chang', 'chen', 'cheng', 'cui', 'dai', 'deng', 'ding', 'dong', 'du', 'duan', 'fan', 'fang', 'fen...
dflt_tourn_part_name = 'Unknown' gang_leader = 'Gang Leader' group_names = {'Thug 1': 'Thugs', 'Robber 1': 'Robbers'} surname_parts = ['bai', 'cai', 'cao', 'chang', 'chen', 'cheng', 'cui', 'dai', 'deng', 'ding', 'dong', 'du', 'duan', 'fan', 'fang', 'feng', 'fu', 'gao', 'gong', 'gu', 'guo', 'han', 'hao', 'he', 'hou', 'h...
''' Created on 07.11.2019 @author: JM ''' class TMC4361_register_variant: " ===== TMC4361 register variants ===== " "..."
""" Created on 07.11.2019 @author: JM """ class Tmc4361_Register_Variant: """ ===== TMC4361 register variants ===== """ '...'
load( "//:repositories.bzl", "com_github_scalapb_scalapb", "io_bazel_rules_scala", "io_grpc_grpc_java", "scalapb_runtime", "scalapb_runtime_grpc", "scalapb_lenses", "rules_proto_grpc_repos", ) def scala_repos(**kwargs): rules_proto_grpc_repos(**kwargs) io_grpc_grpc_java(**kwargs...
load('//:repositories.bzl', 'com_github_scalapb_scalapb', 'io_bazel_rules_scala', 'io_grpc_grpc_java', 'scalapb_runtime', 'scalapb_runtime_grpc', 'scalapb_lenses', 'rules_proto_grpc_repos') def scala_repos(**kwargs): rules_proto_grpc_repos(**kwargs) io_grpc_grpc_java(**kwargs) com_github_scalapb_scalapb(**...
def scope_demo(): # definition of variable is local to do_local(), and so doesn't survive # when method goes out of scope. (This draws a weak warning that the local # variable is not used.) def do_local(): spam = "local spam" # definition of variable is specifically not local to do_nonlo...
def scope_demo(): def do_local(): spam = 'local spam' def do_nonlocal(): nonlocal spam spam = 'nonlocal spam' def do_global(): global spam spam = 'global spam' spam = 'test spam' do_local() print('After local assignment:', spam) do_nonlocal() pr...