content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" Package exception types """ __all__ = ["FileFormatError", "AliasError", "UndefinedAliasError"] class FileFormatError(Exception): """ Exception for invalid file format. """ pass class AliasError(Exception): """ Alias related error. """ pass class UndefinedAliasError(AliasError): """ Alias ...
""" Package exception types """ __all__ = ['FileFormatError', 'AliasError', 'UndefinedAliasError'] class Fileformaterror(Exception): """ Exception for invalid file format. """ pass class Aliaserror(Exception): """ Alias related error. """ pass class Undefinedaliaserror(AliasError): """ Alias is i...
class Solution: def nextPermutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. Array. Running time: O(n) where n == len(nums). """ if not nums: return None n = len(nums) p = n - 1 whi...
class Solution: def next_permutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. Array. Running time: O(n) where n == len(nums). """ if not nums: return None n = len(nums) p = n - 1 w...
# visible_spectrum.py # 2021-05-27 version 1.2 # Copyright 2021 Cedar Grove Studios # Spectral Index to Visible (Rainbow) Spectrum RGB Converter Helper # Based on original 1996 Fortran code by Dan Bruton: # physics.sfasu.edu/astro/color/spectra.html def index_to_rgb(index=0, gamma=0.5): """ Converts a spectr...
def index_to_rgb(index=0, gamma=0.5): """ Converts a spectral index to rainbow (visible light wavelength) spectrum to an RGB value. Spectral index in range of 0.0 to 1.0 (violet --> white). Gamma in range of 0.0 to 1.0 (1.0=linear), default 0.5 for color TFT displays. :return: Returns a 24-bit R...
# ---------------------------------------------------------------------------- # Copyright (c) 2022, Franck Lejzerowicz. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # -----------------------------------------------------------...
__version__ = '2.0'
""" Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, m...
""" Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, m...
''' Creating a class Created with the keyword class followed by a name, Common practice is to make the names Pascal Casing: Example '''
""" Creating a class Created with the keyword class followed by a name, Common practice is to make the names Pascal Casing: Example """
__all__ = [ "accuracy", "confusion_matrix", "multi_class_acc", "top_k_svm", "microf1", "macrof1", ]
__all__ = ['accuracy', 'confusion_matrix', 'multi_class_acc', 'top_k_svm', 'microf1', 'macrof1']
def add_native_methods(clazz): def init__java_lang_String__boolean__(a0, a1): raise NotImplementedError() def indicateMechs____(): raise NotImplementedError() def inquireNamesForMech____(a0): raise NotImplementedError() def releaseName__long__(a0, a1): raise NotImpleme...
def add_native_methods(clazz): def init__java_lang__string__boolean__(a0, a1): raise not_implemented_error() def indicate_mechs____(): raise not_implemented_error() def inquire_names_for_mech____(a0): raise not_implemented_error() def release_name__long__(a0, a1): rai...
class PyVeeException(Exception): pass class InvalidAddressException(PyVeeException): pass class InvalidParameterException(PyVeeException): pass class MissingPrivateKeyException(PyVeeException): pass class MissingPublicKeyException(PyVeeException): pass class MissingAddressException(PyVeeEx...
class Pyveeexception(Exception): pass class Invalidaddressexception(PyVeeException): pass class Invalidparameterexception(PyVeeException): pass class Missingprivatekeyexception(PyVeeException): pass class Missingpublickeyexception(PyVeeException): pass class Missingaddressexception(PyVeeExcepti...
# test builtin type print(type(int)) try: type() except TypeError: print('TypeError') try: type(1, 2) except TypeError: print('TypeError') # second arg should be a tuple try: type('abc', None, None) except TypeError: print('TypeError') # third arg should be a dict try: type('abc', (), N...
print(type(int)) try: type() except TypeError: print('TypeError') try: type(1, 2) except TypeError: print('TypeError') try: type('abc', None, None) except TypeError: print('TypeError') try: type('abc', (), None) except TypeError: print('TypeError') try: type('abc', (1,), {}) except T...
# The MIT License (MIT) # Copyright (c) 2021 Ian Buttimer # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
""" For information regarding UN/LOCODE, see https://www.unece.org/cefact/locode/welcome.html For information regarding the data format, see https://unece.org/DAM/cefact/locode/UNLOCODE_Manual.pdf and '2021-1 UNLOCODE SecretariatNotes.pdf' in data/loc211csv.zip """ col_change: str = 'change' col_...
indexes = [(row, col) for row in range(5) for col in range(5)] class Board: def __init__(self, board: list[list[tuple[int, bool]]]) -> None: self.board = board self.done = False def set(self, n: int): if self.done: return True for row, col in indexes: ...
indexes = [(row, col) for row in range(5) for col in range(5)] class Board: def __init__(self, board: list[list[tuple[int, bool]]]) -> None: self.board = board self.done = False def set(self, n: int): if self.done: return True for (row, col) in indexes: ...
#annapolis latitude = 38.9784 # longitude = -76.4922 longitude = 283.5078 height = 13
latitude = 38.9784 longitude = 283.5078 height = 13
# C++ implementation to convert the # given BST to Min Heap # structure of a node of BST class Node: # Constructor to create a new node def __init__(self, data): self.data = data self.left = None self.right = None # function for the inorder traversal # of the tree so as to store the node # values in 'arr' in...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def inorder_traversal(root, arr): if root == None: return inorder_traversal(root.left, arr) arr.append(root.data) inorder_traversal(root.right, arr) def bst_to_min_heap(root, ...
""""Name : ADVAIT GURUNATH CHAVAN ; PRN : 4119008""" file = open('name_prn.txt', 'w') file.write("NAME : ADVAIT GURUNATH CHAVAN \n") file.write("PRN : 4119008") file.close() file = open('name_prn.txt', 'r') for line in file: print(line, "\n") file.close()
""""Name : ADVAIT GURUNATH CHAVAN ; PRN : 4119008""" file = open('name_prn.txt', 'w') file.write('NAME : ADVAIT GURUNATH CHAVAN \n') file.write('PRN : 4119008') file.close() file = open('name_prn.txt', 'r') for line in file: print(line, '\n') file.close()
""" Constants """ MAX_PARTICLES = 5_000 SCREEN_SIZE = (1250, 750) FPS = 60 MAX_SPEED = 500 MAX_BARRIER_DIST = 500 MAX_REPEL_DIST = 500 MAX_MOUSE_DIST = 500 """ Butterfly mode MAX_SPEED = 1 MAX_BARRIER_DIST = 0 MAX_MOUSE_DIST = 1 MAX_REPEL_DIST = 0 magnitude <= 100 """ """ FONT """ DEFAULT_FONT = "Quicksand-Light....
""" Constants """ max_particles = 5000 screen_size = (1250, 750) fps = 60 max_speed = 500 max_barrier_dist = 500 max_repel_dist = 500 max_mouse_dist = 500 ' Butterfly mode \nMAX_SPEED = 1\nMAX_BARRIER_DIST = 0\nMAX_MOUSE_DIST = 1\nMAX_REPEL_DIST = 0\nmagnitude <= 100\n' ' FONT ' default_font = 'Quicksand-Light.otf' def...
#!/usr/bin/env python # coding: utf-8 # In[34]: def test(): print test() class Testing: def test(): print("hello") Testing.test() a = bool(input("enter the value: ")) if (a==False): print("Please enter some input") print(a) # scope of variables # In[ ]:
def test(): print test() class Testing: def test(): print('hello') Testing.test() a = bool(input('enter the value: ')) if a == False: print('Please enter some input') print(a)
frase = input("Dime una frase: ") letra = input("Dime una letra que quieres que te busque: ") index = 0 contador = 0 while(index < len(frase)): if(frase[index].lower() == letra.lower()): contador += 1 index += 1 print(f"La letra {letra} aparece {contador} veces")
frase = input('Dime una frase: ') letra = input('Dime una letra que quieres que te busque: ') index = 0 contador = 0 while index < len(frase): if frase[index].lower() == letra.lower(): contador += 1 index += 1 print(f'La letra {letra} aparece {contador} veces')
class RibbonItemType(Enum,IComparable,IFormattable,IConvertible): """ An enumerated type listing all the toolbar item styles. enum RibbonItemType,values: ComboBox (6),ComboBoxMember (5),PulldownButton (1),PushButton (0),RadioButtonGroup (4),SplitButton (2),TextBox (7),ToggleButton (3) """ def __eq__(self...
class Ribbonitemtype(Enum, IComparable, IFormattable, IConvertible): """ An enumerated type listing all the toolbar item styles. enum RibbonItemType,values: ComboBox (6),ComboBoxMember (5),PulldownButton (1),PushButton (0),RadioButtonGroup (4),SplitButton (2),TextBox (7),ToggleButton (3) """ def __eq__(...
# Copyright 2018 Johns Hopkins University (author: Yiwen Shao) # Apache 2.0 class UnetConfig: """ A class to store certain configuration information that is needed to initialize a Unet. Making these network specific configurations store on disk can help us keep the network compatible in testing...
class Unetconfig: """ A class to store certain configuration information that is needed to initialize a Unet. Making these network specific configurations store on disk can help us keep the network compatible in testing. """ def __init__(self): """ Initialize default network con...
# Time: O(n) # Space: O(1) class Solution(object): def findDisappearedNumbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ for i in xrange(len(nums)): if nums[abs(nums[i]) - 1] > 0: nums[abs(nums[i]) - 1] *= -1 ...
class Solution(object): def find_disappeared_numbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ for i in xrange(len(nums)): if nums[abs(nums[i]) - 1] > 0: nums[abs(nums[i]) - 1] *= -1 result = [] for i in xrange(l...
line = input() a, b = line.split() a = int(a) b = int(b) maxi = max(a, b) if a <= 0 and b <= 0: print('Not a moose') elif a == b: print(f'Even {a + b}') elif a != b: print(f'Odd {maxi + maxi}')
line = input() (a, b) = line.split() a = int(a) b = int(b) maxi = max(a, b) if a <= 0 and b <= 0: print('Not a moose') elif a == b: print(f'Even {a + b}') elif a != b: print(f'Odd {maxi + maxi}')
localDockerIPP = { "sites": [ {"site": "Local_IPP", "auth": {"channel": None}, "execution": { "executor": "ipp", "container": { "type": "docker", "image": "parslbase_v0.1", }, "provider": "local", ...
local_docker_ipp = {'sites': [{'site': 'Local_IPP', 'auth': {'channel': None}, 'execution': {'executor': 'ipp', 'container': {'type': 'docker', 'image': 'parslbase_v0.1'}, 'provider': 'local', 'block': {'initBlocks': 2}}}], 'globals': {'lazyErrors': True}} local_simple_ipp = {'sites': [{'site': 'Local_IPP', 'auth': {'c...
class Solution: def findDisappearedNumbers(self, nums: List[int]) -> List[int]: res = [] num_set = set(nums) for i in range(1,len(nums)+1): if i not in num_set: res.append(i) return res
class Solution: def find_disappeared_numbers(self, nums: List[int]) -> List[int]: res = [] num_set = set(nums) for i in range(1, len(nums) + 1): if i not in num_set: res.append(i) return res
#create a program that asks the user submit text repeatedly #The program will exit when user submit CLOSE #print the output as text file with open('./96_file/96_file.txt', 'w') as file: while True: user_input = input('Enter anything (to quite- type CLOSE) : '); if user_input == 'CLOSE': ...
with open('./96_file/96_file.txt', 'w') as file: while True: user_input = input('Enter anything (to quite- type CLOSE) : ') if user_input == 'CLOSE': break else: file.write(user_input + '\n')
"""This file contains variables that are used in filters.""" filename = 'sample_filename_here' # filter defult parameters smoothing = 'STEDI' noise_scale = 0.5 feature_scale = 0.5 nr_iterations = 20 save_every = 10 edge_thr = 0.001 gamma = 1 downsampling = 0 no_nonpositive_mask = False
"""This file contains variables that are used in filters.""" filename = 'sample_filename_here' smoothing = 'STEDI' noise_scale = 0.5 feature_scale = 0.5 nr_iterations = 20 save_every = 10 edge_thr = 0.001 gamma = 1 downsampling = 0 no_nonpositive_mask = False
class AllowSenderError(Exception): pass class AllowAuthError(Exception): pass class NotEnoughPoint(Exception): pass class AligoError(Exception): pass
class Allowsendererror(Exception): pass class Allowautherror(Exception): pass class Notenoughpoint(Exception): pass class Aligoerror(Exception): pass
n = int(input()) a = [] for x in range(n): a.append(int(input())) print(min(a)) print(max(a))
n = int(input()) a = [] for x in range(n): a.append(int(input())) print(min(a)) print(max(a))
def is_2xx(response_code): return 200 <= response_code < 300 def is_3xx(response_code): return 300 <= response_code < 400 def is_4xx(response_code): return 400 <= response_code < 500 def is_5xx(response_code): return response_code >= 500
def is_2xx(response_code): return 200 <= response_code < 300 def is_3xx(response_code): return 300 <= response_code < 400 def is_4xx(response_code): return 400 <= response_code < 500 def is_5xx(response_code): return response_code >= 500
# link:https://leetcode.com/problems/design-browser-history/ class BrowserHistory: def __init__(self, homepage: str): self.forw_memo = [] # forw_memo stores the future url self.back_memo = [] # back_memo stores the previous url self.curr_url = homepage def visit(self, url: str...
class Browserhistory: def __init__(self, homepage: str): self.forw_memo = [] self.back_memo = [] self.curr_url = homepage def visit(self, url: str) -> None: self.back_memo.append(self.curr_url) self.curr_url = url self.forw_memo = [] def back(self, steps: i...
def get_formatted_name(first_name, last_name, middle_name=''): """Devolve um nome completo formatado de modo elegante.""" if middle_name: full_name = f'{first_name} {middle_name} {last_name}' else: full_name = f'{first_name} {last_name}'.title() return full_name.title() musician = get_...
def get_formatted_name(first_name, last_name, middle_name=''): """Devolve um nome completo formatado de modo elegante.""" if middle_name: full_name = f'{first_name} {middle_name} {last_name}' else: full_name = f'{first_name} {last_name}'.title() return full_name.title() musician = get_fo...
""" This script is to practice on not in expression """ ACTIVITY = input("What would you like to do today? ") if "cinema" not in ACTIVITY.casefold(): print("But I want to go to the cinema")
""" This script is to practice on not in expression """ activity = input('What would you like to do today? ') if 'cinema' not in ACTIVITY.casefold(): print('But I want to go to the cinema')
# Python program to for appending a list file1 = open("myfile.txt","w") L = [] value=input("how many you want in a list") a=value.split() print(a) for i in a: L.append(i) print(L) file1.close() # Append-adds at last file1 = open("myfile.txt","a")#append mode for i in L: file1.write(i) file1.close() file1 =...
file1 = open('myfile.txt', 'w') l = [] value = input('how many you want in a list') a = value.split() print(a) for i in a: L.append(i) print(L) file1.close() file1 = open('myfile.txt', 'a') for i in L: file1.write(i) file1.close() file1 = open('myfile.txt', 'r') print('Output of Readlines after appending') prin...
class Solution(object): def numIslands(self, grid): self.dx = [-1, 1, 0, 0] self.dy = [0, 0, -1, 1] if not grid: return 0 self.x_max, self.y_max, self.grid = len(grid), len(grid[0]), grid self.visited = set() return sum([self.floodfill_dfs(i, j) for i in range(self.x...
class Solution(object): def num_islands(self, grid): self.dx = [-1, 1, 0, 0] self.dy = [0, 0, -1, 1] if not grid: return 0 (self.x_max, self.y_max, self.grid) = (len(grid), len(grid[0]), grid) self.visited = set() return sum([self.floodfill_dfs(i, j) for ...
# to use this code: # 1. load into slice3dVWR introspection window # 2. execute with ctrl-enter or File | Run current edit # 3. in the bottom window type lm1 = get_lookmark() # 4. do stuff # 5. to restore lookmark, do set_lookmark(lm1) # keep on bugging me to: # 1. fix slice3dVWR # 2. build this sort of functionality ...
def get_plane_infos(): plane_infos = [] for sd in obj.sliceDirections._sliceDirectionsDict.values(): ipw = sd._ipws[0] plane_infos.append((ipw.GetOrigin(), ipw.GetPoint1(), ipw.GetPoint2(), ipw.GetWindow(), ipw.GetLevel())) return plane_infos def set_plane_infos(plane_infos): sds = obj....
#------------------------------------------------------------------------------ # Copyright (c) 2013, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #-------------------------------------------------...
def _format_source_error(filename, context, lineno): """ A helper function which generates an error string. This function handles the work of reading the lines of the file which bracket the error, and formatting a string which points to the offending line. The output is similar to: File "foo.py", ...
class Solution: def findLengthOfLCIS(self, nums): """ :type nums: List[int] :rtype: int """ result = 0 count = 0 for i in range(len(nums)): if i == 0 or nums[i-1] < nums[i]: count += 1 result = max(count, result) ...
class Solution: def find_length_of_lcis(self, nums): """ :type nums: List[int] :rtype: int """ result = 0 count = 0 for i in range(len(nums)): if i == 0 or nums[i - 1] < nums[i]: count += 1 result = max(count, resul...
FLAT, TILT_FORWARD, TILT_LEFT, TILT_RIGHT, TILT_BACK = range(5) def process_tilt(raw_tilt_value): """Use a series of elif/value-checks to process the tilt sensor data.""" if 10 <= raw_tilt_value <= 40: return TILT_BACK elif 60 <= raw_tilt_value <= 90: return TILT_RIGHT elif 170 <= r...
(flat, tilt_forward, tilt_left, tilt_right, tilt_back) = range(5) def process_tilt(raw_tilt_value): """Use a series of elif/value-checks to process the tilt sensor data.""" if 10 <= raw_tilt_value <= 40: return TILT_BACK elif 60 <= raw_tilt_value <= 90: return TILT_RIGHT elif 170 <=...
def author_name(): return "Ganesh" def author_education(): return "Purusing Engineering Pre-final Year" def author_socialmedia(): return "https://www.linkedin.com/in/ganeshuthiravasagam/" def author_github(): return "https://github.com/Ganeshuthiravasagam/"
def author_name(): return 'Ganesh' def author_education(): return 'Purusing Engineering Pre-final Year' def author_socialmedia(): return 'https://www.linkedin.com/in/ganeshuthiravasagam/' def author_github(): return 'https://github.com/Ganeshuthiravasagam/'
# start main program DIGITS = list(range(1, 10)) # create emtpy puzzle grid = [[0 for i in range(9)] for j in range(9)] # hard coded puzzle from North Haven Courier grid[0][0] = 1; grid[0][3] = 6; grid[0][5] = 5; grid[0][6] = 4; grid[0][8] = 3; grid[1][0] = 6; grid[1][2] = 7; grid[1][4] = 2; grid[1][7] = 1; g...
digits = list(range(1, 10)) grid = [[0 for i in range(9)] for j in range(9)] grid[0][0] = 1 grid[0][3] = 6 grid[0][5] = 5 grid[0][6] = 4 grid[0][8] = 3 grid[1][0] = 6 grid[1][2] = 7 grid[1][4] = 2 grid[1][7] = 1 grid[2][1] = 4 grid[2][4] = 7 grid[2][6] = 2 grid[4][4] = 5 grid[4][5] = 3 grid[4][7] = 4 grid[5][2] = 4 gri...
#example 1 dummy_list = ["one","two","three","four","five","six"] separator = ' ' result_string = separator.join(dummy_list) print(result_string) #example 2 dummy_list = ["one","two","three","four","five","six"] separator = ',' result_string = separator.join(dummy_list) print(result_string)
dummy_list = ['one', 'two', 'three', 'four', 'five', 'six'] separator = ' ' result_string = separator.join(dummy_list) print(result_string) dummy_list = ['one', 'two', 'three', 'four', 'five', 'six'] separator = ',' result_string = separator.join(dummy_list) print(result_string)
class CameraInfo : ''' Camera Information. Attributes ---------- model: Camera model. firmware: Firmware version. uid: Camera identification. resolution: Camera resolution port: Serial port ''' def __init__(self, _model, _firm...
class Camerainfo: """ Camera Information. Attributes ---------- model: Camera model. firmware: Firmware version. uid: Camera identification. resolution: Camera resolution port: Serial port """ def __init__(self, _model, _firmw...
def ComputeR10_1(scores,labels,count = 10): total = 0 correct = 0 for i in range(len(labels)): if labels[i] == 1: total = total+1 sublist = scores[i:i+count] if max(sublist) == scores[i]: correct = correct + 1 print(float(correct)/ total ) def...
def compute_r10_1(scores, labels, count=10): total = 0 correct = 0 for i in range(len(labels)): if labels[i] == 1: total = total + 1 sublist = scores[i:i + count] if max(sublist) == scores[i]: correct = correct + 1 print(float(correct) / total)...
class CallAfterCommitMiddleware(object): def process_response(self, request, response): try: callbacks = request._post_commit_callbacks except AttributeError: callbacks = [] for fn, args, kwargs in callbacks: fn(*args, **kwargs) return response
class Callaftercommitmiddleware(object): def process_response(self, request, response): try: callbacks = request._post_commit_callbacks except AttributeError: callbacks = [] for (fn, args, kwargs) in callbacks: fn(*args, **kwargs) return response
# execute with python ./part1.py def trees_met(map: list, right: int, down: int): trees = 0 idx_of_column = 0 idx_of_row = 0 length_of_row = len(map[0])-1 # so that we do not count the newline character!!! while idx_of_row < len(map)-1: idx_of_row = idx_of_row + down row = map[idx_o...
def trees_met(map: list, right: int, down: int): trees = 0 idx_of_column = 0 idx_of_row = 0 length_of_row = len(map[0]) - 1 while idx_of_row < len(map) - 1: idx_of_row = idx_of_row + down row = map[idx_of_row] idx_of_column = idx_of_column + right if idx_of_column > l...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # this is a windows documentation stub. actual code lives in the .ps1 # file of the same name ANSIBLE...
ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} documentation = '\n---\nmodule: win_msg\nversion_added: "2.3"\nshort_description: Sends a message to logged in users on Windows hosts\ndescription:\n - Wraps the msg.exe command in order to send messages to Windows hos...
""" Cache interface. """ class Cache: def __contains__(self, key): raise NotImplementedError() def __getitem__(self, key): raise NotImplementedError() def __setitem__(self, key, value): raise NotImplementedError()
""" Cache interface. """ class Cache: def __contains__(self, key): raise not_implemented_error() def __getitem__(self, key): raise not_implemented_error() def __setitem__(self, key, value): raise not_implemented_error()
""" version which can be consumed from within the module """ VERSION_STR = "0.0.15" DESCRIPTION = "pytimer is an easy to use timer" APP_NAME = "pytimer" LOGGER_NAME = "pytimer"
""" version which can be consumed from within the module """ version_str = '0.0.15' description = 'pytimer is an easy to use timer' app_name = 'pytimer' logger_name = 'pytimer'
# Time: O(n^2) # Space: O(n) class Solution(object): def lenLongestFibSubseq(self, A): """ :type A: List[int] :rtype: int """ lookup = set(A) result = 2 for i in xrange(len(A)): for j in xrange(i+1, len(A)): x, y, l =...
class Solution(object): def len_longest_fib_subseq(self, A): """ :type A: List[int] :rtype: int """ lookup = set(A) result = 2 for i in xrange(len(A)): for j in xrange(i + 1, len(A)): (x, y, l) = (A[i], A[j], 2) whi...
def greeting(): text= "Hello World" print(text) if __name__== '__main__': greeting()
def greeting(): text = 'Hello World' print(text) if __name__ == '__main__': greeting()
# # PySNMP MIB module SNMP-NOTIFICATION-MIB (http://pysnmp.sf.net) # ASN.1 source file:///usr/share/snmp/mibs/SNMP-NOTIFICATION-MIB.txt # Produced by pysmi-0.0.5 at Sat Sep 19 23:00:18 2015 # On host grommit.local platform Darwin version 14.4.0 by user ilya # Using Python version 2.7.6 (default, Sep 9 2014, 15:04:36) ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ...
n = int(input()) w = [list(map(lambda x: int(x)-1, input().split())) for _ in range(n)] syussya = [0] * (n*2) for s, _ in w: syussya[s] += 1 for i in range(1, n*2): syussya[i] += syussya[i-1] for s, t in w: print(syussya[t] - syussya[s])
n = int(input()) w = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(n)] syussya = [0] * (n * 2) for (s, _) in w: syussya[s] += 1 for i in range(1, n * 2): syussya[i] += syussya[i - 1] for (s, t) in w: print(syussya[t] - syussya[s])
USERS = {'editor':'editor', 'viewer':'viewer'} GROUPS = {'editor':['group:editors'], 'viewer':['group:viewers']} def groupfinder(userid, request): if userid in USERS: return GROUPS.get(userid,[])
users = {'editor': 'editor', 'viewer': 'viewer'} groups = {'editor': ['group:editors'], 'viewer': ['group:viewers']} def groupfinder(userid, request): if userid in USERS: return GROUPS.get(userid, [])
# Autogenerated by devscripts/update-version.py __version__ = '2021.12.01' RELEASE_GIT_HEAD = '91f071af6'
__version__ = '2021.12.01' release_git_head = '91f071af6'
# ------------------------------------------------------------------------------ # Access to the CodeHawk Binary Analyzer Analysis Results # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2016-2020 Kestrel Technology LLC # #...
class Stringxrefs(object): def __init__(self, stringsxrefs, xnode): self.stringsxrefs = stringsxrefs self.xnode = xnode self.strval = self.stringsxrefs.bdictionary.read_xml_string(self.xnode) self.addr = self.xnode.get('a') self.xrefs = [] self._initialize() def...
class BaseActionNoise(object): """ Base class of action noise. """ def __init__(self, action_space): self.action_space = action_space def reset(self): pass
class Baseactionnoise(object): """ Base class of action noise. """ def __init__(self, action_space): self.action_space = action_space def reset(self): pass
"""\ Core Random Tools ================= """ depends = ['core'] __all__ = [ 'beta', 'binomial', 'bytes', 'chisquare', 'exponential', 'f', 'gamma', 'geometric', 'get_state', 'gumbel', 'hypergeometric', 'laplace', 'logistic', 'lognormal', 'logseries', 'mu...
"""Core Random Tools ================= """ depends = ['core'] __all__ = ['beta', 'binomial', 'bytes', 'chisquare', 'exponential', 'f', 'gamma', 'geometric', 'get_state', 'gumbel', 'hypergeometric', 'laplace', 'logistic', 'lognormal', 'logseries', 'multinomial', 'multivariate_normal', 'negative_binomial', 'noncentral_c...
#encoding:utf-8 subreddit = 'Windows10' t_channel = '@r_Windows10' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'Windows10' t_channel = '@r_Windows10' def send_post(submission, r2t): return r2t.send_simple(submission)
s, f, l = input('String='), input('First Letter='), input('Second Letter=') for i in range(1): f_in, l_in = s.rindex(f), s.index(l) if f_in == -1 or l_in == -1 or f_in > l_in: print(False) else: print(True)
(s, f, l) = (input('String='), input('First Letter='), input('Second Letter=')) for i in range(1): (f_in, l_in) = (s.rindex(f), s.index(l)) if f_in == -1 or l_in == -1 or f_in > l_in: print(False) else: print(True)
class Solution: def romanToInt(self, s: str) -> int: return self.get_roman(self.roman_numerals(), s) @staticmethod def roman_numerals(): numerals = { 'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M'...
class Solution: def roman_to_int(self, s: str) -> int: return self.get_roman(self.roman_numerals(), s) @staticmethod def roman_numerals(): numerals = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} return numerals @staticmethod def get_roman(numerals, s):...
# https://www.hackerrank.com/challenges/py-set-mutations/problem s = [set(map(int, input().split())) for _ in range(2)][1] # 16 # len(s) # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 24 52 methods1 = { "update": s.update, "difference_update": s.difference_update, "intersection_update": s.intersection_update, ...
s = [set(map(int, input().split())) for _ in range(2)][1] methods1 = {'update': s.update, 'difference_update': s.difference_update, 'intersection_update': s.intersection_update, 'symmetric_difference_update': s.symmetric_difference_update} def methods2(m, s, sub_s): if m == 'update': s |= sub_s elif m ...
""" compartment_type_instances.py """ population = [ # Class diagram # Class {'Name': 'name', 'Horizontal alignment': 'CENTER', 'Vertical alignment': 'CENTER', 'Pad top': 5, 'Pad bottom': 10, 'Pad left': 5, 'Pad right': 5, 'Text style': 'TITLE', 'Node type': 'class', 'Diagram type': 'class', 'Sta...
""" compartment_type_instances.py """ population = [{'Name': 'name', 'Horizontal alignment': 'CENTER', 'Vertical alignment': 'CENTER', 'Pad top': 5, 'Pad bottom': 10, 'Pad left': 5, 'Pad right': 5, 'Text style': 'TITLE', 'Node type': 'class', 'Diagram type': 'class', 'Stack order': 1}, {'Name': 'attribute', 'Horizontal...
#!/usr/bin/python3 def mode(array: list) -> float: """ Calculates the mode of a given array, if two or more elements have the highest frequency then mode is the smallest value among them. """ if len(set(array)) == len(array): mode = min(array) else: maxi = 0 val = [] ...
def mode(array: list) -> float: """ Calculates the mode of a given array, if two or more elements have the highest frequency then mode is the smallest value among them. """ if len(set(array)) == len(array): mode = min(array) else: maxi = 0 val = [] for e in set(ar...
# EOF (end-of-file) indicates no more input for lexical analysis. INTEGER, PLUS, MINUS, EOF = 'INTEGER', 'PLUS', 'MINUS', 'EOF' class ParserError(Exception): """Exception raised when the parser encounters an error.""" pass class Token: """A calculator token. Attributes: kind (str): The kind...
(integer, plus, minus, eof) = ('INTEGER', 'PLUS', 'MINUS', 'EOF') class Parsererror(Exception): """Exception raised when the parser encounters an error.""" pass class Token: """A calculator token. Attributes: kind (str): The kind, or type, of the token. Valid kinds are currently `...
#!/usr/local/bin/python3.7 #!/usr/bin/env python3 #!/usr/bin/python3 for i1 in range(32, 127): c1 = chr(i1) print(("%d %s" % (i1, c1)))
for i1 in range(32, 127): c1 = chr(i1) print('%d %s' % (i1, c1))
# terrascript/resource/grafana.py __all__ = []
__all__ = []
""" In Python, a string can be split on a delimiter. Example: >>> a = "this is a string" >>> a = a.split(" ") # a is converted to a list of strings. >>> print a ['this', 'is', 'a', 'string'] Joining a string is simple: >>> a = "-".join(a) >>> print a this-is-a-string Task You are given a string. Split the string on ...
""" In Python, a string can be split on a delimiter. Example: >>> a = "this is a string" >>> a = a.split(" ") # a is converted to a list of strings. >>> print a ['this', 'is', 'a', 'string'] Joining a string is simple: >>> a = "-".join(a) >>> print a this-is-a-string Task You are given a string. Split the string on ...
## Number Zoo Patrol ## 6 kyu ## https://www.codewars.com//kata/5276c18121e20900c0000235 def find_missing_number(numbers): numbers = set(numbers) if len(numbers) == 0: return 1 for i in range(1,max(numbers)+2): if i not in numbers: return i
def find_missing_number(numbers): numbers = set(numbers) if len(numbers) == 0: return 1 for i in range(1, max(numbers) + 2): if i not in numbers: return i
# datasetPreprocess.py # Preprocessing should should have a fit and a transform step def convert_numpy(df): return df.to_numpy() def drop_columns(df, ids): return df.drop(ids, axis = 1) def recode(df): df["Bound"] = 2*df["Bound"] - 1 return df def squeeze(array): return array.squeeze()
def convert_numpy(df): return df.to_numpy() def drop_columns(df, ids): return df.drop(ids, axis=1) def recode(df): df['Bound'] = 2 * df['Bound'] - 1 return df def squeeze(array): return array.squeeze()
# bergWeight.by # A program that asks user for the weight of a single Berg Bar and the total number of # bars made that month as inputs. # Outputs the total weight of pounds and ounces of all Berg Bar for the month # Name: Ben Goldstone # Date 9/8/2020 weightOfSingleBar = float(input("What was the weight of a single Be...
weight_of_single_bar = float(input('What was the weight of a single Berg Bar? ')) total_number_of_bars = int(input('How many bars were produced? ')) total_weight = weightOfSingleBar * totalNumberOfBars lbs = int(totalWeight // 16) oz = totalWeight % 16 oz_to_grams = 28.34952 bar_in_grams = weightOfSingleBar * OZ_TO_GRA...
# Time: O(1) # Space: O(1) # Calculate the sum of two integers a and b, # but you are not allowed to use the operator + and -. # # Example: # Given a = 1 and b = 2, return 3. class Solution(object): def getSum(self, a, b): """ :type a: int :type b: int :rtype: int """ ...
class Solution(object): def get_sum(self, a, b): """ :type a: int :type b: int :rtype: int """ bit_length = 32 (neg_bit, mask) = (1 << bit_length >> 1, ~(~0 << bit_length)) a = a | ~mask if a & neg_bit else a & mask b = b | ~mask if b & neg_bi...
account_error = {"status": "error", "message": "username or password error!"}, 400 teacher_not_found = {"status": "error", "message": "teacher not found!"}, 400 topic_not_found = {"status": "error", "message": "topic not found!"}, 400 file_not_found = {"status": "error", "message": "file not found!"}, 400 upload_error ...
account_error = ({'status': 'error', 'message': 'username or password error!'}, 400) teacher_not_found = ({'status': 'error', 'message': 'teacher not found!'}, 400) topic_not_found = ({'status': 'error', 'message': 'topic not found!'}, 400) file_not_found = ({'status': 'error', 'message': 'file not found!'}, 400) uploa...
""" persistence_engine.py ~~~~~~~~~~~~ Implements put, get, delete methods for PersistenceStage. Using an actual persistence engine (i.e. MySQL, BDB), one would implement the three methods themselves. """ class PersistenceEngine(object): """ Basic persistence engine implemented as a regular Pytho...
""" persistence_engine.py ~~~~~~~~~~~~ Implements put, get, delete methods for PersistenceStage. Using an actual persistence engine (i.e. MySQL, BDB), one would implement the three methods themselves. """ class Persistenceengine(object): """ Basic persistence engine implemented as a regular Python...
class Solution: # @return a string def countAndSay(self, n): pre = "1" for i in range(n-1): pre = self.f(pre) return pre def f(self, s): ans = "" pre = s[0] cur = 1 for c in s[1:]: if c == pre: cur = cur + 1...
class Solution: def count_and_say(self, n): pre = '1' for i in range(n - 1): pre = self.f(pre) return pre def f(self, s): ans = '' pre = s[0] cur = 1 for c in s[1:]: if c == pre: cur = cur + 1 else: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: b.lin@mfm.tu-darmstadt.de """ def CreateInputFileEulerangles (InputFileName, object ,Phi,Theta,Psi): data = open(InputFileName,'w') data.write("\n[./B%d]\ \n type = ComputeElasticityTensor\ \n euler_angle_1 = %s\ ...
""" @author: b.lin@mfm.tu-darmstadt.de """ def create_input_file_eulerangles(InputFileName, object, Phi, Theta, Psi): data = open(InputFileName, 'w') data.write('\n[./B%d] \n type = ComputeElasticityTensor \n euler_angle_1 = %s \n euler_angle_2 = %s \n euler_...
class Solution: def addDigits(self, num): """ :type num: int :rtype: int """ return 1 + (num - 1) % 9 if __name__ == '__main__': solution = Solution() print(solution.addDigits(38)); else: pass
class Solution: def add_digits(self, num): """ :type num: int :rtype: int """ return 1 + (num - 1) % 9 if __name__ == '__main__': solution = solution() print(solution.addDigits(38)) else: pass
class Solution: def minWindow(self, s: str, t: str) -> str: if t == "": return "" count,window = {},{} res = [-1,-1] ;reslen = float("inf") for c in t : count[c] = 1 + count.get(c,0) have,need = 0, len(count) l = 0 ...
class Solution: def min_window(self, s: str, t: str) -> str: if t == '': return '' (count, window) = ({}, {}) res = [-1, -1] reslen = float('inf') for c in t: count[c] = 1 + count.get(c, 0) (have, need) = (0, len(count)) l = 0 ...
def find_product(lst): b = 1 ans = [] for i, v in enumerate(lst): tmp = 1 for j in lst[i+1:]: tmp *= j ans.append(tmp * b) b *= v print(ans) return ans assert find_product([1,2,3,4]) == [24,12,8,6] assert find_product([4,2,1,5, 0]) == [0,0,0,0,40]
def find_product(lst): b = 1 ans = [] for (i, v) in enumerate(lst): tmp = 1 for j in lst[i + 1:]: tmp *= j ans.append(tmp * b) b *= v print(ans) return ans assert find_product([1, 2, 3, 4]) == [24, 12, 8, 6] assert find_product([4, 2, 1, 5, 0]) == [0, 0, 0...
CONFIG = dict({ 'demo_battery': [ { 'protocol': 'UDP', 'setup': 'single', 'mode': 'simple', 'size': '1MB', 'test_count': 1 } ], 'full_battery': [ { 'protocol': 'UDP', 'setup': 'single', 'mode': 'simple', 'size': '1MB', 'test_count': 3 }, { 'protocol': 'UDP', 'setup': 'si...
config = dict({'demo_battery': [{'protocol': 'UDP', 'setup': 'single', 'mode': 'simple', 'size': '1MB', 'test_count': 1}], 'full_battery': [{'protocol': 'UDP', 'setup': 'single', 'mode': 'simple', 'size': '1MB', 'test_count': 3}, {'protocol': 'UDP', 'setup': 'single', 'mode': 'simple', 'size': '10MB', 'test_count': 3},...
expected_output = { 'key_chain': { 'ISIS-HELLO-CORE': { 'keys': { '1': { 'accept_lifetime': '00:01:00 january 01 2013 infinite', 'key_string': 'password 020F175218', 'cryptographic_algorithm': 'HMAC-MD5'}}, ...
expected_output = {'key_chain': {'ISIS-HELLO-CORE': {'keys': {'1': {'accept_lifetime': '00:01:00 january 01 2013 infinite', 'key_string': 'password 020F175218', 'cryptographic_algorithm': 'HMAC-MD5'}}, 'accept_tolerance': 'infinite'}}}
x, y, w, h = map(int, input().split()) answer = min(x, y, w-x, h-y) print(answer)
(x, y, w, h) = map(int, input().split()) answer = min(x, y, w - x, h - y) print(answer)
def part1(pairs): depth = 0 h_pos = 0 for cmd, val in pairs: val = int(val) if cmd == "forward": h_pos += val elif cmd == "up": depth -= val elif cmd == "down": depth += val else: raise Exception return h_pos * dept...
def part1(pairs): depth = 0 h_pos = 0 for (cmd, val) in pairs: val = int(val) if cmd == 'forward': h_pos += val elif cmd == 'up': depth -= val elif cmd == 'down': depth += val else: raise Exception return h_pos * dep...
userName = input('Ingresar usuario ') password = int(input('Ingresa pass: ')) if (userName == 'pablo') and (password == 123456): print('Bienvenido') else: print('Acceso denegado')
user_name = input('Ingresar usuario ') password = int(input('Ingresa pass: ')) if userName == 'pablo' and password == 123456: print('Bienvenido') else: print('Acceso denegado')
# # PySNMP MIB module CISCO-MOBILE-IP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-MOBILE-IP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:07:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
# https://www.codewars.com/kata/string-cleaning/ def string_clean(s): output = "" for symbol in s: if not(symbol.isdigit()): output += symbol return output
def string_clean(s): output = '' for symbol in s: if not symbol.isdigit(): output += symbol return output
"""default values for the command line interface """ variables = ["T", "FI", "U", "V", "QD", "QW", "RELHUM"] plevs = [100, 200, 500, 850, 950]
"""default values for the command line interface """ variables = ['T', 'FI', 'U', 'V', 'QD', 'QW', 'RELHUM'] plevs = [100, 200, 500, 850, 950]
#! /usr/bin/python class PySopn: # Initialize instance def __init__(self, iface, port): self.interface = interface self.port = port self.socket = PySopn_eth(iface, port) # Set configuration def configSet(self, config): pass # Open def open(self): self...
class Pysopn: def __init__(self, iface, port): self.interface = interface self.port = port self.socket = py_sopn_eth(iface, port) def config_set(self, config): pass def open(self): self.flgopen = True
class Controller: user = '' mdp = '' url = '' port = 0 timeout = 0 def __init__(self, user, mdp, url, port, timeout): self.user = user self.mdp = mdp self.url = url self.port = int(port) self.timeout = int(timeout)
class Controller: user = '' mdp = '' url = '' port = 0 timeout = 0 def __init__(self, user, mdp, url, port, timeout): self.user = user self.mdp = mdp self.url = url self.port = int(port) self.timeout = int(timeout)
categories_db = \ { 'armors': { 'items': [ 'cuirass', 'banded-mail', 'scale-mail', 'ring-mail', 'chainmail', 'half-plate', 'moon...
categories_db = {'armors': {'items': ['cuirass', 'banded-mail', 'scale-mail', 'ring-mail', 'chainmail', 'half-plate', 'moonplate', 'steel-cuirass', 'full-plate', 'longmail', 'noble-plate', 'silvered-scales', 'arcane-guard', 'runic-mail', 'chaos-armor', 'shining-armor', 'valkyrie-armor', 'white-fullplate', 'eldritch-mai...
# 3-3 Problem1, Problem2, Problem3 sum = 0 for i in range(1, 101): sum += i print('{}'.format(sum)) A = [70, 60, 55, 75, 95, 90, 80, 80, 85, 100] mean = 0.0 for point in A: mean += point mean /= len(A) print('{}'.format(mean)) numbers = [1, 2, 3, 4, 5] result = [n * 2 for n in numbers if ...
sum = 0 for i in range(1, 101): sum += i print('{}'.format(sum)) a = [70, 60, 55, 75, 95, 90, 80, 80, 85, 100] mean = 0.0 for point in A: mean += point mean /= len(A) print('{}'.format(mean)) numbers = [1, 2, 3, 4, 5] result = [n * 2 for n in numbers if n % 2 == 1] print(result)
class Solution: def addStrings(self, num1: str, num2: str) -> str: n1 = 0; n2 = 0; o = 0 for c in num1[::-1]: n1 += int(c)*10**o o += 1 o = 0 for c in num2[::-1]: n2 += int(c)*10**o o += 1 return str(n1+n2)
class Solution: def add_strings(self, num1: str, num2: str) -> str: n1 = 0 n2 = 0 o = 0 for c in num1[::-1]: n1 += int(c) * 10 ** o o += 1 o = 0 for c in num2[::-1]: n2 += int(c) * 10 ** o o += 1 return str(n1 +...
#!/usr/bin/env python3 # Write a program that computes the running sum from 1..n # Also, have it compute the factorial of n while you're at it # No, you may not use math.factorial() # Use the same loop for both calculations n = 5 rsum=0 fac=1 for i in range(1,n+1): rsum += i fac *= i print (n, rsum, fac) #goal pri...
n = 5 rsum = 0 fac = 1 for i in range(1, n + 1): rsum += i fac *= i print(n, rsum, fac) '\n5 15 120\n'
""" mcir.py Copyright 2015 Andres Riancho This file is part of w3af, http://w3af.org/ . w3af is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License. w3af is distributed in the hope that it wil...
""" mcir.py Copyright 2015 Andres Riancho This file is part of w3af, http://w3af.org/ . w3af is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License. w3af is distributed in the hope that it wil...
#class method class Employee: raise_amount = 1.04 num_of_emps = 0 def __init__ (self, first, last , pay): self.first = first self.last = last self.email = first + "." + last + "@company.com" self.pay = pay Employee.num_of_emps += 1 def full_n...
class Employee: raise_amount = 1.04 num_of_emps = 0 def __init__(self, first, last, pay): self.first = first self.last = last self.email = first + '.' + last + '@company.com' self.pay = pay Employee.num_of_emps += 1 def full_name(self): return '{} {}'.fo...
# test loading constants in viper functions @micropython.viper def f(): return b'bytes' print(f()) @micropython.viper def f(): @micropython.viper def g() -> int: return 123 return g print(f()())
@micropython.viper def f(): return b'bytes' print(f()) @micropython.viper def f(): @micropython.viper def g() -> int: return 123 return g print(f()())
""" /dms/rssfeedmanager/ Verwaltung der RSS-Feeds innerhalb des Django content Management Systems Hans Rauch hans.rauch@gmx.net Die Programme des dms-Systems koennen frei genutzt und den spezifischen Beduerfnissen entsprechend angepasst werden. """
""" /dms/rssfeedmanager/ Verwaltung der RSS-Feeds innerhalb des Django content Management Systems Hans Rauch hans.rauch@gmx.net Die Programme des dms-Systems koennen frei genutzt und den spezifischen Beduerfnissen entsprechend angepasst werden. """
x = ['apple', 'banana', 'mango', 'orange', 'peach', 'grapes'] def createNewList(l): newList = [] i = 1 while i < 6: newList.append(l[i]) i = i + 1 if i % 2 == 1: i = i + 1 print(newList) createNewList(x)
x = ['apple', 'banana', 'mango', 'orange', 'peach', 'grapes'] def create_new_list(l): new_list = [] i = 1 while i < 6: newList.append(l[i]) i = i + 1 if i % 2 == 1: i = i + 1 print(newList) create_new_list(x)
#!/usr/bin/env python # encoding: utf-8 """ edit_distance.py Created by Shengwei on 2014-07-28. """ # https://oj.leetcode.com/problems/edit-distance/ # tags: medium, string, dp """ Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 st...
""" edit_distance.py Created by Shengwei on 2014-07-28. """ '\nGiven two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)\n\nYou have the following 3 operations permitted on a word:\n\na) Insert a character\nb) Delete a character\nc) Rep...
def find(needle, haystack): for i in range(len(haystack)-len(needle)+1): flag=True for j,char in enumerate(needle): if char=="_": continue elif char!=haystack[i+j]: flag=False break if flag: return i retu...
def find(needle, haystack): for i in range(len(haystack) - len(needle) + 1): flag = True for (j, char) in enumerate(needle): if char == '_': continue elif char != haystack[i + j]: flag = False break if flag: ...
__title__ = 'compas_fab' __description__ = 'Robotic fabrication package for the COMPAS Framework' __url__ = 'https://github.com/gramaziokohler/compas_fab' __version__ = '0.5.0' __author__ = 'Gramazio Kohler Research' __author_email__ = 'gramaziokohler@arch.ethz.ch' __license__ = 'MIT license' __copyright__ = 'Copyright...
__title__ = 'compas_fab' __description__ = 'Robotic fabrication package for the COMPAS Framework' __url__ = 'https://github.com/gramaziokohler/compas_fab' __version__ = '0.5.0' __author__ = 'Gramazio Kohler Research' __author_email__ = 'gramaziokohler@arch.ethz.ch' __license__ = 'MIT license' __copyright__ = 'Copyright...