content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
'''Errors, Exceptions and such''' ERROR_MSG = ''' {path} {error} occurred on line {lineno} {line} {col}^ {msg} ''' def error(err, prints=True): '''Print an error msg formatted to ERROR_MSG from `err`''' error_formatted = ERROR_MSG.format( line=err.position[3], col=' '*(err.position[1]), ...
"""Errors, Exceptions and such""" error_msg = '\n{path}\n{error} occurred on line {lineno}\n{line}\n{col}^\n{msg}\n' def error(err, prints=True): """Print an error msg formatted to ERROR_MSG from `err`""" error_formatted = ERROR_MSG.format(line=err.position[3], col=' ' * err.position[1], lineno=err.position[0]...
def tokenizer(s: str) -> list: def name(s: str, previous: str) -> tuple: print("calling name") print(s) input() if(len(s) == 0): print("exiting name") return ("name",previous,s) elif(s[0] in " \n\t:=?<>|^*+-!()[]{}\/.,;'\"~`@"): pr...
def tokenizer(s: str) -> list: def name(s: str, previous: str) -> tuple: print('calling name') print(s) input() if len(s) == 0: print('exiting name') return ('name', previous, s) elif s[0] in ' \n\t:=?<>|^*+-!()[]{}\\/.,;\'"~`@': print('ex...
assert __name__ != '__main__' PORT = 8375 # random.getrandbits(64).to_bytes(8, 'big') MAGIC = b'\xf6\xda\xc7\xee\xa8\xf1\x0c\xc8'
assert __name__ != '__main__' port = 8375 magic = b'\xf6\xda\xc7\xee\xa8\xf1\x0c\xc8'
# # PySNMP MIB module H3C-VOIF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-VOIF-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:11:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, constraints_union, value_size_constraint) ...
# ############################################# MESSAGE BOX CONSTANTS ################################################ # # These constants can be used for MessageBox creation. # # One item from each category can be OR'd ( | ) or added ( + ) together to combine a single value to represent the # layout of a SecureCRT m...
icon_stop = 16 icon_question = 32 icon_warn = 48 icon_info = 64 button_ok = 0 button_cancel = 1 button_abortretryignore = 2 button_yesnocancel = 3 button_yesno = 4 button_retrycancel = 5 defbutton1 = 0 defbutton2 = 256 defbutton3 = 512 idok = 1 idcancel = 2 idabort = 3 idretry = 4 idignore = 5 idyes = 6 idno = 7
# input with open('input.txt') as f: lines = f.readlines() def neighbors_3d(cube): x, y, z = cube neighbors = [] for i in range(-1, 2): for j in range(-1, 2): for k in range(-1, 2): if i == j == k == 0: continue neighbors.append(...
with open('input.txt') as f: lines = f.readlines() def neighbors_3d(cube): (x, y, z) = cube neighbors = [] for i in range(-1, 2): for j in range(-1, 2): for k in range(-1, 2): if i == j == k == 0: continue neighbors.append((x + i, ...
def addNoVendorArguments(subparsers): subparser = subparsers.add_parser(name='none', help="No vendor specified") class NoVendor(): def getFilterPredicates(self): return [] def postProcess(self, switchboxes, args): return switchboxes
def add_no_vendor_arguments(subparsers): subparser = subparsers.add_parser(name='none', help='No vendor specified') class Novendor: def get_filter_predicates(self): return [] def post_process(self, switchboxes, args): return switchboxes
class SessionPool(list): def __repr__(self): return "\n".join(["{:>6}\t{}".format(i, session) for (i, session) in enumerate(self)])
class Sessionpool(list): def __repr__(self): return '\n'.join(['{:>6}\t{}'.format(i, session) for (i, session) in enumerate(self)])
expected_output = { 'vll': { 'MY-NORMAL-VLL-LOCAL': { 'vll_id': 3, 'ifl_id': '--', 'state': 'UP', 'endpoint': { 1: { 'type': 'tagged', 'vlan_id': 2501, 'interface': 'ethernet2/10', 'cos': 6 }, 2: { 'type': 'tagged', ...
expected_output = {'vll': {'MY-NORMAL-VLL-LOCAL': {'vll_id': 3, 'ifl_id': '--', 'state': 'UP', 'endpoint': {1: {'type': 'tagged', 'vlan_id': 2501, 'interface': 'ethernet2/10', 'cos': 6}, 2: {'type': 'tagged', 'vlan_id': 2501, 'interface': 'ethernet2/9', 'cos': 5}}, 'extended_counters': True}}}
pizzas = ['calabresa', 'mussarela', 'portuguesa', '4 queijos'] for pizza in pizzas: print(f' I like {pizza} pizza') print('\n I really love pizza!')
pizzas = ['calabresa', 'mussarela', 'portuguesa', '4 queijos'] for pizza in pizzas: print(f' I like {pizza} pizza') print('\n I really love pizza!')
# QUESTION 1 # ## Take the inputs # number1 = float(input("Enter the first number: ")) # number2 = float(input("Enter the second number: ")) # operationName = input("Enter the operation: ") # ## Do the operation # if operationName == "sum": # result = number1 + number2 # elif operationName == "sub": # result...
for satir in range(4): for space in range(satir): print(' ', end='') for sayi in range(4): print(satir + 1, end='') print()
# Constantes matematicas VALOR_PI = 3.14159 # Constantes informacion descriptiva CREACION_PYTHON = 1991 CREADOR_PYTHON = 'Guido van Rossum'
valor_pi = 3.14159 creacion_python = 1991 creador_python = 'Guido van Rossum'
# # PySNMP MIB module DLINK-3100-STORMCTRL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-STORMCTRL-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:49:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
# -*- coding: utf-8 -*- def main(): x, y, z, k = map(int, input().split()) a = sorted(list(map(int, input().split())), reverse=True) b = sorted(list(map(int, input().split())), reverse=True) c = sorted(list(map(int, input().split())), reverse=True) ac = list() for ai in a: ...
def main(): (x, y, z, k) = map(int, input().split()) a = sorted(list(map(int, input().split())), reverse=True) b = sorted(list(map(int, input().split())), reverse=True) c = sorted(list(map(int, input().split())), reverse=True) ac = list() for ai in a: for ci in c: ac.append(a...
# Error Constants UNKNOWN_ERR = 'Unknown Error' INVALID_COMMAND = 'Invalid Command' FILE_ERR = 'File Error' INVALID_ARG = 'Invalid Argument' INVALID_SYNTAX = 'Invalid Syntax' VAR_ERR = 'Variable Error' CMP_ERR = 'Comparison Error' EXPR_ERR = 'Expression Error' ARG_SYNTAX_ERR = 'Invalid Argument Syntax'
unknown_err = 'Unknown Error' invalid_command = 'Invalid Command' file_err = 'File Error' invalid_arg = 'Invalid Argument' invalid_syntax = 'Invalid Syntax' var_err = 'Variable Error' cmp_err = 'Comparison Error' expr_err = 'Expression Error' arg_syntax_err = 'Invalid Argument Syntax'
{ "targets": [ { "target_name": "sapi_tts", "sources": [ "sapi_tts.cc" ] } ], "win_delay_load_hook": "true" }
{'targets': [{'target_name': 'sapi_tts', 'sources': ['sapi_tts.cc']}], 'win_delay_load_hook': 'true'}
str = input("Enter string:") li = ['@','#','$'] #add all those 'char' we want to find in string for i in str: if i in li: print("found") break
str = input('Enter string:') li = ['@', '#', '$'] for i in str: if i in li: print('found') break
# XXX Make technical regexes more correct. DOMAIN_NAME_PART = r'(?: [^.\s]+ )' FQDN = rf''' (?: {DOMAIN_NAME_PART} (?: [.] {DOMAIN_NAME_PART} )* ) ''' EMAIL = rf''' (?: [^@\s]+ # user/alias [@] {FQDN} ) ''' URL = rf...
domain_name_part = '(?: [^.\\s]+ )' fqdn = f'\n (?:\n {DOMAIN_NAME_PART}\n (?: [.] {DOMAIN_NAME_PART} )*\n )\n ' email = f'\n (?:\n [^@\\s]+ # user/alias\n [@]\n {FQDN}\n )\n ' url = f'\n (?:\n (?:\n (...
test = { 'name': 'q1b', 'points': 1, 'suites': [ { 'cases': [ { 'code': '>>> ' 'linear_model(np.arange(1,5), ' 'np.arange(1,5))\n' '30', ...
test = {'name': 'q1b', 'points': 1, 'suites': [{'cases': [{'code': '>>> linear_model(np.arange(1,5), np.arange(1,5))\n30', 'hidden': False, 'locked': False}, {'code': '>>> (linear_model(2*np.eye(100), np.ones(100)) == 2*np.ones(100)).all()\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> test_theta = np.array([...
#!/usr/bin/env python3 ################################################## ## Job Logic ################################################## ## A simple script to show a rudimentary "job" ## acquisition logic sequence ################################################## ## Author: Charles F Port ## Copyright: Copyrigh...
job = 0 interview = 0 def got_interview(): interview_0 = input('#' * 15 + '\n' + 'Did your resume generate interest enough to get interview? True or False?') if interview_0 == 'True': i_bool = True else: i_bool = False return i_bool def job_offer(): job_0 = input('#' * 15 + '\n' + ...
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftOP_ASSIGNleftOP_MEMBERleftOP_NAMESPACEDIR_LINE EOS FLOAT_LITERAL ID INTEGER_LITERAL KW_ALLOW KW_BOOL KW_CONST KW_DEFAULT KW_DENY KW_FALSE KW_FLOAT KW_INT KW_MAP KW_...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftOP_ASSIGNleftOP_MEMBERleftOP_NAMESPACEDIR_LINE EOS FLOAT_LITERAL ID INTEGER_LITERAL KW_ALLOW KW_BOOL KW_CONST KW_DEFAULT KW_DENY KW_FALSE KW_FLOAT KW_INT KW_MAP KW_NAMESPACE KW_STRING KW_STRUCT KW_TRUE LCURLY LSQUARE OP_ASSIGN OP_LIST OP_MEMBER OP_NAMESPACE ...
## 1. Introduction ## world_dev = pd.read_csv("World_dev.csv") col_renaming = {'SourceOfMostRecentIncomeAndExpenditureData': 'IESurvey'} merged = pd.merge(left=happiness2015, right=world_dev, how='left', left_on= happiness2015['Country'], right_on=world_dev['ShortName']) merged = merged.rename(col_renaming, axis=1) p...
world_dev = pd.read_csv('World_dev.csv') col_renaming = {'SourceOfMostRecentIncomeAndExpenditureData': 'IESurvey'} merged = pd.merge(left=happiness2015, right=world_dev, how='left', left_on=happiness2015['Country'], right_on=world_dev['ShortName']) merged = merged.rename(col_renaming, axis=1) print(merged) def extract...
def binarySearch(arr, item): # The first step is to sort the array items arr.sort() start_index = 0 end_index = len(arr) - 1 while start_index <= end_index: mid = start_index + (end_index - start_index) // 2 mid_item = arr[mid] if mid_item == item: return f"{item...
def binary_search(arr, item): arr.sort() start_index = 0 end_index = len(arr) - 1 while start_index <= end_index: mid = start_index + (end_index - start_index) // 2 mid_item = arr[mid] if mid_item == item: return f'{item} was found at position {mid}' elif item...
input = open('input.txt', 'r').read().split('\n') heatmap = [[int(c) for c in s] for s in input] x_max = len(heatmap[0]) y_max = len(heatmap) print("X range: 0.." + str(x_max)) print("Y range: 0.." + str(y_max)) is_in_range = lambda x,y: (0 <= x < x_max) and (0 <= y < y_max) def is_lowest(heatmap, x, y): depth = ...
input = open('input.txt', 'r').read().split('\n') heatmap = [[int(c) for c in s] for s in input] x_max = len(heatmap[0]) y_max = len(heatmap) print('X range: 0..' + str(x_max)) print('Y range: 0..' + str(y_max)) is_in_range = lambda x, y: 0 <= x < x_max and 0 <= y < y_max def is_lowest(heatmap, x, y): depth = heat...
#!/usr/bin/env python3 class Node: def __init__(self, x, y, d, parent): self.x = x self.y = y self.d = d self.p = 0. self.children = [] self.parent = parent def set_payoff(self, p): self.p = p def __lt__(self, other): return self.p < other....
class Node: def __init__(self, x, y, d, parent): self.x = x self.y = y self.d = d self.p = 0.0 self.children = [] self.parent = parent def set_payoff(self, p): self.p = p def __lt__(self, other): return self.p < other.p def __eq__(self,...
''' Given an array length 1 or more of ints, return the difference between the largest and smallest values in the array. Note: the built-in min(v1, v2) and max(v1, v2) functions return the smaller or larger of two values. ''' def big_diff(nums): return max(nums) - min(nums)
""" Given an array length 1 or more of ints, return the difference between the largest and smallest values in the array. Note: the built-in min(v1, v2) and max(v1, v2) functions return the smaller or larger of two values. """ def big_diff(nums): return max(nums) - min(nums)
# command definitions START_FOC = (0x03) ACC_MODE_NORMAL = (0x11) GYR_MODE_NORMAL = (0x15) FIFO_FLUSH = (0xB0) INT_RESET = (0xB1) STEP_CNT_CLR = (0xB2) SOFT_RESET = (0xB6)
start_foc = 3 acc_mode_normal = 17 gyr_mode_normal = 21 fifo_flush = 176 int_reset = 177 step_cnt_clr = 178 soft_reset = 182
def name(first, last): print('My first name is '+first +' and my last name is '+last+' .') while True: print('Please tell me your name') a = input('first name: \n\t') b = input('last name: \n\t') name(a, b)
def name(first, last): print('My first name is ' + first + ' and my last name is ' + last + ' .') while True: print('Please tell me your name') a = input('first name: \n\t') b = input('last name: \n\t') name(a, b)
#coding=utf-8 CONSTANT1 = 'Hu' OPEN_FILE_ERROR = 'Open initial file error. ' INITIAL_FILE = 'Initial file invalid. ' INPUT_PWD = "please input password:" INPUT_KEY = "please input keyword:" WRITE_FILE_ERROR = 'Write warning file error. Cause: \n' WRITE_FILE_UNKNOWN = 'Unknown error when writing warning file. Cau...
constant1 = 'Hu' open_file_error = 'Open initial file error. ' initial_file = 'Initial file invalid. ' input_pwd = 'please input password:' input_key = 'please input keyword:' write_file_error = 'Write warning file error. Cause: \n' write_file_unknown = 'Unknown error when writing warning file. Cause: \n' msg_keyword1 ...
ID = "commands" permission = 0 rankdict = {"@@" : 3, "@" : 2, "+" : 1, "" : 0} rankname = ("Guest", "Voiced", "OP", "Owner") def execute(self, name, params, channel, userdata, rank): perms = rankdict[rank] group = {} for i in range(perms+1): group[i] = [] for cmd in self.command...
id = 'commands' permission = 0 rankdict = {'@@': 3, '@': 2, '+': 1, '': 0} rankname = ('Guest', 'Voiced', 'OP', 'Owner') def execute(self, name, params, channel, userdata, rank): perms = rankdict[rank] group = {} for i in range(perms + 1): group[i] = [] for cmd in self.commands: cmdrank...
def getvales(x=None): if x is None: y=2 return y else: return 20 a=getvales(2) print(a) a=getvales() print(a)
def getvales(x=None): if x is None: y = 2 return y else: return 20 a = getvales(2) print(a) a = getvales() print(a)
my_foods = ['pizza', 'falafel', 'carrot cake'] # copy Array my_friend_foods = my_foods[:] print(my_foods) print(my_friend_foods) for food in my_foods: print(food)
my_foods = ['pizza', 'falafel', 'carrot cake'] my_friend_foods = my_foods[:] print(my_foods) print(my_friend_foods) for food in my_foods: print(food)
#!/usr/bin/env python3 # Import data with open('/home/agaspari/aoc2021/dec_11/dec11_input.txt') as f: octopus_rows = [[int(x) for x in row] for row in f.read().split('\n')] class OctopusCave: def __init__(self, octopus_matrix): self.octopus_matrix = octopus_matrix self.flash_count = 0 def...
with open('/home/agaspari/aoc2021/dec_11/dec11_input.txt') as f: octopus_rows = [[int(x) for x in row] for row in f.read().split('\n')] class Octopuscave: def __init__(self, octopus_matrix): self.octopus_matrix = octopus_matrix self.flash_count = 0 def advance_matrix(self): new_ma...
size(300, 300) x, y = 10, 30 fontsize(12) text("Hello", x, y) drawpath(textpath("Hello", x + 100, y)) rect(x, y-12,50,20, fill=None, stroke=0) rect(x + 100, y-12,50,20, fill=None, stroke=0) y += 30 align(LEFT) text("Hello", x, y, width=50) drawpath(textpath("Hello", x + 100, y, width=50)) rect(x, y-12,50,20, fill=Non...
size(300, 300) (x, y) = (10, 30) fontsize(12) text('Hello', x, y) drawpath(textpath('Hello', x + 100, y)) rect(x, y - 12, 50, 20, fill=None, stroke=0) rect(x + 100, y - 12, 50, 20, fill=None, stroke=0) y += 30 align(LEFT) text('Hello', x, y, width=50) drawpath(textpath('Hello', x + 100, y, width=50)) rect(x, y - 12, 50...
JOINTS = { # Body. "Nose": 0, "LEye": 1, "REye": 2, "LEar": 3, "REar": 4, "LShoulder": 5, "RShoulder": 6, "LElbow": 7, "RElbow": 8, "LWrist": 9, "RWrist": 10, "LHip": 11, "RHip": 12, "LKnee": 13, "RKnee": 14, "LAnkle": 15, "RAnkle": 16, "Sternu...
joints = {'Nose': 0, 'LEye': 1, 'REye': 2, 'LEar': 3, 'REar': 4, 'LShoulder': 5, 'RShoulder': 6, 'LElbow': 7, 'RElbow': 8, 'LWrist': 9, 'RWrist': 10, 'LHip': 11, 'RHip': 12, 'LKnee': 13, 'RKnee': 14, 'LAnkle': 15, 'RAnkle': 16, 'Sternum': 17, 'Head': 18, 'LThumb1CMC': 19, 'LThumb2Knuckles': 20, 'LThumb3IP': 21, 'LThumb...
MONGO_URL = 'localhost' MONGO_DB = 'jqzx' MONGO_TABLE = 'ai_daily' STOPWORDS_PATH = './stopwords.dat' CORPUS_PATH = './corpus' IDF_PATH = './idf/idf.txt' USER_DICT_PATH = './THUOCL_it.txt' PAGE_NUM = 30
mongo_url = 'localhost' mongo_db = 'jqzx' mongo_table = 'ai_daily' stopwords_path = './stopwords.dat' corpus_path = './corpus' idf_path = './idf/idf.txt' user_dict_path = './THUOCL_it.txt' page_num = 30
str = 'C:\now\time\a' str1 = r'C:\now\time\a' print(str) print(str1)
str = 'C:\now\time\x07' str1 = 'C:\\now\\time\\a' print(str) print(str1)
''' Stores common global variables for Sellometer's pipeline ''' # datatables will be named based on dimension and event: {event}_{dimension}_{suffix} # valid {suffix} can be 'minute', 'hour', 'rank', there could be additional suffixes # for temporay storage purpose but not for actual data storage. # product dimensio...
""" Stores common global variables for Sellometer's pipeline """ dimensions = ['product_id', 'brand', 'category_l3'] events = ['purchase', 'view'] compress_block = 'hour'
tot = 0 for k in range(int(input())): P1, P2 = input().split() if P1 == "1001": tot += 1.5*int(P2) elif P1 == "1002": tot += 2.5*int(P2) elif P1 == "1003": tot += 3.5*int(P2) elif P1 == "1004": tot += 4.5*int(P2) elif P1 == "1005": tot += 5.5*int(P2) print("{0:.2f}".format(tot))
tot = 0 for k in range(int(input())): (p1, p2) = input().split() if P1 == '1001': tot += 1.5 * int(P2) elif P1 == '1002': tot += 2.5 * int(P2) elif P1 == '1003': tot += 3.5 * int(P2) elif P1 == '1004': tot += 4.5 * int(P2) elif P1 == '1005': tot += 5.5 * i...
class Dog: def __init__(self, name, age): self.name = name self.age = age def get_name(self): return self.name def get_age(self): return self.age def set_age(self, age): self.age = age def set_name(self, name): self.name = name dog1 = Dog("Husky"...
class Dog: def __init__(self, name, age): self.name = name self.age = age def get_name(self): return self.name def get_age(self): return self.age def set_age(self, age): self.age = age def set_name(self, name): self.name = name dog1 = dog('Husky',...
class BaseAdDetectorModel: def __init__(self): pass def save(self, path): pass def load(self, path): pass def find_ads(self, video_ids): return [[] for _ in video_ids] if isinstance(video_ids, list) else [] def train(self, markups): pass
class Baseaddetectormodel: def __init__(self): pass def save(self, path): pass def load(self, path): pass def find_ads(self, video_ids): return [[] for _ in video_ids] if isinstance(video_ids, list) else [] def train(self, markups): pass
class ContinuousMedianHandler: lowerHeapType = "max_heap" greaterHeapType = "min_heap" def __init__(self): self.median = None self.lower_half = [] self.greater_half = [] # O(n*log(n)) Time | O(n) Space, where n = number of inserted numbers def insert(self, number): ...
class Continuousmedianhandler: lower_heap_type = 'max_heap' greater_heap_type = 'min_heap' def __init__(self): self.median = None self.lower_half = [] self.greater_half = [] def insert(self, number): if len(self.lower_half) == 0: self.lower_half.append(numbe...
# Typical Recursion ; 996ms ; faster that 9.17 % class Solution: def fib(self, N: int) -> int: if N==0: return 0 if N==1: return 1 return self.fib(N-1) + self.fib(N-2) # Iterative Solution ; 28ms ; faster than 76.79 % class Solution: def fib(self, N: int) -> in...
class Solution: def fib(self, N: int) -> int: if N == 0: return 0 if N == 1: return 1 return self.fib(N - 1) + self.fib(N - 2) class Solution: def fib(self, N: int) -> int: (first, second) = (0, 1) if N == 0: return first if ...
morse = {'.-':'a', '-...':'b', '-.-.':'c', '-..':'d', '.':'e', '..-.':'f', '--.':'g', \ '....':'h', '..':'i', '.---':'j', '-.-':'k', '.-..':'l', '--':'m', '-.':'n', '---':'o',\ '.--.':'p', '--.-':'q', '.-.':'r', '...':'s', '-':'t', '..-':'u', '...-':'v', '.--':'w',\ '-..-':'x', '-.--':'y', '--..':'z'} def luis(cadena)...
morse = {'.-': 'a', '-...': 'b', '-.-.': 'c', '-..': 'd', '.': 'e', '..-.': 'f', '--.': 'g', '....': 'h', '..': 'i', '.---': 'j', '-.-': 'k', '.-..': 'l', '--': 'm', '-.': 'n', '---': 'o', '.--.': 'p', '--.-': 'q', '.-.': 'r', '...': 's', '-': 't', '..-': 'u', '...-': 'v', '.--': 'w', '-..-': 'x', '-.--': 'y', '--..': ...
passports_valid = 0 default_value_passport = { 'byr': None, 'iyr': None, 'eyr': None, 'hgt': None, 'hcl': None, 'ecl': None, 'pid': None, 'cid': None } passport = None def is_valid(passport): valid = None valid_for = None for key, value in passport.items(): #print(f...
passports_valid = 0 default_value_passport = {'byr': None, 'iyr': None, 'eyr': None, 'hgt': None, 'hcl': None, 'ecl': None, 'pid': None, 'cid': None} passport = None def is_valid(passport): valid = None valid_for = None for (key, value) in passport.items(): if key == 'cid': continue ...
''' Given a root node, validate the binary search tree, ensuring that every node's left hand child is less than the parent node's value, and that every node's right hand child is greater than the parent ''' class Node: def __init__(self, data, left=None, right=None): self.data = data self.left = ...
""" Given a root node, validate the binary search tree, ensuring that every node's left hand child is less than the parent node's value, and that every node's right hand child is greater than the parent """ class Node: def __init__(self, data, left=None, right=None): self.data = data self.left = l...
''' for loop iterates, goes through a list ''' exampleList = [1, 23, 58, 20, 43] for eachNumber in exampleList: print (eachNumber) print ('continue' '' '?') # part of the loop exceuted n times print('no thanks') #not part of the loop, executed once for x in range (1, 11): #@ built in python functon print...
""" for loop iterates, goes through a list """ example_list = [1, 23, 58, 20, 43] for each_number in exampleList: print(eachNumber) print('continue?') print('no thanks') for x in range(1, 11): print(x)
while True: height = int(input('Height: ')) if 0 < height <= 8: break width = height - 1 for row in range(0, height): for element in range(width , 0, -1): print(" ", end="") width -= 1 for element in range( 0, row + 1) : print("#", end="") print()
while True: height = int(input('Height: ')) if 0 < height <= 8: break width = height - 1 for row in range(0, height): for element in range(width, 0, -1): print(' ', end='') width -= 1 for element in range(0, row + 1): print('#', end='') print()
# 1) SQL - alias tables (Employee & Student) # select e.name, m.name as manager_name # from employees e # join employees m # on e.manager_id = m.id; # 2) Object Oriented Programming class Pets(): def __init__(self, animal): self.animal = animal def show(self): print(f'Hi, I am a {self.animal}...
class Pets: def __init__(self, animal): self.animal = animal def show(self): print(f'Hi, I am a {self.animal}') dog = pets('dog') cat = pets('cat') wolf = pets('wolf') dog.animal cat.animal wolf.animal dog.show() cat.show() wolf.show() wolf.animal = 'dog' wolf.show() mixed_str = 'HeLLoWOrld' ...
with open('normalize.txt', 'r', encoding='utf-8') as q: questions = q.readlines() triples = [] with open('normalize_out.txt', 'r', encoding='utf-8') as triple: for line in triple: line_sp = line.strip() line_list = line_sp.split('\t') triples.append({ 'q_id': line_list[0], ...
with open('normalize.txt', 'r', encoding='utf-8') as q: questions = q.readlines() triples = [] with open('normalize_out.txt', 'r', encoding='utf-8') as triple: for line in triple: line_sp = line.strip() line_list = line_sp.split('\t') triples.append({'q_id': line_list[0], 'triple': line_...
COLORS = 256 W_SIZE = 500 H_SIZE = 500
colors = 256 w_size = 500 h_size = 500
BLACK = "BLACK" WHITE = "WHITE" class Move: def __init__(self, player: str = WHITE, x: int = 0, y: int = 0): self.x = x self.y = y self.player = player self.score = 0 self.score_depth = 0 self.board = None def __repr__(self): return 'Move(%s, %r, %r)'...
black = 'BLACK' white = 'WHITE' class Move: def __init__(self, player: str=WHITE, x: int=0, y: int=0): self.x = x self.y = y self.player = player self.score = 0 self.score_depth = 0 self.board = None def __repr__(self): return 'Move(%s, %r, %r)' % (self...
unique_words = set() dictionary = {} try: with open('text.txt', 'r') as text_file: for line in text_file: split_line = line.replace('.', '') split_line = split_line.replace("(", '') split_line = split_line.replace(")", '') split_line = split_line...
unique_words = set() dictionary = {} try: with open('text.txt', 'r') as text_file: for line in text_file: split_line = line.replace('.', '') split_line = split_line.replace('(', '') split_line = split_line.replace(')', '') split_line = split_line.replace('?', ...
# HARD # logic => parse the current level and go deeper and return # ex. Input = "(let x 1 y 2 (add x (add x y)))" # token => # ['x', '1', 'y', '2', '(add x (add x y))'] first parsing, # ['x', '(add x y)'] # ['x', 'y'] # check the command Let => assign token pairs to scope # ...
class Solution: def __init__(self): self.scope = [{}] def evaluate(self, expression: str) -> int: self.scope.append({}) ans = self.dfs(expression) self.scope.pop() return ans def dfs(self, expr): if expr[0] != '(': if expr[0].isdigit() or expr[0...
test_case = int(input()) def fibo(N): zero = [0] * 41 one = [0] * 41 zero[0] = 1 one[1] = 1 for i in range(2, N + 1): zero[i] = zero[i - 1] + zero[i - 2] one[i] = one[i - 1] + one[i - 2] return zero[N], one[N] for t in range(test_case): N = int(input()) print(*fibo...
test_case = int(input()) def fibo(N): zero = [0] * 41 one = [0] * 41 zero[0] = 1 one[1] = 1 for i in range(2, N + 1): zero[i] = zero[i - 1] + zero[i - 2] one[i] = one[i - 1] + one[i - 2] return (zero[N], one[N]) for t in range(test_case): n = int(input()) print(*fibo(N))
liste=[5, "Murat", True, 1.23] for v in liste: print(str(type(v))+" ", end="") print(v) liste+=["Deneme"] print(liste) print(liste[1]) print(liste[-1])
liste = [5, 'Murat', True, 1.23] for v in liste: print(str(type(v)) + ' ', end='') print(v) liste += ['Deneme'] print(liste) print(liste[1]) print(liste[-1])
def m_hamming_distance(s1, s2): if len(s1) < len(s2): return s1 elif len(s1) > len(s2): return s2 else: result = 0 for i in range(len(s1)): if s1[i] != s2[i]: result = result + 1 return result if __name__ == "__main__": print(m_hammin...
def m_hamming_distance(s1, s2): if len(s1) < len(s2): return s1 elif len(s1) > len(s2): return s2 else: result = 0 for i in range(len(s1)): if s1[i] != s2[i]: result = result + 1 return result if __name__ == '__main__': print(m_hamming_...
num= 1 num= 2 num= 33 num= 3 num4= 4
num = 1 num = 2 num = 33 num = 3 num4 = 4
n, m = map(int, input().split()) graph = [[] for _ in range(n)] for i in range(m): x, y = map(int, input().split()) graph[x-1].append(y-1) graph[y-1].append(x-1) result = 1 for i in range(1<<n): count = 0 h = 1 for j in range(n): if (i >> j & 1) == 0: continue count ...
(n, m) = map(int, input().split()) graph = [[] for _ in range(n)] for i in range(m): (x, y) = map(int, input().split()) graph[x - 1].append(y - 1) graph[y - 1].append(x - 1) result = 1 for i in range(1 << n): count = 0 h = 1 for j in range(n): if i >> j & 1 == 0: continue ...
_FONT = { 32: [3, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63], 33: [4, 255, 255, 255, 255, 243, 243, 243, 243, 243, 243, 255, 255, 243, 243, 255, 255, 255], 34: [5, 1023, 1023, 1023, 819, 819, 819, 819, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023], 35: [8, 65535, 65535, 65535, 655...
_font = {32: [3, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63], 33: [4, 255, 255, 255, 255, 243, 243, 243, 243, 243, 243, 255, 255, 243, 243, 255, 255, 255], 34: [5, 1023, 1023, 1023, 819, 819, 819, 819, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023], 35: [8, 65535, 65535, 65535, 6553...
class Emp: def __init__(self, name, salary): # class constructor self.name = name self.salary = salary def printName(self): # class function print(f"The name is: {self.name}") def printSalary(self): print(f"The salary is: {self.salary}") def printDetails(self): ...
class Emp: def __init__(self, name, salary): self.name = name self.salary = salary def print_name(self): print(f'The name is: {self.name}') def print_salary(self): print(f'The salary is: {self.salary}') def print_details(self): print(f'The salary of {self.name...
## Implements the creation of power set for a given set using the method described in the Computer Science Distilled book. ## Author: AJ class power_set: def __init__(self): self.arr = [] self.power_set = [] def get_data(self): self.arr = list(map(int, input().split())) def print_...
class Power_Set: def __init__(self): self.arr = [] self.power_set = [] def get_data(self): self.arr = list(map(int, input().split())) def print_power_set(self): for ele in self.power_set: print(ele, end=' ') def create_power_sets(self): for ele in ...
__author__ = 'admin' class ContactHelper: def __init__(self, app): self.app = app def create(self, contact): self.fill_contact_fields(contact) def modify(self, contact): # modify contact self.click_edit_button() self.fill_contact_fields(contact) def set_field_...
__author__ = 'admin' class Contacthelper: def __init__(self, app): self.app = app def create(self, contact): self.fill_contact_fields(contact) def modify(self, contact): self.click_edit_button() self.fill_contact_fields(contact) def set_field_value(self, field_name, ...
def increment(arg): return arg +1 def square(arg): return arg * arg def apply_f (list_f,arg): result=arg for f in list_f: result = f(result) return result def add_level(list_list_f,list_f): return [x+[f] for x in list_list_f for f in list_f] def mixed_solution(initial,final,list_list_f =[[]]): ...
def increment(arg): return arg + 1 def square(arg): return arg * arg def apply_f(list_f, arg): result = arg for f in list_f: result = f(result) return result def add_level(list_list_f, list_f): return [x + [f] for x in list_list_f for f in list_f] def mixed_solution(initial, final, l...
# Destructors class Student: def __init__(self,name,age): self.__name=name self.__age=age def display(self): print('Name',self.__name,' Age',self.__age) def setName(self,name): self.__name=name def __del__(self): # The destructor print('Hahah, destroying',self._...
class Student: def __init__(self, name, age): self.__name = name self.__age = age def display(self): print('Name', self.__name, ' Age', self.__age) def set_name(self, name): self.__name = name def __del__(self): print('Hahah, destroying', self.__class__.__nam...
class Persona: def inicializar(self, nom, ed): self.nombre = nom self.edad = ed def imprimirNombre(self): print(self.nombre) def imprimirEdad(self): print(self.edad) def comprobarEdad(self): if self.edad >= 18: print(self.nombre, " es mayor de edad...
class Persona: def inicializar(self, nom, ed): self.nombre = nom self.edad = ed def imprimir_nombre(self): print(self.nombre) def imprimir_edad(self): print(self.edad) def comprobar_edad(self): if self.edad >= 18: print(self.nombre, ' es mayor de e...
# Minimum Remove to Make Valid Parentheses: https://leetcode.com/problems/minimum-remove-to-make-valid-parentheses/ # Given a string s of '(' , ')' and lowercase English characters. # Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that the resulting parentheses string is ...
class Solution: def min_remove_to_make_valid(self, s: str) -> str: remove = set() stack = [] for i in range(len(s)): if s[i] == '(': stack.append(i) elif s[i] == ')': if len(stack) > 0 and s[stack[-1]] == '(': stack...
# This class represents the restriction related to the consistency and diversity of the recommendations. class ConsistencyAndDiversityRestriction: INTERPOLATION_REFERENCE_VALUE = 1.0 # Constructor def __init__(self): pass # This method evaluates the phenotype of individuals in terms of consi...
class Consistencyanddiversityrestriction: interpolation_reference_value = 1.0 def __init__(self): pass def evaluate(self, phenotype): main_food_item_name_list = [] side_food_item_name_list = [] main_food_item_type_list = [] side_food_item_type_list = [] pa_i...
# Reversing an integer def int_reversal(n): remainder = 0 reverse = 0 while n > 0: remainder = n % 10 reverse = reverse * 10 + remainder n = n // 10 return reverse if __name__ == '__main__': num = 123456789123456789123456789 print(num) num = int_revers...
def int_reversal(n): remainder = 0 reverse = 0 while n > 0: remainder = n % 10 reverse = reverse * 10 + remainder n = n // 10 return reverse if __name__ == '__main__': num = 123456789123456789123456789 print(num) num = int_reversal(num) print(num)
class Stack: data = [] def push(self, item): return self.data.append(item) def pop(self): return self.data.pop() def peek(self): return self.data[-1] def is_empty(self): return len(self.data) == 0 def __str__(self): return f"[{', '.join(reversed(self....
class Stack: data = [] def push(self, item): return self.data.append(item) def pop(self): return self.data.pop() def peek(self): return self.data[-1] def is_empty(self): return len(self.data) == 0 def __str__(self): return f"[{', '.join(reversed(self....
# time complexity is O(n) palindromString = input() def palindrome(palimdromString): reversePalindrom = '' for i in palimdromString: reversePalindrom = i + reversePalindrom if reversePalindrom == palimdromString: print("It's a palindrome string 1") else: print("It's not a pali...
palindrom_string = input() def palindrome(palimdromString): reverse_palindrom = '' for i in palimdromString: reverse_palindrom = i + reversePalindrom if reversePalindrom == palimdromString: print("It's a palindrome string 1") else: print("It's not a palindrom string 1") palindro...
# Find this puzzle at: # https://adventofcode.com/2020/day/2 with open('input.txt', 'r') as file: puzzle_input = file.read().splitlines() valid = 0 for line in puzzle_input: # Extract the indexes, letter, and password indexes, letter, password = line.split() index_low, index_hi = indexes.split('-') ...
with open('input.txt', 'r') as file: puzzle_input = file.read().splitlines() valid = 0 for line in puzzle_input: (indexes, letter, password) = line.split() (index_low, index_hi) = indexes.split('-') if password[int(index_low) - 1] == letter[0] and password[int(index_hi) - 1] != letter[0] or (password[in...
name=["Mark","Lee", "Rac", "Qi","Alan","Dog","Pikachu"] mark=[95,10,32,33,80,60,30] age=[60,15,3,70,13,1,0.5] d1=dict(zip(name,mark)) d2=dict(zip(age,mark)) name.sort(key=d1.get) age.sort(key=d2.get) mark.sort() mark.reverse() top=int(len(name)*0.8) first_ans=name[top-1] print(top) print(name) print(first_ans) ...
name = ['Mark', 'Lee', 'Rac', 'Qi', 'Alan', 'Dog', 'Pikachu'] mark = [95, 10, 32, 33, 80, 60, 30] age = [60, 15, 3, 70, 13, 1, 0.5] d1 = dict(zip(name, mark)) d2 = dict(zip(age, mark)) name.sort(key=d1.get) age.sort(key=d2.get) mark.sort() mark.reverse() top = int(len(name) * 0.8) first_ans = name[top - 1] print(top) p...
# # PySNMP MIB module Juniper-ERX-System-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-ERX-System-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:02:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ...
class Movil: def __init__(self, id, modelo, precio, so, fabricante): self.id = id self.modelo = modelo self.precio = precio self.so = so self.fabricante = fabricante
class Movil: def __init__(self, id, modelo, precio, so, fabricante): self.id = id self.modelo = modelo self.precio = precio self.so = so self.fabricante = fabricante
# https://leetcode.com/explore/other/card/30-day-leetcoding-challenge/528/week-1/3284/ class Solution: def isHappy(self, n: int) -> bool: if n == 1: return True def SumDigits(num): currSum = 0 while (num): digit = num % 10 num =...
class Solution: def is_happy(self, n: int) -> bool: if n == 1: return True def sum_digits(num): curr_sum = 0 while num: digit = num % 10 num = math.floor(num / 10) curr_sum += digit * digit return currS...
#title hdr = [ord(c) for c in "SLOWBOY\0"] # manuf code, new licensee code hdr += [0, 0, 0, 0, 0] # sgb flag hdr += [0] # cart type hdr += [0] # ROM size hdr += [0] # RAM size hdr += [0] # dest code hdr += [1] # old licensee code hdr += [0x33] # mask rom version hdr += [0] def not8(x): return x ^ 0xff d...
hdr = [ord(c) for c in 'SLOWBOY\x00'] hdr += [0, 0, 0, 0, 0] hdr += [0] hdr += [0] hdr += [0] hdr += [0] hdr += [1] hdr += [51] hdr += [0] def not8(x): return x ^ 255 def sub(x, y): return x + not8(y) + 1 & 255 chksum = 0 for x in hdr: chksum = sub(chksum, sub(x, 1)) print(chksum)
UUIDS_COLUMN_NAME = \ 'uuids' TUPLE_TYPE_IDS_COLUMN_NAME = \ 'TupleTypeIds' PLACED1_OBJECT_UUIDS_COLUMN_NAME = \ 'Place1Uuids' PLACED2_OBJECT_UUIDS_COLUMN_NAME = \ 'Place2Uuids'
uuids_column_name = 'uuids' tuple_type_ids_column_name = 'TupleTypeIds' placed1_object_uuids_column_name = 'Place1Uuids' placed2_object_uuids_column_name = 'Place2Uuids'
class Entry: def __init__(self, name, rating=None): self._name = name self._rating = rating def __repr__(self): name_str = "'{name}'".format(name=self._name) if self._rating is None: repr_fmt = "Entry({name_str})" else: repr_fmt = "Entry({name_st...
class Entry: def __init__(self, name, rating=None): self._name = name self._rating = rating def __repr__(self): name_str = "'{name}'".format(name=self._name) if self._rating is None: repr_fmt = 'Entry({name_str})' else: repr_fmt = 'Entry({name_st...
''' Created on //201 @author: Kippel @ ihaveseenthings.com '''
""" Created on //201 @author: Kippel @ ihaveseenthings.com """
n=int(input()) l=list(map(int,input().split())) ans=2 c=2 if n==1: ans=1 else: for i in range(2,n): if l[i]== l[i-1]+l[i-2]: c+=1 else: c=2 ans=max(ans,c) print(ans)
n = int(input()) l = list(map(int, input().split())) ans = 2 c = 2 if n == 1: ans = 1 else: for i in range(2, n): if l[i] == l[i - 1] + l[i - 2]: c += 1 else: c = 2 ans = max(ans, c) print(ans)
count_num = int(input()) left = 0 right = 0 for i in range(1, count_num * 2 + 1): curr_num = int(input()) if i <= count_num: left += curr_num else: right += curr_num if left == right: print(f'Yes, sum = {left}') elif left > right: print(f'No, diff = {left-right}') else: print(f...
count_num = int(input()) left = 0 right = 0 for i in range(1, count_num * 2 + 1): curr_num = int(input()) if i <= count_num: left += curr_num else: right += curr_num if left == right: print(f'Yes, sum = {left}') elif left > right: print(f'No, diff = {left - right}') else: print(f...
casos = int(input()) while casos > 0 and casos<25: casos=casos-1 palabra = input() print('Y')
casos = int(input()) while casos > 0 and casos < 25: casos = casos - 1 palabra = input() print('Y')
__version__ = '1.0.0-dev' __author__ = "Mirco Huennefeld" __author_email__ = "mirco.huennefeld@tu-dortmund.de" __description__ = "Creates MC labels for IceCube simulation data" __url__ = "https://github.com/mhuen/ic3-labels"
__version__ = '1.0.0-dev' __author__ = 'Mirco Huennefeld' __author_email__ = 'mirco.huennefeld@tu-dortmund.de' __description__ = 'Creates MC labels for IceCube simulation data' __url__ = 'https://github.com/mhuen/ic3-labels'
# this program can remove duplicates from a list # there are two implementations # TODO: fetching data from files, writing data to files example_list_with_dupes = [11, 2, 4, 11, 4, 5, 11, 7, 4, 2, 11, 13, 22] def dedupe(list_with_dupes): list_without_dupes = list_with_dupes.copy() # if we remove an item from or...
example_list_with_dupes = [11, 2, 4, 11, 4, 5, 11, 7, 4, 2, 11, 13, 22] def dedupe(list_with_dupes): list_without_dupes = list_with_dupes.copy() for item in list_with_dupes: if list_without_dupes.count(item) > 1: list_without_dupes.remove(item) return list_without_dupes def dedupe_refe...
ID = "id" TITLE = "title" DATE = "release_date" ALBUM_ID = "album_id" ALBUM = "album_title" URL = "url" TEXT = "text"
id = 'id' title = 'title' date = 'release_date' album_id = 'album_id' album = 'album_title' url = 'url' text = 'text'
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ print('Hello, World.') def f1(): def f2(): print('this is f2') return f2 x = f1() # assigning function object to var x.; f1() returns the f2 function x() # since in python everything is an object, hence var is an object too. Hence, ...
print('Hello, World.') def f1(): def f2(): print('this is f2') return f2 x = f1() x()
def grade(marks): if marks >= 90: return "A" elif marks >= 80: return "B" elif marks >= 70: return "C" elif marks >= 60: return "D" elif marks >= 50: return "E" else: return "F" print(grade(95))
def grade(marks): if marks >= 90: return 'A' elif marks >= 80: return 'B' elif marks >= 70: return 'C' elif marks >= 60: return 'D' elif marks >= 50: return 'E' else: return 'F' print(grade(95))
halve = lambda x: x // 2 double = lambda x: x*2 even = lambda x: not x % 2 def ethiopian(multiplier, multiplicand): result = 0 while multiplier >= 1: if not even(multiplier): result += multiplicand multiplier = halve(multiplier) multiplicand = double(multiplicand) ...
halve = lambda x: x // 2 double = lambda x: x * 2 even = lambda x: not x % 2 def ethiopian(multiplier, multiplicand): result = 0 while multiplier >= 1: if not even(multiplier): result += multiplicand multiplier = halve(multiplier) multiplicand = double(multiplicand) retu...
def check_plagiarism(afile1, afile2): myF1 = open(afile1, "r") myF2 = open(afile2, "r") list1 = myF1.read().split() list2 = myF2.read().split() myF1.close() myF2.close() resList = [] resIndex = 0 for i in range(len(list1)): for h in range(len(list2)): count = 0...
def check_plagiarism(afile1, afile2): my_f1 = open(afile1, 'r') my_f2 = open(afile2, 'r') list1 = myF1.read().split() list2 = myF2.read().split() myF1.close() myF2.close() res_list = [] res_index = 0 for i in range(len(list1)): for h in range(len(list2)): count = ...
MODE_BAR_TIME_LINE_HIDES = [ "zoom2d", "pan2d", "select2d", "lasso2d", "zoomIn2d", "zoomOut2d", "autoScale2d", "toggleSpikelines", "toggleHover", "hoverClosestCartesian", "hoverCompareCartesian", ] MODE_BAR_MAP_HIDES = [ "pan2d", "select2d", "lasso2d", "toggle...
mode_bar_time_line_hides = ['zoom2d', 'pan2d', 'select2d', 'lasso2d', 'zoomIn2d', 'zoomOut2d', 'autoScale2d', 'toggleSpikelines', 'toggleHover', 'hoverClosestCartesian', 'hoverCompareCartesian'] mode_bar_map_hides = ['pan2d', 'select2d', 'lasso2d', 'toggleSpikelines', 'toggleHover', 'hoverClosestCartesian', 'hoverCompa...
class LinkedList: def __init__(self): self.head = None def insert(self, value): self.head = Node(value, self.head) def includes(self, val): current = self.head if self.head == None: return False while True: try: if current.value == val: ret...
class Linkedlist: def __init__(self): self.head = None def insert(self, value): self.head = node(value, self.head) def includes(self, val): current = self.head if self.head == None: return False while True: try: if current.va...
setting={ } def encode(content='', setting={}): return content.lower() def decode(content='', setting={}): return content.upper()
setting = {} def encode(content='', setting={}): return content.lower() def decode(content='', setting={}): return content.upper()
#Mod-env environment class Person: def __init__(self, name): self.name = name def show_name(self): print(f'Hello, {self.name}! My name is {self.name}, nice to meet you') class BasicMath: def __init__(self, a, b): self.a = a self.b = b # Addition def add(self): r...
class Person: def __init__(self, name): self.name = name def show_name(self): print(f'Hello, {self.name}! My name is {self.name}, nice to meet you') class Basicmath: def __init__(self, a, b): self.a = a self.b = b def add(self): return self.a + self.b class ...
# TITLE FIELD. MAX_LENGTH_TITLE = 200 MIN_LENGTH_TITLE = 5 TITLE_SIZE = 'Title must be between 5 and 200 characters' # DESCRIPTION FIELD. MAX_LENGTH_SUBTITLE = 500 MIN_LENGTH_SUBTITLE = 5 SUBTITLE_SIZE = 'Subtitle must be between 5 and 200 characters' # AUTHOR FIELD. MAX_LENGTH_AUTHOR = 12 # TOPIC DESCRIPTION FIELD....
max_length_title = 200 min_length_title = 5 title_size = 'Title must be between 5 and 200 characters' max_length_subtitle = 500 min_length_subtitle = 5 subtitle_size = 'Subtitle must be between 5 and 200 characters' max_length_author = 12 max_length_topic_description = 100000000 min_length_topic_description = 10 topic_...
def generator2(): for i in range(10): yield i def generator3(): for j in range(10, 20): yield j def generator(): for i in generator2(): yield i for j in generator3(): yield j def generator_easy(): yield from generator2() yield from generator3() v = generator(...
def generator2(): for i in range(10): yield i def generator3(): for j in range(10, 20): yield j def generator(): for i in generator2(): yield i for j in generator3(): yield j def generator_easy(): yield from generator2() yield from generator3() v = generator() ...
class Solution: def solve(self, nums): return [int(x) for x in list(str(int(''.join([str(num) for num in nums])) + 1))]
class Solution: def solve(self, nums): return [int(x) for x in list(str(int(''.join([str(num) for num in nums])) + 1))]
class ControlFlowException(Exception): def __init__(self, val): self.value = val def __str__(self): return repr(self.value) class ControlFlowControl(): def __init__(self, CFC_ON=True): self.CFC_ON = CFC_ON self.prevState = None self.graph = {} def buildGraph(self, current, previous): #assumes hiera...
class Controlflowexception(Exception): def __init__(self, val): self.value = val def __str__(self): return repr(self.value) class Controlflowcontrol: def __init__(self, CFC_ON=True): self.CFC_ON = CFC_ON self.prevState = None self.graph = {} def build_graph(s...
# all numbers in mm length = 300 # x width = 200 # y height = 200 # z point_spacing = 10 def write_points(a, b, c, fout): fixed = -a/2 for first in range(-b/2, b/2, point_spacing): for second in range(-c/2, c/2, point_spacing): fout.write("{} {} {}\n".format(fixed/1000.0, first/1000.0, ...
length = 300 width = 200 height = 200 point_spacing = 10 def write_points(a, b, c, fout): fixed = -a / 2 for first in range(-b / 2, b / 2, point_spacing): for second in range(-c / 2, c / 2, point_spacing): fout.write('{} {} {}\n'.format(fixed / 1000.0, first / 1000.0, second / 1000.0)) ...
# platforms/BUILD ArchProvider = provider(fields = ['arch']) architectures = ["x86_64", "i386", "arm", "thumb", "mips"] SubArchProvider = provider(fields = ['subarch']) subarchitectures = {"arm": ["v5", "v6m", "v7a", "v7m"]} VendorProvider = provider(fields = ['vendor']) vendors = ["pc", "apple", "unknown"] # one ...
arch_provider = provider(fields=['arch']) architectures = ['x86_64', 'i386', 'arm', 'thumb', 'mips'] sub_arch_provider = provider(fields=['subarch']) subarchitectures = {'arm': ['v5', 'v6m', 'v7a', 'v7m']} vendor_provider = provider(fields=['vendor']) vendors = ['pc', 'apple', 'unknown'] def arch_impl(ctx): raw_ar...