content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def lengthOfLastWord(self, s: str) -> int: if len(s.strip()) == 0: return 0 else: return len(s.strip().split(' ')[-1])
class Solution: def length_of_last_word(self, s: str) -> int: if len(s.strip()) == 0: return 0 else: return len(s.strip().split(' ')[-1])
def externa(func): def interna(x, y): return func(x, y) return interna @externa def soma(x, y): return x + y print(soma(2,2))
def externa(func): def interna(x, y): return func(x, y) return interna @externa def soma(x, y): return x + y print(soma(2, 2))
with open('inputs/input14.txt') as fin: raw = fin.read() def parse(raw): a = [x for x in raw.split('\nmask')] for i, x in enumerate(a): test = x.split('\n') x = [test[0][test[0].find('=') + 2:], [[int(i[4:i.find(']')]), int(i[i.find('=') + 2:])] for i in test if i.startswith('mem')]] ...
with open('inputs/input14.txt') as fin: raw = fin.read() def parse(raw): a = [x for x in raw.split('\nmask')] for (i, x) in enumerate(a): test = x.split('\n') x = [test[0][test[0].find('=') + 2:], [[int(i[4:i.find(']')]), int(i[i.find('=') + 2:])] for i in test if i.startswith('mem')]] ...
# Time: O(n) # Space: O(h) class Solution(object): def depthSumInverse(self, nestedList): """ :type nestedList: List[NestedInteger] :rtype: int """ def depthSumInverseHelper(list, depth, result): if len(result) < depth + 1: result.appe...
class Solution(object): def depth_sum_inverse(self, nestedList): """ :type nestedList: List[NestedInteger] :rtype: int """ def depth_sum_inverse_helper(list, depth, result): if len(result) < depth + 1: result.append(0) if list.isInteg...
## Base64 encoded admin:Strangep4assw0rd #auth = {'Authorization': 'Basic YWRtaW46U3RyYW5nZXA0YXNzdzByZA=='} RUBRIK_AUTH = 'YWRtaW46U3RyYW5nZXA0YXNzdzByZA==' RUBRIK_URL = 'rubrik.company.com'
rubrik_auth = 'YWRtaW46U3RyYW5nZXA0YXNzdzByZA==' rubrik_url = 'rubrik.company.com'
N = int(input()) L = list(map(int, input().split())) max_len = max(L) sum = 0 for i in L: sum += i sum -= max_len print("Yes" if sum > max_len else "No")
n = int(input()) l = list(map(int, input().split())) max_len = max(L) sum = 0 for i in L: sum += i sum -= max_len print('Yes' if sum > max_len else 'No')
# -*- coding: utf-8 -*- positives = 0 for i in range(6): number = float(input()) if (number > 0): positives += 1 print("%d valores positivos" % positives)
positives = 0 for i in range(6): number = float(input()) if number > 0: positives += 1 print('%d valores positivos' % positives)
''' Various commands of the same kind as `~owmeta_core.command.OWM`, mostly intended as sub-commands of `OWM`. '''
""" Various commands of the same kind as `~owmeta_core.command.OWM`, mostly intended as sub-commands of `OWM`. """
# We can get an individual character from a string # by indexing it. name = "Patrick" # eg. char in position 0 print(name[0]) # eg. char in position 2 print(name[2]) # using a negative index takes chars from the end. # -1 means the last char in the string, # (because -0 is the same as 0). print(name[-1])
name = 'Patrick' print(name[0]) print(name[2]) print(name[-1])
# 2D Lists hero=["Iron Man", "Thor", "Hulk"] villan=["Thanos", "Ultron", "Taskmaster"] places=["midgaurd", "nowhere", "Titan"] mixer=[hero,villan,places] print(mixer[0][0]+" Killed "+mixer[1][0]+ " at "+mixer[2][2]) print(":)")
hero = ['Iron Man', 'Thor', 'Hulk'] villan = ['Thanos', 'Ultron', 'Taskmaster'] places = ['midgaurd', 'nowhere', 'Titan'] mixer = [hero, villan, places] print(mixer[0][0] + ' Killed ' + mixer[1][0] + ' at ' + mixer[2][2]) print(':)')
def flip_and_invert_image(matrix): """ 0 ^ 1 = 1 1 ^ 1 = 0 """ for row in matrix: reverse(row) for i in range(len(row)): row[i] = row[i] ^ 1 return matrix def reverse(arr): left, right = 0, len(arr)-1 while left < right: arr[left], arr[right] = arr[right], arr[left] left += 1 ...
def flip_and_invert_image(matrix): """ 0 ^ 1 = 1 1 ^ 1 = 0 """ for row in matrix: reverse(row) for i in range(len(row)): row[i] = row[i] ^ 1 return matrix def reverse(arr): (left, right) = (0, len(arr) - 1) while left < right: (arr[left], arr[right]) = (arr...
''' Concatenating vertically to get MultiIndexed rows When stacking a sequence of DataFrames vertically, it is sometimes desirable to construct a MultiIndex to indicate the DataFrame from which each row originated. This can be done by specifying the keys parameter in the call to pd.concat(), which generates a hierarch...
""" Concatenating vertically to get MultiIndexed rows When stacking a sequence of DataFrames vertically, it is sometimes desirable to construct a MultiIndex to indicate the DataFrame from which each row originated. This can be done by specifying the keys parameter in the call to pd.concat(), which generates a hierarch...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 9 12:02:48 2018 @author: ablaas """
""" Created on Mon Apr 9 12:02:48 2018 @author: ablaas """
def get_fuel(mass): return int(mass / 3) - 2 def get_total_fuel(fuel): adds = [] append = adds.append while True: fuel = get_fuel(fuel) if fuel > 0: append(fuel) else: return sum(adds) def solve1(modules): return sum(get_fuel(m) for m in modules) de...
def get_fuel(mass): return int(mass / 3) - 2 def get_total_fuel(fuel): adds = [] append = adds.append while True: fuel = get_fuel(fuel) if fuel > 0: append(fuel) else: return sum(adds) def solve1(modules): return sum((get_fuel(m) for m in modules)) ...
# -*- coding: utf-8 -*- def asian_character_check(segments): ''' Identifies Asian characters included in the target English text of a given segment. A character is defined as being Asian if the Unicode code point of the character is greater than that for the ideographic space (doublebyte/fullwidth...
def asian_character_check(segments): """ Identifies Asian characters included in the target English text of a given segment. A character is defined as being Asian if the Unicode code point of the character is greater than that for the ideographic space (doublebyte/fullwidth space). This results in c...
print("I will now count my chickens:") print("Hens", 25 + 30 /6 ) print("Roosters", 100 - 25 * 3% 4) print("Now I will ocunt the eggs :") print(3 + 2 + 1 - 5 % + 4 % 2 - 1/4 +6) print("Is it true that 3 + 2 < 5 - 7?") print(3+2 < 5-7) print("What is 3 + 2 ? " , 3+ 2)
print('I will now count my chickens:') print('Hens', 25 + 30 / 6) print('Roosters', 100 - 25 * 3 % 4) print('Now I will ocunt the eggs :') print(3 + 2 + 1 - 5 % +4 % 2 - 1 / 4 + 6) print('Is it true that 3 + 2 < 5 - 7?') print(3 + 2 < 5 - 7) print('What is 3 + 2 ? ', 3 + 2)
#input name = input("Your Name: ") age = input("Your Age: ") #output print ("Hello",name,"Your age is",age,"years old")
name = input('Your Name: ') age = input('Your Age: ') print('Hello', name, 'Your age is', age, 'years old')
class Tree(): def __init__(self, val, left=None, right=None): self.value = val self.left = left self.right = right def max_depth(tree): if not tree: return 0 depth_rigth=max_depth(tree.right) depth_left=max_depth(tree.left) return max(depth_left, depth_rigth)+1 def is_BST_balanced(tree): return abs(ma...
class Tree: def __init__(self, val, left=None, right=None): self.value = val self.left = left self.right = right def max_depth(tree): if not tree: return 0 depth_rigth = max_depth(tree.right) depth_left = max_depth(tree.left) return max(depth_left, depth_rigth) + 1 ...
class NonVersionMessageError(Exception): def __init__(self, msg: str, is_known: bool) -> None: super().__init__(msg) self.msg: str = msg self.is_known: bool = is_known
class Nonversionmessageerror(Exception): def __init__(self, msg: str, is_known: bool) -> None: super().__init__(msg) self.msg: str = msg self.is_known: bool = is_known
num=1 for i in range(1, 20, 1): j=1 while (num%i!=0): num*=j if (num%i!=0): num/=j j+=1 print(num)
num = 1 for i in range(1, 20, 1): j = 1 while num % i != 0: num *= j if num % i != 0: num /= j j += 1 print(num)
RELU = "relu" SIGMOID = "sigmoid" FMNIST_PATH = "data/fmnist/" TASKS = "tasks" MIXING = "mixing" TOTAL_EPOCHS = "total_epochs" SWITCH_EPOCH = "switch_epoch" LEARNING_RATE = "learning_rate" BATCH_SIZE = "batch_size" INPUT_DIMENSION = "input_dimension" HIDDEN_DIMENSION = "hidden_dimension" OUTPUT_DIMENSION = "output_dime...
relu = 'relu' sigmoid = 'sigmoid' fmnist_path = 'data/fmnist/' tasks = 'tasks' mixing = 'mixing' total_epochs = 'total_epochs' switch_epoch = 'switch_epoch' learning_rate = 'learning_rate' batch_size = 'batch_size' input_dimension = 'input_dimension' hidden_dimension = 'hidden_dimension' output_dimension = 'output_dime...
# # PySNMP MIB module FASTPATH-QOS-DIFFSERV-EXTENSIONS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-QOS-DIFFSERV-EXTENSIONS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:58:32 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # U...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ...
class Solution: def mergeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]: if not head: return None if not head.next.val: node = ListNode(head.val) node.next = self.mergeNodes(head.next.next) return node next = self.mergeNodes(head.next) next.val += head.val ret...
class Solution: def merge_nodes(self, head: Optional[ListNode]) -> Optional[ListNode]: if not head: return None if not head.next.val: node = list_node(head.val) node.next = self.mergeNodes(head.next.next) return node next = self.mergeNodes(hea...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. py:currentmodule:: pysemeels.mc.oos_file .. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca> Read and write oos file genereated by oos_maker code. """ ############################################################################### # Copyright 2017 He...
""" .. py:currentmodule:: pysemeels.mc.oos_file .. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca> Read and write oos file genereated by oos_maker code. """ class Oosfile(object): def __init__(self): self.title = '' self.number_electrons = None self.molecular_weight = None ...
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage def run_multi_type_test (opname, tagname, options) : global command command += testshade("-g 32 32 --param numStripes ...
def run_multi_type_test(opname, tagname, options): global command command += testshade('-g 32 32 --param numStripes 16 ' + options + ' -od uint8 -o out_float out_float_' + tagname + '.tif -o out_color out_color_' + tagname + '.tif -o out_point out_point_' + tagname + '.tif -o out_vector out_vector_' + tagname +...
class Stepper: def __init__(self) -> None: self.current_pos = 0 #angle (rad) from angle origin pass def setPos(self) -> None: self.current_pos = 0 def getPos(self) -> None: return self.current_pos def Step(self, x, clk_wise=True) -> None: #x=number of steps #actuate motor function here self.get...
class Stepper: def __init__(self) -> None: self.current_pos = 0 pass def set_pos(self) -> None: self.current_pos = 0 def get_pos(self) -> None: return self.current_pos def step(self, x, clk_wise=True) -> None: self.getPos() def move_to(self, a) -> None: ...
def tt(a,b) : print(a,b) ParaPkg = CallBackObj.PrintHello("---------------",{'Name': 'Zara', 'Age': 7, 'Class': True},1234) print(ParaPkg) print(ParaPkg._Get(0)) print(ParaPkg._Get(1)) print(ParaPkg._Get(1)._ToTuple()) print(ParaPkg._Get(2)) return a,b g1 = 123 def rr() : print("f...
def tt(a, b): print(a, b) para_pkg = CallBackObj.PrintHello('---------------', {'Name': 'Zara', 'Age': 7, 'Class': True}, 1234) print(ParaPkg) print(ParaPkg._Get(0)) print(ParaPkg._Get(1)) print(ParaPkg._Get(1)._ToTuple()) print(ParaPkg._Get(2)) return (a, b) g1 = 123 def rr(): prin...
# -*- coding:utf-8 -*- ''' @project: '__dbreport__.py' @modules: report.sqlscript @description: @author: abelit @email: ychenid@live.com @created:Feb 10, 2018 @licence: GPL ''' sqlpool = { "test_connect": """select 1 from dual""", "instance_status": """select instance_name,host_name,startup_time,status,datab...
""" @project: '__dbreport__.py' @modules: report.sqlscript @description: @author: abelit @email: ychenid@live.com @created:Feb 10, 2018 @licence: GPL """ sqlpool = {'test_connect': 'select 1 from dual', 'instance_status': 'select instance_name,host_name,startup_time,status,database_status from v$instance', 'database_...
class Solution: def isValid(self, s: str) -> bool: stack = [] lookup = {} lookup['('] = ')' lookup['['] = ']' lookup['{'] = '}' for para in s: if para in lookup: stack.append(para) elif len(stack) == 0: ...
class Solution: def is_valid(self, s: str) -> bool: stack = [] lookup = {} lookup['('] = ')' lookup['['] = ']' lookup['{'] = '}' for para in s: if para in lookup: stack.append(para) elif len(stack) == 0: return ...
class Solution: def dominantIndex(self, nums: List[int]) -> int: idx, m1, m2 = -1, -1, -1 for i, n in enumerate(nums): if n > m1: idx, m1, m2 = i, n, m1 elif n > m2: m2 = n return idx if (m1 >= 2*m2) else -1
class Solution: def dominant_index(self, nums: List[int]) -> int: (idx, m1, m2) = (-1, -1, -1) for (i, n) in enumerate(nums): if n > m1: (idx, m1, m2) = (i, n, m1) elif n > m2: m2 = n return idx if m1 >= 2 * m2 else -1
def first_not_repeating_character(s): # Create a list to hold the characters nr_chars = [] # Create a dict to hold the count count = {} # Loop through the string for i in s: # If the letter is already in the dict if i in count: # Increment the count c...
def first_not_repeating_character(s): nr_chars = [] count = {} for i in s: if i in count: count[i] += 1 else: count[i] = 1 nr_chars.append(i) for i in nr_chars: if count[i] == 1: return i return '_'
""" Template file for creating micropiplines for Global Fishing Watch """ # [TODO]: Review and edit everything in this file __version__ = '0.0.1' __author__ = 'Paul Woods' __email__ = 'paul@globalfishingwatch.org' __source__ = 'https://github.com/GlobalFishingWatch/pipe-template-python' __license__ = """ Copyright 20...
""" Template file for creating micropiplines for Global Fishing Watch """ __version__ = '0.0.1' __author__ = 'Paul Woods' __email__ = 'paul@globalfishingwatch.org' __source__ = 'https://github.com/GlobalFishingWatch/pipe-template-python' __license__ = '\nCopyright 2018 Global Fishing Watch Inc.\nAuthors:\n\nPaul Woods ...
###### Config for test SP_RUN_TIMES = 3 SP_LOG_FILENAME = "LOG_MODELS" SP_PATH_SAVE_BASE = "history/results/" SP_DRAW = True SP_PRINT_TRAIN = 2 # 0: nothing, 1 : full detail, 2: short version SP_PREPROCESSING_METHOD = 0 # 0: sliding window, 1: mean, 2: min-mean-max, 3: min-median-max SP_DATA_SPLIT_INDEX = (0.8, 0, ...
sp_run_times = 3 sp_log_filename = 'LOG_MODELS' sp_path_save_base = 'history/results/' sp_draw = True sp_print_train = 2 sp_preprocessing_method = 0 sp_data_split_index = (0.8, 0, 0.2) sp_data_split_index_2 = (0.75, 0.15, 0.15) sp_load_data_from = 'data/formatted/' sp_data_filename = ['it_eu_5m', 'it_uk_5m', 'worldcup9...
class Needs: """Class used to hold the needs of a clergy Robot""" def __init__(self): self.hunger = 100 self.thirst = 100 self.tired = 100 self.boredom = 0 def stepNeeds(self): self.hunger -= 1 self.tired -= 1 def isTired(self) -> bool: if self....
class Needs: """Class used to hold the needs of a clergy Robot""" def __init__(self): self.hunger = 100 self.thirst = 100 self.tired = 100 self.boredom = 0 def step_needs(self): self.hunger -= 1 self.tired -= 1 def is_tired(self) -> bool: if sel...
# 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 removeLeafNodes(self, root: TreeNode, target: int) -> TreeNode: def dfs(root, target): ...
class Solution: def remove_leaf_nodes(self, root: TreeNode, target: int) -> TreeNode: def dfs(root, target): if root.left: root.left = dfs(root.left, target) if root.right: root.right = dfs(root.right, target) if not root.left and (not ro...
n = int(input()) for a in range(n): for b in range(n): for c in range(n): print(f"{chr(a + 97)}{chr(b + 97)}{chr(c + 97)}")
n = int(input()) for a in range(n): for b in range(n): for c in range(n): print(f'{chr(a + 97)}{chr(b + 97)}{chr(c + 97)}')
""" Dataset - set (list) of configs given to algorithm as an input. "datasets" is a dictionary from algorithm shortcut to list of available datasets. Do not forget to update help message after changing! """ datasets = { "sender": [[(0.3, 0.75)], [(0.02, 1.0), (0.04, 1.0), (0.06, 1.0...
""" Dataset - set (list) of configs given to algorithm as an input. "datasets" is a dictionary from algorithm shortcut to list of available datasets. Do not forget to update help message after changing! """ datasets = {'sender': [[(0.3, 0.75)], [(0.02, 1.0), (0.04, 1.0), (0.06, 1.0), (0.08, 1.0), (0.1, ...
#!/usr/bin/python3 count1 = input("How much is 4 + 4 ? ") while count1 != "8": print("Sorry, try again.") count1 = input("How much is 4 + 4 ? ") else: count2 = input("Congrats! Next one: How much is 5 + 4 ? ") while count2 != "9": print("Sorry, try again.") count2 = input("How much is...
count1 = input('How much is 4 + 4 ? ') while count1 != '8': print('Sorry, try again.') count1 = input('How much is 4 + 4 ? ') else: count2 = input('Congrats! Next one: How much is 5 + 4 ? ') while count2 != '9': print('Sorry, try again.') count2 = input('How much is 5 + 4 ? ') print('Th...
""" Longest Common Substring Given two strings X and Y, find the of longest common substring. Input: 'GeeksforGeeks', 'GeeksQuiz' Output: 'Geeks' ========================================= Dynamic Programming Solution. Time Complexity: O(N * M) Space Complexity: O(M) * For this problem exists a faster so...
""" Longest Common Substring Given two strings X and Y, find the of longest common substring. Input: 'GeeksforGeeks', 'GeeksQuiz' Output: 'Geeks' ========================================= Dynamic Programming Solution. Time Complexity: O(N * M) Space Complexity: O(M) * For this problem exists a faster so...
class Teste: def exibir(self): print("--------") print(valor) print("--------") valor =3 teste = Teste() teste.exibir()
class Teste: def exibir(self): print('--------') print(valor) print('--------') valor = 3 teste = teste() teste.exibir()
"""ex075 - Analise de dados em uma tupla. Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final mostre: A) Quantas vezes apareceu o valor 9. B) Em que posicao foi digitado o primeiro valor 3 C) Quais foram os numeros pares""" nums = (int(input("Digite um numero: ")), int...
"""ex075 - Analise de dados em uma tupla. Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final mostre: A) Quantas vezes apareceu o valor 9. B) Em que posicao foi digitado o primeiro valor 3 C) Quais foram os numeros pares""" nums = (int(input('Digite um numero: ')), int(input('...
# property tax is 0.72 for each $100. $6000 will be $43.20 in taxes def main(): property_value = int(input('What is the value of the property? : ')) print('The assessed value is $', format(assValue(property_value), '.2f')) print('The property tax is $', format(propTax(assValue(property_value)), '.2f'...
def main(): property_value = int(input('What is the value of the property? : ')) print('The assessed value is $', format(ass_value(property_value), '.2f')) print('The property tax is $', format(prop_tax(ass_value(property_value)), '.2f')) def ass_value(property_value): value = property_value * 0.6 ...
class cuenta_bancaria: def __init__(self, titular,fondos): if isinstance(titular,str): self.titular=titular else: self.titular="nombre" if isinstance(fondos,float): self.fondos=fondos else: self.fondos=0 def imprimir(self): ...
class Cuenta_Bancaria: def __init__(self, titular, fondos): if isinstance(titular, str): self.titular = titular else: self.titular = 'nombre' if isinstance(fondos, float): self.fondos = fondos else: self.fondos = 0 def imprimir(se...
n = int(input()) ugly_numbers = [] ugly_numbers.append(1) p2 = p3 = p5 = 0 next2 = ugly_numbers[p2] * 2 next3 = ugly_numbers[p3] * 3 next5 = ugly_numbers[p5] * 5 for i in range(n-1): ugly_numbers.append(min(next2, next3, next5)) if ugly_numbers[-1] == next2: p2 = p2 + 1 next2 = ugly_number...
n = int(input()) ugly_numbers = [] ugly_numbers.append(1) p2 = p3 = p5 = 0 next2 = ugly_numbers[p2] * 2 next3 = ugly_numbers[p3] * 3 next5 = ugly_numbers[p5] * 5 for i in range(n - 1): ugly_numbers.append(min(next2, next3, next5)) if ugly_numbers[-1] == next2: p2 = p2 + 1 next2 = ugly_numbers[p2...
class Solution(object): def islandPerimeter(self, grid): """ :type grid: List[List[int]] :rtype: int """ # cycle through each element and count the perimeter # Perimeter of each block with land is 4-occupied sides total = 0 for row in range(len(grid...
class Solution(object): def island_perimeter(self, grid): """ :type grid: List[List[int]] :rtype: int """ total = 0 for row in range(len(grid)): for column in range(len(grid[0])): if grid[row][column] == 1: surrounding ...
## Approach 1 - Using dictionary (Time efficient) ## Approach 2 - Using Binary Search (Space efficient) class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: ## More space complexity dic = {} for i, num in enumerate(numbers): if target...
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: dic = {} for (i, num) in enumerate(numbers): if target - num in dic: return [dic[target - num] + 1, i + 1] dic[num] = i
SDOC_SPEC_OBJECT_TYPE_SINGLETON = "REQUIREMENT_OR_SECTION" class SDocRequirementReservedField: UID = "UID" # STATUS = "STATUS" TITLE = "TITLE" STATEMENT = "STATEMENT" COMMENT = "COMMENT" SET = {UID, TITLE, STATEMENT, COMMENT} class ReqIFRequirementReservedField: UID = "ReqIF.ForeignID" ...
sdoc_spec_object_type_singleton = 'REQUIREMENT_OR_SECTION' class Sdocrequirementreservedfield: uid = 'UID' title = 'TITLE' statement = 'STATEMENT' comment = 'COMMENT' set = {UID, TITLE, STATEMENT, COMMENT} class Reqifrequirementreservedfield: uid = 'ReqIF.ForeignID' name = 'ReqIF.Name' ...
#!/usr/bin/python3 open_file = open('./dest/comp3.fasta', 'r') writ_file = open('./dest/data.txt', 'w') #Gets the Covid Name def get_name(line): s_line = line.lstrip('>') a_list = s_line.split() the_name = a_list[0] return the_name ################################################################...
open_file = open('./dest/comp3.fasta', 'r') writ_file = open('./dest/data.txt', 'w') def get_name(line): s_line = line.lstrip('>') a_list = s_line.split() the_name = a_list[0] return the_name def process_it(inserted_list, inserted_name): poly_a_length = 0 the_string = '' break_out = False ...
def to_hex(value, size = 2): return ('%x' %value).upper().zfill(size) def print_nintendulator(data): string = '' params = '' mode = data.opcode.mode args = data.args info = data.info op = data.opcode reg = data.registers if mode.uses_arg1: params += to_hex(args.arg1) + ' ...
def to_hex(value, size=2): return ('%x' % value).upper().zfill(size) def print_nintendulator(data): string = '' params = '' mode = data.opcode.mode args = data.args info = data.info op = data.opcode reg = data.registers if mode.uses_arg1: params += to_hex(args.arg1) + ' ' ...
# S = 1 + 2 + ... + n-1 + n # S = n + n-1 +... + 2 + 1 # 2S = n+1 + n+1 + ... + n+1 + n+1 = n*(n+1) # S = n*(n+1)/2 # S = 1^2 + 2^2 + ... + (n-1)^2 + n^2 # Sum of first squares = n^3/3 + n^2/2 + n/6 def euler6(n): sumnat = n*(n+1)/2 sumsq = n**3/3 + n**2/2 + n/6 return sumnat**2 - sumsq t = int(input(...
def euler6(n): sumnat = n * (n + 1) / 2 sumsq = n ** 3 / 3 + n ** 2 / 2 + n / 6 return sumnat ** 2 - sumsq t = int(input().strip()) for a0 in range(t): n = int(input().strip()) print(euler6(n))
''' Created on May 21, 2018 @author: nishant.sethi ''' n=int(input()) num=[int(x) for x in input().split()] weight=[int(x) for x in input().split()] p=0 for i,j in zip(num,weight): p+=i*j result=round(p/sum(weight),1) print(result)
""" Created on May 21, 2018 @author: nishant.sethi """ n = int(input()) num = [int(x) for x in input().split()] weight = [int(x) for x in input().split()] p = 0 for (i, j) in zip(num, weight): p += i * j result = round(p / sum(weight), 1) print(result)
''' PROBLEM STATEMENT: Implementation of Selection Sort for an array in Python ''' def selectionSort(array): size = len(array) for step in range(size): curr_index = step for i in range(step + 1, size): if array[i] < array[curr_index]: curr_index = i ...
""" PROBLEM STATEMENT: Implementation of Selection Sort for an array in Python """ def selection_sort(array): size = len(array) for step in range(size): curr_index = step for i in range(step + 1, size): if array[i] < array[curr_index]: curr_index = i (a...
# Version 1: DP, O(n^2), TLE class Solution: """ @param A: A list of integers @return: An integer """ def jump(self, A): n = len(A) if n == 0: return 0 jumps = [sys.maxsize for _ in range(n)] jumps[0] = 0 for i in range(1, n)...
class Solution: """ @param A: A list of integers @return: An integer """ def jump(self, A): n = len(A) if n == 0: return 0 jumps = [sys.maxsize for _ in range(n)] jumps[0] = 0 for i in range(1, n): for j in range(i, -1, -1): ...
class Token: def __init__(self, ctx, raw, type): self.ctx = ctx if raw == None or raw == "": print(" token is null or empty") exit(-1) self.type = type self.token = raw self.list = [] st = self.token.split(" ") for t in st: ...
class Token: def __init__(self, ctx, raw, type): self.ctx = ctx if raw == None or raw == '': print(' token is null or empty') exit(-1) self.type = type self.token = raw self.list = [] st = self.token.split(' ') for t in st: ...
class Config: IRODS_ID = "irods_id" DATASET_CONFIG_FILE = "dataset.json" DATASET_META_FILE = "meta.json" class Paths: HOME = "/ebrc/workspaces" STAGING = HOME + "/staging" EVENTS = HOME + "/events" LZ = HOME + "/lz" FLAGS = HOME + "/flags" USERS = HOME +...
class Config: irods_id = 'irods_id' dataset_config_file = 'dataset.json' dataset_meta_file = 'meta.json' class Paths: home = '/ebrc/workspaces' staging = HOME + '/staging' events = HOME + '/events' lz = HOME + '/lz' flags = HOME + '/flags' users = HOME + ...
class Solution: def maxLengthBetweenEqualCharacters(self, s: str) -> int: last = {} ans = -1 for i,c in enumerate(s): if c not in last: last[c] = i else: ans = max(ans, i - last[c] - 1) return ans
class Solution: def max_length_between_equal_characters(self, s: str) -> int: last = {} ans = -1 for (i, c) in enumerate(s): if c not in last: last[c] = i else: ans = max(ans, i - last[c] - 1) return ans
def find_data_period(run_number, data_summary): if data_summary is None: return None, None for year_tag, summary in data_summary.items(): for period, run_ranges in summary.items(): for run_range in run_ranges: if isinstance(run_range, int): run_ran...
def find_data_period(run_number, data_summary): if data_summary is None: return (None, None) for (year_tag, summary) in data_summary.items(): for (period, run_ranges) in summary.items(): for run_range in run_ranges: if isinstance(run_range, int): r...
# The Eucledian algorithm for calculating the Greatest Common Divisor of two numbers # is a classic recursion algorithm. # The central idea is that if y > x, the GCD of x and y is the GCD of x and y - x. # By extension, this implies that the GCD of x and y is the GCD of x and y mod x. def gcd(x, y): if y == 0: ...
def gcd(x, y): if y == 0: return x else: return gcd(y, x % y)
convert = {"0":"0000", "1":"0001", "2":"0010", "3":"0011", "4":"0100", "5":"0101", "6":"0110", "7":"0111", "8":"1000", "9":"1001", "A":"1010", "B":"1011", "C":"1100", "D":"1101", "E":"1110", "F":"1111"} n_bits = 16 reg = "D008" s = "<table><tr><td><h4>Hex Digits</h4></td>" for c in reg: s += "<td colspan=4><center>...
convert = {'0': '0000', '1': '0001', '2': '0010', '3': '0011', '4': '0100', '5': '0101', '6': '0110', '7': '0111', '8': '1000', '9': '1001', 'A': '1010', 'B': '1011', 'C': '1100', 'D': '1101', 'E': '1110', 'F': '1111'} n_bits = 16 reg = 'D008' s = '<table><tr><td><h4>Hex Digits</h4></td>' for c in reg: s += '<td co...
"""listdict.py -- quickly search & filter a list of dictionaries Experimental idea, research.txt 0K2 Import with: ----------------------------------------------------------- from listdict import cue, val, val01, req, srt from listdict import EQ, NEQ, GT, LT, GTE, LTE from listdict import CONTAINS, NCONTAINS, WITHIN...
"""listdict.py -- quickly search & filter a list of dictionaries Experimental idea, research.txt 0K2 Import with: ----------------------------------------------------------- from listdict import cue, val, val01, req, srt from listdict import EQ, NEQ, GT, LT, GTE, LTE from listdict import CONTAINS, NCONTAINS, WITHIN...
class Solution: def findCircleNum(self, isConnected: List[List[int]]) -> int: def isExplored(node, visited): """ To explore the province starting from the current node. Mark all connected cities as visited. return: True if the current city is vis...
class Solution: def find_circle_num(self, isConnected: List[List[int]]) -> int: def is_explored(node, visited): """ To explore the province starting from the current node. Mark all connected cities as visited. return: True if the current city is...
class Age(object): def set_age(self, age_val): try: age_val = int(age_val) except ValueError: return self.age_val = age_val def get_val(self): return print(self.age_val) def increment_val(self): self.age_val = self.age_val + 1 my_age = Age(...
class Age(object): def set_age(self, age_val): try: age_val = int(age_val) except ValueError: return self.age_val = age_val def get_val(self): return print(self.age_val) def increment_val(self): self.age_val = self.age_val + 1 my_age = age()...
class Solution(object): def decodeString(self, s): """ :type s: str :rtype: str """ num = "" stack = [["", 1]] for c in s: if c in "0123456789": num += c elif c == "[": stack.append(["", int(n...
class Solution(object): def decode_string(self, s): """ :type s: str :rtype: str """ num = '' stack = [['', 1]] for c in s: if c in '0123456789': num += c elif c == '[': stack.append(['', int(num)]) ...
# Example using pygame-zero actor object BACK_COLOR = (200, 220, 255) BACK_COLOR_CLOSE = (170, 170, 255) HEIGHT = 200 WIDTH = 400 DOG1 = 'dog1_100x100' DOG2 = 'dog2_100x100' BALL = 'ball_100x100' dog = Actor(DOG2, (200,100)) ball = Actor(BALL, (200,100)) close = False def on_mouse_move(pos): global close do...
back_color = (200, 220, 255) back_color_close = (170, 170, 255) height = 200 width = 400 dog1 = 'dog1_100x100' dog2 = 'dog2_100x100' ball = 'ball_100x100' dog = actor(DOG2, (200, 100)) ball = actor(BALL, (200, 100)) close = False def on_mouse_move(pos): global close dog.angle = dog.angle_to(pos) + 90 ball....
# 2021 June 8 23:38 # Create a number, whenever a bit is "torn down" from n, we add it to the number. # So that in the end it represents the reverse of n. class Solution: def reverseBits(self, n: int) -> int: ans = 0 for _ in range(32): # left shift 1 bit ans = ans << 1 ...
class Solution: def reverse_bits(self, n: int) -> int: ans = 0 for _ in range(32): ans = ans << 1 ans += n & 1 n = n >> 1 return ans class Solution1: def reverse_bits(self, n: int) -> int: ans = '' for _ in range(32): ans...
#!/usr/bin/env python ''' Test data for setting and working with the neo graph ''' dolphins = { "nodes": [ { "id": "0", "label": "Beak" }, { "id": "1", "label": "Beescratch" }, { "id": "2", "label": "Bumper" }, { "id": "3", "label": "CCL" ...
""" Test data for setting and working with the neo graph """ dolphins = {'nodes': [{'id': '0', 'label': 'Beak'}, {'id': '1', 'label': 'Beescratch'}, {'id': '2', 'label': 'Bumper'}, {'id': '3', 'label': 'CCL'}, {'id': '4', 'label': 'Cross'}, {'id': '5', 'label': 'DN16'}, {'id': '6', 'label': 'DN21'}, {'id': '7', 'label'...
def feets_to_meters(a): return (a*0.3048) def meters_to_feet(b): return(b/0.3048) c=50 d=10 print("{0} feets are {1} meters.".format(c,feets_to_meters(c))) print("{0} meters are {1} feets.".format(d,meters_to_feet(d)))
def feets_to_meters(a): return a * 0.3048 def meters_to_feet(b): return b / 0.3048 c = 50 d = 10 print('{0} feets are {1} meters.'.format(c, feets_to_meters(c))) print('{0} meters are {1} feets.'.format(d, meters_to_feet(d)))
class Solution: def duplicateZeros(self, arr: List[int]) -> None: """ Do not return anything, modify arr in-place instead. Running time: O(n) where n is the length of arr. """ n = len(arr) c = 0 for i in arr: if i == 0: c += 1 ...
class Solution: def duplicate_zeros(self, arr: List[int]) -> None: """ Do not return anything, modify arr in-place instead. Running time: O(n) where n is the length of arr. """ n = len(arr) c = 0 for i in arr: if i == 0: c += 1 ...
""" 136. Single Number Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Example 1: Input: [2,2,1] Output: 1 Example 2: Input: [4,1,2,1,2] Output: 4 ...
""" 136. Single Number Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Example 1: Input: [2,2,1] Output: 1 Example 2: Input: [4,1,2,1,2] Output: 4 ...
# -*- coding: utf-8 -*- """ Created on Tue Apr 10 20:51:58 2018 @author: adrian """ #f(1)=0, f(2)=0.69, f'(1)=1, f'(2)=0.5 def diferenciasDivididas(x,y): size = len(x) w, h = 5, 4; matrix = [[0 for x in range(w)] for y in range(h)] for i in range(size): matrix[i][0] = x[i] ...
""" Created on Tue Apr 10 20:51:58 2018 @author: adrian """ def diferencias_divididas(x, y): size = len(x) (w, h) = (5, 4) matrix = [[0 for x in range(w)] for y in range(h)] for i in range(size): matrix[i][0] = x[i] matrix[i][1] = y[i] matrix[0][2] = 1 matrix[2][2] = 0.5 fo...
"""Internal utility helpers.""" UNDEFINED = object() # ----------------------------------------------------------------------------- def if_none(value, default): if value is None: return default return value # ----------------------------------------------------------------------------- def ite...
"""Internal utility helpers.""" undefined = object() def if_none(value, default): if value is None: return default return value def iter_validation_errors(errors, path=()): if isinstance(errors, dict): for (field_key, field_errors) in errors.items(): field_path = path + (field_...
class Solution: """ @param nums: a list of integers @return: return a list of integers """ def findDuplicates(self, nums): # write your code here result = [] for num in nums: index = abs(num) - 1 if nums[index] < 0: result.append(abs(nu...
class Solution: """ @param nums: a list of integers @return: return a list of integers """ def find_duplicates(self, nums): result = [] for num in nums: index = abs(num) - 1 if nums[index] < 0: result.append(abs(num)) else: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Svend' # Integer a = 1 print(a) # String str = 'lean python' print(str) # Boolean Answer = True print(Answer) # Float f = 3.14159 print(f)
__author__ = 'Svend' a = 1 print(a) str = 'lean python' print(str) answer = True print(Answer) f = 3.14159 print(f)
# -*- coding: utf-8 -*- # @Time : 2019/10/3 22:02 # @Author : Run # @File : numbers.py # @Software : PyCharm def fibonacci(num: 'int > 0') -> list: res = [1, 1] while len(res) <= num: res.append(res[-2] + res[-1]) return res if __name__ == "__main__": print(fibonacci(10)) pri...
def fibonacci(num: 'int > 0') -> list: res = [1, 1] while len(res) <= num: res.append(res[-2] + res[-1]) return res if __name__ == '__main__': print(fibonacci(10)) print()
"""8.2 Eight Queens: Write an algorithm to print all ways of arranging eight queens on an 8x8 chess board so that none of them share the same row, column, or diagonal. In this case, "diagonal" means all diagonals, not just the two that bisect the board. """ def eight_queens(n: int)-> int: eight_queens.BOARD_SIZE = ...
"""8.2 Eight Queens: Write an algorithm to print all ways of arranging eight queens on an 8x8 chess board so that none of them share the same row, column, or diagonal. In this case, "diagonal" means all diagonals, not just the two that bisect the board. """ def eight_queens(n: int) -> int: eight_queens.BOARD_SIZE ...
''' skype-chatsync-reader: Main module Copyright 2015, Konstantin Tretyakov Licensed under MIT. ''' def main(): ''' Main function of the boilerplate code is the entry point of the 'skypechatsyncreader' executable script (defined in setup.py). Use doctests, those are very helpful. >>> main()...
""" skype-chatsync-reader: Main module Copyright 2015, Konstantin Tretyakov Licensed under MIT. """ def main(): """ Main function of the boilerplate code is the entry point of the 'skypechatsyncreader' executable script (defined in setup.py). Use doctests, those are very helpful. >>> main() ...
class Transformer(Module): __parameters__ = [] __buffers__ = [] training : bool resblocks : __torch__.torch.nn.modules.container.___torch_mangle_9587.Sequential def forward(self: __torch__.multimodal.model.multimodal_transformer.___torch_mangle_9588.Transformer, x: Tensor) -> Tensor: return (self.resb...
class Transformer(Module): __parameters__ = [] __buffers__ = [] training: bool resblocks: __torch__.torch.nn.modules.container.___torch_mangle_9587.Sequential def forward(self: __torch__.multimodal.model.multimodal_transformer.___torch_mangle_9588.Transformer, x: Tensor) -> Tensor: return s...
# # PySNMP MIB module DMTF-SERVICE-LAYER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DMTF-SERVICE-LAYER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:36:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ...
def _make_key_value(val): return val.strip().split("=", 1) def parse_auth_header(header): if isinstance(header, bytes): header = header.decode("latin1") try: return dict(map(_make_key_value, header.split(" ", 1)[1].split(","))) except Exception: return {}
def _make_key_value(val): return val.strip().split('=', 1) def parse_auth_header(header): if isinstance(header, bytes): header = header.decode('latin1') try: return dict(map(_make_key_value, header.split(' ', 1)[1].split(','))) except Exception: return {}
# You have a permutation: an array a=[a[1] , a[2], ..., a[n]] of distinct integers from 1 to n. # The length of the permutation n is odd. Consider the following algorithm of sorting the # permutation in increasing order. A helper procedure of the algorithm, f(i), takes a single # argument i (1 <= i <= n-1) and does the...
def is_sorted_array(T): if all((T[i] <= T[i + 1] for i in range(len(T) - 1))): return True return False def strange_sort(n, T): j = 0 while j < n and (not is_sorted_array(T)): if j % 2 == 0: for k in range(0, n - 1, 2): if T[k] > T[k + 1]: ...
#!/usr/bin/env python """Solve task A of qualification round of Google Code jam 2016.""" def get_digits(number): """Get a dictionary which indicates which digits are in number.""" n = str(number) return {0: '0' in n, 1: '1' in n, 2: '2' in n, 3: '3' in n, 4...
"""Solve task A of qualification round of Google Code jam 2016.""" def get_digits(number): """Get a dictionary which indicates which digits are in number.""" n = str(number) return {0: '0' in n, 1: '1' in n, 2: '2' in n, 3: '3' in n, 4: '4' in n, 5: '5' in n, 6: '6' in n, 7: '7' in n, 8: '8' in n, 9: '9' i...
login="First" user_login=input("Enter your login ") while user_login == login: print("Your authentication is successful, congrats!") break if user_login != login: print("Your login an incorrect,sorry")
login = 'First' user_login = input('Enter your login ') while user_login == login: print('Your authentication is successful, congrats!') break if user_login != login: print('Your login an incorrect,sorry')
""" new polynomial implementation """ __all__ = [ "factor", "formalsum", "groebner", "hensel", "multiutil", "multivar", "ratfunc", "ring", "termorder", "uniutil", "univar" ]
""" new polynomial implementation """ __all__ = ['factor', 'formalsum', 'groebner', 'hensel', 'multiutil', 'multivar', 'ratfunc', 'ring', 'termorder', 'uniutil', 'univar']
#----------------------------------------------------------------------------- # Runtime: 48ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def isMatch(self, s: str, p: str) -> bool: memo = {} def dp(i, j): if (...
class Solution: def is_match(self, s: str, p: str) -> bool: memo = {} def dp(i, j): if (i, j) not in memo: if j == len(p): memo[i, j] = i == len(s) else: match = i < len(s) and p[j] in {s[i], '.'} ...
class LMS8001_GPIO(object): def __init__(self, chip, n): if n not in range(0,9): raise ValueError("GPIO n must be in range 0 - 8") self.chip = chip # reference to chip instance self.n = n # GPIO number # # GPIOn output value # @property ...
class Lms8001_Gpio(object): def __init__(self, chip, n): if n not in range(0, 9): raise value_error('GPIO n must be in range 0 - 8') self.chip = chip self.n = n @property def out(self): """ Get the value written to GPIOn """ val = self.ch...
""" osparc's service models library """ __version__ = "0.1.0"
""" osparc's service models library """ __version__ = '0.1.0'
#!/usr/bin/env python # coding=utf-8 """ Common constants for test modules. Created: Dmitrii Gusev, 19.05.2019 Modified: Dmitrii Gusev, 20.05.2019 """ TEST_LOGGING_CONFIG = 'pyutilities/tests/configs/logging.yml'
""" Common constants for test modules. Created: Dmitrii Gusev, 19.05.2019 Modified: Dmitrii Gusev, 20.05.2019 """ test_logging_config = 'pyutilities/tests/configs/logging.yml'
letras = ["A", "B", "C", "D", "E"] numeros = [1,2,3,4,5] pares = dict(zip(letras, numeros)) print(pares) a = [1, 2, 3] b= [10, 20, 30] c = zip(a,b) print(c) for i in c: print(i) d = dict([(1,1), (2,2), (3,3)]) print(d) d=dict(zip(a,b)) print(d) thisdict = { "brand": "Ford", "model": "Mustang", "year": 1...
letras = ['A', 'B', 'C', 'D', 'E'] numeros = [1, 2, 3, 4, 5] pares = dict(zip(letras, numeros)) print(pares) a = [1, 2, 3] b = [10, 20, 30] c = zip(a, b) print(c) for i in c: print(i) d = dict([(1, 1), (2, 2), (3, 3)]) print(d) d = dict(zip(a, b)) print(d) thisdict = {'brand': 'Ford', 'model': 'Mustang', 'year': 19...
''' Directory of files that are not developed by cuthbertLab for music21 but which extend music21 functionality and whose licenses allow them to be distributed with music21. ''' __ALL__ = ['jsonpickle', 'joblib', 'xlrd', 'webcolors', 'six', # for more_itertools 'chardet', 'more_itertools']
""" Directory of files that are not developed by cuthbertLab for music21 but which extend music21 functionality and whose licenses allow them to be distributed with music21. """ __all__ = ['jsonpickle', 'joblib', 'xlrd', 'webcolors', 'six', 'chardet', 'more_itertools']
expected_output = { "43":{ "name":"43", "type":"ipv4-acl-type", "acl_type": "standard", "aces":{ "10":{ "name":"10", "actions":{ "forwarding":"permit" }, "matches":{ "l3":{ "ipv4":{ ...
expected_output = {'43': {'name': '43', 'type': 'ipv4-acl-type', 'acl_type': 'standard', 'aces': {'10': {'name': '10', 'actions': {'forwarding': 'permit'}, 'matches': {'l3': {'ipv4': {'protocol': 'ipv4', 'source_network': {'10.1.0.2 0.0.0.0': {'source_network': '10.1.0.2 0.0.0.0'}}}}}, 'statistics': {'matched_packets':...
i = 5 print("\nCount to 100 by fives:\n") while (i <= 100): print(i) i += 5 print("---------Completed---------")
i = 5 print('\nCount to 100 by fives:\n') while i <= 100: print(i) i += 5 print('---------Completed---------')
mult = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], ...
mult = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2,...
"""Top-level package for Computer Vision on Raspberry Pi.""" __author__ = """Leigh Johnson""" __email__ = 'leigh@data-literate.com' __version__ = '0.1.0'
"""Top-level package for Computer Vision on Raspberry Pi.""" __author__ = 'Leigh Johnson' __email__ = 'leigh@data-literate.com' __version__ = '0.1.0'
class Point(object): def __init__(self, x, y): self.x = x self.y = y p = Point(1) # TypeError: too few arguments p = Point(1,2,3) # TypeError: too many arguments
class Point(object): def __init__(self, x, y): self.x = x self.y = y p = point(1) p = point(1, 2, 3)
#-*-coding:utf-8-*- class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 1: return nums[0] nums.sort() for i in range(int(len(nums) / 3)): if nums[3 * i] != nums[3 * i + 1]: ...
class Solution(object): def single_number(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 1: return nums[0] nums.sort() for i in range(int(len(nums) / 3)): if nums[3 * i] != nums[3 * i + 1]: retur...
# If you remove a client, replace with None to avoid IP reassignment. CLIENTS = [ 'chloe-thinkpad', 'chloe-android', 'shyla-macbook', ]
clients = ['chloe-thinkpad', 'chloe-android', 'shyla-macbook']
#!/usr/bin/env python """ util.py provides a set of nice utility functions that support the snapchat_fs pkg """ __author__ = "Alex Clemmer, Chad Brubaker" __copyright__ = "Copyright 2013, Alex Clemmer and Chad Brubaker" __credits__ = ["Alex Clemmer", "Chad Brubaker"] __license__ = "MIT" __version__ = "0.1" __maintai...
""" util.py provides a set of nice utility functions that support the snapchat_fs pkg """ __author__ = 'Alex Clemmer, Chad Brubaker' __copyright__ = 'Copyright 2013, Alex Clemmer and Chad Brubaker' __credits__ = ['Alex Clemmer', 'Chad Brubaker'] __license__ = 'MIT' __version__ = '0.1' __maintainer__ = 'Alex Clemmer' __...
"""This is a sample settings.py file. A 'settings.py' needs to be included in the directory where the script runs. It needs to include the following attributes. """ # This is the API Key your receive from Enphase when you sign for an API Account. # See the Enphase API documentation for more details. API_KEY = '6d3222...
"""This is a sample settings.py file. A 'settings.py' needs to be included in the directory where the script runs. It needs to include the following attributes. """ api_key = '6d32223a44baffe9ffa9b9edbff05adc7a' user_id = '2e7a67afed9a51220a' system_id = 1223456 system_kw = 2.85 collect = True plot = True
# Created by MechAviv # Quest ID :: 1404 # Thieves of Kerning City sm.setSpeakerID(1052001) sm.sendNext("So, you're the one Mai was talking about? #h0#... I guess you do have some potential. You want to become a Thief? Do you know what Thieves are all about?") sm.setSpeakerID(1052001) sm.sendSay("Most people think o...
sm.setSpeakerID(1052001) sm.sendNext("So, you're the one Mai was talking about? #h0#... I guess you do have some potential. You want to become a Thief? Do you know what Thieves are all about?") sm.setSpeakerID(1052001) sm.sendSay("Most people think of us as petty thieves who steal things, but that's not true at all. Th...
#!/usr/bin/python # SPDX-License-Identifier: MIT # Returns the number of paths to "end" if we are currently in cave and have # previously visited the caves in current_path def number_of_paths(cave="start", current_path=[]): current_path = current_path.copy() current_path.append(cave) if cave == "end": ...
def number_of_paths(cave='start', current_path=[]): current_path = current_path.copy() current_path.append(cave) if cave == 'end': return 1 neighbours = [(c - {cave}).pop() for c in connections if cave in c] return sum((number_of_paths(n, current_path) for n in neighbours if n.isupper() or n...