content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
INSTALLED_APPS = [ 'hooked', ] SECRET_KEY = 'nFG*WM(K7C9iun%Qy9G6De9XDZB$?4?Rj8KMBY[#7cue4#.Uj8'
installed_apps = ['hooked'] secret_key = 'nFG*WM(K7C9iun%Qy9G6De9XDZB$?4?Rj8KMBY[#7cue4#.Uj8'
#!/usr/bin/env python3 # coding=utf-8 # author: @netmanchris # -*- coding: utf-8 -*- """ This module contains contains a single function to return the current version of the pyhpeimc library. The function should return the current value the library and should be updated with every new version """ def version(): ...
""" This module contains contains a single function to return the current version of the pyhpeimc library. The function should return the current value the library and should be updated with every new version """ def version(): """Function takes no aruguments and returns a STR value of the current version of ...
# data TARGET_FILE = '/cl/work/shusuke-t/BioIE/data/multi_label_corpus/longest_match/' test_data = TARGET_FILE + 'test_conllform.txt' toy_data = TARGET_FILE + 'toy.txt' # dict PROTEIN = '/cl/work/shusuke-t/BioIE/2019_03_05_keywords/protein.tsv' GENE = '/cl/work/shusuke-t/BioIE/2019_03_05_keywords/gene.tsv' #ENZYME = '...
target_file = '/cl/work/shusuke-t/BioIE/data/multi_label_corpus/longest_match/' test_data = TARGET_FILE + 'test_conllform.txt' toy_data = TARGET_FILE + 'toy.txt' protein = '/cl/work/shusuke-t/BioIE/2019_03_05_keywords/protein.tsv' gene = '/cl/work/shusuke-t/BioIE/2019_03_05_keywords/gene.tsv' dict_list = [(PROTEIN, 'pr...
""" Programming for linguists Implementation of the data structure "Binary Search Tree" """ class EmptyError (Exception): """ Custom Error """ class NoNodeError (Exception): """ Custom Error """ class Node: """ Node Data Structure """ def __init__(self, data): self...
""" Programming for linguists Implementation of the data structure "Binary Search Tree" """ class Emptyerror(Exception): """ Custom Error """ class Nonodeerror(Exception): """ Custom Error """ class Node: """ Node Data Structure """ def __init__(self, data): self.data...
# 2413 - Busca na Internet # https://www.urionlinejudge.com.br/judge/pt/problems/view/2413 def main(): print(int(input()) * 4) if __name__ == "__main__": main()
def main(): print(int(input()) * 4) if __name__ == '__main__': main()
def bulk_chunks(actions, docs_per_chunk=300, bytes_per_chunk=None): """ Return groups of bulk-indexing operations to send to :meth:`~pyelasticsearch.ElasticSearch.bulk()`. Return an iterable of chunks, each of which is a JSON-encoded line or pair of lines in the format understood by ES's bulk API. ...
def bulk_chunks(actions, docs_per_chunk=300, bytes_per_chunk=None): """ Return groups of bulk-indexing operations to send to :meth:`~pyelasticsearch.ElasticSearch.bulk()`. Return an iterable of chunks, each of which is a JSON-encoded line or pair of lines in the format understood by ES's bulk API. ...
filename_top_left = "cmu_top_left.txt" filename_top_right = "cmu_top_right.txt" filename_bottom_left = "cmu_bottom_left.txt" filename_bottom_right = "cmu_bottom_right.txt" filename_output = "cmu.txt" n_rows = 100 out = open(filename_output,"w") def getRows(file): rows = [] for line in file: if(li...
filename_top_left = 'cmu_top_left.txt' filename_top_right = 'cmu_top_right.txt' filename_bottom_left = 'cmu_bottom_left.txt' filename_bottom_right = 'cmu_bottom_right.txt' filename_output = 'cmu.txt' n_rows = 100 out = open(filename_output, 'w') def get_rows(file): rows = [] for line in file: if line[-...
class RawSerialisation: """ A "serialiser" that just does nothing, only returning raw `bytes` (and making sure that bytes is indeed the type that is being sent/received). """ mimetype = 'application/octet-stream' @staticmethod def dumps(o): if isinstance(o, (list, tuple)): ...
class Rawserialisation: """ A "serialiser" that just does nothing, only returning raw `bytes` (and making sure that bytes is indeed the type that is being sent/received). """ mimetype = 'application/octet-stream' @staticmethod def dumps(o): if isinstance(o, (list, tuple)): ...
#creating prompts name = input("What is your name?") age = int(input("How old are you?")) true_false = bool(input("True or False: Is this statement true?")) print("My name is " + str(name)) print("My age is " + str(age)) print ("I will be " + str(age + 1) + " this year") print("This statement is " + str(true_false))
name = input('What is your name?') age = int(input('How old are you?')) true_false = bool(input('True or False: Is this statement true?')) print('My name is ' + str(name)) print('My age is ' + str(age)) print('I will be ' + str(age + 1) + ' this year') print('This statement is ' + str(true_false))
def main(): s1 = input() # String. s1 = dict.fromkeys(s1) # Convert it to dictionary to remove duplicates. if len(s1) % 2 == 0: print("CHAT WITH HER!") else: print("IGNORE HIM!") if __name__ == "__main__": main()
def main(): s1 = input() s1 = dict.fromkeys(s1) if len(s1) % 2 == 0: print('CHAT WITH HER!') else: print('IGNORE HIM!') if __name__ == '__main__': main()
class Bike(object): def __init__(self, description, condition, sale_price, cost=0): # Different initial values for every new instance self.description = description self.condition = condition self.sale_price = sale_price self.cost = cost # Same initial value for ever...
class Bike(object): def __init__(self, description, condition, sale_price, cost=0): self.description = description self.condition = condition self.sale_price = sale_price self.cost = cost self.sold = False def update_sale_price(self): pass def sell(self): ...
def service_category(): """ServiceCategory https://www.hl7.org/fhir/valueset-service-category.html Demographics and other administrative information about an individual or animal receiving care or other health-related services. This value set is used in the following places: CodeSystem: This ...
def service_category(): """ServiceCategory https://www.hl7.org/fhir/valueset-service-category.html Demographics and other administrative information about an individual or animal receiving care or other health-related services. This value set is used in the following places: CodeSystem: This ...
"""Exception classes.""" class StructureParserException(Exception): """Exception to signal errors when parsing PDB/mmCIF files.""" pass class MatrixReadingException(Exception): """Exception to signal error when reading matrices from file."""
"""Exception classes.""" class Structureparserexception(Exception): """Exception to signal errors when parsing PDB/mmCIF files.""" pass class Matrixreadingexception(Exception): """Exception to signal error when reading matrices from file."""
input_template = keras.layers.Input(shape=[None,1,16]) input_search = keras.layers.Input(shape=[47,1,16]) def x_corr_map(inputs): input_template = inputs[0] input_search = inputs[1] input_template = tf.transpose(input_template, perm=[1,2,0,3]) input_search = tf.transpose(input_search, perm=[1,2,0,3]) ...
input_template = keras.layers.Input(shape=[None, 1, 16]) input_search = keras.layers.Input(shape=[47, 1, 16]) def x_corr_map(inputs): input_template = inputs[0] input_search = inputs[1] input_template = tf.transpose(input_template, perm=[1, 2, 0, 3]) input_search = tf.transpose(input_search, perm=[1, 2...
# kittystuff: what do cats care about class KittyStuff: def __init__(self): self.lives = 9 self.enemies = [] self.enemies.append('dog') self.happiness = 0 def purr(self, happiness_level=0): purring = 'purr' for i in range(0, happiness_level): purring...
class Kittystuff: def __init__(self): self.lives = 9 self.enemies = [] self.enemies.append('dog') self.happiness = 0 def purr(self, happiness_level=0): purring = 'purr' for i in range(0, happiness_level): purring += '!' return purring de...
output_columns = ['PheWAS Code', 'PheWAS Name', 'p-val', '\"-log(p)\"', 'beta', 'Conf-interval beta', 'cpt'] imbalance_colors = { 0: 'white', 1: 'deepskyblue', -1: 'red' } m = len(fm[0]) p_values = n...
output_columns = ['PheWAS Code', 'PheWAS Name', 'p-val', '"-log(p)"', 'beta', 'Conf-interval beta', 'cpt'] imbalance_colors = {0: 'white', 1: 'deepskyblue', -1: 'red'} m = len(fm[0]) p_values = np.zeros(m, dtype=float) icodes = [] regressions = pd.DataFrame(columns=output_columns) labnames = df.columns def get_bon_thr...
class Solution: def primePalindrome(self, N: int) -> int: if 8 <= N <= 11: return 11 def isPrime(num): if num < 2 or num % 2 == 0: return num == 2 return all(num % i for i in range(3, int(num**0.5) + 1, 2)) for i in range(1, 100000...
class Solution: def prime_palindrome(self, N: int) -> int: if 8 <= N <= 11: return 11 def is_prime(num): if num < 2 or num % 2 == 0: return num == 2 return all((num % i for i in range(3, int(num ** 0.5) + 1, 2))) for i in range(1, 100000)...
class Solution: def hasPath(self, maze: List[List[int]], start: List[int], destination: List[int]) -> bool: m = len(maze) n = len(maze[0]) dirs = [0, 1, 0, -1, 0] seen = set() def isValid(x: int, y: int) -> bool: return 0 <= x < m and 0 <= y < n and maze[x][y] == 0 def dfs(i: int, j: ...
class Solution: def has_path(self, maze: List[List[int]], start: List[int], destination: List[int]) -> bool: m = len(maze) n = len(maze[0]) dirs = [0, 1, 0, -1, 0] seen = set() def is_valid(x: int, y: int) -> bool: return 0 <= x < m and 0 <= y < n and (maze[x][y...
# https://www.codewars.com/kata/550f22f4d758534c1100025a/ def dirreduc(arr): DIRECT = { "NORTH": "SOUTH", "SOUTH": "NORTH", "EAST": "WEST", "WEST": "EAST", } i = 0 while i + 1 < len(arr) and len(arr) >= 2: if arr[i] == DIRECT[arr[i + 1]]: arr.pop(i) ...
def dirreduc(arr): direct = {'NORTH': 'SOUTH', 'SOUTH': 'NORTH', 'EAST': 'WEST', 'WEST': 'EAST'} i = 0 while i + 1 < len(arr) and len(arr) >= 2: if arr[i] == DIRECT[arr[i + 1]]: arr.pop(i) arr.pop(i) i = 0 continue i += 1 return arr
"""weight dict definitions""" weights_sanctum_of_domination = { 'pw_ba_1': 0.000, 'pw_sa_1': 0.055, 'pw_na_1': 0.570, 'lm_ba_1': 0.000, 'lm_sa_1': 0.050, 'lm_na_1': 0.205, 'hm_ba_1': 0.000, 'hm_sa_1': 0.000, 'hm_na_1': 0.000, 'pw_ba_2': 0.020, 'pw_sa_2': 0.020, 'pw_na_2'...
"""weight dict definitions""" weights_sanctum_of_domination = {'pw_ba_1': 0.0, 'pw_sa_1': 0.055, 'pw_na_1': 0.57, 'lm_ba_1': 0.0, 'lm_sa_1': 0.05, 'lm_na_1': 0.205, 'hm_ba_1': 0.0, 'hm_sa_1': 0.0, 'hm_na_1': 0.0, 'pw_ba_2': 0.02, 'pw_sa_2': 0.02, 'pw_na_2': 0.05, 'lm_ba_2': 0.02, 'lm_sa_2': 0.0, 'lm_na_2': 0.01, 'hm_ba...
examples_list = [ 'hello_world', 'many_to_one', 'many_to_one_options', 'many_to_one_to_self', 'many_to_many', 'many_to_many_options', 'many_to_many_to_self', 'one_to_one', 'multiple_many_to_one', 'raw_sql', 'multiple_databases', 'table_inheritance', 'meta...
examples_list = ['hello_world', 'many_to_one', 'many_to_one_options', 'many_to_one_to_self', 'many_to_many', 'many_to_many_options', 'many_to_many_to_self', 'one_to_one', 'multiple_many_to_one', 'raw_sql', 'multiple_databases', 'table_inheritance', 'meta_builder', 'model_for_stackoverflow'] examples_dict = {'hello_worl...
Votes = [] count = 0 while True: try: N = int(input('')) Votes = list(map(int, input().split())) for i in Votes: if i == 1: count += 1 if count >= (2 * len(Votes)) / 3: print('impeachment') count = 0 else: print('acusacao arquivada') count = 0 ...
votes = [] count = 0 while True: try: n = int(input('')) votes = list(map(int, input().split())) for i in Votes: if i == 1: count += 1 if count >= 2 * len(Votes) / 3: print('impeachment') count = 0 else: print('a...
a = float(input("Triangle base: ")) h = float(input("Triangle height: ")) calc = (a * h) / 2 print(float(calc))
a = float(input('Triangle base: ')) h = float(input('Triangle height: ')) calc = a * h / 2 print(float(calc))
''' Base environment definitions See docs/api.md for api documentation ''' class AECEnv: def __init__(self): pass def step(self, action): raise NotImplementedError def reset(self): raise NotImplementedError def seed(self, seed=None): pass def observe(self, agen...
""" Base environment definitions See docs/api.md for api documentation """ class Aecenv: def __init__(self): pass def step(self, action): raise NotImplementedError def reset(self): raise NotImplementedError def seed(self, seed=None): pass def observe(self, agen...
class CredentialAPI(): """Wraps credential API.""" def __init__(self, session): """intialiaze a new Credential API""" self.session = session def get_credentials(self, provider_name): """Get a tuple of containing credentials for the supplied provider, chosen at random""" res...
class Credentialapi: """Wraps credential API.""" def __init__(self, session): """intialiaze a new Credential API""" self.session = session def get_credentials(self, provider_name): """Get a tuple of containing credentials for the supplied provider, chosen at random""" res =...
somatorio = 0 qtdnum = 0 for c in range(1, 501): if c % 3 == 0 and c % 2 != 0: somatorio += c qtdnum = qtdnum + 1 print(somatorio) print(qtdnum)
somatorio = 0 qtdnum = 0 for c in range(1, 501): if c % 3 == 0 and c % 2 != 0: somatorio += c qtdnum = qtdnum + 1 print(somatorio) print(qtdnum)
"""GeoNet NZ Volcanic Alert Level constants.""" ATTR_ACTIVITY = "activity" ATTR_HAZARDS = "hazards" ATTR_LEVEL = "level" ATTR_VOLCANO_ID = "volcanoID" ATTR_VOLCANO_TITLE = "volcanoTitle" ATTRIBUTION = "GeoNet Geological hazard information for New Zealand" URL = "https://api.geonet.org.nz/volcano/val"
"""GeoNet NZ Volcanic Alert Level constants.""" attr_activity = 'activity' attr_hazards = 'hazards' attr_level = 'level' attr_volcano_id = 'volcanoID' attr_volcano_title = 'volcanoTitle' attribution = 'GeoNet Geological hazard information for New Zealand' url = 'https://api.geonet.org.nz/volcano/val'
def point_compare(a, b): if is_point(a) and is_point(b): return a[0] - b[0] or a[1] - b[1] #def is_point(p): # try: # float(p[0]), float(p[1]) # except (TypeError, IndexError): # return False is_point = lambda x : isinstance(x,list) and len(x)==2 class Strut(list): def __init__(self,...
def point_compare(a, b): if is_point(a) and is_point(b): return a[0] - b[0] or a[1] - b[1] is_point = lambda x: isinstance(x, list) and len(x) == 2 class Strut(list): def __init__(self, ite=[]): self.index = 0 list.__init__(self, ite) def is_infinit(n): return abs(n) == float('inf...
N = int(input()) h = N // 3600 N = N - h * 3600 m = N // 60 N = N - m * 60 print('{}:{}:{}'.format(h, m, N))
n = int(input()) h = N // 3600 n = N - h * 3600 m = N // 60 n = N - m * 60 print('{}:{}:{}'.format(h, m, N))
julia = "Julia", "Roberts", 1967, "Duplicity", 2009, "Actress", "Atlanta, Georgia" name, surname, birth_year, movie, movie_year, profession, birth_place = julia ######### (a, b, c, d) = (1, 2, 3) # ValueError: need more than 3 values to unpack ######### def add(x, y): return x + y print(add(3, 4)) z = (5, 4) pri...
julia = ('Julia', 'Roberts', 1967, 'Duplicity', 2009, 'Actress', 'Atlanta, Georgia') (name, surname, birth_year, movie, movie_year, profession, birth_place) = julia (a, b, c, d) = (1, 2, 3) def add(x, y): return x + y print(add(3, 4)) z = (5, 4) print(add(z)) print(add(*z)) pokemon = {'Rattata': 19, 'Machop': 66, ...
#website compile doctype = "html" lang = "en-US" author = "Angelo Carrabba" self.keywords = [] spacing = 0 class webPage(): def __init__(self): self.pageName = "" self.title = "" self.styleSheets = [] self.scripts = [] self.description = "" self.menu = "" def p...
doctype = 'html' lang = 'en-US' author = 'Angelo Carrabba' self.keywords = [] spacing = 0 class Webpage: def __init__(self): self.pageName = '' self.title = '' self.styleSheets = [] self.scripts = [] self.description = '' self.menu = '' def pl(s, *elements): ...
""" In a factory a printer prints labels for boxes. For one kind of boxes the printer has to use colors which, for the sake of simplicity, are named with letters from a to m. The colors used by the printer are recorded in a control string. For example a "good" control string would be aaabbbbhaijjjm meaning that the pr...
""" In a factory a printer prints labels for boxes. For one kind of boxes the printer has to use colors which, for the sake of simplicity, are named with letters from a to m. The colors used by the printer are recorded in a control string. For example a "good" control string would be aaabbbbhaijjjm meaning that the pr...
""" PASSENGERS """ numPassengers = 30645 passenger_arriving = ( (7, 8, 5, 10, 6, 4, 3, 6, 2, 0, 1, 1, 0, 11, 2, 11, 4, 5, 7, 6, 2, 2, 5, 2, 0, 0), # 0 (8, 9, 5, 4, 5, 3, 4, 5, 3, 4, 2, 1, 0, 15, 9, 4, 2, 5, 2, 5, 3, 3, 4, 0, 2, 0), # 1 (5, 6, 6, 8, 5, 1, 5, 4, 5, 3, 2, 0, 0, 3, 8, 4, 4, 10, 5, 4, 2, 1, 3, 2, 0,...
""" PASSENGERS """ num_passengers = 30645 passenger_arriving = ((7, 8, 5, 10, 6, 4, 3, 6, 2, 0, 1, 1, 0, 11, 2, 11, 4, 5, 7, 6, 2, 2, 5, 2, 0, 0), (8, 9, 5, 4, 5, 3, 4, 5, 3, 4, 2, 1, 0, 15, 9, 4, 2, 5, 2, 5, 3, 3, 4, 0, 2, 0), (5, 6, 6, 8, 5, 1, 5, 4, 5, 3, 2, 0, 0, 3, 8, 4, 4, 10, 5, 4, 2, 1, 3, 2, 0, 0), (9, 13, 4, ...
''' ret, thresh = cv2.threshold(img.copy(), 75, 255, cv2.THRESH_BINARY_INV) contours, _ = cv2.findContours( thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) preprocessed_digits = [] for c in contours: x, y, w, h = cv2.boundingRect(c) # Creating a rectangle around the...
""" ret, thresh = cv2.threshold(img.copy(), 75, 255, cv2.THRESH_BINARY_INV) contours, _ = cv2.findContours( thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) preprocessed_digits = [] for c in contours: x, y, w, h = cv2.boundingRect(c) # Creating a rectangle around the...
# License MIT (https://opensource.org/licenses/MIT). # Copyright 2015-2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev> # Copyright 2015 Veronika veryberry <https://github.com/veryberry> # Copyright 2016 Ilmir Karamov <https://it-projects.info/team/ilmir-k> # Copyright 2016 Alex Comba <https://github.com/...
{'name': 'Stop Sale on Website', 'summary': 'Sale only available products on Website', 'version': '12.0.1.0.0', 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'Other OSI approved licence', 'category': 'eCommerce', 'support': 'apps@itpp.dev', 'website': 'https://yelizariev.github.io', 'images': ['images/availa...
items = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] for x in items: print(x) for x in "1234567890": print(x) input("are you ready to go?") for x in range(999999999): print(x)
items = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] for x in items: print(x) for x in '1234567890': print(x) input('are you ready to go?') for x in range(999999999): print(x)
#Node class Node(object): def __init__(self, content, next=None): self.content = content self.next = next #Stack LIFO class Stack(object): def __init__(self): self.head = None self.top = None self.next = None #isEmpty? def isEmpty(self): return sel...
class Node(object): def __init__(self, content, next=None): self.content = content self.next = next class Stack(object): def __init__(self): self.head = None self.top = None self.next = None def is_empty(self): return self.head is None def push(self, ...
# Abhishek Parashar # counting zeroes in an array t= int(input()) while(t>0): n=int(input()) a=list(map(int,input().split())) count=0 for i in a: if(i==0): count=count+1 print(count) t=t-1
t = int(input()) while t > 0: n = int(input()) a = list(map(int, input().split())) count = 0 for i in a: if i == 0: count = count + 1 print(count) t = t - 1
# coding=UTF-8 # ex:ts=4:sw=4:et=on # ------------------------------------------------------------------------- # Copyright (C) 2014 by Mathijs Dumon <mathijs dot dumon at gmail dot com> # # mvc is a framework derived from the original pygtkmvc framework # hosted at: <http://sourceforge.net/projects/pygtkmvc/> # # ...
def _toggle_cb(dialog, event, cb): cb_id_name = '%s_cb_id' % event.replace('-', '_') cb_id = getattr(dialog, cb_id_name, None) if cb_id is not None: dialog.disconnect(cb_id) cb_id = dialog.connect(event, cb) setattr(dialog, cb_id_name, cb_id) def run_dialog(dialog, on_accept_callback=None, ...
class ACCUMULATE_METHODS: Execute = "execute" ExecuteAddCredits = "add-credits" ExecuteCreateAdi = "create-adi" ExecuteCreateDataAccount = "create-data-account" ExecuteCreateKeyBook = "create-key-book" ExecuteCreateKeyPage = "create-key-page" ExecuteCreateToken = "create-token" ExecuteCr...
class Accumulate_Methods: execute = 'execute' execute_add_credits = 'add-credits' execute_create_adi = 'create-adi' execute_create_data_account = 'create-data-account' execute_create_key_book = 'create-key-book' execute_create_key_page = 'create-key-page' execute_create_token = 'create-token...
class Dragons: def __init__(self, strength, rewards): self.strength = strength self.rewards = rewards def shell_sort(arr): n = len(arr) gap = n//2 while gap > 0: for i in range(gap,n): temp = arr[i] j = i while j >= gap and arr[j-gap].strength > temp.st...
class Dragons: def __init__(self, strength, rewards): self.strength = strength self.rewards = rewards def shell_sort(arr): n = len(arr) gap = n // 2 while gap > 0: for i in range(gap, n): temp = arr[i] j = i while j >= gap and arr[j - gap].st...
s=input() s=s.strip('0') if s==s[::-1]: print("Yes") else: print("No")
s = input() s = s.strip('0') if s == s[::-1]: print('Yes') else: print('No')
""" 242 valid anagram easy hash 20210604 Given two strings s and t, return true if t is an anagram of s, and false otherwise. """ class Solution: def isAnagram(self, s: str, t: str) -> bool: hash = {} for c in s: if c not in hash: hash[c] = 1 else: ...
""" 242 valid anagram easy hash 20210604 Given two strings s and t, return true if t is an anagram of s, and false otherwise. """ class Solution: def is_anagram(self, s: str, t: str) -> bool: hash = {} for c in s: if c not in hash: hash[c] = 1 else: ...
# O(nW) def knapsack_no_repetition(w, v, W): table = [] l = len(w) for i in range(l + 1): table.append([]) for cap in range(W+1): if i == 0 or cap == 0: table[-1].append(0) else: if w[i-1] > cap: table[-1].append(table[i-1][ca...
def knapsack_no_repetition(w, v, W): table = [] l = len(w) for i in range(l + 1): table.append([]) for cap in range(W + 1): if i == 0 or cap == 0: table[-1].append(0) elif w[i - 1] > cap: table[-1].append(table[i - 1][cap]) ...
def convert(s: str, numRows: int) -> str: if numRows == 1: return s rows = [] current_row = 0 going_down = False for i in range(0, min(numRows, len(s))): rows.append("") for char in s: rows[current_row] += char if (current_row == 0 or current_row == numRows - 1)...
def convert(s: str, numRows: int) -> str: if numRows == 1: return s rows = [] current_row = 0 going_down = False for i in range(0, min(numRows, len(s))): rows.append('') for char in s: rows[current_row] += char if current_row == 0 or current_row == numRows - 1: ...
class Solution(object): # @param A : tuple of integers # @param B : integer # @return a list of integers def twoSum(self, A, B): dp = dict() for i, a in enumerate(A): if a in dp: return dp[a] + 1, i + 1 if B - a not in dp: dp[B - a...
class Solution(object): def two_sum(self, A, B): dp = dict() for (i, a) in enumerate(A): if a in dp: return (dp[a] + 1, i + 1) if B - a not in dp: dp[B - a] = i return [] if __name__ == '__main__': s = solution() print(s.twoSum...
load("//testsuite:testsuite.bzl", "jflex_testsuite") jflex_testsuite( name = "SemcheckTest", srcs = [ "SemcheckTest.java", ], data = [ "semcheck.flex", "semcheck-flex.output", ], deps = [ "//jflex/src/main/java/jflex/exceptions", ], )
load('//testsuite:testsuite.bzl', 'jflex_testsuite') jflex_testsuite(name='SemcheckTest', srcs=['SemcheckTest.java'], data=['semcheck.flex', 'semcheck-flex.output'], deps=['//jflex/src/main/java/jflex/exceptions'])
def next_palindrome(digit_list): high_mid = len(digit_list) // 2 low_mid = (len(digit_list) - 1) // 2 while high_mid < len(digit_list) and low_mid >= 0: if digit_list[high_mid] == 9: digit_list[high_mid] = 0 digit_list[low_mid] = 0 high_mid += 1 low_mi...
def next_palindrome(digit_list): high_mid = len(digit_list) // 2 low_mid = (len(digit_list) - 1) // 2 while high_mid < len(digit_list) and low_mid >= 0: if digit_list[high_mid] == 9: digit_list[high_mid] = 0 digit_list[low_mid] = 0 high_mid += 1 low_mi...
"""Definition of a pair.""" class Pair: """A pairing of people. Ordering doesn't matter in a pair. You can be paired with yourself. Treat as immutable. """ def __init__(self, name_a: str, name_b: str) -> None: """Make a new pair. >>> pair = Pair('A', 'B') >>> pair.n...
"""Definition of a pair.""" class Pair: """A pairing of people. Ordering doesn't matter in a pair. You can be paired with yourself. Treat as immutable. """ def __init__(self, name_a: str, name_b: str) -> None: """Make a new pair. >>> pair = Pair('A', 'B') >>> pair.na...
''' Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. ''' class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place in...
""" Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. """ class Solution: def reverse_string(self, s: List[str]) -> None: """ Do not return anything, modify s in-place i...
''' As Jason discussed in the video, by using a where clause that selects more records, you can update multiple records at once. It's time now to practice this! For your convenience, the names of the tables and columns of interest in this exercise are: state_fact (Table), notes (Column), and census_region_name (Column...
""" As Jason discussed in the video, by using a where clause that selects more records, you can update multiple records at once. It's time now to practice this! For your convenience, the names of the tables and columns of interest in this exercise are: state_fact (Table), notes (Column), and census_region_name (Column...
""" Write a separate Privileges class. The class should have one attribute, privileges , that stores a list of strings as described in Exercise 9-7. Move the show_privileges() method to this class. Make a Privileges instance as an attribute in the Admin class. Create a new instance of Admin and use your method to s...
""" Write a separate Privileges class. The class should have one attribute, privileges , that stores a list of strings as described in Exercise 9-7. Move the show_privileges() method to this class. Make a Privileges instance as an attribute in the Admin class. Create a new instance of Admin and use your method to s...
def sentence_analyzer(sentence): solution = {} for char in sentence: if char is not ' ': if char in solution: solution[char] += 1 else: solution[char] = 1 return solution
def sentence_analyzer(sentence): solution = {} for char in sentence: if char is not ' ': if char in solution: solution[char] += 1 else: solution[char] = 1 return solution
__version__ = "0.0.0" __title__ = "example" __description__ = "Example description" __uri__ = "https://github.com/Elemnir/example" __author__ = "Adam Howard" __email__ = "ahoward@utk.edu" __license__ = "BSD 3-clause" __copyright__ = "Copyright (c) Adam Howard"
__version__ = '0.0.0' __title__ = 'example' __description__ = 'Example description' __uri__ = 'https://github.com/Elemnir/example' __author__ = 'Adam Howard' __email__ = 'ahoward@utk.edu' __license__ = 'BSD 3-clause' __copyright__ = 'Copyright (c) Adam Howard'
"""Supervisr Core Errors""" class SupervisrException(Exception): """Base Exception class for all supervisr exceptions""" class SignalException(SupervisrException): """Exception which is used as a base for all Exceptions in Signals""" class UnauthorizedException(SupervisrException): """User is not auth...
"""Supervisr Core Errors""" class Supervisrexception(Exception): """Base Exception class for all supervisr exceptions""" class Signalexception(SupervisrException): """Exception which is used as a base for all Exceptions in Signals""" class Unauthorizedexception(SupervisrException): """User is not authori...
class RecipeNotValidError(Exception): def __init__(self): self.message = 'RecipeNotValidError' try: recipe = 5656565 if type(recipe) != str: raise RecipeNotValidError except RecipeNotValidError as e: print(e.message) print('Yay the code got to the end')
class Recipenotvaliderror(Exception): def __init__(self): self.message = 'RecipeNotValidError' try: recipe = 5656565 if type(recipe) != str: raise RecipeNotValidError except RecipeNotValidError as e: print(e.message) print('Yay the code got to the end')
# /* ****************************************************************************** # * # * # * This program and the accompanying materials are made available under the # * terms of the Apache License, Version 2.0 which is available at # * https://www.apache.org/licenses/LICENSE-2.0. # * # * See the NOT...
class Dtype(object): inherit = 0 bool = 1 float8 = 2 half = 3 half2 = 4 float = 5 double = 6 int8 = 7 int16 = 8 int32 = 9 int64 = 10 uint8 = 11 uint16 = 12 uint32 = 13 uint64 = 14 qint8 = 15 qint16 = 16 bfloat16 = 17 utf8 = 50 utf16 = 51 ...
BOT_NAME = 'hit_dl' SPIDER_MODULES = ['hit_dl.spiders'] NEWSPIDER_MODULE = 'hit_dl.spiders' # downloads folder FILES_STORE = 'moodle_downloads' USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36' # Obey robots.txt rules ROBOTSTXT_OBEY =...
bot_name = 'hit_dl' spider_modules = ['hit_dl.spiders'] newspider_module = 'hit_dl.spiders' files_store = 'moodle_downloads' user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36' robotstxt_obey = True log_level = 'WARNING' item_pipelines = {'h...
#Dog Years dog_years = int(input("What is the dog age? ")) human_years = (dog_years * 3) print("Human age: " + str(human_years))
dog_years = int(input('What is the dog age? ')) human_years = dog_years * 3 print('Human age: ' + str(human_years))
class Solution(object): def countPrimes(self, n: int) -> int: # corner case if n <= 1: return 0 visited = [True for _ in range(n)] visited[0] = False visited[1] = False for x in range(2, n): if visited[x]: t = 2 ...
class Solution(object): def count_primes(self, n: int) -> int: if n <= 1: return 0 visited = [True for _ in range(n)] visited[0] = False visited[1] = False for x in range(2, n): if visited[x]: t = 2 while t * x < n: ...
def main(): puzzleInput = open("python/day15.txt", "r").read() # Part 1 # assert(part1("") == 588) # print(part1(puzzleInput)) # Part 2 # assert(part2("") == 309) print(part2(puzzleInput)) def part1(puzzleInput): puzzleInput = puzzleInput.split("\n") a = int(puzzleInput[0].s...
def main(): puzzle_input = open('python/day15.txt', 'r').read() print(part2(puzzleInput)) def part1(puzzleInput): puzzle_input = puzzleInput.split('\n') a = int(puzzleInput[0].split(' ')[-1]) b = int(puzzleInput[1].split(' ')[-1]) match_count = 0 for i in range(0, 40000000): a = gen...
class Solution: def isAnagram(self, s: str, t: str) -> bool: """ My idea is to use bucket -> Passed sList = list(s) tList = list(t) sCounter = len(sList) tCounter = len(tList) if sCounter != tCounter: return False sBucket ...
class Solution: def is_anagram(self, s: str, t: str) -> bool: """ My idea is to use bucket -> Passed sList = list(s) tList = list(t) sCounter = len(sList) tCounter = len(tList) if sCounter != tCounter: return False sBucke...
actual = 'day1-input.txt' sample = 'day1-sample.txt' file = actual try: fh = open(file) except: print(f'File {file} not found') depths = [int(x) for x in fh] inc = 0 for i in range(len(depths)): if i == 0: prevDepth = depths[i] continue if prevDepth < depths[i]: inc += 1 ...
actual = 'day1-input.txt' sample = 'day1-sample.txt' file = actual try: fh = open(file) except: print(f'File {file} not found') depths = [int(x) for x in fh] inc = 0 for i in range(len(depths)): if i == 0: prev_depth = depths[i] continue if prevDepth < depths[i]: inc += 1 pre...
def main(): A, B, C = map(int, input().split()) list = [A, B, C] list.sort() print(list[1]) if __name__ == "__main__": main()
def main(): (a, b, c) = map(int, input().split()) list = [A, B, C] list.sort() print(list[1]) if __name__ == '__main__': main()
# # PySNMP MIB module CISCO-TRUSTSEC-SXP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-TRUSTSEC-SXP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:58:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) ...
# import sys # from io import StringIO # # input_1 = """3 # 1, 2, 3 # 4, 5, 6 # 7, 8, 9 # """ # # sys.stdin = StringIO(input_1) matrix = [[int(x) for x in input().split(', ')] for x in range(int(input()))] primary_diagonal = [] secondary_diagonal = [] for row in range(len(matrix)): for col in rang...
matrix = [[int(x) for x in input().split(', ')] for x in range(int(input()))] primary_diagonal = [] secondary_diagonal = [] for row in range(len(matrix)): for col in range(len(matrix)): if row == col: primary_diagonal.append(matrix[row][col]) if row + col == len(matrix) - 1: ...
""" You need to find the largest value in each row of a binary tree. Example: Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9] """ #Difficulty: Medium #78 / 78 test cases passed. #Runtime: 48 ms #Memory Usage: 16 MB #Runtime: 48 ms...
""" You need to find the largest value in each row of a binary tree. Example: Input: 1 / 3 2 / \\ \\ 5 3 9 Output: [1, 3, 9] """ class Solution: def largest_values(self, root: TreeNode) -> List[int]: if not root: ...
txt = "hello, my name is Peter, I am 26 years old" minusculas = txt.lower() x = minusculas.split(", ") cont = 0 for palabla in x: for caracter in palabla: if caracter == 'a' or caracter == 'e' or caracter == 'i' or caracter == 'o' or caracter == 'u': cont += 1 #print(caracter,) ...
txt = 'hello, my name is Peter, I am 26 years old' minusculas = txt.lower() x = minusculas.split(', ') cont = 0 for palabla in x: for caracter in palabla: if caracter == 'a' or caracter == 'e' or caracter == 'i' or (caracter == 'o') or (caracter == 'u'): cont += 1 print(palabla, ' => ', cont...
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt # partial branches and excluded lines a = 6 while True: break while 1: break while a: # pragma: no branch break if 0: never_happen() if...
a = 6 while True: break while 1: break while a: break if 0: never_happen() if 1: a = 21 if a == 23: raise assertion_error("Can't")
mystock = ['kakao', 'naver'] print(mystock[0]) print(mystock[1]) for stock in mystock: print(stock)
mystock = ['kakao', 'naver'] print(mystock[0]) print(mystock[1]) for stock in mystock: print(stock)
#%% """ - Logger Rate Limiter - https://leetcode.com/problems/logger-rate-limiter/ - Easy """ #%% """ Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in the last 10 seconds. Given a message and a timestamp (in seconds gr...
""" - Logger Rate Limiter - https://leetcode.com/problems/logger-rate-limiter/ - Easy """ '\nDesign a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in the last 10 seconds.\n\nGiven a message and a timestamp (in seconds granularit...
print(2 * 10 ** 200) def sqrt(my_number): a_index = 200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 the_index = int(a_index) the_index_plus_one = int...
print(2 * 10 ** 200) def sqrt(my_number): a_index = 200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 the_index = int(a_index) the_index_plus_one = int(the...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def mergeKLists(self, lists): amount = len(lists) interval = 1 while interval < amount: ...
class Solution(object): def merge_k_lists(self, lists): amount = len(lists) interval = 1 while interval < amount: for i in range(0, amount - interval, interval * 2): lists[i] = self.merge2Lists(lists[i], lists[i + interval]) interval *= 2 retu...
## # @brief This is a class in BRIDGES a channel of audio data # # This class contains one channel of 8, 16, 24, or 32 bit audio samples. # # @author Luke Sloop # # @date 2020, 1/31/2020 # class AudioChannel(object): def __init__(self, sample_count: int=0, sample_bits: int=32) -> None: """ A...
class Audiochannel(object): def __init__(self, sample_count: int=0, sample_bits: int=32) -> None: """ AudioChannel constructor args: (int) sample_count: The total number of samples in this audio channel Returns: None """ se...
#!/usr/bin/python3 class standard: def __init__(self, name, message): self.app_name = name self.app_message = message def __del__(self): print("Python3 object finalized for: standard") def self_identify(self): print("Class name: standard") print("Application name: ...
class Standard: def __init__(self, name, message): self.app_name = name self.app_message = message def __del__(self): print('Python3 object finalized for: standard') def self_identify(self): print('Class name: standard') print('Application name: {name}'.format(name...
phonebook = { "John" : 938477566, "Jack" : 938377264, "Jill" : 947662781 } del phonebook["John"] print(phonebook)
phonebook = {'John': 938477566, 'Jack': 938377264, 'Jill': 947662781} del phonebook['John'] print(phonebook)
#Evaluate two variables: x = "Hello" y = 15 print(bool(x)) print(bool(y))
x = 'Hello' y = 15 print(bool(x)) print(bool(y))
# https://github.com/balloob/pychromecast # Follow their example to get your chromecastname # chromecastName = "RobsKamerMuziek" # pychromecast.get_chromecasts_as_dict().keys() server = 'http://192.168.1.147:8000/' # replace this with your local ip and your port port = 8000
chromecast_name = 'RobsKamerMuziek' server = 'http://192.168.1.147:8000/' port = 8000
class command_parser(object): argument_array=[] def __init__(self): pass def add_argument(self,arg): self.argument_array.append(arg) def get_shot_arg(self): shot_arg="" for arg in self.argument_array: shot_arg=shot_arg+arg.shot_text+':' return shot_arg def get_long_arg(self): ...
class Command_Parser(object): argument_array = [] def __init__(self): pass def add_argument(self, arg): self.argument_array.append(arg) def get_shot_arg(self): shot_arg = '' for arg in self.argument_array: shot_arg = shot_arg + arg.shot_text + ':' r...
ENV = "dev" issuesPath = 'issues' SERVICE_ACCOUNT_FILE = 'config/credentials/firebase_key.json' AUTHORIZED_ORIGIN = '*' DEBUG = True
env = 'dev' issues_path = 'issues' service_account_file = 'config/credentials/firebase_key.json' authorized_origin = '*' debug = True
class Solution: def sortColors(self, nums: list[int]) -> None: """ Do not return anything, modify nums in-place instead. Dutch National Flag Problem (https://users.monash.edu/~lloyd/tildeAlgDS/Sort/Flag/) """ low = mid = 0 high = len(nums)-1 while mid <= high: ...
class Solution: def sort_colors(self, nums: list[int]) -> None: """ Do not return anything, modify nums in-place instead. Dutch National Flag Problem (https://users.monash.edu/~lloyd/tildeAlgDS/Sort/Flag/) """ low = mid = 0 high = len(nums) - 1 while mid <= high: ...
""" This is a comment written in more than just one line """ """ Since Python will ignore string literals that are not assigned to a variable, you can add a multiline string (triple quotes) in your code, and place your comment inside it: """ def add(x,y): """Add two nu,mers together""" return x + y
""" This is a comment written in more than just one line """ '\nSince Python will ignore string literals that are not assigned to a variable, \nyou can add a multiline string (triple quotes) in your code, and place your comment inside it:\n' def add(x, y): """Add two nu,mers together""" return x + y
expected_output = { "interfaces": { "GigabitEthernet0/0/0": { "neighbors": { "172.18.197.242": { "address": "172.19.197.93", "dead_time": "00:00:32", "priority": 1, "state": "FULL/BDR", ...
expected_output = {'interfaces': {'GigabitEthernet0/0/0': {'neighbors': {'172.18.197.242': {'address': '172.19.197.93', 'dead_time': '00:00:32', 'priority': 1, 'state': 'FULL/BDR'}, '172.19.197.251': {'address': '172.19.197.91', 'dead_time': '00:00:32', 'priority': 1, 'state': 'FULL/BDR'}}}, 'GigabitEthernet0/0/2': {'n...
# This code is a part of XMM: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS). # Last modified by David J Turner (david.turner@sussex.ac.uk) 13/05/2021, 20:46. Copyright (c) David J Turner class HeasoftError(Exception): def __init__(self, *args): """ Exception rais...
class Heasofterror(Exception): def __init__(self, *args): """ Exception raised for unexpected output from HEASOFT calls, currently all encompassing. :param expression: :param message: """ if args: self.message = args[0] else: self.mes...
# -*- coding: utf-8 -*- """Class for dependency error exception .. module:: lib.exceptions.dependencyerror :platform: Unix :synopsis: Class for dependency error exception .. moduleauthor:: Petr Czaderna <pc@hydratk.org> """ class DependencyError(Exception): """Class DependencyError """ def __init...
"""Class for dependency error exception .. module:: lib.exceptions.dependencyerror :platform: Unix :synopsis: Class for dependency error exception .. moduleauthor:: Petr Czaderna <pc@hydratk.org> """ class Dependencyerror(Exception): """Class DependencyError """ def __init__(self, error_num, args,...
# https://www.codewars.com/kata/alphabetically-ordered/train/python # My solution def alphabetic(s): return sorted(s) == list(s) # def alphabetic(s): return all(a<=b for a,b in zip(s, s[1:]))
def alphabetic(s): return sorted(s) == list(s) return all((a <= b for (a, b) in zip(s, s[1:])))
input = """29x13x26 11x11x14 27x2x5 6x10x13 15x19x10 26x29x15 8x23x6 17x8x26 20x28x3 23x12x24 11x17x3 19x23x28 25x2x25 1x15x3 25x14x4 23x10x23 29x19x7 17x10x13 26x30x4 16x7x16 7x5x27 8x23x6 2x20x2 18x4x24 30x2x26 6x14x23 10x23x9 29x29x22 1x21x14 22x10x13 10x12x10 20x13x11 12x2x14 2x16x29 27x18x26 6x12x20 18x17x8 14x25x...
input = '29x13x26\n11x11x14\n27x2x5\n6x10x13\n15x19x10\n26x29x15\n8x23x6\n17x8x26\n20x28x3\n23x12x24\n11x17x3\n19x23x28\n25x2x25\n1x15x3\n25x14x4\n23x10x23\n29x19x7\n17x10x13\n26x30x4\n16x7x16\n7x5x27\n8x23x6\n2x20x2\n18x4x24\n30x2x26\n6x14x23\n10x23x9\n29x29x22\n1x21x14\n22x10x13\n10x12x10\n20x13x11\n12x2x14\n2x16x29\...
class Statistic: def __init__(self): self.events = {} def add_event(self, event): try: self.events[event] += 1 except KeyError: self.events[event] = 1 def display_events(self): for event in sorted(self.events): print("Event <%s> occurre...
class Statistic: def __init__(self): self.events = {} def add_event(self, event): try: self.events[event] += 1 except KeyError: self.events[event] = 1 def display_events(self): for event in sorted(self.events): print('Event <%s> occurred...
# time O(m*n*len(word)) class Solution: def exist(self, board: List[List[str]], word: str) -> bool: for i in range(len(board)): for j in range(len(board[0])): if self.dfs(board, i, j, set(), word, 0): return True return False def dfs(self, board, ...
class Solution: def exist(self, board: List[List[str]], word: str) -> bool: for i in range(len(board)): for j in range(len(board[0])): if self.dfs(board, i, j, set(), word, 0): return True return False def dfs(self, board, x, y, visited, word, id...
# https://www.codechef.com/problems/COMM3 for T in range(int(input())): n,k,l=int(input()),0,[] for i in range(3): l.append(list(map(int,input().split()))) if(((l[0][0]-l[1][0])**2+(l[0][1]-l[1][1])**2)<=n*n):k+=1 if(((l[0][0]-l[2][0])**2+(l[0][1]-l[2][1])**2)<=n*n):k+=1 if(((l[1][0]-l[2][0...
for t in range(int(input())): (n, k, l) = (int(input()), 0, []) for i in range(3): l.append(list(map(int, input().split()))) if (l[0][0] - l[1][0]) ** 2 + (l[0][1] - l[1][1]) ** 2 <= n * n: k += 1 if (l[0][0] - l[2][0]) ** 2 + (l[0][1] - l[2][1]) ** 2 <= n * n: k += 1 if (l[1...
def fibonacciModified(t1, t2, n): n-=2 t3=t2 while n!=0: t3=t1+t2*t2 t1,t2=t2,t3 n-=1; return t3 if __name__ == "__main__": t1, t2, n = input().strip().split(' ') t1, t2, n = [int(t1), int(t2), int(n)] result = fibonacciModified(t1, t2, n) print(result)
def fibonacci_modified(t1, t2, n): n -= 2 t3 = t2 while n != 0: t3 = t1 + t2 * t2 (t1, t2) = (t2, t3) n -= 1 return t3 if __name__ == '__main__': (t1, t2, n) = input().strip().split(' ') (t1, t2, n) = [int(t1), int(t2), int(n)] result = fibonacci_modified(t1, t2, n) ...
def swap(A, i, j): temp = A[i] A[i] = A[j] A[j] = temp def partition(a, start, end): pivot = a[end] pIndex = start for i in range(start, end): if a[i] <= pivot: swap(a, i, pIndex) pIndex = pIndex + 1 swap(a, end, pIndex) return pIndex def qui...
def swap(A, i, j): temp = A[i] A[i] = A[j] A[j] = temp def partition(a, start, end): pivot = a[end] p_index = start for i in range(start, end): if a[i] <= pivot: swap(a, i, pIndex) p_index = pIndex + 1 swap(a, end, pIndex) return pIndex def quicksort(a, ...
# # PySNMP MIB module DGS1100-26ME-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DGS1100-26ME-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:30:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ...
# Suppose we have a string with some alphabet and we want to # store all the letters from it in a tuple. Read the input string and # print this tuple. alphabet = input() print(tuple(alphabet))
alphabet = input() print(tuple(alphabet))
# coding:950 __author__ = 'Liu' def letraParaNumero(list_numerais): resultado = '' letra_para_numero = { 'um':'1', 'dois':'2', 'tres':'3', 'quatro':'4', 'cinco':'5', 'seis':'6', 'sete':'7', 'oito':'8', 'nove':'9', 'zero':'0' } for numeral in list_numerais: resultado += letra_para_numer...
__author__ = 'Liu' def letra_para_numero(list_numerais): resultado = '' letra_para_numero = {'um': '1', 'dois': '2', 'tres': '3', 'quatro': '4', 'cinco': '5', 'seis': '6', 'sete': '7', 'oito': '8', 'nove': '9', 'zero': '0'} for numeral in list_numerais: resultado += letra_para_numero[numeral] r...
""" The schema package contains validation-related functionality, constants and the schemas Optimal BPM adds to the Optimal Framework namespaces Created on Jan 23, 2016 @author: Nicklas Boerjesson """ __author__ = 'nibo'
""" The schema package contains validation-related functionality, constants and the schemas Optimal BPM adds to the Optimal Framework namespaces Created on Jan 23, 2016 @author: Nicklas Boerjesson """ __author__ = 'nibo'
N,K = map(int, input().split()) S = list(input()) target = S[K-1] if target == "A": S[K-1] = "a" elif target == "B": S[K-1] = "b" else: S[K-1] = "c" for str in S: print(str, end="")
(n, k) = map(int, input().split()) s = list(input()) target = S[K - 1] if target == 'A': S[K - 1] = 'a' elif target == 'B': S[K - 1] = 'b' else: S[K - 1] = 'c' for str in S: print(str, end='')
def can_build(plat): return plat=="android" def configure(env): if (env['platform'] == 'android'): env.android_add_java_dir("android") env.disable_module()
def can_build(plat): return plat == 'android' def configure(env): if env['platform'] == 'android': env.android_add_java_dir('android') env.disable_module()
class MyClass(object): pass def func(): # type: () -> MyClass pass
class Myclass(object): pass def func(): pass
class Subsector: def __init__(self): self.systems = None self.name = None
class Subsector: def __init__(self): self.systems = None self.name = None