content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def _impl(ctx): outputs = [] for src in ctx.files.srcs: name = src.basename idx = name.find(".") if idx >= 0: name = name[:idx] out = ctx.actions.declare_file(name + ".html") outputs.append(out) ctx.actions.run_shell( inputs = [src], ...
def _impl(ctx): outputs = [] for src in ctx.files.srcs: name = src.basename idx = name.find('.') if idx >= 0: name = name[:idx] out = ctx.actions.declare_file(name + '.html') outputs.append(out) ctx.actions.run_shell(inputs=[src], outputs=[out], progre...
def MERGE(list, p, q, r): L = list[p:q] R = list[q:r] i = j = 0 while i < len(L) and j < len(R): if L[i] <= R[j]: list[p] = L[i] i += 1 else: list[p] = R[j] j += 1 p += 1 if i > j: for j in range(j, len(R)): ...
def merge(list, p, q, r): l = list[p:q] r = list[q:r] i = j = 0 while i < len(L) and j < len(R): if L[i] <= R[j]: list[p] = L[i] i += 1 else: list[p] = R[j] j += 1 p += 1 if i > j: for j in range(j, len(R)): ...
company, n = map(int, input().split()) locations = list(map(int, input().split())) companyLocations = {c: locations[c-1] for c in range(1, company + 1)} for _ in range(n): sign, a, b = map(int, input().split()) if sign == 1: companyLocations[a] = b else: print(abs(companyLocations[a] - comp...
(company, n) = map(int, input().split()) locations = list(map(int, input().split())) company_locations = {c: locations[c - 1] for c in range(1, company + 1)} for _ in range(n): (sign, a, b) = map(int, input().split()) if sign == 1: companyLocations[a] = b else: print(abs(companyLocations[a] ...
# Quick script to combine files + add positioning tokens filenames = ['mtg_encoded1.txt', 'mtg_encoded2.txt', 'mtg_encoded3.txt', 'mtg_encoded4.txt', 'mtg_encoded5.txt', 'mtg_encoded6.txt', 'mtg_encoded7.txt', 'mtg_encoded8.txt', 'mtg_encoded9.txt', 'mtg_encoded10.txt'] with open('concat_mtg_encoded.txt', ...
filenames = ['mtg_encoded1.txt', 'mtg_encoded2.txt', 'mtg_encoded3.txt', 'mtg_encoded4.txt', 'mtg_encoded5.txt', 'mtg_encoded6.txt', 'mtg_encoded7.txt', 'mtg_encoded8.txt', 'mtg_encoded9.txt', 'mtg_encoded10.txt'] with open('concat_mtg_encoded.txt', 'w') as outfile: for fname in filenames: with open(fname) ...
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*- { 'name': 'Database Auto Backup', 'author': 'Khubab & Ghazali', 'summary': 'Database auto backup application.', 'version': '1.0', 'license': 'OPL-1', 'category': 'Tools', 'description': """ Database Auto Backup ======== """, 'depends': ['w...
{'name': 'Database Auto Backup', 'author': 'Khubab & Ghazali', 'summary': 'Database auto backup application.', 'version': '1.0', 'license': 'OPL-1', 'category': 'Tools', 'description': '\nDatabase Auto Backup\n========\n', 'depends': ['web'], 'data': ['security/ir.model.access.csv', 'data/autobackup_cron.xml', 'views/a...
# # Local customizations # # Where to find the Universal Header include files: MWERKSDIR="Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:" INCLUDEDIR=MWERKSDIR + "MacOS Support:Universal:Interfaces:CIncludes:" # Where to put the python definitions file: TOOLBOXDIR="Macintosh HD:SWDev:Jack:Python:Mac:Lib:...
mwerksdir = 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:' includedir = MWERKSDIR + 'MacOS Support:Universal:Interfaces:CIncludes:' toolboxdir = 'Macintosh HD:SWDev:Jack:Python:Mac:Lib:lib-toolbox:' creator = 'CWIE'
""" String processing utilities """ def ranges_to_list(range_str): """ ranges_to_list("1-3,5-7") == [1,2,3,5,6,7] """ num_list = [] for rng in range_str.split(','): a, b = map(int, rng.split('-')) num_list.extend(range(a, b+1)) return num_list
""" String processing utilities """ def ranges_to_list(range_str): """ ranges_to_list("1-3,5-7") == [1,2,3,5,6,7] """ num_list = [] for rng in range_str.split(','): (a, b) = map(int, rng.split('-')) num_list.extend(range(a, b + 1)) return num_list
#!/usr/bin/env python # Copyright 2019 Bruno P. Kinoshita # # 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...
query_suite_state = '{\n workflows {\n id\n name\n owner\n host\n port\n }\n}\n' def get_query_suite_tasks_state_variables(workflow_id): return {'wIds': [workflow_id], 'minDepth': 0, 'maxDepth': 4} '\n{\n "wIds": ["%s"],\n "minDepth": 0,\n "maxDepth": 4 \n}\n\n' query_su...
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
class Invaliddeploymentgrouperror(Exception): """InvalidDeploymentGroupError Represents that a deployment group's configuration is invalid """ pass class Invaliddeploymentgroupnodelookuperror(Exception): """InvalidDeploymentGroupNodeLookupError Indicates that there is a problem with the node ...
class Status: def is_informational(self, code): return code >= 100 and code <= 199 def is_success(self, code): return code >= 200 and code <= 299 def is_redirect(self, code): return code >= 300 and code <= 399 def is_client_error(self, code): return code >= 400 and c...
class Status: def is_informational(self, code): return code >= 100 and code <= 199 def is_success(self, code): return code >= 200 and code <= 299 def is_redirect(self, code): return code >= 300 and code <= 399 def is_client_error(self, code): return code >= 400 and co...
print("Hi I am Nexon Bot !!! I am a chat bot") print("First let's get u signed up") person=input('Type ur Email here- ') print("Great !!! So what is ur name") person=input('Your name- ') print("Great !!! My name is Avyansh and ur custom tag is 0001") person=input('Do u like it ? Yes/Yes-') print("I know u will like it"...
print('Hi I am Nexon Bot !!! I am a chat bot') print("First let's get u signed up") person = input('Type ur Email here- ') print('Great !!! So what is ur name') person = input('Your name- ') print('Great !!! My name is Avyansh and ur custom tag is 0001') person = input('Do u like it ? Yes/Yes-') print('I know u will li...
def rowsearch(q,p): prow,qrow=[len(p),len(q)]# no. of rows pcol,qcol=[len(p[0]),len(q[0])]# 0 only for reference, pcol= no. of columns in p #print(prow, qrow, pcol, qcol) for i in range(qrow-prow+1):# for checking every row of q if(p[0] in q[i]):#if present in any row of q, then only bother to proceed fur...
def rowsearch(q, p): (prow, qrow) = [len(p), len(q)] (pcol, qcol) = [len(p[0]), len(q[0])] for i in range(qrow - prow + 1): if p[0] in q[i]: for j in range(qcol - pcol + 1): count = 0 for k in range(prow): if p[k] in q[i + k][j:j + pcol...
""" Unit tests for shell script conversion """ load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") load( "//tools/build_defs:shell_script_helper.bzl", "convert_shell_script_by_context", "do_function_call", "replace_exports", "replace_var_ref", "split_arguments", ) load("//tools/build...
""" Unit tests for shell script conversion """ load('@bazel_skylib//lib:unittest.bzl', 'asserts', 'unittest') load('//tools/build_defs:shell_script_helper.bzl', 'convert_shell_script_by_context', 'do_function_call', 'replace_exports', 'replace_var_ref', 'split_arguments') load('//tools/build_defs/shell_toolchain/toolch...
#!usr/bin/env python3 """Example 6 from https://www.practicepython.org/exercise/2014/03/12/06-string-lists.html ========================== - Prompt user for a string - Print whether user's string is a palindrome or not """ def main(): maybePalindrome = input("Enter some string.\n" + ...
"""Example 6 from https://www.practicepython.org/exercise/2014/03/12/06-string-lists.html ========================== - Prompt user for a string - Print whether user's string is a palindrome or not """ def main(): maybe_palindrome = input('Enter some string.\n' + '--> ') for letter_idx in range(len(maybePalind...
age = 99 if age < 2: print("This man is a baby.") elif age < 4: print("This man is child.") elif age < 13: print("This man is children.") elif age < 20: print("This man is teenagers.") elif age < 65: print("This man is adult.") else: print("This man is old man.")
age = 99 if age < 2: print('This man is a baby.') elif age < 4: print('This man is child.') elif age < 13: print('This man is children.') elif age < 20: print('This man is teenagers.') elif age < 65: print('This man is adult.') else: print('This man is old man.')
""" Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. Sample value of n is 5 Expected Result : 615 """ n = int(input("Enter a positive integer:")) if n<0: print("Enter a positive integer") else: n1 = str(n) n2 = n1+n1 n3 = n1+n1+n1 value = n + int(n2)+int(n3) ...
""" Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. Sample value of n is 5 Expected Result : 615 """ n = int(input('Enter a positive integer:')) if n < 0: print('Enter a positive integer') else: n1 = str(n) n2 = n1 + n1 n3 = n1 + n1 + n1 value = n + int(n2) + i...
""" You are keeping score for a baseball game with strange rules. The game consists of several rounds, where the scores of past rounds may affect future rounds' scores. At the beginning of the game, you start with an empty record. You are given a list of strings ops, where ops[i] is the ith oper...
""" You are keeping score for a baseball game with strange rules. The game consists of several rounds, where the scores of past rounds may affect future rounds' scores. At the beginning of the game, you start with an empty record. You are given a list of strings ops, where ops[i] is the ith oper...
#!/usr/bin/env python imagedir = parent + "/oiio-images" files = [ "dpx_nuke_10bits_rgb.dpx", "dpx_nuke_16bits_rgba.dpx" ] for f in files: command += rw_command (imagedir, f) # Additionally, test for regressions for endian issues with 16 bit DPX output # (related to issue #354) command += oiio_app("oiiotool") + ...
imagedir = parent + '/oiio-images' files = ['dpx_nuke_10bits_rgb.dpx', 'dpx_nuke_16bits_rgba.dpx'] for f in files: command += rw_command(imagedir, f) command += oiio_app('oiiotool') + ' src/input_rgb_mattes.tif -o output_rgb_mattes.dpx >> out.txt;' command += oiio_app('idiff') + ' src/input_rgb_mattes.tif output_rg...
''' Here, we assume that word1 and word2 are both in English. You can use unidecode.unidecode() to remove the accents in European languages, and use googletrans.Translator.translate() to translate other languages into English. ''' def match_words(word1, word2): if (len(word1) == 1 or len(word2) == 1) or (word1[1] ...
""" Here, we assume that word1 and word2 are both in English. You can use unidecode.unidecode() to remove the accents in European languages, and use googletrans.Translator.translate() to translate other languages into English. """ def match_words(word1, word2): if (len(word1) == 1 or len(word2) == 1) or (word1[1] ...
class Solution: def countBits(self, n: int) -> List[int]: res = [0]*(n+1) for i in range(1,n+1): res[i] = res[i>>1] + (i&1) return res
class Solution: def count_bits(self, n: int) -> List[int]: res = [0] * (n + 1) for i in range(1, n + 1): res[i] = res[i >> 1] + (i & 1) return res
def simple_reduce_function(results): """general purpose reduce function that sums up the results of previous activations of map functions """ total = 0 for map_result in results: total = total + map_result return total def my_reduce_function(results): """sums up the number of words by...
def simple_reduce_function(results): """general purpose reduce function that sums up the results of previous activations of map functions """ total = 0 for map_result in results: total = total + map_result return total def my_reduce_function(results): """sums up the number of words by ...
""" Utils is a subpackage designed to provide utility functions and classes to the rest of pyMez or store one-off helper functions needed in daily development life. All other packages should if needed import this one. Help --------------- <a href="../index.html">`pyMez.Code`</a> <div> <a href="../../../pyMez_Document...
""" Utils is a subpackage designed to provide utility functions and classes to the rest of pyMez or store one-off helper functions needed in daily development life. All other packages should if needed import this one. Help --------------- <a href="../index.html">`pyMez.Code`</a> <div> <a href="../../../pyMez_Document...
def product(R1, R2): "Compute the relational product of R1 and R2." return { (x, z) for (x, y1) in R1 for (y2, z) in R2 if y1 == y2 } def transClosure(R): "Compute the transitive closure of the binary relation R." T = R while True: oldT = T T = product(R,T) | R if T == ol...
def product(R1, R2): """Compute the relational product of R1 and R2.""" return {(x, z) for (x, y1) in R1 for (y2, z) in R2 if y1 == y2} def trans_closure(R): """Compute the transitive closure of the binary relation R.""" t = R while True: old_t = T t = product(R, T) | R if T...
# Description: Three electron density as volumes. # Source: placeHolder """ cmd.do('load ${1:4dgr}.pdb;') cmd.do('# Make sure to rename map file so that ;') cmd.do('# the root filename differs from pdb root filename;') cmd.do('load ${1:4dgr}_2fofc.ccp4, 2fofc;') cmd.do('load ${1:4dgr}_fofc.ccp4, fofc;') cmd.do('sele...
""" cmd.do('load ${1:4dgr}.pdb;') cmd.do('# Make sure to rename map file so that ;') cmd.do('# the root filename differs from pdb root filename;') cmd.do('load ${1:4dgr}_2fofc.ccp4, 2fofc;') cmd.do('load ${1:4dgr}_fofc.ccp4, fofc;') cmd.do('select ${2:glycan}, ${3:resid 200 or (resid 469:477)};') cmd.do('volume ${4:me...
# GIS4WRF (https://doi.org/10.5281/zenodo.1288569) # Copyright (c) 2018 D. Meyer and M. Riechert. Licensed under MIT. # colors for categories defined directly in WPS Binary index file or WRF NetCDF global attributes # (only used if existing category scheme does not contain the category) darkblue = '#001DB1' blue = '#0...
darkblue = '#001DB1' blue = '#0000FF' lightblue = '#BAECFF' black = '#000000' landuse_fields = {'iswater': ('Water', darkblue), 'islake': ('Lake', blue), 'isice': ('Ice', lightblue), 'isurban': ('Urban', black)} landuse = {'USGS': {1: ('Urban and Built-Up Land', '#FF0000'), 2: ('Dryland Cropland and Pasture', '#FFFF00'...
DB_NAME = "postgres" ARN = "arn:aws:rds:us-east-2:500514381816:cluster:postgres" SECRET_ARN = "arn:aws:secretsmanager:us-east-2:500514381816:secret:rds-db-credentials/cluster-33FXTTBJUA6VTIJBXQWHEGXQRE/postgres-3QyWu7"
db_name = 'postgres' arn = 'arn:aws:rds:us-east-2:500514381816:cluster:postgres' secret_arn = 'arn:aws:secretsmanager:us-east-2:500514381816:secret:rds-db-credentials/cluster-33FXTTBJUA6VTIJBXQWHEGXQRE/postgres-3QyWu7'
places = ['shiyan', 'shanghai', 'chicago', 'paris', 'berlin'] print('original list') print(places) print('alphabetical order') print(sorted(places)) print('original list') print(places) print('reverse alphabetical order') print(sorted(places, reverse=True)) print('original list') print(places) # reversed list places...
places = ['shiyan', 'shanghai', 'chicago', 'paris', 'berlin'] print('original list') print(places) print('alphabetical order') print(sorted(places)) print('original list') print(places) print('reverse alphabetical order') print(sorted(places, reverse=True)) print('original list') print(places) places.reverse() print('r...
#!/usr/bin/env python3 """ Advent of Code! --- Day 1: Sonar Sweep --- Looking forward to discovering more tricks within Python! Although solving the puzzles in as few lines as possible might prove too challenging... I'll probably play with learning Python more deeply for real after finals (if my interest still per...
""" Advent of Code! --- Day 1: Sonar Sweep --- Looking forward to discovering more tricks within Python! Although solving the puzzles in as few lines as possible might prove too challenging... I'll probably play with learning Python more deeply for real after finals (if my interest still persists!) """ def proces...
def SwapOddEvenBits(n): even = n & 0xAAAAAAAA odd = n & 0x55555555 even >>= 1 odd <<= 1 return (even | odd) print(SwapOddEvenBits(30)) print(SwapOddEvenBits(20))
def swap_odd_even_bits(n): even = n & 2863311530 odd = n & 1431655765 even >>= 1 odd <<= 1 return even | odd print(swap_odd_even_bits(30)) print(swap_odd_even_bits(20))
def format_starred(t): return "%x %x %x" % (0, *t) def ascii(a, b): return "%a %x" % (a, b)
def format_starred(t): return '%x %x %x' % (0, *t) def ascii(a, b): return '%a %x' % (a, b)
#encoding: utf-8 userAgents=["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SE 2.X MetaSr 1.0; SE 2.X Meta...
user_agents = ['Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser)', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SE 2.X MetaSr 1.0; SE 2.X MetaSr 1.0; .NET CLR 2.0.50727...
class TestGCL: def testTest(self): assert 1 == 1
class Testgcl: def test_test(self): assert 1 == 1
def on_button_pressed_a(): basic.show_number(randint(1, 6)) input.on_button_pressed(Button.A, on_button_pressed_a) def on_button_pressed_b(): basic.show_number(randint(1, 4)) input.on_button_pressed(Button.B, on_button_pressed_b)
def on_button_pressed_a(): basic.show_number(randint(1, 6)) input.on_button_pressed(Button.A, on_button_pressed_a) def on_button_pressed_b(): basic.show_number(randint(1, 4)) input.on_button_pressed(Button.B, on_button_pressed_b)
# while True: # command = input() # result = "" # # if "end" in command: # break # # for i in range(len(command) - 1, -1, -1): # result += command[i] # # print(f"{command} = {result}") command = input() while not command == "end": print(f"{command} = {command[::-1]}") comman...
command = input() while not command == 'end': print(f'{command} = {command[::-1]}') command = input()
#Mock class for Adafruit Python DHT mock def read_retry(a,b): print ("read_retry DHT",a,b)
def read_retry(a, b): print('read_retry DHT', a, b)
INITIAL_POSITION =\ { "blue": { 1: [-3.5, 0, 0], 2: [-1, 0, 0], 3: [-1.5, 1.75, 0] }, "red": { 1: [3.5, 0, -3.14], 2: [1, -2.5, -3.14], 3: [1.5, 1.75, -3.14] } } START_POSITION =\ { "blue": { 1: [-4, -3.1, 1.57], 2: [-1, -...
initial_position = {'blue': {1: [-3.5, 0, 0], 2: [-1, 0, 0], 3: [-1.5, 1.75, 0]}, 'red': {1: [3.5, 0, -3.14], 2: [1, -2.5, -3.14], 3: [1.5, 1.75, -3.14]}} start_position = {'blue': {1: [-4, -3.1, 1.57], 2: [-1, -3.1, 1.57], 3: [-4, 3.1, -1.57]}, 'red': {1: [4, -3.1, 1.57], 2: [1, -3.1, 1.57], 3: [4, 3.1, -1.57]}} penal...
# pylint: disable=missing-docstring # -1: [too-many-lines] __revision__ = 0 ...
__revision__ = 0 zerfzaer = 3 hehehe = 2
a = input() if a == "A": print("best!!!") elif a == "B": print("good!!") elif a == "C": print("run!") elif a == "D": print("slowly~") else: print("what?")
a = input() if a == 'A': print('best!!!') elif a == 'B': print('good!!') elif a == 'C': print('run!') elif a == 'D': print('slowly~') else: print('what?')
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-02-29 Last_modify: 2016-02-29 ****************************************** ''' ''' Follow up for "Remove Duplicates": What if...
""" ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-02-29 Last_modify: 2016-02-29 ****************************************** """ '\nFollow up for "Remove Duplicates":\nWhat if duplicates are allowed at most twice?\n\nFor e...
#!/usr/local/bin/python # -*- coding: utf-8 -*- base_params = { "sequence.max_length": 15, "sequence.num_units": 128, "random_seed": 0, "use_horovod": False, "num_gpus": 8, "batch_size_per_gpu": [[300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400], [120, 90, 72, 6...
base_params = {'sequence.max_length': 15, 'sequence.num_units': 128, 'random_seed': 0, 'use_horovod': False, 'num_gpus': 8, 'batch_size_per_gpu': [[300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400], [120, 90, 72, 60, 50, 44, 38, 20, 18, 18, 18]], 'max_steps': 5000 * 999999, 'save_summaries_steps': 100, 'print_loss_s...
def remove_quotes(s: str) -> str: if not isinstance(s, str): return s for q in '\'"': if s.startswith(q): s = s[1:] if s.endswith(q): s = s[0:-1] return s def get_bulks(items: list, bulk_size: int) -> list: bulks = [] _items = items.copy() while ...
def remove_quotes(s: str) -> str: if not isinstance(s, str): return s for q in '\'"': if s.startswith(q): s = s[1:] if s.endswith(q): s = s[0:-1] return s def get_bulks(items: list, bulk_size: int) -> list: bulks = [] _items = items.copy() while _...
""" Module imports for templates.python.business_logic.my_project This file is automatically generated by ./scripts/empty_pyinit.sh DO NOT EDIT IT MANUALLY """
""" Module imports for templates.python.business_logic.my_project This file is automatically generated by ./scripts/empty_pyinit.sh DO NOT EDIT IT MANUALLY """
class EngineBase: def __init__(self, *args, **kwargs): raise NotImplementedError() def connection(self, *args, **kwargs): raise NotImplementedError() def execute(self, query, params): raise NotImplementedError() def fetchone(self, query, params): raise NotImplementedEr...
class Enginebase: def __init__(self, *args, **kwargs): raise not_implemented_error() def connection(self, *args, **kwargs): raise not_implemented_error() def execute(self, query, params): raise not_implemented_error() def fetchone(self, query, params): raise not_imple...
C = 0 X = str(input('')) for i in X: if i == ',': C = X.index(i) break print(X[:C]) print(X[C+1 : len(X)])
c = 0 x = str(input('')) for i in X: if i == ',': c = X.index(i) break print(X[:C]) print(X[C + 1:len(X)])
RECIPE = \ { "Registration_FakeAccountCreationByBots": { "data_path": "data/Registration_FakeAccountCreationByBots_100k.csv", "variable_mappings": [ { "variable_name": "first_name", ...
recipe = {'Registration_FakeAccountCreationByBots': {'data_path': 'data/Registration_FakeAccountCreationByBots_100k.csv', 'variable_mappings': [{'variable_name': 'first_name', 'variable_type': 'SHIPPING_NAME', 'data_type': 'STRING'}, {'variable_name': 'last_name', 'variable_type': 'BILLING_NAME', 'data_type': 'STRING'}...
a=set((11,11,11,22,3,33,"hi",False)) print(a) b = tuple((11,11,22,False,"hi")) print(b) c = {2:1,"b":3} print(c["b"]) sequence= [1, 6, -1, 10] q = set(sequence) l = tuple(sequence) w = tuple(q) x =tuple(w) print(sorted(q)) print(sorted(l)) print(w) print(x) if w == x: print(True)
a = set((11, 11, 11, 22, 3, 33, 'hi', False)) print(a) b = tuple((11, 11, 22, False, 'hi')) print(b) c = {2: 1, 'b': 3} print(c['b']) sequence = [1, 6, -1, 10] q = set(sequence) l = tuple(sequence) w = tuple(q) x = tuple(w) print(sorted(q)) print(sorted(l)) print(w) print(x) if w == x: print(True)
############################################################################# # Copyright (c) 2018 Eli Polonsky. All rights reserved # # 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...
class Context(object): def __init__(self): super(Context, self).__init__() self._ci_provider = None self._github = None self._packager = None @property def ci_provider(self): return self._ci_provider @ci_provider.setter def ci_provider(self, value): ...
class Content(object): """Content to be included in your email. You must specify at least one mime type in the Contents of your email. """ def __init__(self, type_=None, value=None): """Create a Content with the specified MIME type and value. :param type_: MIME type of this Content (e...
class Content(object): """Content to be included in your email. You must specify at least one mime type in the Contents of your email. """ def __init__(self, type_=None, value=None): """Create a Content with the specified MIME type and value. :param type_: MIME type of this Content (e...
connections = { "default": { "engine": "tortoise.backends.sqlite", "credentials": { "file_path": "common.db" } } } apps = { "default": { "models": [ "model.visitor" ], "default_connection": "default" } }
connections = {'default': {'engine': 'tortoise.backends.sqlite', 'credentials': {'file_path': 'common.db'}}} apps = {'default': {'models': ['model.visitor'], 'default_connection': 'default'}}
input = """ win( X ) :- move( X, Y ), not win( Y ). move( a, d ). move( b, c ). move( c, b ). """ output = """ win( X ) :- move( X, Y ), not win( Y ). move( a, d ). move( b, c ). move( c, b ). """
input = '\nwin( X ) :- move( X, Y ), not win( Y ).\n\nmove( a, d ).\nmove( b, c ).\nmove( c, b ).\n\n' output = '\nwin( X ) :- move( X, Y ), not win( Y ).\n\nmove( a, d ).\nmove( b, c ).\nmove( c, b ).\n\n'
class Symbol(object): def __init__(self, type, value): self.type = type self.value = value def get_value(self): return self.value def set_value(self, value): self.value = value return self class SymbolType(object): INT = 0 FLOAT = 1 BOOL = 2 CHAR =...
class Symbol(object): def __init__(self, type, value): self.type = type self.value = value def get_value(self): return self.value def set_value(self, value): self.value = value return self class Symboltype(object): int = 0 float = 1 bool = 2 char =...
# -*- coding: utf-8 -*- ########################################################################## # pySAP - Copyright (C) CEA, 2017 - 2018 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-e...
class Loaderbase(object): """ Base class for all loaders. """ allowed_extensions = [] def can_load(self, path): """ A method checking the file extension. Parameters ---------- path: str the path to the image to be loaded. Returns ------- ...
class Solution: def isMatch(self, s: str, p: str) -> bool: """ recurrence: x. match -> move i, j x. "." move forwards i, j -. "d*" move forwards i as long as d is match, then move j once x. "d*" move forwards j, backtrack move i if char1 == char2 x. ".*" move...
class Solution: def is_match(self, s: str, p: str) -> bool: """ recurrence: x. match -> move i, j x. "." move forwards i, j -. "d*" move forwards i as long as d is match, then move j once x. "d*" move forwards j, backtrack move i if char1 == char2 x. ".*" mo...
HTML_WITH_EMPTY_BODY = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>Just some page</title> </head> <body> {} </body> </html>"""
html_with_empty_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n\n<html xmlns="http://www.w3.org/1999/xhtml" lang="en">\n <head>\n <title>Just some page</title>\n </head>\n <body>\n {}\n </body>\n</html>'
text = """ //------------------------------------------------------------------------------ // Explicit instantiation. //------------------------------------------------------------------------------ #include "ConnectivityMap.cc" #include "Geometry/Dimension.hh" template class Spheral::ConnectivityMap<Spheral::Dim< %(...
text = '\n//------------------------------------------------------------------------------\n// Explicit instantiation.\n//------------------------------------------------------------------------------\n#include "ConnectivityMap.cc"\n#include "Geometry/Dimension.hh"\n\ntemplate class Spheral::ConnectivityMap<Spheral::Di...
def multiples(a, b, n): total = [] for i in range(1, n + 1): if i % a == 0 or i % b == 0: total.append(i) return total print(multiples(7, 3, 30))
def multiples(a, b, n): total = [] for i in range(1, n + 1): if i % a == 0 or i % b == 0: total.append(i) return total print(multiples(7, 3, 30))
class Solution: def oddEvenJumps(self, A) -> int: largerIndex = [-1] * len(A) smallerIndex = [-1] * len(A) St = [] for _, i in sorted((a, i) for i, a in enumerate(A)): while St and St[-1] < i: largerIndex[St.pop()] = i St.append(i) St ...
class Solution: def odd_even_jumps(self, A) -> int: larger_index = [-1] * len(A) smaller_index = [-1] * len(A) st = [] for (_, i) in sorted(((a, i) for (i, a) in enumerate(A))): while St and St[-1] < i: largerIndex[St.pop()] = i St.append(i) ...
def reader(): a, b = map(int, input().split()) q, r = divmod(a, b) print(f'{a + b}\n{a - b}\n{a * b}\n{q}\n{r}') if __name__ == '__main__': reader()
def reader(): (a, b) = map(int, input().split()) (q, r) = divmod(a, b) print(f'{a + b}\n{a - b}\n{a * b}\n{q}\n{r}') if __name__ == '__main__': reader()
def left(A, k): xt = A[k:] + A[:k] return ''.join([str(ele) for ele in xt]) def right(A, k): xt = A[-k:] + A[:-k] return ''.join([str(ele) for ele in xt]) class Solution: def stringShift(self, s: str, shift: List[List[int]]) -> str: for i in shift: if i[0] == 0: ...
def left(A, k): xt = A[k:] + A[:k] return ''.join([str(ele) for ele in xt]) def right(A, k): xt = A[-k:] + A[:-k] return ''.join([str(ele) for ele in xt]) class Solution: def string_shift(self, s: str, shift: List[List[int]]) -> str: for i in shift: if i[0] == 0: ...
# Enter your code here. Read input from STDIN. Print output to STDOUT rd, rm, ry = [int(x) for x in input().split(' ')] ed, em, ey = [int(x) for x in input().split(' ')] if (ry, rm, rd) <= (ey, em, ed): print(0) elif (ry, rm) == (ey, em): print(15 * (rd - ed)) elif ry == ey: print(500 * (rm - em)) else: ...
(rd, rm, ry) = [int(x) for x in input().split(' ')] (ed, em, ey) = [int(x) for x in input().split(' ')] if (ry, rm, rd) <= (ey, em, ed): print(0) elif (ry, rm) == (ey, em): print(15 * (rd - ed)) elif ry == ey: print(500 * (rm - em)) else: print(10000)
# passing a list def greet_users(names): for name in names: msg = "Hello, " + name.title() + "!" print(msg) usernames = ['harry potter','ron weasly','harmoine granger'] greet_users(usernames) unprinted_designs = ['iphone case', 'robot pendant', 'dodechedron'] completed_designs = [] while unprinted_...
def greet_users(names): for name in names: msg = 'Hello, ' + name.title() + '!' print(msg) usernames = ['harry potter', 'ron weasly', 'harmoine granger'] greet_users(usernames) unprinted_designs = ['iphone case', 'robot pendant', 'dodechedron'] completed_designs = [] while unprinted_designs: cur...
# Copyright 2021 The XLS Authors # # 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 law or agreed to in writ...
"""This module contains helper rules.""" load('//xls/build_rules:xls_common_rules.bzl', 'get_output_filename_value') _protobin_file_extension = '.protobin' def _check_sha256sum_test_impl(ctx): """The implementation of the 'check_sha256sum_test' rule. Args: ctx: The current rule's context object. Re...
TIMEOUT = 8 # s CP = 1 # by default ROWS = 6 COLUMNS = 7 CONNECT_X = 4 # value of X
timeout = 8 cp = 1 rows = 6 columns = 7 connect_x = 4
name1_1_1_1_0_2_0 = None name1_1_1_1_0_2_1 = None name1_1_1_1_0_2_2 = None name1_1_1_1_0_2_3 = None name1_1_1_1_0_2_4 = None
name1_1_1_1_0_2_0 = None name1_1_1_1_0_2_1 = None name1_1_1_1_0_2_2 = None name1_1_1_1_0_2_3 = None name1_1_1_1_0_2_4 = None
__author__ = 'florianseidl' # Copyright (C) Schweizerische Bundesbahnen SBB, 2016 # Python 3.4 __author__ = '<your_userid_here>' # Template for an output. For ampel type output with 3 or less lights or signals, use myampeloutput template instead. # copy and add your functionality def create(configuration, key=None): ...
__author__ = 'florianseidl' __author__ = '<your_userid_here>' def create(configuration, key=None): """Create an instance (called by cimon.py)""" return my_output() class Myoutput: """Template for your own output device.""" def on_update(self, status): """Display the given status. Stat...
__all__ = ["Serializer"] class Serializer(object): def __call__(self, *args, **kwargs): return self.serialize(*args, **kwargs) def get_attrs(self, item_list): return {} def serialize(self, item, attrs): return {} def format_datetime(self, datetime): if not datetime: ...
__all__ = ['Serializer'] class Serializer(object): def __call__(self, *args, **kwargs): return self.serialize(*args, **kwargs) def get_attrs(self, item_list): return {} def serialize(self, item, attrs): return {} def format_datetime(self, datetime): if not datetime: ...
# coding=UTF-8 # ex:ts=4:sw=4:et=on # Copyright (c) 2013, Mathijs Dumon # All rights reserved. # Complete license can be found in the LICENSE file. class AlreadyRegistered(Exception): pass class NotRegistered(Exception): pass
class Alreadyregistered(Exception): pass class Notregistered(Exception): pass
class DpiChangedEventArgs(CancelEventArgs): # no doc def ToString(self): """ ToString(self: DpiChangedEventArgs) -> str """ pass DeviceDpiNew = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: DeviceDpiNew(self: DpiChangedEventArgs)...
class Dpichangedeventargs(CancelEventArgs): def to_string(self): """ ToString(self: DpiChangedEventArgs) -> str """ pass device_dpi_new = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Get: DeviceDpiNew(self: DpiChangedEventArgs) -> int\n\n\n\n' device_dpi_old...
#! /usr/bin/env python3 with open("test.pgm") as fp: lineno = 0 for line in fp.readlines(): lineno+= 1 if lineno == 2: break lineno = 0 for line in fp.readlines(): lst = [int(v) for v in line.split()] for i in range(len(lst)): if (i + lineno) % 2 =...
with open('test.pgm') as fp: lineno = 0 for line in fp.readlines(): lineno += 1 if lineno == 2: break lineno = 0 for line in fp.readlines(): lst = [int(v) for v in line.split()] for i in range(len(lst)): if (i + lineno) % 2 == 0: if...
# coding=utf-8 n = int(input()) a = list(map(int, input().split())) f = [0] * 1010 ans = [] for v in reversed(a): if f[v] == 0: ans.append(v) f[v] += 1 print(len(ans)) ans = reversed(ans) print(*ans)
n = int(input()) a = list(map(int, input().split())) f = [0] * 1010 ans = [] for v in reversed(a): if f[v] == 0: ans.append(v) f[v] += 1 print(len(ans)) ans = reversed(ans) print(*ans)
""" http://codekata.com/kata/kata01-supermarket-pricing/ """ def run(): raise NotImplementedError("This function is not yet implemented.")
""" http://codekata.com/kata/kata01-supermarket-pricing/ """ def run(): raise not_implemented_error('This function is not yet implemented.')
def build_table(text, style): if not text: return "" lengths=[-float("inf") for i in range(len(text[0]))] for i in text: for j,k in enumerate(i): lengths[j]=max(lengths[j], len(k)+style.off_min*2) res=[style.sep_he*(sum(lengths)+len(style.sep_vi)*(len(lengths)-1)+len(style.se...
def build_table(text, style): if not text: return '' lengths = [-float('inf') for i in range(len(text[0]))] for i in text: for (j, k) in enumerate(i): lengths[j] = max(lengths[j], len(k) + style.off_min * 2) res = [style.sep_he * (sum(lengths) + len(style.sep_vi) * (len(lengt...
# https://www.acmicpc.net/problem/10871 a, b = input().split() c = list(input().split()) for i in range(len(c)): if int(c[i]) < int(b): print(int(c[i]), end = " ", flush = True)
(a, b) = input().split() c = list(input().split()) for i in range(len(c)): if int(c[i]) < int(b): print(int(c[i]), end=' ', flush=True)
# -*- coding: utf-8 -*- """ Created on Mon Feb 26 15:22:21 2018 @author: chenxi11 """ #665. Non-decreasing Array class Solution: def checkPossibility(self, nums): """ :type nums: List[int] :rtype: bool """ lows = 0 point = 0 for i in range(len(nums) - 1): ...
""" Created on Mon Feb 26 15:22:21 2018 @author: chenxi11 """ class Solution: def check_possibility(self, nums): """ :type nums: List[int] :rtype: bool """ lows = 0 point = 0 for i in range(len(nums) - 1): if nums[i + 1] < nums[i]: ...
class DirectorException(Exception): """Basic exception for errors raised with director""" def __init__(self, msg=None): if msg is None: msg = "Unexpected error occured in director subpackage" super().__init__(msg) class ServiceNotFoundError(DirectorException): """Service was n...
class Directorexception(Exception): """Basic exception for errors raised with director""" def __init__(self, msg=None): if msg is None: msg = 'Unexpected error occured in director subpackage' super().__init__(msg) class Servicenotfounderror(DirectorException): """Service was no...
# -*- coding: utf-8 -*- # Author: Tonio Teran # Copyright: Stateoftheart AI PBC 2021. '''Tensorflow Dataset's wrapper module. Model information taken from: Dataset information taken from: ''' SOURCE_METADATA = { 'name': 'tensorflow', 'original_name': 'TensorFlow Datasets', 'url': 'https://www.tensorflow.o...
"""Tensorflow Dataset's wrapper module. Model information taken from: Dataset information taken from: """ source_metadata = {'name': 'tensorflow', 'original_name': 'TensorFlow Datasets', 'url': 'https://www.tensorflow.org/datasets/'} datasets = {'Question Answering': ['cosmos_qa', 'mctaco', 'natural_questions', 'squad...
#===- enumerations.py - Python Enumerations ------------------*- python -*--===# # # The LLVM37 Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # #===------------------------------------------------------------...
""" Clang Enumerations ================== This module provides static definitions of enumerations that exist in libclang. Enumerations are typically defined as a list of tuples. The exported values are typically munged into other types or classes at module load time. All enumerations are centrally defined in this fi...
######### # Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved # # 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...
class Config(object): def __init__(self): self._db_address = 'localhost' self._db_port = 9200 self._amqp_address = 'localhost' self._file_server_root = None self._file_server_base_uri = None self._file_server_blueprints_folder = None self._file_server_uploade...
data = {'level_index': 10216, 'move_count': '24', 'board_info': {(-7, 14): {}, (-7, 13): {}, (-4, 13): {'next': (0, -1), 'prev': (1, 0)}, (-4, 12): {'next': (0, -1), 'prev': (0, 1)}, (-4, 11): {'next': (0, -1), 'prev': (0, 1)}, (-4, 10): {'next': (0, -1), 'prev': (0...
data = {'level_index': 10216, 'move_count': '24', 'board_info': {(-7, 14): {}, (-7, 13): {}, (-4, 13): {'next': (0, -1), 'prev': (1, 0)}, (-4, 12): {'next': (0, -1), 'prev': (0, 1)}, (-4, 11): {'next': (0, -1), 'prev': (0, 1)}, (-4, 10): {'next': (0, -1), 'prev': (0, 1)}, (-4, 9): {'next': (0, -1), 'prev': (0, 1)}, (-4...
array = [6, 5, 12, 10, 9, 1]
array = [6, 5, 12, 10, 9, 1]
RABBIT_HOST= 'localhost' PORT=32784 QUEUE_TOPIC='boom' USER='guest' PASSWORD='guest'
rabbit_host = 'localhost' port = 32784 queue_topic = 'boom' user = 'guest' password = 'guest'
class Payload: def __init__(self, website, username, password): self.website = website self.username = username self.password = password
class Payload: def __init__(self, website, username, password): self.website = website self.username = username self.password = password
class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: """ Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Notice that the solution s...
class Solution: def three_sum(self, nums: List[int]) -> List[List[int]]: """ Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Notice that the solution set must...
def test_create_user(client, user_data, users_api): resp = client.post(users_api.url, json=user_data) assert resp.status_code == 201 json_data = resp.get_json() assert json_data['email'] == user_data['email'] assert json_data['first_name'] == user_data['first_name'] assert json_data['last_name'...
def test_create_user(client, user_data, users_api): resp = client.post(users_api.url, json=user_data) assert resp.status_code == 201 json_data = resp.get_json() assert json_data['email'] == user_data['email'] assert json_data['first_name'] == user_data['first_name'] assert json_data['last_name']...
def clr(colour): if colour == "teal": clr = 0x1abc9c elif colour == "dark_teal": clr = 0x11806a elif colour == "green": clr = 0x2ecc71 elif colour == "dark_green": clr = 0x1f8b4c elif colour == "blue": clr = 0x3498db elif colour == "dark_blue": ...
def clr(colour): if colour == 'teal': clr = 1752220 elif colour == 'dark_teal': clr = 1146986 elif colour == 'green': clr = 3066993 elif colour == 'dark_green': clr = 2067276 elif colour == 'blue': clr = 3447003 elif colour == 'dark_blue': clr = 21...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isCousins(self, root: TreeNode, x: int, y: int) -> bool: # store (parent, depth) tuple res = ...
class Solution: def is_cousins(self, root: TreeNode, x: int, y: int) -> bool: res = [] def dfs(node, parent, depth): if not node: return if node.val == x or node.val == y: res.append((parent, depth)) dfs(node.left, node, depth + 1...
"""Metadata and other parsers. """ class Parser: def __init__(self): pass
"""Metadata and other parsers. """ class Parser: def __init__(self): pass
line = [int(i) for i in input().split()] ans = True for a in range(line[0]): cur = input().split() for b in cur: if(b!='B' and b!='W' and b!='G'): ans=False if(ans): print("#Black&White") else: print("#Color")
line = [int(i) for i in input().split()] ans = True for a in range(line[0]): cur = input().split() for b in cur: if b != 'B' and b != 'W' and (b != 'G'): ans = False if ans: print('#Black&White') else: print('#Color')
def no_match(num): mid_index = int(len(num) / 2) left_side = num[:mid_index] right_side = num[mid_index:] item_to_append = f"-{moves}a" left_side += [item_to_append] * 2 print("Invalid input! Adding additional elements to the board") return left_side + right_side def match(num): print(...
def no_match(num): mid_index = int(len(num) / 2) left_side = num[:mid_index] right_side = num[mid_index:] item_to_append = f'-{moves}a' left_side += [item_to_append] * 2 print('Invalid input! Adding additional elements to the board') return left_side + right_side def match(num): print(f...
ODESK_REDIRECT_SESSION_KEY = '_odesk_redirect_url' ODESK_TOKEN_SESSION_KEY = '_odesk_api_token' ENCRYPTION_KEY_NAME = 'oekey'
odesk_redirect_session_key = '_odesk_redirect_url' odesk_token_session_key = '_odesk_api_token' encryption_key_name = 'oekey'
class Solution: def connectTwoGroups(self, cost: List[List[int]]) -> int: g1Size, g2Size = len(cost), len(cost[0]) g2Mins = [min(cost[i][j] for i in range(g1Size)) for j in range(g2Size)] @lru_cache(None) def dfs(g1Index, group2): sumCost = 0 if g1Index >= g1Size else flo...
class Solution: def connect_two_groups(self, cost: List[List[int]]) -> int: (g1_size, g2_size) = (len(cost), len(cost[0])) g2_mins = [min((cost[i][j] for i in range(g1Size))) for j in range(g2Size)] @lru_cache(None) def dfs(g1Index, group2): sum_cost = 0 if g1Index >= g...
expected_output = { "active": { "boot_variable": "disk0:s72033-adventerprisek9-mz.122-33.SRE0a-ssr-nxos-76k-1,12;", "configuration_register": "0x2012", }, "next_reload_boot_variable": "disk0:s72033-adventerprisek9-mz.122-33.SRE0a-ssr-nxos-76k-1,12;", }
expected_output = {'active': {'boot_variable': 'disk0:s72033-adventerprisek9-mz.122-33.SRE0a-ssr-nxos-76k-1,12;', 'configuration_register': '0x2012'}, 'next_reload_boot_variable': 'disk0:s72033-adventerprisek9-mz.122-33.SRE0a-ssr-nxos-76k-1,12;'}
# TODO Wrap coffeescad command line to build it def build_with_coffeescad(state): pass
def build_with_coffeescad(state): pass
A, B = map(int, input().split()) unused_socket = 1 plug_num = 0 while True: if unused_socket >= B: break unused_socket += A - 1 plug_num += 1 print(plug_num)
(a, b) = map(int, input().split()) unused_socket = 1 plug_num = 0 while True: if unused_socket >= B: break unused_socket += A - 1 plug_num += 1 print(plug_num)
# # Demonstrate grid's "free unit" # # Column 1: fix width 60 px # Column 2: 1 unit from the remaining free space # Column 3: 2 unit from the remaining free space col_dsc = [60, lv.grid_fr(1), lv.grid_fr(2), lv.GRID_TEMPLATE.LAST] # Row 1: fix width 60 px # Row 2: 1 unit from the remaining free space # Row 3: fix wi...
col_dsc = [60, lv.grid_fr(1), lv.grid_fr(2), lv.GRID_TEMPLATE.LAST] row_dsc = [40, lv.grid_fr(1), 40, lv.GRID_TEMPLATE.LAST] cont = lv.obj(lv.scr_act()) cont.set_size(300, 220) cont.center() cont.set_grid_dsc_array(col_dsc, row_dsc) for i in range(9): col = i % 3 row = i // 3 obj = lv.obj(cont) obj.set_...
def get_name(first_name, last_name): return f'{first_name} {last_name}' def is_valid_card_number(card_number): my_sum = sum(list(map(int, card_number))) if my_sum % 7 == 0: return True return False class ExistingCard: def __init__(self, first_name, last_name, card_number): self.n...
def get_name(first_name, last_name): return f'{first_name} {last_name}' def is_valid_card_number(card_number): my_sum = sum(list(map(int, card_number))) if my_sum % 7 == 0: return True return False class Existingcard: def __init__(self, first_name, last_name, card_number): self.na...
INF = 987654321 def solution(arr): size = len(arr) // 2 + 1 min_dp = [[INF for _ in range(size)] for _ in range(size)] max_dp = [[-INF for _ in range(size)] for _ in range(size)] for i in range(size): min_dp[i][i] = int(arr[2 * i]) max_dp[i][i] = int(arr[2 * i]) for cnt in range(1,...
inf = 987654321 def solution(arr): size = len(arr) // 2 + 1 min_dp = [[INF for _ in range(size)] for _ in range(size)] max_dp = [[-INF for _ in range(size)] for _ in range(size)] for i in range(size): min_dp[i][i] = int(arr[2 * i]) max_dp[i][i] = int(arr[2 * i]) for cnt in range(1, ...
#!/usr/bin/env python3 # coding:utf-8 class Solution: def reOrderArray(self, array): odd = [] even = [] for num in array: if num % 2 == 1: odd.append(num) else: even.append(num) return odd + even if __name__ == "__main__": ...
class Solution: def re_order_array(self, array): odd = [] even = [] for num in array: if num % 2 == 1: odd.append(num) else: even.append(num) return odd + even if __name__ == '__main__': s = solution() a = [2, 9, 19, 35...
class SeafileAdmin(object): def lists_users(self, maxcount=100): pass def list_user_repos(self, username): pass
class Seafileadmin(object): def lists_users(self, maxcount=100): pass def list_user_repos(self, username): pass
# -*- coding: utf-8 -*- #STIX open vocabulary and values #simulate enums TYPES = [ "attack-pattern", "campaign", "course-of-action", "identity", "indicator", "intrusion-set", "malware", "observed-data", "report", "threat-actor", "tool", "vulnerability", ] GENERATABLE_T...
types = ['attack-pattern', 'campaign', 'course-of-action', 'identity', 'indicator', 'intrusion-set', 'malware', 'observed-data', 'report', 'threat-actor', 'tool', 'vulnerability'] generatable_types = ['attack-pattern', 'campaign', 'course-of-action', 'identity', 'intrusion-set', 'malware', 'threat-actor', 'tool', 'vuln...