content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
map = [200090710, 200090610] sm.sendSay("Where would you like to go? \r\n#L0#Victoria Island#l\r\n#L1#Orbis#l") sm.warp(map[answer], 0)
map = [200090710, 200090610] sm.sendSay('Where would you like to go? \r\n#L0#Victoria Island#l\r\n#L1#Orbis#l') sm.warp(map[answer], 0)
class DependenceNode: def __init__(self): self.parents = [] self.children = [] self.inter_parents = [] self.inter_children = [] self.fictitious_parents = [] self.fictitious_children = [] self.ast = None def add_parent(self, parent): self.parents....
class Dependencenode: def __init__(self): self.parents = [] self.children = [] self.inter_parents = [] self.inter_children = [] self.fictitious_parents = [] self.fictitious_children = [] self.ast = None def add_parent(self, parent): self.parents....
def longest_consec(strarr, k): output,n = None ,len(strarr) if n == 0 or k > n or k<=0 : return "" for i in range(n-k+1): aux = '' for j in range(i,i+k): aux += strarr[j] if output == None or len(output) < len(aux): output = aux return output
def longest_consec(strarr, k): (output, n) = (None, len(strarr)) if n == 0 or k > n or k <= 0: return '' for i in range(n - k + 1): aux = '' for j in range(i, i + k): aux += strarr[j] if output == None or len(output) < len(aux): output = aux return...
f = open("demo.txt", "r")#read file print(f.read()) c=open("demosfile.txt","r") print(c.read()) w= open("demo.txt", "a") #update file with additional data w.write("Now the file has one more line!") ow = open("demo.txt", "w") #delete entire content and add new content ow.write("Woops! I have deleted the content!"...
f = open('demo.txt', 'r') print(f.read()) c = open('demosfile.txt', 'r') print(c.read()) w = open('demo.txt', 'a') w.write('Now the file has one more line!') ow = open('demo.txt', 'w') ow.write('Woops! I have deleted the content!') new = open('demosfile.txt', 'w') new.write('a new file is created with python program an...
# Banker's Algorithm n = 5 # no. of processes / rows m = 4 # no. of resources / columns # Maximum matrix - denotes maximum demand of each process maxi = [[0, 0, 1, 2], [1, 7, 5, 0], [2, 3, 5, 6], [0, 6, 5, 2], [0, 6, 5, 6]] # Allocation matrix - denotes no. of resources allocated to pr...
n = 5 m = 4 maxi = [[0, 0, 1, 2], [1, 7, 5, 0], [2, 3, 5, 6], [0, 6, 5, 2], [0, 6, 5, 6]] alloc = [[0, 0, 1, 2], [1, 0, 0, 0], [1, 3, 5, 4], [0, 6, 3, 2], [0, 0, 1, 4]] avail = [1, 5, 2, 0] f = [0] * n ans = [0] * n ind = 0 need = [[0 for i in range(m)] for i in range(n)] for i in range(n): for j in range(m): ...
class dotGuideline_t(object): # no doc Curve = None Id = None Spacing = None
class Dotguideline_T(object): curve = None id = None spacing = None
# draw some simple shapes # hint! The order in which you draw is important # change x and y to move him around x = width/2 y = 25 w = 23 # make him bigger or smaller h = w # distort by changing the h seperatly bmi = 1 # body mass index # a line takes 4 values the starting point and the end point line(x - w, y + h, x +w...
x = width / 2 y = 25 w = 23 h = w bmi = 1 line(x - w, y + h, x + w, y + h) ellipse(x, y, w, h) point(x, y) rect(x - bmi / 2, y + h, bmi, h) no_fill() begin_shape() vertex(x - w, y + h * 3) vertex(x - w, y + h * 2) vertex(x + w, y + h * 2) vertex(x + w, y + h * 3) end_shape()
AdminApp.install('/tmp/installers/war_app/JspDemo.war', '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname JspDemo -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDis...
AdminApp.install('/tmp/installers/war_app/JspDemo.war', '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname JspDemo -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\\.dll=755#.*\\.so=755#.*\\.a=755#.*\\.sl=755 -noallo...
class Queue(object): def __init__(self,vals,n=10): self.queue = [None for x in range(n)] self.head = -1 self.tail = -1 for val in vals: self.add(val) def add(self,val): if (self.tail+1) % len(self.queue) == self.head: print("Queue full") ...
class Queue(object): def __init__(self, vals, n=10): self.queue = [None for x in range(n)] self.head = -1 self.tail = -1 for val in vals: self.add(val) def add(self, val): if (self.tail + 1) % len(self.queue) == self.head: print('Queue full') ...
# Split into train and test data for GAN def build_dataset(X, nx, ny, n_test = 0): m = X.shape[0] print("Number of images: " + str(m) ) X = X.T Y = np.zeros((m,)) # Random permutation of samples p = np.random.permutation(m) X = X[:,p] Y = Y[p] # Reshape X and crop to 96x96 pixels X_new ...
def build_dataset(X, nx, ny, n_test=0): m = X.shape[0] print('Number of images: ' + str(m)) x = X.T y = np.zeros((m,)) p = np.random.permutation(m) x = X[:, p] y = Y[p] x_new = np.zeros((m, nx, ny)) for i in range(m): xtemp = np.reshape(X[:, i], (101, 101)) X_new[i, :...
# # Solution to Project Euler Problem 1 # by Lucas Chen # # Answer: 233168 # NUM = 1000 # Compute sum of the naturals that are a multiple of 3 or 5 and less than [NUM] def compute(): return sum(i for i in range(1, NUM) if i % 3 == 0 or i % 5 == 0) if __name__ == "__main__": print(compute())
num = 1000 def compute(): return sum((i for i in range(1, NUM) if i % 3 == 0 or i % 5 == 0)) if __name__ == '__main__': print(compute())
n=int(input("enter a number ")) backup=n num=0 while(n>0): x=n%10 n=n//10 x=x**3 num+=x if(num==backup): print(num,"is a armstrong number") else: print(backup,"is not a armstrong number")
n = int(input('enter a number ')) backup = n num = 0 while n > 0: x = n % 10 n = n // 10 x = x ** 3 num += x if num == backup: print(num, 'is a armstrong number') else: print(backup, 'is not a armstrong number')
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( arr , n , k ) : for i in range ( 0 , k ) : x = arr [ 0 ] for j in range ( 0 , n - 1 ) : ...
def f_gold(arr, n, k): for i in range(0, k): x = arr[0] for j in range(0, n - 1): arr[j] = arr[j + 1] arr[n - 1] = x if __name__ == '__main__': param = [([75], 0, 0), ([-58, -60, -38, 48, -2, 32, -48, -46, 90, -54, -18, 28, 72, 86, 0, -2, -74, 12, -58, 90, -30, 10, -88, 2, -1...
# # PySNMP MIB module CISCO-DOT11-HT-PHY-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-HT-PHY-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:38:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ...
#!/usr/bin/env python class Solution: def wordBreak(self, s, wordDict): if len(s) == 0: return True ret = False for w in wordDict: if s.startswith(w): ret = ret or self.wordBreak(s[len(w):], wordDict) return ret s, wordDict = 'leetcode', ['leet', 'code']...
class Solution: def word_break(self, s, wordDict): if len(s) == 0: return True ret = False for w in wordDict: if s.startswith(w): ret = ret or self.wordBreak(s[len(w):], wordDict) return ret (s, word_dict) = ('leetcode', ['leet', 'code']) (s, ...
customer_basket_cost = 34 customer_basket_weight = 44 shipping_cost = customer_basket_weight * 1.2 #Write if statement here to calculate the total cost if customer_basket_weight >= 100: coste_cesta = customer_basket_cost print("Total: " + str(coste_cesta) + " euros") else: coste_cesta = customer_basket_co...
customer_basket_cost = 34 customer_basket_weight = 44 shipping_cost = customer_basket_weight * 1.2 if customer_basket_weight >= 100: coste_cesta = customer_basket_cost print('Total: ' + str(coste_cesta) + ' euros') else: coste_cesta = customer_basket_cost + shipping_cost print('Total: ' + str(coste_cest...
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the message...
def test(): assert not cat_cols is None, 'Your answer for cat_cols does not exist. Have you assigned the list of labels for categorical columns to the correct variable name?' assert type(cat_cols) == list, 'cat_cols does not appear to be of type list. Can you store all the labels of the categorical columns into...
n, q = map(int, input().split()) graph = [[] for _ in range(n)] for i in range(n - 1): a, b = map(int, input().split()) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) group = [[], []] town_color = [-1] * n tmp = [[0, -1, 0]] while tmp: v, past, color = tmp.pop() town_color[v] = color gr...
(n, q) = map(int, input().split()) graph = [[] for _ in range(n)] for i in range(n - 1): (a, b) = map(int, input().split()) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) group = [[], []] town_color = [-1] * n tmp = [[0, -1, 0]] while tmp: (v, past, color) = tmp.pop() town_color[v] = color ...
def main(): grid = open("data.txt").readlines() for i in range(0, len(grid)): grid[i] = grid[i][:-1] x_width = len(grid[i]) y_length = len(grid) ctr = 0 y_pos = 0 x_pos = 0 product = 1 for i in [[1,1], [3,1], [5,1], [7,1], [1,2]]: while y_pos < y_length: ...
def main(): grid = open('data.txt').readlines() for i in range(0, len(grid)): grid[i] = grid[i][:-1] x_width = len(grid[i]) y_length = len(grid) ctr = 0 y_pos = 0 x_pos = 0 product = 1 for i in [[1, 1], [3, 1], [5, 1], [7, 1], [1, 2]]: while y_pos < y_length: ...
class Node: def __init__(self, data): self.data = data self.left = self.right = None def printSpiral(root): h = height(root) condi = False for i in range(1, h + 1): printGivenLevel(root, i, condi) condi = not condi def printGivenLevel(root, level, condi): if ro...
class Node: def __init__(self, data): self.data = data self.left = self.right = None def print_spiral(root): h = height(root) condi = False for i in range(1, h + 1): print_given_level(root, i, condi) condi = not condi def print_given_level(root, level, condi): if r...
# Course title: Udemy Course: Introduction to the Python Language # Instructor: Prof. Dr. Diego Mariano # Example adapted by: Charles Fernandes de Souza # Date: July 10, 2021 # Print Message print("Hello, World!") print("Running Google Colab with Python")
print('Hello, World!') print('Running Google Colab with Python')
def merge(lst1,lst2): lst = [] while lst1 and lst2: if lst1[0] < lst2[0]: lst.append(lst1[0]) lst1.remove(lst1[0]) elif lst1[0] > lst2[0]: lst.append(lst2[0]) lst2.remove(lst2[0]) else: lst.append(lst1[0]) lst1.remov...
def merge(lst1, lst2): lst = [] while lst1 and lst2: if lst1[0] < lst2[0]: lst.append(lst1[0]) lst1.remove(lst1[0]) elif lst1[0] > lst2[0]: lst.append(lst2[0]) lst2.remove(lst2[0]) else: lst.append(lst1[0]) lst1.remo...
class Alternativa(): def __init__(self, contenido: str, ayuda: str): self.contenido = contenido self.ayuda= ayuda def mostrar_alternativa(self) -> None: print(self.contenido) if self.ayuda: print(f"({self.ayuda})")
class Alternativa: def __init__(self, contenido: str, ayuda: str): self.contenido = contenido self.ayuda = ayuda def mostrar_alternativa(self) -> None: print(self.contenido) if self.ayuda: print(f'({self.ayuda})')
PAD = 0 EOS = 1 BOS = 2 UNK = 3 UNK_WORD = '<unk>' PAD_WORD = '<pad>' BOS_WORD = '<s>' EOS_WORD = '</s>' NEG_INF = -10000 # -float('inf')
pad = 0 eos = 1 bos = 2 unk = 3 unk_word = '<unk>' pad_word = '<pad>' bos_word = '<s>' eos_word = '</s>' neg_inf = -10000
# !/usr/bin/env python3 ############################################################################# # # # Program purpose: Prints even numbers in list before an exception. # # The exception being inclusive. ...
def print_even(num, exc): for x in num: if int(x) % 2 == 0 and x != exc: print(f'{x} ') elif x == exc: print(f'{x} ') break if __name__ == '__main__': numbers = [386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219,...
employees = [] with open("employees.txt", mode="r") as myfile: for line in myfile: employee = line.strip().split(",") full_name, salary, birth_year, department, full_time = employee employees.append((full_name, float(salary), int(birth_year), department, full_time =...
employees = [] with open('employees.txt', mode='r') as myfile: for line in myfile: employee = line.strip().split(',') (full_name, salary, birth_year, department, full_time) = employee employees.append((full_name, float(salary), int(birth_year), department, full_time == 'FULL_TIME')) prin...
a=[] n=int(input("Enter no. of elements: ")) print("Enter array:") for x in range(n): element=int(input()) a.append(element) a.sort() b=[] for i in range(0,len(a)-1): if a[i]==a[i+1]: b.append(a[i]) b=list(set(b)) a=set(a) while(len(b)>0): a.remove(b[0]) b.pop(0) print("Output:",end=" ") pri...
a = [] n = int(input('Enter no. of elements: ')) print('Enter array:') for x in range(n): element = int(input()) a.append(element) a.sort() b = [] for i in range(0, len(a) - 1): if a[i] == a[i + 1]: b.append(a[i]) b = list(set(b)) a = set(a) while len(b) > 0: a.remove(b[0]) b.pop(0) print('O...
N, K = map(int, input().split()) A = list(map(int, input().split())) bcs = [0] * 41 for i in range(N): a = A[i] for j in range(41): if a & (1 << j) != 0: bcs[j] += 1 X = 0 for i in range(40, -1, -1): if bcs[i] >= N - bcs[i]: continue t = 1 << i if X + t <= K: X ...
(n, k) = map(int, input().split()) a = list(map(int, input().split())) bcs = [0] * 41 for i in range(N): a = A[i] for j in range(41): if a & 1 << j != 0: bcs[j] += 1 x = 0 for i in range(40, -1, -1): if bcs[i] >= N - bcs[i]: continue t = 1 << i if X + t <= K: x +=...
# Assignment 1 def assignment_1(): print("Working on assignment 1\n") # Assignment 2 def number_is_even(counter): if counter % 2 == 0: return True else: return False def assignment_2(): for counter in range (1,21): if number_is_even(counter): print("Even numb...
def assignment_1(): print('Working on assignment 1\n') def number_is_even(counter): if counter % 2 == 0: return True else: return False def assignment_2(): for counter in range(1, 21): if number_is_even(counter): print('Even number:', counter) def assignment_3(): ...
class Solution: def getSum(self, a: int, b: int) -> int: a &= 0xFFFFFFFF b &= 0xFFFFFFFF while b: carry = a & b a = a ^ b b = ((carry) << 1) & 0xFFFFFFFF return a if a < 0x80000000 else ~(a ^ 0xFFFFFFFF)
class Solution: def get_sum(self, a: int, b: int) -> int: a &= 4294967295 b &= 4294967295 while b: carry = a & b a = a ^ b b = carry << 1 & 4294967295 return a if a < 2147483648 else ~(a ^ 4294967295)
a=1 b=3 c=a+b print(c)
a = 1 b = 3 c = a + b print(c)
UL = {} MT = { 'start_message' : ['Welcome to the StolenBottle Bot. I was created to store and reproduce all content that you and ' 'other users share with me.\n' 'Send me whatever you want (text, audio, text, etc.) and I will reply with something from mine archive.\n'...
ul = {} mt = {'start_message': ['Welcome to the StolenBottle Bot. I was created to store and reproduce all content that you and other users share with me.\nSend me whatever you want (text, audio, text, etc.) and I will reply with something from mine archive.\n/help - show help\n/top - top of senders\n/lang - switch lan...
#!/usr/bin/python # list_sorting.py numbers = [4, 3, 6, 1, 2, 0, 5 ] print (numbers) numbers.sort() print (numbers)
numbers = [4, 3, 6, 1, 2, 0, 5] print(numbers) numbers.sort() print(numbers)
def read_file(path): f = open(path, 'a+') f.seek(0) files = [line for line in f.readlines()] f.close() return files
def read_file(path): f = open(path, 'a+') f.seek(0) files = [line for line in f.readlines()] f.close() return files
# # PySNMP MIB module ELTEX-MES-BRIDGE-ERPS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-BRIDGE-ERPS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:46:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ...
DATASETS = { "imdb": { "train": "s3://suching-dev/final-datasets/imdb/train.jsonl", "dev": "s3://suching-dev/final-datasets/imdb/dev.jsonl", "test": "s3://suching-dev/final-datasets/imdb/test.jsonl", "unlabeled": "s3://suching-dev/final-datasets/imdb/unlabeled.jsonl", "refere...
datasets = {'imdb': {'train': 's3://suching-dev/final-datasets/imdb/train.jsonl', 'dev': 's3://suching-dev/final-datasets/imdb/dev.jsonl', 'test': 's3://suching-dev/final-datasets/imdb/test.jsonl', 'unlabeled': 's3://suching-dev/final-datasets/imdb/unlabeled.jsonl', 'reference_counts': 's3://suching-dev/final-datasets/...
''' this function can handle oracle script with block comment handle change drop table table to begin execute immediate \'drop table UTLMGT_DASHBOARD.temp_gen_dm_auth_2\'; exception when others then null; end ''' def convertToBODSScript ( path): f0 = open(path,'r') f1 = [] for line in f0: ...
""" this function can handle oracle script with block comment handle change drop table table to begin execute immediate 'drop table UTLMGT_DASHBOARD.temp_gen_dm_auth_2'; exception when others then null; end """ def convert_to_bods_script(path): f0 = open(path, 'r') f1 = [] for line in f0: if line....
size = int(input()) arr=[] for i in range(size): string = list(input()) rev_string = list(reversed(string)) msg = "Funny" for j in range(len(string)): #print(j) if not abs(ord(string[j])-ord(string[j-1])) == abs(ord(rev_string[j])-ord(rev_string[j-1])): msg="Not Funny" ...
size = int(input()) arr = [] for i in range(size): string = list(input()) rev_string = list(reversed(string)) msg = 'Funny' for j in range(len(string)): if not abs(ord(string[j]) - ord(string[j - 1])) == abs(ord(rev_string[j]) - ord(rev_string[j - 1])): msg = 'Not Funny' ...
family = 'wiktionary' mylang = 'en' usernames['wiktionary']['en'] = u'AryamanA' # change to your username console_encoding = 'utf-8' minthrottle = 0 maxthrottle = 1
family = 'wiktionary' mylang = 'en' usernames['wiktionary']['en'] = u'AryamanA' console_encoding = 'utf-8' minthrottle = 0 maxthrottle = 1
{ 2 : { "operator" : "selection", "selectivity" : 0.2 }, 4 : { "operator" : "selection", "selectivity" : 0.5 }, 5 : { "operator" : "join", "selectivity" : 0.19, "multimatch" : False }, 7 : { "operator" : "selection", ...
{2: {'operator': 'selection', 'selectivity': 0.2}, 4: {'operator': 'selection', 'selectivity': 0.5}, 5: {'operator': 'join', 'selectivity': 0.19, 'multimatch': False}, 7: {'operator': 'selection', 'selectivity': 0.5}, 8: {'operator': 'join', 'selectivity': 0.05, 'multimatch': False}}
while True: inp = input('Enter a number: ') if inp == 'done' : break try: num = float(inp) except: print ('Invalid input') continue numbers = list(num) minimum = None maximum = None for num in numbers : ...
while True: inp = input('Enter a number: ') if inp == 'done': break try: num = float(inp) except: print('Invalid input') continue numbers = list(num) minimum = None maximum = None for num in numbers: if minimum == None or num < minimum: minimum = num for num i...
# Programmed by </Rudransh Joshi> | Class XII - A | Kendriya Vidyalaya Haldwani Cantt :) out = [] # Initialising an empty list which will store out results def table(num, start=1): # Table function which will return us a list of numbers as table of the given number global upto if start > upto: # Code logic ...
out = [] def table(num, start=1): global upto if start > upto: return out.append(str(num * start)) return table(num, start + 1) while True: num = int(input('Enter a number to print out its table:\t')) upto = int(input('Enter number upto where you want to print table:\t')) table(num,...
LOADTRACKS = "/loadtracks?identifier={query}" DECODETRACK = "/decodetrack" DECODETRACKS = "/decodetracks" ROUTEPLANNER = "/routeplanner/status" UNMARK_FAILED_ADDRESS = "/routeplanner/free/address" UNMARK_ALL_FAILED_ADDRESS = "/routeplanner/free/all"
loadtracks = '/loadtracks?identifier={query}' decodetrack = '/decodetrack' decodetracks = '/decodetracks' routeplanner = '/routeplanner/status' unmark_failed_address = '/routeplanner/free/address' unmark_all_failed_address = '/routeplanner/free/all'
#print(args) if args[5] == 'COMP': outTop = op('null') m = op('movie') t = op('tox') fromPath = args[6] + '/' + args[0] type = op(fromPath + '/info')[1, 'type'] path = op(fromPath + '/info')[1, 'path'] parent().par.Mediatype = type op('display_select').par.top = fromPath + '/display' op(fromPath).op('m...
if args[5] == 'COMP': out_top = op('null') m = op('movie') t = op('tox') from_path = args[6] + '/' + args[0] type = op(fromPath + '/info')[1, 'type'] path = op(fromPath + '/info')[1, 'path'] parent().par.Mediatype = type op('display_select').par.top = fromPath + '/display' op(fromPat...
#By enumerating with two variables for i,char in enumerate('enumerate'): print(1,char) for i,c in enumerate(list(range(100))): print(i,c) if c == 50: #F is to make the print be able to format the i to a value. print(f'Index of 50 is: {i}')
for (i, char) in enumerate('enumerate'): print(1, char) for (i, c) in enumerate(list(range(100))): print(i, c) if c == 50: print(f'Index of 50 is: {i}')
def check_values(group, value): for x in group: if x == value: return True return False print (check_values([34, 56, 77], 22)) print (check_values([34, 56, 77], 34))
def check_values(group, value): for x in group: if x == value: return True return False print(check_values([34, 56, 77], 22)) print(check_values([34, 56, 77], 34))
a = (1, 2, 3, 4, 5) print(a, type(a)) b = (6, 7, [10, 20, 30]) print(b, type(b)) b[2].append(100) print(b, type(b)) print(len(a)) print(2 in a or 5 in a and 3 in a) print(a + b, b + a) print(sum(a)) print(a.index(2)) a.count(4) print(a.__sizeof__()) # you can't change tuple after init # but you can make ch...
a = (1, 2, 3, 4, 5) print(a, type(a)) b = (6, 7, [10, 20, 30]) print(b, type(b)) b[2].append(100) print(b, type(b)) print(len(a)) print(2 in a or (5 in a and 3 in a)) print(a + b, b + a) print(sum(a)) print(a.index(2)) a.count(4) print(a.__sizeof__()) list1 = list(a) print(list1, type(list1)) list1.append(10) a = tuple...
class Solution: def lowestCommonAncestor(self, root, p, q): curr = root while curr: if p.val > curr.val and q.val > curr.val: curr = curr.right elif p.val < curr.val and q.val < curr.val: curr = curr.left else: retu...
class Solution: def lowest_common_ancestor(self, root, p, q): curr = root while curr: if p.val > curr.val and q.val > curr.val: curr = curr.right elif p.val < curr.val and q.val < curr.val: curr = curr.left else: re...
A5_CHECK_DIR = '/etc/dd-agent/checks.d' A5_CONF_DIR = '/etc/dd-agent/conf.d' A5_EXE_PATH = '/opt/datadog-agent/agent/agent.py' A6_CHECK_DIR = '/etc/datadog-agent/checks.d' A6_CONF_DIR = '/etc/datadog-agent/conf.d' A6_EXE_PATH = '/opt/datadog-agent/bin/agent/agent' def get_agent_exe_path(agent_version_major): if ...
a5_check_dir = '/etc/dd-agent/checks.d' a5_conf_dir = '/etc/dd-agent/conf.d' a5_exe_path = '/opt/datadog-agent/agent/agent.py' a6_check_dir = '/etc/datadog-agent/checks.d' a6_conf_dir = '/etc/datadog-agent/conf.d' a6_exe_path = '/opt/datadog-agent/bin/agent/agent' def get_agent_exe_path(agent_version_major): if in...
def pytest_addoption(parser): parser.addoption("--unity_exe_path", action="store", default=None)
def pytest_addoption(parser): parser.addoption('--unity_exe_path', action='store', default=None)
# # Copyright (C) 2018 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
model = model() i1 = input('input', 'TENSOR_FLOAT32', '{2, 2}') perms = input('perms', 'TENSOR_INT32', '{0}') output = output('output', 'TENSOR_FLOAT32', '{2, 2}') model = model.Operation('TRANSPOSE', i1, perms).To(output) quant8 = data_type_converter().Identify({i1: ('TENSOR_QUANT8_ASYMM', 0.5, 0), output: ('TENSOR_QU...
# A foolish try. def splitp(p: str): res = [] tmp = "" for i in range(len(p)): if p[i] != "*" and p[i] != ".": tmp += p[i] elif p[i] == ".": res.append(tmp) res.append(p[i]) tmp = "" else: if len(res) > 0 and res[-1] == "."...
def splitp(p: str): res = [] tmp = '' for i in range(len(p)): if p[i] != '*' and p[i] != '.': tmp += p[i] elif p[i] == '.': res.append(tmp) res.append(p[i]) tmp = '' else: if len(res) > 0 and res[-1] == '.' and (tmp == ''): ...
__author__ = 'awbennett' class AbstractMethod(object): def __init__(self): pass def fit(self, x_train, z_train, y_train, x_dev, z_dev, y_dev): raise NotImplementedError() def predict(self, x_test): raise NotImplementedError()
__author__ = 'awbennett' class Abstractmethod(object): def __init__(self): pass def fit(self, x_train, z_train, y_train, x_dev, z_dev, y_dev): raise not_implemented_error() def predict(self, x_test): raise not_implemented_error()
def findDivisible(numberList): print("Given list is ",numberList) print("Divisible by 5 in a list") for num in numberList: if(num%5==0): print(num) numberList=[10,55,21,26,55] findDivisible(numberList)
def find_divisible(numberList): print('Given list is ', numberList) print('Divisible by 5 in a list') for num in numberList: if num % 5 == 0: print(num) number_list = [10, 55, 21, 26, 55] find_divisible(numberList)
event_aliases = { 'halloween 2020': 1, 'candy': 2, 'swimsuits 2020': 3, 'maids': 5, 'christmas 2020': 6, 'countdown': 7, 'monster hunter pt1': 9, 'mh1': 9, 'monster hunter pt2': 10, 'mh2': 10, }
event_aliases = {'halloween 2020': 1, 'candy': 2, 'swimsuits 2020': 3, 'maids': 5, 'christmas 2020': 6, 'countdown': 7, 'monster hunter pt1': 9, 'mh1': 9, 'monster hunter pt2': 10, 'mh2': 10}
BZX = Contract.from_abi("BZX", "0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f", interface.IBZx.abi) TOKEN_REGISTRY = Contract.from_abi("TOKEN_REGISTRY", "0xf0E474592B455579Fe580D610b846BdBb529C6F7", TokenRegistry.abi) list = TOKEN_REGISTRY.getTokens(0, 100) for l in list: iTokenTemp = Contract.from_abi("iTokenTemp", ...
bzx = Contract.from_abi('BZX', '0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f', interface.IBZx.abi) token_registry = Contract.from_abi('TOKEN_REGISTRY', '0xf0E474592B455579Fe580D610b846BdBb529C6F7', TokenRegistry.abi) list = TOKEN_REGISTRY.getTokens(0, 100) for l in list: i_token_temp = Contract.from_abi('iTokenTemp',...
expected_output = { 'vrf': { 'default': { 'local_label': { 201: { 'outgoing_label_or_vc': { 'Pop tag': { 'prefix_or_tunnel_id': { '10.18.18.18/32': { ...
expected_output = {'vrf': {'default': {'local_label': {201: {'outgoing_label_or_vc': {'Pop tag': {'prefix_or_tunnel_id': {'10.18.18.18/32': {'outgoing_interface': {'Port-channel1/1/0': {'next_hop': 'point2point', 'bytes_label_switched': 0}}}}}}}, 'No Label': {'outgoing_label_or_vc': {'2/35': {'prefix_or_tunnel_id': {'1...
a = 1 b = 2 num = 3
a = 1 b = 2 num = 3
_base_ = [ 'r50_sz224_4xb64_head1_lr0_1_step_ep20.py', ] # optimizer optimizer = dict(lr=0.01)
_base_ = ['r50_sz224_4xb64_head1_lr0_1_step_ep20.py'] optimizer = dict(lr=0.01)
KNOWN_SIDS = { "S-1-0": "Null Authority", "S-1-0-0": "Nobody", "S-1-1": "World Authority", "S-1-1-0": "Everyone", "S-1-2": "Local Authority", "S-1-2-0": "Local", "S-1-3": "Creator Authority", "S-1-3-0": "Creator Owner", "S-1-3-1": "Creator Group", "S-1-3-4": "Owner Rights", ...
known_sids = {'S-1-0': 'Null Authority', 'S-1-0-0': 'Nobody', 'S-1-1': 'World Authority', 'S-1-1-0': 'Everyone', 'S-1-2': 'Local Authority', 'S-1-2-0': 'Local', 'S-1-3': 'Creator Authority', 'S-1-3-0': 'Creator Owner', 'S-1-3-1': 'Creator Group', 'S-1-3-4': 'Owner Rights', 'S-1-4': 'Non-unique Authority', 'S-1-5': 'NT ...
''' Write a Python program to count the number occurrence of a specific character in a string. ''' data = input("Enter a long sentence: ") datas = data[4] print(data.count(datas))
""" Write a Python program to count the number occurrence of a specific character in a string. """ data = input('Enter a long sentence: ') datas = data[4] print(data.count(datas))
class Reversed_Proxy(object): def __init__(self, app, script_name=None, scheme='http', server=None): self.app = app self.script_name = script_name self.scheme = scheme self.server = server def __call__(self, environ, start_response): script_name = environ.get('HTTP_X_SC...
class Reversed_Proxy(object): def __init__(self, app, script_name=None, scheme='http', server=None): self.app = app self.script_name = script_name self.scheme = scheme self.server = server def __call__(self, environ, start_response): script_name = environ.get('HTTP_X_SC...
class ResponsePayloadOperations: def ProductsJSON(self, records): products = [] i = 0 while i < len(records): products.append({ 'id' : records[i][0], 'name' : records[i][1], 'description': records[i][2], 'count' :...
class Responsepayloadoperations: def products_json(self, records): products = [] i = 0 while i < len(records): products.append({'id': records[i][0], 'name': records[i][1], 'description': records[i][2], 'count': records[i][3], 'price': float(records[i][4])}) i += 1 ...
class dtype(object): def __init__(self, name): self.type_name = name float = dtype('float') double = dtype('double') half = dtype('half') uint8 = dtype('uint8') int16 = dtype('int16') int32 = dtype('int32') int64 = dtype('int64')
class Dtype(object): def __init__(self, name): self.type_name = name float = dtype('float') double = dtype('double') half = dtype('half') uint8 = dtype('uint8') int16 = dtype('int16') int32 = dtype('int32') int64 = dtype('int64')
#!/usr/bin/python3 def print_list_integer(my_list=[]): for i in range(len(my_list)): print("{:d}".format(my_list[i]))
def print_list_integer(my_list=[]): for i in range(len(my_list)): print('{:d}'.format(my_list[i]))
res=0 for i in range(1,1001): res += i**i res=str(res) #res='nursyahjaya' print(res[len(res)-10:])
res = 0 for i in range(1, 1001): res += i ** i res = str(res) print(res[len(res) - 10:])
def get_token_group(partitioner="murmur3", group="static-random"): return static_tokens[partitioner][group] static_tokens = { "murmur3": { "static-random": [ "-1046743493966813495,-1127180199537005110,-118022819648698044,-1189703775502125091,-1249903220729897117,-1363229807648136104,-14179...
def get_token_group(partitioner='murmur3', group='static-random'): return static_tokens[partitioner][group] static_tokens = {'murmur3': {'static-random': ['-1046743493966813495,-1127180199537005110,-118022819648698044,-1189703775502125091,-1249903220729897117,-1363229807648136104,-1417918458648377457,-1437865264282...
COMMAND_HELP = ''' oplab <command> [<args>] ''' TRAIN_COMMAND_HELP = ''' oplab t|train --params <params_file_path> --output <model_save_path> '''
command_help = '\n oplab <command> [<args>]\n' train_command_help = '\n oplab t|train \n --params <params_file_path> \n --output <model_save_path>\n'
# Storage Account def storage (storage_client,storage_account_name, location): #storage_account_name = 'invalid-or-used-name' availability = storage_client.storage_accounts.check_name_availability(storage_account_name) print('The storage account account {} is available: {}'.format(storage_account_name, ava...
def storage(storage_client, storage_account_name, location): availability = storage_client.storage_accounts.check_name_availability(storage_account_name) print('The storage account account {} is available: {}'.format(storage_account_name, availability.name_available)) print('Reason: {}'.format(availability....
# Tower of Hanoi def toh(n,A,B,C): if n==0: return toh(n-1,A,C,B) print("Moved Disk",n,"From Tower",A,"To Tower ",B) toh(n-1,C,B,A) no_of_disk = int(input()) not1 = input() not2 = input() not3 = input() toh(no_of_disk,not1,not2,not3)
def toh(n, A, B, C): if n == 0: return toh(n - 1, A, C, B) print('Moved Disk', n, 'From Tower', A, 'To Tower ', B) toh(n - 1, C, B, A) no_of_disk = int(input()) not1 = input() not2 = input() not3 = input() toh(no_of_disk, not1, not2, not3)
dd = { 'a': 1, 'b': 2, 'c': 3 } ll = [1, 2, 3, 4] print(ll[0]) print(dd) dd['new'] = 7 print(dd) dd['new'] += 6 print(dd)
dd = {'a': 1, 'b': 2, 'c': 3} ll = [1, 2, 3, 4] print(ll[0]) print(dd) dd['new'] = 7 print(dd) dd['new'] += 6 print(dd)
class WinRMError(Exception): def __init__(self, code, msg): super(Exception, self).__init__(msg) self.code = code
class Winrmerror(Exception): def __init__(self, code, msg): super(Exception, self).__init__(msg) self.code = code
name = 'forum' aliases = ('forums', 'f') pad_none = False async def run(message): await message.send('Forum commands: **!forums user (username)**')
name = 'forum' aliases = ('forums', 'f') pad_none = False async def run(message): await message.send('Forum commands: **!forums user (username)**')
num = int(input('Type a number between 0 and 9999: ')) u = num % 10 t = num // 10 % 10 h = num // 100 % 10 th = num // 1000 % 10 print(f'Unity: {u} \n' f'Ten: {t} \n' f'Hundred: {h} \n' f'Thousand: {th}')
num = int(input('Type a number between 0 and 9999: ')) u = num % 10 t = num // 10 % 10 h = num // 100 % 10 th = num // 1000 % 10 print(f'Unity: {u} \nTen: {t} \nHundred: {h} \nThousand: {th}')
''' Created on Nov 21, 2012 @author: Gary '''
""" Created on Nov 21, 2012 @author: Gary """
print(a == b) print(a == c) print(b == c) # a and b evaluate to the same
print(a == b) print(a == c) print(b == c)
# # PySNMP MIB module MIMOSA-NETWORKS-BASE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MIMOSA-NETWORKS-BASE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:12:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ...
# Question 3 # Midpoints of a line x1 = float(input("Enter x of 1st point: ")) y1 = float(input("Enter y of 1st point: ")) x2 = float(input("Enter x of 2nd point: ")) y2 = float(input("Enter y of 2nd point: ")) midpoint_x = abs(x1 + x2) / 2 midpoint_y = abs(y1 + y2) / 2 print("Midpoint of a line: (" + str(midpoin...
x1 = float(input('Enter x of 1st point: ')) y1 = float(input('Enter y of 1st point: ')) x2 = float(input('Enter x of 2nd point: ')) y2 = float(input('Enter y of 2nd point: ')) midpoint_x = abs(x1 + x2) / 2 midpoint_y = abs(y1 + y2) / 2 print('Midpoint of a line: (' + str(midpoint_x) + ', ' + str(midpoint_y) + ')')
def giwaxs_S_edge_wenkai(t=1): dets = [pil300KW] names = [ 'A2', 'A3', 'A4', 'A5', 'A6'] x = [30000, 16000, 0, -15000, -36000] energies = np.arange(2450, 2470, 5).tolist() + np.arange(2470, 2480, 0.25).tolist() + np.arange(2480, 2490, 1).tolist()+ np.arange(2490, 2501, 5).tolist() waxs_...
def giwaxs_s_edge_wenkai(t=1): dets = [pil300KW] names = ['A2', 'A3', 'A4', 'A5', 'A6'] x = [30000, 16000, 0, -15000, -36000] energies = np.arange(2450, 2470, 5).tolist() + np.arange(2470, 2480, 0.25).tolist() + np.arange(2480, 2490, 1).tolist() + np.arange(2490, 2501, 5).tolist() waxs_arc = np.lins...
# # PySNMP MIB module AILUXCONNECT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AILUXCONNECT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:00:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(aii_conn_type,) = mibBuilder.importSymbols('AISYSTEM-MIB', 'AIIConnType') (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constra...
def test_get_custom_properties(exporters, mocker): blender_data = mocker.MagicMock() vector = mocker.MagicMock() vector.to_list.return_value = [0.0, 0.0, 1.0] blender_data.items.return_value = [ ['str', 'spam'], ['float', 1.0], ['int', 42], ['bool', False], ['vect...
def test_get_custom_properties(exporters, mocker): blender_data = mocker.MagicMock() vector = mocker.MagicMock() vector.to_list.return_value = [0.0, 0.0, 1.0] blender_data.items.return_value = [['str', 'spam'], ['float', 1.0], ['int', 42], ['bool', False], ['vector', vector]] assert exporters.BaseEx...
{ 'includes': [ '../common.gypi' ], 'targets': [ { 'target_name': 'shbench', 'product_name': 'shbench', 'type' : 'executable', 'conditions': [ ['OS=="linux"', { 'ldflags': [ '-pthread' ] }], ], 'defines': [ 'SYS_MULTI_TH...
{'includes': ['../common.gypi'], 'targets': [{'target_name': 'shbench', 'product_name': 'shbench', 'type': 'executable', 'conditions': [['OS=="linux"', {'ldflags': ['-pthread']}]], 'defines': ['SYS_MULTI_THREAD'], 'sources': ['src/sh6bench.c'], 'include_dirs': ['src']}]}
data = [['accesstoken', 'title', 'tab', 'content'], ['6eb92a53-9392-4dc5-a10a-3a853cad6e2c', 'helloworld', 'share', 'hshahdhsahashhdhahda']] def parse_data(): json_data ={} for i in range(len(data)): for j in range(len(data[i])): json_data[data[0][j]] = data[1][j] print(json_dat...
data = [['accesstoken', 'title', 'tab', 'content'], ['6eb92a53-9392-4dc5-a10a-3a853cad6e2c', 'helloworld', 'share', 'hshahdhsahashhdhahda']] def parse_data(): json_data = {} for i in range(len(data)): for j in range(len(data[i])): json_data[data[0][j]] = data[1][j] print(json_data) json...
# Wrapper node Model # Holds the rules and associated key class Node: def __init__(self, rules, key) -> None: self.rules = rules self.key = key
class Node: def __init__(self, rules, key) -> None: self.rules = rules self.key = key
# binary search tree # author: D1N3SHh # https://github.com/D1N3SHh/algorithms class Red_black_tree(): def __init__(self): self.nil = Node(0, 'black', None, None) self.root = self.nil def __repr__(self): return str(self.root) def left_rotate(self, x): y = x.right ...
class Red_Black_Tree: def __init__(self): self.nil = node(0, 'black', None, None) self.root = self.nil def __repr__(self): return str(self.root) def left_rotate(self, x): y = x.right x.right = y.left if y.left != self.nil: y.left.parent = x ...
# -*- coding: utf-8 -*- '''A completely generic, data-driven, configuration dialog''' class ConfigDialog(QtGui.QDialog): def __init__(self, parent): QtGui.QDialog.__init__(self, parent) # Set up the UI from designer self.ui=UI_ConfigDialog() self.ui.setupUi(self) pages=[] sections=[] sel...
"""A completely generic, data-driven, configuration dialog""" class Configdialog(QtGui.QDialog): def __init__(self, parent): QtGui.QDialog.__init__(self, parent) self.ui = ui__config_dialog() self.ui.setupUi(self) pages = [] sections = [] self.values = {} fo...
# The XPATH to determine if the main page has fully loaded HOME_PAGE_XPATH: str = '/html/body/center/table/tbody/tr[2]/td/center/table[1]/tbody/tr/td[3]' + \ '/table/tbody/tr/td/ul[1]/li[1]/a' # The XPATH on the main page to the table listing the kits KITS_XPATH: str = '/html/body/center/table/...
home_page_xpath: str = '/html/body/center/table/tbody/tr[2]/td/center/table[1]/tbody/tr/td[3]' + '/table/tbody/tr/td/ul[1]/li[1]/a' kits_xpath: str = '/html/body/center/table/tbody/tr[2]/td/center/table[1]/tbody/tr/td[1]' + '/table/tbody/tr[4]/td/table/tbody/tr[4]/td/table'
def test_parameter_exclusion_empty(api_client, api_prefix): response = api_client.get(f"{api_prefix}/parameters/1/exclusions/") assert response.status_code == 200 json_dict = response.json expected = { "message": "exclusions for parameter 1", "parameter": {"excluded": [], "excluded_by":...
def test_parameter_exclusion_empty(api_client, api_prefix): response = api_client.get(f'{api_prefix}/parameters/1/exclusions/') assert response.status_code == 200 json_dict = response.json expected = {'message': 'exclusions for parameter 1', 'parameter': {'excluded': [], 'excluded_by': [], 'name': 'Colo...
g = int(input()) l = list(map(int,input().split())) mi = min(l) ma = max(l) y=0 for i in l: if i == ma: break y+=1 l.remove(ma) l.insert(0,ma) x = l[-1::-1] for j in x: if j==mi: break y+=1 print(y)
g = int(input()) l = list(map(int, input().split())) mi = min(l) ma = max(l) y = 0 for i in l: if i == ma: break y += 1 l.remove(ma) l.insert(0, ma) x = l[-1::-1] for j in x: if j == mi: break y += 1 print(y)
def vsota_stevk(n): s = str(n) vsota = 0 for x in s: vsota += int(x) return vsota def euler56(): najvecja_vsota = 0 for a in range(1,100): for b in range(1,100): st = a ** b s = vsota_stevk(st) if s > najvecja_vsota: ...
def vsota_stevk(n): s = str(n) vsota = 0 for x in s: vsota += int(x) return vsota def euler56(): najvecja_vsota = 0 for a in range(1, 100): for b in range(1, 100): st = a ** b s = vsota_stevk(st) if s > najvecja_vsota: najvecja...
# this one needs to be a multiple of 8 bitsString = "1111111101111111001111110001111100001111000001110000001100000001" # store here the hex values bhex = list() # check the size of bitsString if len(bitsString) % 8 != 0 : print("Invalid string len provided") # split, convert to 8 and append to a string (make this more ...
bits_string = '1111111101111111001111110001111100001111000001110000001100000001' bhex = list() if len(bitsString) % 8 != 0: print('Invalid string len provided') for i in range(0, len(bitsString), 8): bhex.append(hex(int(bitsString[i:i + 8], 2))) print(bhex) for i in range(len(bhex)): c = bytearray(bhex[i], ...
def gcd(a, b): while b: a, b = b, a % b return a def isPrimeMR(n): d = n - 1 d = d // (d & -d) L = [2] for a in L: t = d y = pow(a, t, n) if y == 1: continue while y != n - 1: y = (y * y) % n if y == 1 or t == n - 1: return 0 t ...
def gcd(a, b): while b: (a, b) = (b, a % b) return a def is_prime_mr(n): d = n - 1 d = d // (d & -d) l = [2] for a in L: t = d y = pow(a, t, n) if y == 1: continue while y != n - 1: y = y * y % n if y == 1 or t == n - 1...
x=int(input()) for i in range(0,x): a,b=map(int,input().split()) print(a+b)
x = int(input()) for i in range(0, x): (a, b) = map(int, input().split()) print(a + b)
suppressions = [ # This one cannot be covered by any Python language test because there is # no code pathway to it. But it is part of the C API, so must not be # excised from the code. [ r".*/multiarray/mapping\.", "PyArray_MapIterReset" ], # PyArray_Std trivially forwards to and appears to be sup...
suppressions = [['.*/multiarray/mapping\\.', 'PyArray_MapIterReset'], ['.*/multiarray/calculation\\.', 'PyArray_Std'], ['.*/multiarray/common\\.', 'PyCapsule_Check']]
# _*_coding:utf-8_*_ class Solution: def get_maybe(self, index, pushV): maybe = [None] j = index - 1 while j >= 0: if None is not pushV[j]: maybe[0] = j break j -= 1 j = index + 1 while j < len...
class Solution: def get_maybe(self, index, pushV): maybe = [None] j = index - 1 while j >= 0: if None is not pushV[j]: maybe[0] = j break j -= 1 j = index + 1 while j < len(pushV): if None is not pushV[j]: ...
# 2020.07.09 # Problem Statement: # https://leetcode.com/problems/longest-palindromic-substring/ class Solution: def longestPalindrome(self, s: str) -> str: # discuss corner cases if len(s) == 0: return "" elif len(s) == 1: return s elif len(s) == 2: ...
class Solution: def longest_palindrome(self, s: str) -> str: if len(s) == 0: return '' elif len(s) == 1: return s elif len(s) == 2: if s[0] == s[1]: return s else: return s[0] current_longest = '' ...
class Solution: @staticmethod def naive(nums,target): l,r = 0,len(nums)-1 while l<=r: m = (l+r)//2 if nums[m]==target: return m if nums[l]<=nums[m]: if target>=nums[l] and target<nums[m]: r=m-1 ...
class Solution: @staticmethod def naive(nums, target): (l, r) = (0, len(nums) - 1) while l <= r: m = (l + r) // 2 if nums[m] == target: return m if nums[l] <= nums[m]: if target >= nums[l] and target < nums[m]: ...
consumer_key = 'gdLsE3urZ6HqjE2RjiwaFBwag' consumer_secret = 'rubc1WvJoYOnsBoUMXXV660MUOhw685uTFjqnYmrRWdqoq6Y48' access_token = '846813944186650627-CpBzbP1i8ag3pREHkd6YcGQeMHbaLOx' access_secret = 'rX2ikxxtI4zplBp9kbEEpibWVKyCwKJmvuxTiKxFgeJKA'
consumer_key = 'gdLsE3urZ6HqjE2RjiwaFBwag' consumer_secret = 'rubc1WvJoYOnsBoUMXXV660MUOhw685uTFjqnYmrRWdqoq6Y48' access_token = '846813944186650627-CpBzbP1i8ag3pREHkd6YcGQeMHbaLOx' access_secret = 'rX2ikxxtI4zplBp9kbEEpibWVKyCwKJmvuxTiKxFgeJKA'
save_dir = './logs' # miniImageNet_path = '../../semifew_data/miniImagenetFullSize' miniImageNet_path = '/home/ojas/projects/unsupervised-meta-learning/data/untarred/miniImagenetFullSize' ISIC_path = "../../semifew_data/ISIC" ChestX_path = "../../semifew_data/chestX" CropDisease_path = "...
save_dir = './logs' mini_image_net_path = '/home/ojas/projects/unsupervised-meta-learning/data/untarred/miniImagenetFullSize' isic_path = '../../semifew_data/ISIC' chest_x_path = '../../semifew_data/chestX' crop_disease_path = '../../semifew_data/plant-disease' euro_sat_path = '/home/ojas/projects/unsupervised-meta-lea...
class Result(object): ''' Simple wrapper object to contain result of single iteration MPI computation ''' def __init__(self, rank, idx): self.rank = rank self.idx = idx self.result = None def __repr__(self): return "rank: %d idx: %s result: %s" % (self.rank, self.idx...
class Result(object): """ Simple wrapper object to contain result of single iteration MPI computation """ def __init__(self, rank, idx): self.rank = rank self.idx = idx self.result = None def __repr__(self): return 'rank: %d idx: %s result: %s' % (self.rank, self.id...