content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class ContentTransformer: def transform(content): raise NotImplementedError() @classmethod def from_siteinfo(cls, siteinfo, *args, **kwargs): raise NotImplementedError()
class Contenttransformer: def transform(content): raise not_implemented_error() @classmethod def from_siteinfo(cls, siteinfo, *args, **kwargs): raise not_implemented_error()
ports_assignment = { "rs1_rs2" : 6004, "rs1_receive_bgp_messages" : 6000 , "rs1_send_mpc_output" : 6001 , "worker_port" : 7760, "rs2_receive_bgp_messages" : 6002, "rs2_send_mpc_output" : 6003, "rs1-preference-channel" : 6005, "rs2-preference-channel" : 6006} #process_assignement = {"rs1" : '192.168.102.2',"rs2" : '192...
ports_assignment = {'rs1_rs2': 6004, 'rs1_receive_bgp_messages': 6000, 'rs1_send_mpc_output': 6001, 'worker_port': 7760, 'rs2_receive_bgp_messages': 6002, 'rs2_send_mpc_output': 6003, 'rs1-preference-channel': 6005, 'rs2-preference-channel': 6006} process_assignement = {'rs1': 'localhost', 'rs2': 'localhost'}
# DAN KABAGAMBE # TUMUSIIME FRANCIS # NAKUYA SHAKIRAH HADIJJAH total = 0 count = 0 smallest = None largest = None # Finding the largest and smallest while True: a = input('Enter a number:') try: a = int(a) count = count + 1 total = total + a if smallest is None: ...
total = 0 count = 0 smallest = None largest = None while True: a = input('Enter a number:') try: a = int(a) count = count + 1 total = total + a if smallest is None: smallest = a elif a < smallest: smallest = a if largest is None: ...
DASHBOARD = 'mydashboard' DISABLED = False ADD_INSTALLED_APPS = [ 'openstack_dashboard.dashboards.mydashboard', ]
dashboard = 'mydashboard' disabled = False add_installed_apps = ['openstack_dashboard.dashboards.mydashboard']
class Status: CANCELED = "CANCELED" DECOMPRESSING = "DECOMPRESSING" DELETED = "DELETED" FAILED = "FAILED" FREE = "FREE" INITIAL_LOAD = "INITIAL_LOAD" INVALID_FILE = "INVALID_FILE" LOST = "LOST" STAGE = "STAGE" PROCESSING = "PROCESSING" RUNNING = "RUNNING" SUCCEEDED = "S...
class Status: canceled = 'CANCELED' decompressing = 'DECOMPRESSING' deleted = 'DELETED' failed = 'FAILED' free = 'FREE' initial_load = 'INITIAL_LOAD' invalid_file = 'INVALID_FILE' lost = 'LOST' stage = 'STAGE' processing = 'PROCESSING' running = 'RUNNING' succeeded = 'SUC...
# -*- coding: utf-8 -*- def test_del_first_contact(app): app.session.login(username = "admin", password = "secret") app.contact.delete_first_contact() app.session.logout()
def test_del_first_contact(app): app.session.login(username='admin', password='secret') app.contact.delete_first_contact() app.session.logout()
class Person: def __init__(self, params): self.name = params.get('name') self.birth_date = params.get('birth_date') def params_str(self): return "{{name: '{}', birth_date: '{}'}}".format(self.name, self.birth_date)
class Person: def __init__(self, params): self.name = params.get('name') self.birth_date = params.get('birth_date') def params_str(self): return "{{name: '{}', birth_date: '{}'}}".format(self.name, self.birth_date)
def add_native_methods(clazz): def getAll____(a0): raise NotImplementedError() def getByName0__java_lang_String__(a0, a1): raise NotImplementedError() def getByIndex0__int__(a0, a1): raise NotImplementedError() def getByInetAddress0__java_net_InetAddress__(a0, a1): rai...
def add_native_methods(clazz): def get_all____(a0): raise not_implemented_error() def get_by_name0__java_lang__string__(a0, a1): raise not_implemented_error() def get_by_index0__int__(a0, a1): raise not_implemented_error() def get_by_inet_address0__java_net__inet_address__(a0...
''' Description: Exercise 3 (for loop) Version: 1.0.0.20210117 Author: Arvin Zhao Date: 2021-01-17 17:46:34 Last Editors: Arvin Zhao LastEditTime: 2021-01-18 10:40:04 ''' direction = input('Which direction do you want to count? (up/down)').strip().lower() if direction == 'up': top = int(input('Enter the top numbe...
""" Description: Exercise 3 (for loop) Version: 1.0.0.20210117 Author: Arvin Zhao Date: 2021-01-17 17:46:34 Last Editors: Arvin Zhao LastEditTime: 2021-01-18 10:40:04 """ direction = input('Which direction do you want to count? (up/down)').strip().lower() if direction == 'up': top = int(input('Enter the top number:...
#!/usr/bin/env python # -*- coding: utf-8 -*- def colorText(txt='', fgColor='', fgLine='', bgColor='', ): txtColor = '' if (fgLine != ''): txtColor += '\033[4m' if (fgColor == 'black'): txtColor += '\033[30m' elif (fgColor == 'red'): txtColor += '\033[31m' elif (fgCo...
def color_text(txt='', fgColor='', fgLine='', bgColor=''): txt_color = '' if fgLine != '': txt_color += '\x1b[4m' if fgColor == 'black': txt_color += '\x1b[30m' elif fgColor == 'red': txt_color += '\x1b[31m' elif fgColor == 'green': txt_color += '\x1b[32m' elif fg...
type_dict = { "[INFO]": "info", "[WARNING]": "warning", "[ERROR]": "error", "[DEBUG]": "debug", "START": "start", "REPORT": "report", "END": "end", "DEBUG": "debug", } style_dict = { "error": "bold red", "start": "green", "report": "dim yellow", "debug": "bold blue", ...
type_dict = {'[INFO]': 'info', '[WARNING]': 'warning', '[ERROR]': 'error', '[DEBUG]': 'debug', 'START': 'start', 'REPORT': 'report', 'END': 'end', 'DEBUG': 'debug'} style_dict = {'error': 'bold red', 'start': 'green', 'report': 'dim yellow', 'debug': 'bold blue', 'warning': 'yellow', 'info': 'yellow', 'end': 'cyan'} ot...
class Connection: def __init__(self, unique,ip, hostname): self.ip = ip self.hostname = hostname self.unique = unique def __str__(self): return str({"ip":self.ip, "hostname": self.hostname, "unique": self.unique})
class Connection: def __init__(self, unique, ip, hostname): self.ip = ip self.hostname = hostname self.unique = unique def __str__(self): return str({'ip': self.ip, 'hostname': self.hostname, 'unique': self.unique})
def external_service(name, datacenter, node, address, port, token=None): ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} if token is None: token = __pillar__['consul']['acl']['tokens']['default'] # Determine if the cluster is ready if not __salt__["consul.cluster_ready"]():...
def external_service(name, datacenter, node, address, port, token=None): ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} if token is None: token = __pillar__['consul']['acl']['tokens']['default'] if not __salt__['consul.cluster_ready'](): ret['result'] = True ret[...
class DumbDriveForward(Autonomous): nickname = "Dumb drive forward" def __init__(self, robot): super().__init__(robot) self.addSequential(AutoDumbDrive(robot, time=3, speed=-0.4)) class DumbDriveForwardHighGear(CommandGroup): nickname = "Dumb drive forward high gear" def __init__(sel...
class Dumbdriveforward(Autonomous): nickname = 'Dumb drive forward' def __init__(self, robot): super().__init__(robot) self.addSequential(auto_dumb_drive(robot, time=3, speed=-0.4)) class Dumbdriveforwardhighgear(CommandGroup): nickname = 'Dumb drive forward high gear' def __init__(se...
#Write a function name kinetic_energy that accepts an object's mass (in kg) and #velocity (in m/s) as arguments. The function should return the amount of kinetic #energy that object has. Write a program that asks the user to enter values for #mass and velocity, the calls kinetic_energy to get the object's kinetic en...
def main(): print('This program calculates and displays kinetic energy of an object') print('with the values entered.') print() mass = float(input('Enter mass: ')) velocity = float(input('Enter velocity: ')) energy = kinetic_energy(mass, velocity) print('The kinetic energy is', format(energy...
def seg(s): s2 = s[0] for e in s[1:]: if e == s2[-1]: s2 += e else: s2 += '/' s2 += e print(s) print(s2) def seg2(): s2 = [] s = ['a', 'a', 'b', 'b', 'v', 'v', 'c', 'c', 'a', 's'] for e in enumerate(s): s2.append(e) s3 = s2[0...
def seg(s): s2 = s[0] for e in s[1:]: if e == s2[-1]: s2 += e else: s2 += '/' s2 += e print(s) print(s2) def seg2(): s2 = [] s = ['a', 'a', 'b', 'b', 'v', 'v', 'c', 'c', 'a', 's'] for e in enumerate(s): s2.append(e) s3 = s2[0] ...
class Solution: def subtractProductAndSum(self, n: int) -> int: prod = 1 sum_ = 0 while n > 0: last_digit = n % 10 prod *= last_digit sum_ += last_digit n //= 10 return prod - sum_ ...
class Solution: def subtract_product_and_sum(self, n: int) -> int: prod = 1 sum_ = 0 while n > 0: last_digit = n % 10 prod *= last_digit sum_ += last_digit n //= 10 return prod - sum_
def test(x): try: if x: print(x) else: raise (Exception) except: print("wrong") finally: print("finally") print("after finally") if __name__ == "__main__": test(None) test("hello")
def test(x): try: if x: print(x) else: raise Exception except: print('wrong') finally: print('finally') print('after finally') if __name__ == '__main__': test(None) test('hello')
# The example function below keeps track of the opponent's history and plays whatever the opponent played two plays ago. It is not a very good player so you will need to change the code to pass the challenge. def player(prev_play, opponent_history=[]): opponent_history.append(prev_play) guess = "R" if len...
def player(prev_play, opponent_history=[]): opponent_history.append(prev_play) guess = 'R' if len(opponent_history) > 2: guess = opponent_history[-2] return guess
def view(user, tool): return True def create(user, tool): if user.is_superuser: return True return user.is_developer def change(user, tool): if user.is_superuser: return True return user.is_developer def delete(user, tool): if user.is_superuser: return True r...
def view(user, tool): return True def create(user, tool): if user.is_superuser: return True return user.is_developer def change(user, tool): if user.is_superuser: return True return user.is_developer def delete(user, tool): if user.is_superuser: return True return ...
ingredient1 = "chicken" ingredient2 = "rice" Michsays = input ("What is inside this hawker chicken rice?") if (Michsays == ingredient1 or Michsays == ingredient2): print("correct!") else: print("look again!") # == takes precedence over or Michasks = input("How much is the hawker chicken rice?") floatConvert...
ingredient1 = 'chicken' ingredient2 = 'rice' michsays = input('What is inside this hawker chicken rice?') if Michsays == ingredient1 or Michsays == ingredient2: print('correct!') else: print('look again!') michasks = input('How much is the hawker chicken rice?') float_converted_michasks = float(Michasks) if flo...
with open("input.txt") as f: arr = [line.strip() for line in f.readlines()] feesh = arr[0].split(",") feesh = [int(num) for num in feesh] days = 256 max_age = 8 birth_rates = [ [None] * (max_age + 1) for i in range(days + 1)] #print(feesh) #print(birth_rates) def final_feesh(fish_age, day): print("Age: "...
with open('input.txt') as f: arr = [line.strip() for line in f.readlines()] feesh = arr[0].split(',') feesh = [int(num) for num in feesh] days = 256 max_age = 8 birth_rates = [[None] * (max_age + 1) for i in range(days + 1)] def final_feesh(fish_age, day): print('Age: ' + str(fish_age) + ' Day: ' + str(day)) ...
class Solution: def flipgame(self, fronts: 'List[int]', backs: 'List[int]') -> 'int': same_sides = {} for i in range(len(fronts)): if fronts[i] == backs[i]: if fronts[i] not in same_sides: same_sides[fronts[i]] = 0 same_sides[fronts[i]]...
class Solution: def flipgame(self, fronts: 'List[int]', backs: 'List[int]') -> 'int': same_sides = {} for i in range(len(fronts)): if fronts[i] == backs[i]: if fronts[i] not in same_sides: same_sides[fronts[i]] = 0 same_sides[fronts[i]...
UNSIGNED_CHAR_COLUMN = 251 UNSIGNED_CHAR_LENGTH = 1 UNSIGNED_INT24_COLUMN = 253 UNSIGNED_INT24_LENGTH = 3 UNSIGNED_INT64_COLUMN = 254 UNSIGNED_INT64_LENGTH = 8 UNSIGNED_SHORT_COLUMN = 252 UNSIGNED_SHORT_LENGTH = 2
unsigned_char_column = 251 unsigned_char_length = 1 unsigned_int24_column = 253 unsigned_int24_length = 3 unsigned_int64_column = 254 unsigned_int64_length = 8 unsigned_short_column = 252 unsigned_short_length = 2
info = { "friendly_name": "Comment (Block)", "example_template": "comment text", "summary": "The text within the block is not interpreted or rendered in the final displayed page.", } def SublanguageHandler(args, doc, renderer): pass
info = {'friendly_name': 'Comment (Block)', 'example_template': 'comment text', 'summary': 'The text within the block is not interpreted or rendered in the final displayed page.'} def sublanguage_handler(args, doc, renderer): pass
def digitize(n): if n == 0: return[0] else: digits = [] while n > 0: digits.append(n % 10) n = (n - n % 10) // 10 return(digits[::-1]) #def digitize(n): #return list(map(int, str(n)))cc
def digitize(n): if n == 0: return [0] else: digits = [] while n > 0: digits.append(n % 10) n = (n - n % 10) // 10 return digits[::-1]
# # PySNMP MIB module CERENT-GLOBAL-REGISTRY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CERENT-GLOBAL-REGISTRY # Produced by pysmi-0.3.4 at Wed May 1 11:48:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) ...
def metade(valor, formatar=False): valor = valor / 2 if formatar: valor = moeda(valor) return valor def dobro(valor, formatar=False): valor *= 2 if formatar: return moeda(valor) return valor def aumentar(valor, porcentagem, formatar=False): aumenta = valor * (porcentagem ...
def metade(valor, formatar=False): valor = valor / 2 if formatar: valor = moeda(valor) return valor def dobro(valor, formatar=False): valor *= 2 if formatar: return moeda(valor) return valor def aumentar(valor, porcentagem, formatar=False): aumenta = valor * (porcentagem / ...
print('Accessing private members in Class:') print('-'*35) class Human(): # Private var __privateVar = "this is __private variable" # Constructor method def __init__(self): self.className = "Human class constructor" self.__privateVar = "this is redefined __private variable"...
print('Accessing private members in Class:') print('-' * 35) class Human: __private_var = 'this is __private variable' def __init__(self): self.className = 'Human class constructor' self.__privateVar = 'this is redefined __private variable' def show_name(self, name): self.name = n...
def CheckPairSum(Arr, Total): n = len(Arr) dict_of_numbers = [0] * 1000 # print("Start of loop") for i in range (n): difference = Total - Arr[i] # print difference if dict_of_numbers[difference] == 1: print("The pair is"...
def check_pair_sum(Arr, Total): n = len(Arr) dict_of_numbers = [0] * 1000 for i in range(n): difference = Total - Arr[i] if dict_of_numbers[difference] == 1: print('The pair is', Arr[i], 'and', difference) dict_of_numbers[Arr[i]] = 1 arr = [1, 2, 4, 5, 7, 8, 10, -1, 6] to...
# Variant DBScan analysis item # Set variants vdbscan_variants = pd.DataFrame({'eps': [2,2,3,3], 'mp' : [4,4,5,5]}) # Set column names vdbscan_column_names = ('ra', 'dec') # Create Variant DBScan analysis item ana_vdbscan = skdiscovery.data_structure.table.analysis.VDBScan('VDBScan',vdbscan_variants, vdbscan_column_na...
vdbscan_variants = pd.DataFrame({'eps': [2, 2, 3, 3], 'mp': [4, 4, 5, 5]}) vdbscan_column_names = ('ra', 'dec') ana_vdbscan = skdiscovery.data_structure.table.analysis.VDBScan('VDBScan', vdbscan_variants, vdbscan_column_names) sc_vdbscan = stage_container(ana_vdbscan)
n=int(input("enter number of elements: ")) l=[] for i in range(n): l.append(int(input(f"enter l[{i}]: "))) print(l) ''' output: enter number of elements: 6 enter l[0]: 23 enter l[1]: 11 enter l[2]: 67 enter l[3]: 889 enter l[4]: 342 enter l[5]: 23 [23, 11, 67, 889, 342, 23] '''
n = int(input('enter number of elements: ')) l = [] for i in range(n): l.append(int(input(f'enter l[{i}]: '))) print(l) '\noutput:\nenter number of elements: 6\nenter l[0]: 23\nenter l[1]: 11\nenter l[2]: 67\nenter l[3]: 889\nenter l[4]: 342\nenter l[5]: 23\n[23, 11, 67, 889, 342, 23]\n'
nun = [[], []] val = 0 for c in range(0, 8): val = int(input('Digite um numero: ')) if val % 2 == 0: num[0].append(val) else: num[1].append(val)
nun = [[], []] val = 0 for c in range(0, 8): val = int(input('Digite um numero: ')) if val % 2 == 0: num[0].append(val) else: num[1].append(val)
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def prefix(A): pref = [0] * (len(A)+1) for i in range(1, len(A)+1): pref[i] = pref[i-1] + A[i-1] return pref def countTotal(P, left, right): return P[right] - P[left] def solution(A): pref = prefix(A)...
def prefix(A): pref = [0] * (len(A) + 1) for i in range(1, len(A) + 1): pref[i] = pref[i - 1] + A[i - 1] return pref def count_total(P, left, right): return P[right] - P[left] def solution(A): pref = prefix(A) n = len(A) pairs = 0 for i in range(len(A)): if A[i] == 0: ...
# https://codeforces.com/problemset/problem/584/A n, t = map(int, input().split()) if n == 1: if t < 10: print(t) else: print(-1) else: if t < 10: print(str(t)+'0'*(n-1)) else: print('1'+'0'*(n-1))
(n, t) = map(int, input().split()) if n == 1: if t < 10: print(t) else: print(-1) elif t < 10: print(str(t) + '0' * (n - 1)) else: print('1' + '0' * (n - 1))
# Quick Sort # Time Complexity: O(n^2) # Space Complexity: O(log(n)) # In-place quick sort does not create subsequences # its subsequence of the input is represented by a leftmost and rightmost index def quick_Sort(lst, first, last): print(lst) if first >= last: # the lst is sorte...
def quick__sort(lst, first, last): print(lst) if first >= last: return pivot = lst[last] lo = first hi = last - 1 while lo <= hi: while lo <= hi and lst[lo] < pivot: lo += 1 while lo <= hi and pivot < lst[hi]: hi -= 1 if lo <= hi: ...
# Fibonacci numbers module def greeting(name="stranger"): print("Hi {}".format(name))
def greeting(name='stranger'): print('Hi {}'.format(name))
#split function is used for creat string in to list of String's # String="10 11 12 13 14 15 16" #we have to give Raguler Expression as argument of split function #Know split function will split over string with respact" " #l=["10","11","12","13","14","15","16"] # l=String.split(" ") # String=" 10 12 13 " #stri...
s = input('Enter String to Split!!!:') c = input('Enter Char which Respact to Split!!:') print('List:', s.split(c)) s = input('Enter String :') print('After Strip String:' + s.strip())
def power(number, power=2): return number ** power print(power(2, 3)) # 2 * 2 * 2 = 8 print(power(3)) # 3 * 2 = 9 print("------------------") def showFullName(first, last): return f"{first} {last}" print(showFullName(last="Golchinpour", first="Milad"))
def power(number, power=2): return number ** power print(power(2, 3)) print(power(3)) print('------------------') def show_full_name(first, last): return f'{first} {last}' print(show_full_name(last='Golchinpour', first='Milad'))
data = {} individual = {} info = input().split(" -> ") while "no more time" not in info: name = info[0] contest = info[1] points = int(info[2]) already_in = False if contest in data: for i in range(len(data[contest])): if name == data[contest][i][0]: already_in ...
data = {} individual = {} info = input().split(' -> ') while 'no more time' not in info: name = info[0] contest = info[1] points = int(info[2]) already_in = False if contest in data: for i in range(len(data[contest])): if name == data[contest][i][0]: already_in = ...
# -*-coding: utf-8 -*- cg_notexists = '15019' cg_zip_failed = '15009' vray_notmatch = '15020' cginfo_failed = '15002' conflict_multiscatter_vray = '15021' cg_notmatch = '15013' camera_duplicat = '15015' element_duplicat = '15016' vrmesh_ext_null = "15018" proxy_enable = "15010" renderer_notsupport = "15004" # -------...
cg_notexists = '15019' cg_zip_failed = '15009' vray_notmatch = '15020' cginfo_failed = '15002' conflict_multiscatter_vray = '15021' cg_notmatch = '15013' camera_duplicat = '15015' element_duplicat = '15016' vrmesh_ext_null = '15018' proxy_enable = '15010' renderer_notsupport = '15004' camera_null = '15006' task_folder_...
#!/usr/bin/env python3 with open("input.txt", "r") as f: all_groups = [x.strip().split("\n") for x in f.read().split("\n\n")] anyone = 0 everyone = 0 for group in all_groups: all = set(group[0]) any = set(group[0]) for person in group[1:]: all = all.intersection(person) any.update(*person) everyone += len...
with open('input.txt', 'r') as f: all_groups = [x.strip().split('\n') for x in f.read().split('\n\n')] anyone = 0 everyone = 0 for group in all_groups: all = set(group[0]) any = set(group[0]) for person in group[1:]: all = all.intersection(person) any.update(*person) everyone += len(...
class Solution: def maxScore(self, arr, k): dp = {'l':[0], 'r':[0]} curr_sum_left = 0 curr_sum_right = 0 for index in range(0, k): # for left curr_sum_left += arr[index] dp['l'].append(curr_sum_left) # for right j = len...
class Solution: def max_score(self, arr, k): dp = {'l': [0], 'r': [0]} curr_sum_left = 0 curr_sum_right = 0 for index in range(0, k): curr_sum_left += arr[index] dp['l'].append(curr_sum_left) j = len(arr) - 1 - index curr_sum_right += ...
# date: 18/06/2020 # Description: # Given a 32-bit integer, # swap the 1st and 2nd bit, # 3rd and 4th bit, up til the 31st and 32nd bit. # convert from decimal to binary def convert_to_binary(num): result='' while num != 0: remainder = num % 2 # gives the exact remainder num = num // 2 ...
def convert_to_binary(num): result = '' while num != 0: remainder = num % 2 num = num // 2 result = str(remainder) + result return result def swap_bits(num): results = list(convert_to_binary(num)) out = '' for i in range(len(results)): if results[i] == '1': ...
vectors = { 'NW': (-1, -1), 'N': (-1, 0), 'NE': (-1, 1), 'W' : ( 0, -1), '' : ( 0, 0), 'E' : ( 0, 1), 'SW': ( 1, -1), 'S': ( 1, 0), 'SE': ( 1, 1), } class Board: def __init__(self,grid,directions): self._nb_row,self._nb_col=(len(grid),len(grid[0])) s...
vectors = {'NW': (-1, -1), 'N': (-1, 0), 'NE': (-1, 1), 'W': (0, -1), '': (0, 0), 'E': (0, 1), 'SW': (1, -1), 'S': (1, 0), 'SE': (1, 1)} class Board: def __init__(self, grid, directions): (self._nb_row, self._nb_col) = (len(grid), len(grid[0])) self._size = max(self._nb_row, self._nb_col) ...
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Maritalstatus, obj[8]: Children, obj[9]: Education, obj[10]: Occupation, obj[11]: Income, obj[12]: Bar, obj[13]: Coffeehouse, obj[14]: Restaurant20to50, obj[15]: Direct...
def find_decision(obj): if obj[6] <= 6: if obj[10] > 3: if obj[11] > 0: if obj[14] <= 1.0: if obj[2] <= 2: if obj[3] <= 2: return 'False' elif obj[3] > 2: i...
class Solution: def solveNQueens(self, n: int) -> List[List[str]]: def findPositions(i, j, attackedColumn = set(), attackedHill = set(), attackedDale = set()): if i == n-1: return [[j]] i += 1 validPos_list = [] ...
class Solution: def solve_n_queens(self, n: int) -> List[List[str]]: def find_positions(i, j, attackedColumn=set(), attackedHill=set(), attackedDale=set()): if i == n - 1: return [[j]] i += 1 valid_pos_list = [] for k in range(n): ...
#! /usr/bin/env python3 with open("input", "r") as fd : instructions = [x.split(' ') for x in fd.read().split('\n')] acc = 0 done = [False] * len(instructions) i = 0 while 0 <= i < len(instructions) and not done[i] : done[i] = True instruction, value = instructions[i] if instruction == "acc" : ...
with open('input', 'r') as fd: instructions = [x.split(' ') for x in fd.read().split('\n')] acc = 0 done = [False] * len(instructions) i = 0 while 0 <= i < len(instructions) and (not done[i]): done[i] = True (instruction, value) = instructions[i] if instruction == 'acc': acc += int(value) if...
def ben_update(): return def ben_random_tick(): return
def ben_update(): return def ben_random_tick(): return
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def set_width(self, n): self.width = n def set_height(self, n): self.height = n def get_area(self): return self.height * self.width def get_perimeter(self): ...
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def set_width(self, n): self.width = n def set_height(self, n): self.height = n def get_area(self): return self.height * self.width def get_perimeter(self): ...
''' Duplicate the elements of a list. Example: * (dupli '(a b c c d)) (A A B B C C C C D D) ''' #taking input of list elements at a single time seperating by space and splitting each by split() method demo_list = input("Enter elements seperated by space: ").split() duplicates_list = list() list_length = l...
""" Duplicate the elements of a list. Example: * (dupli '(a b c c d)) (A A B B C C C C D D) """ demo_list = input('Enter elements seperated by space: ').split() duplicates_list = list() list_length = len(demo_list) index = 0 while index < list_length: for _ in range(2): duplicates_list.append(de...
n = int(input()) max_num = -1000000000000 for i in range(n): num = int(input()) if num > max_num: max_num = num print(max_num)
n = int(input()) max_num = -1000000000000 for i in range(n): num = int(input()) if num > max_num: max_num = num print(max_num)
with open("day-08.txt") as f: lines = f.read().rstrip().splitlines() ans = 0 for line in lines: _, output = line.split(" | ") for digit in output.split(maxsplit=3): ans += len(digit) in (2, 3, 4, 7) print(ans)
with open('day-08.txt') as f: lines = f.read().rstrip().splitlines() ans = 0 for line in lines: (_, output) = line.split(' | ') for digit in output.split(maxsplit=3): ans += len(digit) in (2, 3, 4, 7) print(ans)
class ApplyMaskBase(object): def __init__(self): pass def apply_mask(self, *arg, **kwargs): raise NotImplementedError("Please implement in subclass")
class Applymaskbase(object): def __init__(self): pass def apply_mask(self, *arg, **kwargs): raise not_implemented_error('Please implement in subclass')
a == b a != b a < b a <= b a > b a >= b a is b a is not b a in b a not in b
a == b a != b a < b a <= b a > b a >= b a is b a is not b a in b a not in b
def quickshort(a,start,end): if start<end: pindex = partition(a,start,end) quickshort(a,start,pindex-1) quickshort(a,pindex+1,end) def partition(a,start,end): middle = int(end/2) pivot = a[middle] pindex = start for i in range(start,middle): if a[i]>=pivot: a[i],a[pindex]=a[pindex],a[i] ...
def quickshort(a, start, end): if start < end: pindex = partition(a, start, end) quickshort(a, start, pindex - 1) quickshort(a, pindex + 1, end) def partition(a, start, end): middle = int(end / 2) pivot = a[middle] pindex = start for i in range(start, middle): if a[i...
N, C = map(int, input().split()) l = [tuple(map(int, input().split())) for i in range(N)] s = set() for a, b, c in l: s.add(a) s.add(b + 1) d = {} s = sorted(list(s)) for i, j in enumerate(s): d[j] = i m = [0] * (len(s) + 1) for a, b, c in l: m[d[a]] += c m[d[b + 1]] -= c ans = 0 for i in range(len(...
(n, c) = map(int, input().split()) l = [tuple(map(int, input().split())) for i in range(N)] s = set() for (a, b, c) in l: s.add(a) s.add(b + 1) d = {} s = sorted(list(s)) for (i, j) in enumerate(s): d[j] = i m = [0] * (len(s) + 1) for (a, b, c) in l: m[d[a]] += c m[d[b + 1]] -= c ans = 0 for i in ra...
print( 1 == 1 or 2 == 2 ) print( 1 == 1 or 2 == 3 ) print( 1 != 1 or 2 == 2 ) print( 2 < 1 or 3 > 6 )
print(1 == 1 or 2 == 2) print(1 == 1 or 2 == 3) print(1 != 1 or 2 == 2) print(2 < 1 or 3 > 6)
class Node: def __init__(self, data): self.data = data self.next = None class llist: def __init__(self): self.head = None def reverse(self, head): if head is None or head.next is None: return head rest = self.reverse(head.next) head.next.next ...
class Node: def __init__(self, data): self.data = data self.next = None class Llist: def __init__(self): self.head = None def reverse(self, head): if head is None or head.next is None: return head rest = self.reverse(head.next) head.next.next =...
texto = input("Ingrese su texto: ") def SpaceToDash(texto): return texto.replace(" ", "-") print (SpaceToDash(texto))
texto = input('Ingrese su texto: ') def space_to_dash(texto): return texto.replace(' ', '-') print(space_to_dash(texto))
nome = 'Fabio Rodrigues Dias' cores = {'limpa':'\033[m', 'azul':'\033[1;7;34m', 'amarelo':'\033[33m', 'pretoebranco': '\033[7;30m'} print('Ola!! Muito prazer em te conhecer, {}{}{}'.format(cores['azul'], nome , cores['limpa']))
nome = 'Fabio Rodrigues Dias' cores = {'limpa': '\x1b[m', 'azul': '\x1b[1;7;34m', 'amarelo': '\x1b[33m', 'pretoebranco': '\x1b[7;30m'} print('Ola!! Muito prazer em te conhecer, {}{}{}'.format(cores['azul'], nome, cores['limpa']))
# Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. def CheckDoNotMerge(input_api, output_api): for l in input_api.change.FullDescriptionText().splitlines(): ...
def check_do_not_merge(input_api, output_api): for l in input_api.change.FullDescriptionText().splitlines(): if l.lower().startswith('do not merge'): msg = "Your cl contains: 'Do not merge' - this will break WIP bots" return [output_api.PresubmitPromptWarning(msg, [])] return [] ...
# I wouldn't be able to say if this question was hard or easy. It uses the fundamental stuff. No modules. # However changing the rules of math was mind-boggling def Part1(part2): calc = list() with open("Day18.txt") as f: for line in f: operation = line.strip().replace(" ", "") ...
def part1(part2): calc = list() with open('Day18.txt') as f: for line in f: operation = line.strip().replace(' ', '') start = 0 parentheses = list() while True: for i in range(start, len(operation)): if operation[i] == '...
class VCard(): def __init__(self, filename:str): self.filename = filename def create(self, display_name:list, full_name:str, number:str, email:str=None): '''Create a vcf card''' bp = [1, 2, 0] pp = [0, 1, 2] rn = [] for i, j in zip(bp, pp): rn.insert(i, display_name[j]+";") fd = self.fi...
class Vcard: def __init__(self, filename: str): self.filename = filename def create(self, display_name: list, full_name: str, number: str, email: str=None): """Create a vcf card""" bp = [1, 2, 0] pp = [0, 1, 2] rn = [] for (i, j) in zip(bp, pp): rn.i...
# # Copyright (c) 2017 Joy Diamond. All rights reserved. # @gem('Quartz.Parse1') def gem(): require_gem('Quartz.Match') require_gem('Quartz.Core') show = true @share def parse1_mysql_from_path(path): data = read_text_from_path(path) many = [] append = many.append ...
@gem('Quartz.Parse1') def gem(): require_gem('Quartz.Match') require_gem('Quartz.Core') show = true @share def parse1_mysql_from_path(path): data = read_text_from_path(path) many = [] append = many.append iterate_lines = z_initialize(path, data) for s in iter...
a = range(2, 10, 2) b = list(a) c = [a] print('')
a = range(2, 10, 2) b = list(a) c = [a] print('')
# This si a hello worls script # written in Python def main(): print("Hello, world") if __name__ == "__main__": main()
def main(): print('Hello, world') if __name__ == '__main__': main()
# Your code below: number_list = range(9) print(list(number_list)) zero_to_seven = range(8) print(list(zero_to_seven))
number_list = range(9) print(list(number_list)) zero_to_seven = range(8) print(list(zero_to_seven))
# Solution to problem 6 # #Student: Niamh O'Leary# #ID: G00376339# #Write a program that takes a user input string and outputs every second word# string = "The quick broen fox jumps over the lazy dog" even_words = string.split(' ')[::2] #split the original string. Then use slice to select every second word# ...
string = 'The quick broen fox jumps over the lazy dog' even_words = string.split(' ')[::2]
def left(i): return 2*i+1 def right(i): return 2*i+2 def max_heapify(data, size, i): l = left(i) r = right(i) val = data[i] largest = i if l < size and data[l] > data[largest]: largest = l if r < size and data[r] > data[largest]: largest = r if largest != i: ...
def left(i): return 2 * i + 1 def right(i): return 2 * i + 2 def max_heapify(data, size, i): l = left(i) r = right(i) val = data[i] largest = i if l < size and data[l] > data[largest]: largest = l if r < size and data[r] > data[largest]: largest = r if largest != i:...
# Calculate the standard deviation by taking the square root port_standard_dev = np.sqrt(np.dot(weights.T, np.dot(cov_matrix, weights))) # Print the results print(str(np.round(port_standard_dev, 4) * 100) + '%')
port_standard_dev = np.sqrt(np.dot(weights.T, np.dot(cov_matrix, weights))) print(str(np.round(port_standard_dev, 4) * 100) + '%')
class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: if not root: return 0 self.res = 0 self.dfs(root) return self.res-1 def dfs(self, root): if not root: return 0 left = self.dfs(root.left) right = self.dfs(r...
class Solution: def diameter_of_binary_tree(self, root: TreeNode) -> int: if not root: return 0 self.res = 0 self.dfs(root) return self.res - 1 def dfs(self, root): if not root: return 0 left = self.dfs(root.left) right = self.dfs...
def _set_status(task_list, task_name, status): task = task_list.get_task(task_name) task.status = status def done(task_list, args): _set_status(task_list, args.task, "completed") return def start(task_list, args): _set_status(task_list, args.task, "started") return def pause(task_list, arg...
def _set_status(task_list, task_name, status): task = task_list.get_task(task_name) task.status = status def done(task_list, args): _set_status(task_list, args.task, 'completed') return def start(task_list, args): _set_status(task_list, args.task, 'started') return def pause(task_list, args):...
# coding: utf-8 class ArrayBasedQueue: def __init__(self): self.array = [] def __len__(self): return len(self.array) def __iter__(self): for item in self.array: yield item # O(1) def enqueue(self, value): self.array.append(value) # O(n) def deq...
class Arraybasedqueue: def __init__(self): self.array = [] def __len__(self): return len(self.array) def __iter__(self): for item in self.array: yield item def enqueue(self, value): self.array.append(value) def dequeue(self): try: ...
#1. Create a greeting for your program. print("\nSimple Name Generator\n") #2. Ask the user for the city that they grew up in. #raw_input() for python v2 , input() for python v3 # Make sure the input cursor shows on a new line raw_input("Press enter : ") print("\nSimple Name Generator\n") city = raw_input("What is the ...
print('\nSimple Name Generator\n') raw_input('Press enter : ') print('\nSimple Name Generator\n') city = raw_input('What is the name of the city you grew up ? : ') family_name = raw_input('What is your family name ? : ') print('The name of your new brand is: \n' + city + ' ' + family_name)
class Solution: def solve(self, height, blacklist): blacklist = set(blacklist) if height in blacklist: return 0 dp = [[0,1]] MOD = int(1e9+7) for i in range(1,height+1): if height-i in blacklist: dp.append([0,0]) continue ...
class Solution: def solve(self, height, blacklist): blacklist = set(blacklist) if height in blacklist: return 0 dp = [[0, 1]] mod = int(1000000000.0 + 7) for i in range(1, height + 1): if height - i in blacklist: dp.append([0, 0]) ...
def addFeatureDataStruc(data): data['LenCarName']=data['car name'].apply(lambda x: len(x.split())) newFeat=[ 'cylinders', 'displacement', 'horsepower', 'weight','acceleration','lrScore','LenCarName'] return data[newFeat],data[['mpg']]
def add_feature_data_struc(data): data['LenCarName'] = data['car name'].apply(lambda x: len(x.split())) new_feat = ['cylinders', 'displacement', 'horsepower', 'weight', 'acceleration', 'lrScore', 'LenCarName'] return (data[newFeat], data[['mpg']])
#!/usr/bin/env python # encoding: utf-8 ''' @author: Jason Lee @license: (C) Copyright @ Jason Lee @contact: jiansenll@163.com @file: min_heap.py @time: 2019/4/29 20:23 @desc: ''' # please see the comments in max_heap.py def min_heap(array): if not array: return None length = len(array) ...
""" @author: Jason Lee @license: (C) Copyright @ Jason Lee @contact: jiansenll@163.com @file: min_heap.py @time: 2019/4/29 20:23 @desc: """ def min_heap(array): if not array: return None length = len(array) if length == 1: return array for i in range(length // 2 - 1, -1, -1): ...
# -*- coding: utf-8 -*- #Lists myList = [1, 2, 3, 4, 5, "Hello"] print(myList) print(myList[2]) print(myList[-1]) myList.append("Simo") print(myList) #Tuples - like lists, but you cannot modify their values. monthsOf = ("Jan","Feb","Mar","Apr") print(monthsOf) #Dictionary - a collection of related data PAIRS myDict ...
my_list = [1, 2, 3, 4, 5, 'Hello'] print(myList) print(myList[2]) print(myList[-1]) myList.append('Simo') print(myList) months_of = ('Jan', 'Feb', 'Mar', 'Apr') print(monthsOf) my_dict = {'One': 1.35, 2.5: 'Two Point Five', 3: '+', 7.9: 2} print(myDict) del myDict['One'] print(myDict)
SCAN_COMMANDS = {'arp', 'arp-scan', 'fping', 'nmap'} def rule(event): # Filter out commands if event['event'] == 'session.command' and not event.get('argv'): return False # Check that the program is in our watch list return event.get('program') in SCAN_COMMANDS def title(event): return '...
scan_commands = {'arp', 'arp-scan', 'fping', 'nmap'} def rule(event): if event['event'] == 'session.command' and (not event.get('argv')): return False return event.get('program') in SCAN_COMMANDS def title(event): return 'User [{}] has issued a network scan with [{}]'.format(event.get('user', 'USE...
def getPeopleHarvest(req): try: # result = req.get("result") # username = "pescettoe@amvbbdo.com" # password = "Welcome1!" # top_level_url = "https://xlaboration.harvestapp.com/people/1514150" # # # create an authorization handler # p = urllib.request.HTTPPass...
def get_people_harvest(req): try: q = request('https://xlaboration.harvestapp.com/people/1514150') q.add_header('Authorization', 'Basic cGVzY2V0dG9lQGFtdmJiZG8uY29tOldlbGNvbWUxIQ==') q.add_header('Accept', 'application/json') q.add_header('Content-Type', 'application/json') a...
ASCII = [c for c in (chr(i) for i in range(32, 127))] def cipher(text, key, decode): op = '' for i, j in enumerate(text): if j not in ASCII: op += j else: text_index = ASCII.index(j) k = key[i % len(key)] key_index = ASCII.index(k) if...
ascii = [c for c in (chr(i) for i in range(32, 127))] def cipher(text, key, decode): op = '' for (i, j) in enumerate(text): if j not in ASCII: op += j else: text_index = ASCII.index(j) k = key[i % len(key)] key_index = ASCII.index(k) i...
''' Write a code which accepts a sequence of words as input and prints the words in a sequence after sorting them alphabetically. Hint: In case of input data being supplied to the question, it should be assumed to be a console input. ''' print('Input number word for : ') n = input() mp = list(map(lambda x: ord(...
""" Write a code which accepts a sequence of words as input and prints the words in a sequence after sorting them alphabetically. Hint: In case of input data being supplied to the question, it should be assumed to be a console input. """ print('Input number word for : ') n = input() mp = list(map(lambda x: ord(x), n)) ...
class subject (): def __init__(self): x=[] self.students=[] def addstudents(self): n=int(input("Enter No. Of Students :- ")) for i in range (n): self.name=input("Enter Name :- ") self.rno=input("Enter Roll No. :- ") self.marks=input("E...
class Subject: def __init__(self): x = [] self.students = [] def addstudents(self): n = int(input('Enter No. Of Students :- ')) for i in range(n): self.name = input('Enter Name :- ') self.rno = input('Enter Roll No. :- ') self.marks = input('...
def make_dot(count, left, right): if left == "" and right == "": return count * "." if right == "": if left == "L": return '.'*count else: return 'R'*count if left == "": if right == "L": return count * "L" else: retur...
def make_dot(count, left, right): if left == '' and right == '': return count * '.' if right == '': if left == 'L': return '.' * count else: return 'R' * count if left == '': if right == 'L': return count * 'L' else: ret...
if sys.version_info.minor > 9: phr = {"user_id": user_id} | content else: z = {"user_id": user_id} phr = {**z, **content}
if sys.version_info.minor > 9: phr = {'user_id': user_id} | content else: z = {'user_id': user_id} phr = {**z, **content}
class Solution: def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int: if k <= 1 : return 0 prod =1 res = 0 i,j = 0, 0 while j < len(nums): prod *= nums[j] if prod < k : res += (j-i+1) elif prod...
class Solution: def num_subarray_product_less_than_k(self, nums: List[int], k: int) -> int: if k <= 1: return 0 prod = 1 res = 0 (i, j) = (0, 0) while j < len(nums): prod *= nums[j] if prod < k: res += j - i + 1 ...
# -*- coding: utf-8 -*- # ScrollBar part codes # Left arrow of horizontal scroll bar. # @see ScrollBar::scrollStep sbLeftArrow = 0 # Right arrow of horizontal scroll bar. # @see ScrollBar::scrollStep sbRightArrow = 1 # Left paging area of horizontal scroll bar. # @see ScrollBar::scrollStep sbPageLeft = 2 # Right pag...
sb_left_arrow = 0 sb_right_arrow = 1 sb_page_left = 2 sb_page_right = 3 sb_up_arrow = 4 sb_down_arrow = 5 sb_page_up = 6 sb_page_down = 7 sb_indicator = 8 sb_horizontal = 0 sb_vertical = 1 sb_handle_keyboard = 2
BLACK = u"\u001b[30m" RED = u"\u001b[31m" GREEN = u"\u001b[32m" YELLOW = u"\u001b[33m" BLUE = u"\u001b[34m" MAGENTA = u"\u001b[35m" CYAN = u"\u001b[36m" WHITE = u"\u001b[37m" BBLACK = u"\u001b[30;1m" BRED = u"\u001b[31;1m" BGREEN = u"\u001b[32;1m" BYELLOW = u"\u001b[33;1m" BBLUE = u"\u001b[34;1m" BMAGENTA = u"\u001b[3...
black = u'\x1b[30m' red = u'\x1b[31m' green = u'\x1b[32m' yellow = u'\x1b[33m' blue = u'\x1b[34m' magenta = u'\x1b[35m' cyan = u'\x1b[36m' white = u'\x1b[37m' bblack = u'\x1b[30;1m' bred = u'\x1b[31;1m' bgreen = u'\x1b[32;1m' byellow = u'\x1b[33;1m' bblue = u'\x1b[34;1m' bmagenta = u'\x1b[35;1m' bcyan = u'\x1b[36;1m' b...
''' module for implementation of merge sort ''' def merge_sort(arr: list): if len(arr) > 1: mid = len(arr) // 2 L = arr[:mid] R = arr[mid:] merge_sort(L) merge_sort(R) i, j, k = 0, 0, 0 while (i < len(L) and j < len(R)): if (L[i] < R[j])...
""" module for implementation of merge sort """ def merge_sort(arr: list): if len(arr) > 1: mid = len(arr) // 2 l = arr[:mid] r = arr[mid:] merge_sort(L) merge_sort(R) (i, j, k) = (0, 0, 0) while i < len(L) and j < len(R): if L[i] < R[j]: ...
#!/usr/bin/env python3 class MessageBroadcast: def __init__(self, friend_graph, start_person): self.friend_graph = friend_graph self.start_person = start_person self.people_without_message = list(friend_graph.keys()) self.step_number = 0 self.new_people_with_message_in_last...
class Messagebroadcast: def __init__(self, friend_graph, start_person): self.friend_graph = friend_graph self.start_person = start_person self.people_without_message = list(friend_graph.keys()) self.step_number = 0 self.new_people_with_message_in_last_step = [] def broa...
''' pythagorean_triples.py: When given the sides of a triangle, tells the user whether the triangle is a right triangle. Based on https://www.redd.it/19jwi6 ''' while True: sides = input('Enter the three sides of a triangle, separated by spaces: ') try: sides = [int(x) for x in sides.split()] e...
""" pythagorean_triples.py: When given the sides of a triangle, tells the user whether the triangle is a right triangle. Based on https://www.redd.it/19jwi6 """ while True: sides = input('Enter the three sides of a triangle, separated by spaces: ') try: sides = [int(x) for x in sides.split()] ex...
# -*- coding: utf-8 -*- # Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com> # License: MIT (see LICENSE.TXT file) ID = r"[0-9]+" SLUG = r"[a-z0-9\-]+" USERNAME = r"[\w.@+-]+" # see django.contrib.auth.forms.UserCreationForm def _build_arg(name, pattern): return "(?P<%s>%s)" % (name...
id = '[0-9]+' slug = '[a-z0-9\\-]+' username = '[\\w.@+-]+' def _build_arg(name, pattern): return '(?P<%s>%s)' % (name, pattern) def arg_id(name): return _build_arg(name, ID) def arg_slug(name): return _build_arg(name, SLUG) def arg_username(name): return _build_arg(name, USERNAME)
translations = { "startMessage": "I can help you see all of your EqualHash.pt statistics\n\nYou can control me by " "sending these " "commands:\n\n/newaddr - Add new address\n/myaddrs - View all address\n\n*Edit " "Addresses*\n/setname - Ch...
translations = {'startMessage': "I can help you see all of your EqualHash.pt statistics\n\nYou can control me by sending these commands:\n\n/newaddr - Add new address\n/myaddrs - View all address\n\n*Edit Addresses*\n/setname - Change a address's name\n/setaddress - Change the address\n/deleteaddr - Delete a address\n\...
# A Python program to demonstrate need # of packing and unpacking # A sample function that takes 4 arguments # and prints them. def fun(a, b, c, d): print(a, b, c, d) # Driver Code my_list = [1, 2, 3, 4] # This doesn't work fun(my_list)
def fun(a, b, c, d): print(a, b, c, d) my_list = [1, 2, 3, 4] fun(my_list)
''' 1. Write a Python program for binary search. Binary Search : In computer science, a binary search or half-interval search algorithm finds the position of a target value within a sorted array. The binary search algorithm can be classified as a dichotomies divide-and-conquer search algorithm and executes in logarith...
""" 1. Write a Python program for binary search. Binary Search : In computer science, a binary search or half-interval search algorithm finds the position of a target value within a sorted array. The binary search algorithm can be classified as a dichotomies divide-and-conquer search algorithm and executes in logarith...
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: __init__.py MCL_OS_ARCH_I386 = 0 MCL_OS_ARCH_SPARC = 1 MCL_OS_ARCH_ALPHA = 2 MCL_OS_ARCH_ARM = 3 MCL_OS_ARCH_PPC = 4 MCL_OS_ARCH_HPPA1 = 5 MCL_OS_ARC...
mcl_os_arch_i386 = 0 mcl_os_arch_sparc = 1 mcl_os_arch_alpha = 2 mcl_os_arch_arm = 3 mcl_os_arch_ppc = 4 mcl_os_arch_hppa1 = 5 mcl_os_arch_hppa2 = 6 mcl_os_arch_mips = 7 mcl_os_arch_x64 = 8 mcl_os_arch_ia64 = 9 mcl_os_arch_sparc64 = 10 mcl_os_arch_mips64 = 11 mcl_os_arch_unknown = 65535 arch_names = {MCL_OS_ARCH_I386: ...
#!/usr/bin/python ''' --- Part Two --- "Great work; looks like we're on the right track after all. Here's a star for your effort." However, the program seems a little worried. Can programs be worried? "Based on what we're seeing, it looks like all the User wanted is some information about the evenly divisible values...
""" --- Part Two --- "Great work; looks like we're on the right track after all. Here's a star for your effort." However, the program seems a little worried. Can programs be worried? "Based on what we're seeing, it looks like all the User wanted is some information about the evenly divisible values in the spreadsheet...
File1 = open(input("File path of first list in text file:"), "rt") File2 = open(input("File path of second list in text file:"), "rt") file = open("Compared_List.txt", "a+") suffix_sp = [] #a list of genuses with "sp." suffix to denote the entire genus species = [] #list of species from File1 if __name__ =...
file1 = open(input('File path of first list in text file:'), 'rt') file2 = open(input('File path of second list in text file:'), 'rt') file = open('Compared_List.txt', 'a+') suffix_sp = [] species = [] if __name__ == '__main__': for line in File1: if line[-4:-1] == 'sp.': suffix_sp.append(line[:...
class Solution: def zigzagLevelOrder(self, root): if root is None: return [] res = [] res.append([root.val]) queue = [] queue.append(root) level_nodes = [] level_node_count = 1 next_level_node_count = 0 left_to_right = True ...
class Solution: def zigzag_level_order(self, root): if root is None: return [] res = [] res.append([root.val]) queue = [] queue.append(root) level_nodes = [] level_node_count = 1 next_level_node_count = 0 left_to_right = True ...