content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" Provide errors for BaseGenerator interface. """ class ValidationDataError(Exception): """ Name generation data contains invalid characters or does not match the name length error. """ def __init__(self, message): self.message = message
""" Provide errors for BaseGenerator interface. """ class Validationdataerror(Exception): """ Name generation data contains invalid characters or does not match the name length error. """ def __init__(self, message): self.message = message
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # # This program is free software: you can redistribute it and/or modify # ...
{'name': 'Issue Tracking', 'version': '1.0', 'category': 'Project Management', 'sequence': 9, 'summary': 'Support, Bug Tracker, Helpdesk', 'description': '\nTrack Issues/Bugs Management for Projects\n=========================================\nThis application allows you to manage the issues you might face in a project ...
# https://www.codewars.com/kata/56dec885c54a926dcd001095 opposite = lambda n: -n
opposite = lambda n: -n
class py_solution: def int_to_Roman(self, num): val = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ] syb = [ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", ...
class Py_Solution: def int_to__roman(self, num): val = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] syb = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] roman_num = '' i = 0 while num > 0: for _ in range(num // val[i]): ...
# Copyright 2016 Google Inc. All rights reserved. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd { 'includes': [ '../common.gypi', ], 'targets': [ { 'target_name': 'hls_builder', ...
{'includes': ['../common.gypi'], 'targets': [{'target_name': 'hls_builder', 'type': '<(component)', 'sources': ['base/hls_notifier.h', 'base/master_playlist.cc', 'base/master_playlist.h', 'base/media_playlist.cc', 'base/media_playlist.h', 'base/simple_hls_notifier.cc', 'base/simple_hls_notifier.h'], 'dependencies': ['....
# # This file is part of pysnmp software. # # Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net> # License: http://pysnmp.sf.net/license.html # # PySNMP MIB module SNMP-COMMUNITY-MIB (http://pysnmp.sf.net) # ASN.1 source file:///usr/share/snmp/mibs/SNMP-COMMUNITY-MIB.txt # Produced by pysmi-0.0.5 at Sat Sep 19 16:28...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ...
# hangman_lib.py # A set of library functions for use with your Hangman game def print_hangman_image(mistakes=6): """Prints out a gallows image for hangman. The image printed depends on the number of mistakes (0-6).""" if mistakes <= 0: print(''' ____________________ | .__________________| | | / / ...
def print_hangman_image(mistakes=6): """Prints out a gallows image for hangman. The image printed depends on the number of mistakes (0-6).""" if mistakes <= 0: print(' ____________________\n| .__________________|\n| | / / \n| |/ / \n| | / \n| |/ \n| | \n| | \n| | \n| | \n| | ...
def apply(df, model, rel_ev, rel_act, parameters=None): if parameters is None: parameters = {} ret = {} for persp in rel_ev: df = rel_ev[persp] df = df[df["event_activity_merge"].isin(rel_act[persp])] df = df.groupby([persp, persp+"_2", "event_activity_merge"]).first() ...
def apply(df, model, rel_ev, rel_act, parameters=None): if parameters is None: parameters = {} ret = {} for persp in rel_ev: df = rel_ev[persp] df = df[df['event_activity_merge'].isin(rel_act[persp])] df = df.groupby([persp, persp + '_2', 'event_activity_merge']).first() ...
class ListReader(): def __init__(self, aList: list): self.list = aList def __enter__(self) -> list: print("will print a list:") return self.list def __exit__(self, expType, expVal, expTrace): print("end") aList = [1, 2, 3, 4, 5, 6] with ListReader(aList) as lr: print(...
class Listreader: def __init__(self, aList: list): self.list = aList def __enter__(self) -> list: print('will print a list:') return self.list def __exit__(self, expType, expVal, expTrace): print('end') a_list = [1, 2, 3, 4, 5, 6] with list_reader(aList) as lr: print(l...
class RateLimit: def __init__(self): self.rateLimitType = "" self.interval = "" self.intervalNum = 0 self.limit = 0 class ExchangeFilter: def __init__(self): self.filterType = "" self.maxOrders = 0 class Symbol: def __init__(self): self.symbol =...
class Ratelimit: def __init__(self): self.rateLimitType = '' self.interval = '' self.intervalNum = 0 self.limit = 0 class Exchangefilter: def __init__(self): self.filterType = '' self.maxOrders = 0 class Symbol: def __init__(self): self.symbol = '...
""" redis client and lua script api """ VERSION = "0.0.1"
""" redis client and lua script api """ version = '0.0.1'
"""----------------------------------------------------------------------------- finalize.py (Last Updated: 10/16/2020) The purpose of this script is to finalize the rt-cloud session. Specifically, here we want to dowload any important files from the cloud back to the stimulus computer and maybe even delete files fro...
"""----------------------------------------------------------------------------- finalize.py (Last Updated: 10/16/2020) The purpose of this script is to finalize the rt-cloud session. Specifically, here we want to dowload any important files from the cloud back to the stimulus computer and maybe even delete files fro...
def remove_middle(a, b, c): cross = (a[0] - b[0]) * (c[1] - b[1]) - (a[1] - b[1]) * (c[0] - b[0]) dot = (a[0] - b[0]) * (c[0] - b[0]) + (a[1] - b[1]) * (c[1] - b[1]) return cross < 0 or cross == 0 and dot <= 0 def convex_hull(points): spoints = sorted(points) hull = [] for p in spoint...
def remove_middle(a, b, c): cross = (a[0] - b[0]) * (c[1] - b[1]) - (a[1] - b[1]) * (c[0] - b[0]) dot = (a[0] - b[0]) * (c[0] - b[0]) + (a[1] - b[1]) * (c[1] - b[1]) return cross < 0 or (cross == 0 and dot <= 0) def convex_hull(points): spoints = sorted(points) hull = [] for p in spoints + spoi...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'api', 'type': 'static_library', 'sources': [ '<@(schema_files)', ], # TODO(j...
{'targets': [{'target_name': 'api', 'type': 'static_library', 'sources': ['<@(schema_files)'], 'msvs_disabled_warnings': [4267], 'includes': ['../../../../build/json_schema_bundle_compile.gypi', '../../../../build/json_schema_compile.gypi'], 'variables': {'chromium_code': 1, 'non_compiled_schema_files': ['adview.json',...
#!/usr/bin/env python # encoding: utf-8 class Solution: def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: # adjacency matrix of the directed graph self.graph = collections.defaultdict(list) for to_node, from_node in prerequisites: self.graph[from_node...
class Solution: def can_finish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: self.graph = collections.defaultdict(list) for (to_node, from_node) in prerequisites: self.graph[from_node].append(to_node) self.state = [0] * numCourses for n in range(numCour...
def file_from_tar(context, tar, member): return tar.extractfile(member).read() def static_file(context, path): with open(path, 'rb') as fobj: return fobj.read()
def file_from_tar(context, tar, member): return tar.extractfile(member).read() def static_file(context, path): with open(path, 'rb') as fobj: return fobj.read()
#Find the BITWISE NOT of the given number a = int(input()) b = ~a print(b)
a = int(input()) b = ~a print(b)
#!/usr/bin/env python3 def merge_chars(string, block): for i in range(0, len(string), block): s = '' for c in string[i:i+block]: if c not in s: s += c print(s) if __name__ == '__main__': merge_chars(input(), int(input()))
def merge_chars(string, block): for i in range(0, len(string), block): s = '' for c in string[i:i + block]: if c not in s: s += c print(s) if __name__ == '__main__': merge_chars(input(), int(input()))
def solve(): direction = 0 # north = 0, east = 1, south = 2, west = 3 x = 0 y = 0 moves = [x for x in input().split(',')] visited = [] for elem in moves: elem = elem.strip() turn = elem[0] length = int(elem[1:]) if (turn == "R"): direction = abs((direction + 1) % 4) elif (turn == "L"): direction ...
def solve(): direction = 0 x = 0 y = 0 moves = [x for x in input().split(',')] visited = [] for elem in moves: elem = elem.strip() turn = elem[0] length = int(elem[1:]) if turn == 'R': direction = abs((direction + 1) % 4) elif turn == 'L': ...
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ DEVELOPER_SIGN_ON_CLIENT_ID = "04b07795-8ddb-461a-bbee-02f9e1bf7b46" AZURE_VSCODE_CLIENT_ID = "aebc6443-996d-45c2-90f0-388ff96faa56" VSCODE_CREDENTIALS_SECTION = "VS C...
developer_sign_on_client_id = '04b07795-8ddb-461a-bbee-02f9e1bf7b46' azure_vscode_client_id = 'aebc6443-996d-45c2-90f0-388ff96faa56' vscode_credentials_section = 'VS Code Azure' default_refresh_offset = 300 default_token_refresh_retry_delay = 30 class Azureauthorityhosts: azure_china = 'login.chinacloudapi.cn' ...
""" Conditioner =========== Create simple 'if this then that' style rules in your Django application. Comes with a bunch of ready to use actions and conditions, but is also easily extensible and allows model specific actions/conditions. """ default_app_config = 'conditioner.apps.ConditionerAppConfig' __title__ = 'dja...
""" Conditioner =========== Create simple 'if this then that' style rules in your Django application. Comes with a bunch of ready to use actions and conditions, but is also easily extensible and allows model specific actions/conditions. """ default_app_config = 'conditioner.apps.ConditionerAppConfig' __title__ = 'djang...
def Glados(thoughts, eyes, eye, tongue): return f""" {thoughts} {thoughts} \#+ \@ \# \# M#\@ . .X X.%##\@;# \# +\@#######X. \@#% ,==. ,######M+ -#####%M####M- \# :H##M%:=##+ .M##M,;#####/+#######% ,M# .M########= =\@#\@.=#####M=M#######= X# :\@\@MMM##M. -##M.,#####...
def glados(thoughts, eyes, eye, tongue): return f'\n {thoughts}\n {thoughts}\n \\#+ \\@ \\# \\# M#\\@\n . .X X.%##\\@;# \\# +\\@#######X. \\@#%\n ,==. ,######M+ -#####%M####M- \\#\n :H##M%:=##+ .M##M,;#####/+#######% ,M#\n .M########= =\\@#\\@.=#####M=M#######= X#\n :\\@\...
live = 'yes' def love(): live
live = 'yes' def love(): live
class Solution(object): def removeCoveredIntervals(self, intervals): """ :type intervals: List[List[int]] :rtype: int """ # Sort by start point. # If two intervals share the same start point # put the longer one to be the first. intervals.sort(key=lamb...
class Solution(object): def remove_covered_intervals(self, intervals): """ :type intervals: List[List[int]] :rtype: int """ intervals.sort(key=lambda x: (x[0], -x[1])) count = 0 prev_end = 0 for (_, end) in intervals: if end > prevEnd: ...
# exercise-02 Length of Phrase # Write the code that: # 1. Prompts the user to enter a phrase: # Please enter a word or phrase: # 2. Print the following message: # - What you entered is xx characters long # 3. Return to step 1, unless the word 'quit' was entered. while True: input_word_phrase = input('P...
while True: input_word_phrase = input('Please enter a word or phrase ') if input_word_phrase == 'quit': break print(f'What you entered is {len(input_word_phrase)} characters long')
KEY_PRESSES = { '1ADGJMPTW* #': 1, 'BEHKNQUX0': 2, 'CFILORVY': 3, '23456S8Z': 4, '79': 5 } def presses(phrase): total = 0 for a in phrase.upper(): for k, v in KEY_PRESSES.iteritems(): if a in k: total += v break return total
key_presses = {'1ADGJMPTW* #': 1, 'BEHKNQUX0': 2, 'CFILORVY': 3, '23456S8Z': 4, '79': 5} def presses(phrase): total = 0 for a in phrase.upper(): for (k, v) in KEY_PRESSES.iteritems(): if a in k: total += v break return total
# 04 sKeyword Arguments # def increment(number, by): # return number + by # result = increment(2, 1) # print(result) # It also works like this def increment(number, by): return number + by print(increment(2, by=1)) # by=1 Its the keyword arguent, if a function as multiple arguments, the code can be more...
def increment(number, by): return number + by print(increment(2, by=1))
with open("day16.txt") as f: data = f.readline() data = data.split(",") programs = [chr(i) for i in range(97, 113)] for instruction in data: type_ = instruction[0] if type_ == "s": length = int(instruction[1:]) programs = programs[-length:] + programs[:len(programs)-length] if type_ == ...
with open('day16.txt') as f: data = f.readline() data = data.split(',') programs = [chr(i) for i in range(97, 113)] for instruction in data: type_ = instruction[0] if type_ == 's': length = int(instruction[1:]) programs = programs[-length:] + programs[:len(programs) - length] if type_ ==...
# # Simple class for dealing with Parameter. # Parameter has a name, a value, an error and some bounds # Names are also latex names. class Parameter: def __init__(self, name, value, err=0, bounds=None, Ltxname=None): self.name = name if Ltxname: self.Ltxname = Ltxname else: ...
class Parameter: def __init__(self, name, value, err=0, bounds=None, Ltxname=None): self.name = name if Ltxname: self.Ltxname = Ltxname else: self.Ltxname = name self.value = value self.error = err if bounds == None: self.bounds = ...
def enter_text(text): print(text) input("Press Enter key.") return(0) def nostop(text): enter_text(text) return(0) def message(text): enter_text(text) exit(0) def error(text): enter_text(text) exit(9001) def fatal(text): error(text) #return true if yes, false if no def yes_n...
def enter_text(text): print(text) input('Press Enter key.') return 0 def nostop(text): enter_text(text) return 0 def message(text): enter_text(text) exit(0) def error(text): enter_text(text) exit(9001) def fatal(text): error(text) def yes_no(prompt): opt = 'x' while ...
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython """ mayor = 0 suma = 0 for _ in range(10): edad = int(input("Ingresar edad: ")) if edad >= 18: mayor += 1 suma += edad print(f"Promedio: {suma / 10}") print(f"Mayores de edad: {mayor}")
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython """ mayor = 0 suma = 0 for _ in range(10): edad = int(input('Ingresar edad: ')) if edad >= 18: mayor += 1 suma += edad print(f'Promedio: {suma / 10}') print(f'Mayores de edad: {mayor}')
lista = [1, 13, 15, 7] lista_animal = ['cachorro', 'gato', 'elefante', 'arara'] #Ordenando a lista lista.sort() lista_animal.sort() print(lista) print(lista_animal) #Revertendo a ordem da lista lista_animal.reverse() print(lista_animal)
lista = [1, 13, 15, 7] lista_animal = ['cachorro', 'gato', 'elefante', 'arara'] lista.sort() lista_animal.sort() print(lista) print(lista_animal) lista_animal.reverse() print(lista_animal)
class xcconfig_item_base(object): def __init__(self, line): line_end = line.find('//'); if line_end > 0: line = line[:line_end]; self.contents = line; self.type = 'EMPTY'; def __repr__(self): if self.isValid(): return '(%s : %s : %s)' % (...
class Xcconfig_Item_Base(object): def __init__(self, line): line_end = line.find('//') if line_end > 0: line = line[:line_end] self.contents = line self.type = 'EMPTY' def __repr__(self): if self.isValid(): return '(%s : %s : %s)' % (type(self), ...
# -*- coding: utf-8 -*- """ A module containing the Edge Validator functions which can be registered as callbacks to :class:`~nodeeditor.node_edge.Edge` class. Example of registering Edge Validator callbacks: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You can register validation callbacks once for example on t...
""" A module containing the Edge Validator functions which can be registered as callbacks to :class:`~nodeeditor.node_edge.Edge` class. Example of registering Edge Validator callbacks: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You can register validation callbacks once for example on the bottom of node_edge.p...
""" 1 / \ / \ / \ 2 3 / \ / 4 5 6 / / \ 7 8 9 The correct output should look like this: preorder: 1 2 4 7 5 3 6 8 9 inorder: 7 4 2 5 1 8 6 9 3 postorder: 7 4 5 2 8 9 6 3 1 level-order: 1 2 3 4 5 6 7 8 9 """ # pre-order, in-order, a...
""" 1 / / / 2 3 / \\ / 4 5 6 / / 7 8 9 The correct output should look like this: preorder: 1 2 4 7 5 3 6 8 9 inorder: 7 4 2 5 1 8 6 9 3 postorder: 7 4 5 2 8 9 6 3 1 level-order: 1 2 3 4 5 6 7 8 9 """ def max_height(node): if n...
''' Take name and two grades from many students ONE LIST -> Nested list Show a final grade from each student with the average grade first show the final grade Then ask if want to get the individual grade ''' main_grade = list() while True: name = str(input('Name: ')) grade1 = float(input('First grade: ')) g...
""" Take name and two grades from many students ONE LIST -> Nested list Show a final grade from each student with the average grade first show the final grade Then ask if want to get the individual grade """ main_grade = list() while True: name = str(input('Name: ')) grade1 = float(input('First grade: ')) g...
class Bag: def __init__(self, bag_name): self.name = bag_name self.children_names = [bag_name] self.children_counts = [1] self.contained_bags = 0 def is_empty(self): return len(self.children_names) == 0 def contains(self, bag_name): return b...
class Bag: def __init__(self, bag_name): self.name = bag_name self.children_names = [bag_name] self.children_counts = [1] self.contained_bags = 0 def is_empty(self): return len(self.children_names) == 0 def contains(self, bag_name): return bag_name in self....
def schoolbook_operand_scanning(SRC1, SRC2, DEST, t, n): """ This generates a simple static schoolbook multiplication of n by n; assumes SRC1 and SRC2 registers with pointers to where n elements live, writes 2n-1 elements to the DEST pointer """ yield "mov r11, #0" for i in range(2*n - 1):...
def schoolbook_operand_scanning(SRC1, SRC2, DEST, t, n): """ This generates a simple static schoolbook multiplication of n by n; assumes SRC1 and SRC2 registers with pointers to where n elements live, writes 2n-1 elements to the DEST pointer """ yield 'mov r11, #0' for i in range(2 * n - 1):...
# Networking settings HOST = 'localhost' PORT = 8000 TIMEOUT = 500 KEEP_ALIVE = False # Validator settings VALIDATOR_HOST = 'localhost' VALIDATOR_PORT = 4004 # Database settings DB_HOST = 'localhost' DB_PORT = 28015 DB_NAME = 'marketplace' # Runtime settings DEBUG = True # Secret keys # WARNING! These defaults are ...
host = 'localhost' port = 8000 timeout = 500 keep_alive = False validator_host = 'localhost' validator_port = 4004 db_host = 'localhost' db_port = 28015 db_name = 'marketplace' debug = True secret_key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' aes_key = 'ffffffffffffffffffffffffffffffff' batcher_private_key = '1111111111...
""" Exceptions for events app To have so many exception types might be a little over the top, but ... """ class EventException(Exception): """Base exception type for events app""" class UserRegistrationException(EventException): """Base class for exceptions that can be raised when a user trys to register f...
""" Exceptions for events app To have so many exception types might be a little over the top, but ... """ class Eventexception(Exception): """Base exception type for events app""" class Userregistrationexception(EventException): """Base class for exceptions that can be raised when a user trys to register for...
ROLES = ["administrator", "developer", "newswriter", "repositories"] # Scenario: Try to add a role that 'admin' already has. try: output = instance.execute( ["sudo", "criticctl", "addrole", "--name", "admin", "--role", "administrator"]) expected_output = "admin: user already has role ...
roles = ['administrator', 'developer', 'newswriter', 'repositories'] try: output = instance.execute(['sudo', 'criticctl', 'addrole', '--name', 'admin', '--role', 'administrator']) expected_output = "admin: user already has role 'administrator'" if expected_output not in output.splitlines(): logger.e...
assert 1 + 1 == 2 try: assert 1 + 1 == 3 except AssertionError as err: print(err.__class__) try: assert 2 + 2 == 5, 'Only for very large values of 2' except AssertionError as err: print(err) """ <class 'AssertionError'> Only for very large values of 2 """
assert 1 + 1 == 2 try: assert 1 + 1 == 3 except AssertionError as err: print(err.__class__) try: assert 2 + 2 == 5, 'Only for very large values of 2' except AssertionError as err: print(err) "\n<class 'AssertionError'>\nOnly for very large values of 2\n"
''' Created on Aug 15, 2009 @author: santiago '''
""" Created on Aug 15, 2009 @author: santiago """
class KeyValueStorage: def __init__(self, name, env, wtx, dupsort=False): self.name = name.encode("utf-8") self.env = env self.main_db = self.env.open_db(self.name + b'_main_db', txn=wtx, dupsort=dupsort) def put(self, key, value, wtx, dupdata=False): return wtx.put( bytes(key), bytes(value), db=...
class Keyvaluestorage: def __init__(self, name, env, wtx, dupsort=False): self.name = name.encode('utf-8') self.env = env self.main_db = self.env.open_db(self.name + b'_main_db', txn=wtx, dupsort=dupsort) def put(self, key, value, wtx, dupdata=False): return wtx.put(bytes(key),...
a = input() print(a) name = input("Enter your name: ") print(f'Welcome {name}!') age = input("Enter your age:") print(age) print("Hello " + input("Enter your name ")+"!") None weapons = None print(weapons) name = input("Enter your name") # print(name) print(f'Welcome {name} !') print("...
a = input() print(a) name = input('Enter your name: ') print(f'Welcome {name}!') age = input('Enter your age:') print(age) print('Hello ' + input('Enter your name ') + '!') None weapons = None print(weapons) name = input('Enter your name') print(f'Welcome {name} !') print('Hello ' + input('Enter your name ') + '!') Non...
def scala_proto_register_toolchains(): native.register_toolchains("@io_bazel_rules_scala//scala_proto:default_toolchain") def scala_proto_register_enable_all_options_toolchain(): native.register_toolchains("@io_bazel_rules_scala//scala_proto:enable_all_options_toolchain")
def scala_proto_register_toolchains(): native.register_toolchains('@io_bazel_rules_scala//scala_proto:default_toolchain') def scala_proto_register_enable_all_options_toolchain(): native.register_toolchains('@io_bazel_rules_scala//scala_proto:enable_all_options_toolchain')
class Generator(nn.Module): def __init__(self): super().__init__() self.noise_branch = nn.Sequential( nn.ConvTranspose2d(noise_dim, d * 8, kernel_size=4, stride=1, padding=0, bias=False), norm_layer(d * 8), nn.ReLU(True) ) self.label_branch = nn.S...
class Generator(nn.Module): def __init__(self): super().__init__() self.noise_branch = nn.Sequential(nn.ConvTranspose2d(noise_dim, d * 8, kernel_size=4, stride=1, padding=0, bias=False), norm_layer(d * 8), nn.ReLU(True)) self.label_branch = nn.Sequential(nn.ConvTranspose2d(10, d * 8, 4, 1, ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
query_format = '?q={}' dashboards_api_url = 'api/v1/dashboard/' dashboards_api_url_with_query_format = DASHBOARDS_API_URL + QUERY_FORMAT dashboard_api_url_format = DASHBOARDS_API_URL + '{}' export_dashboards_api_url = DASHBOARDS_API_URL + 'export/' export_dashboards_api_url_with_query_format = EXPORT_DASHBOARDS_API_URL...
t = int(input()) answer = [] for a in range(t): val = int(input()) if(val == 2): answer.append(2) elif(val%2 == 1): answer.append(1) else: answer.append(0) for b in answer: print(str(b))
t = int(input()) answer = [] for a in range(t): val = int(input()) if val == 2: answer.append(2) elif val % 2 == 1: answer.append(1) else: answer.append(0) for b in answer: print(str(b))
# Module version py_version_info = (1, 0, 8) js_version_info = (0, 1, 13) # Module version accessible using vitessce.__version__ __version__ = '%s.%s.%s' % ( py_version_info[0], py_version_info[1], py_version_info[2])
py_version_info = (1, 0, 8) js_version_info = (0, 1, 13) __version__ = '%s.%s.%s' % (py_version_info[0], py_version_info[1], py_version_info[2])
#isEqual(cad1: "abcd", cad2= "abcd") -> True def isEqual(cad1,cad2): diccCad = {} for key in cad1: if key in diccCad: diccCad[key] += 1 else: diccCad[key] = 1 for key in cad2: if key in diccCad: diccCad[key] -= 1 else: return False for (key) in diccCad: if diccCad[key] !...
def is_equal(cad1, cad2): dicc_cad = {} for key in cad1: if key in diccCad: diccCad[key] += 1 else: diccCad[key] = 1 for key in cad2: if key in diccCad: diccCad[key] -= 1 else: return False for key in diccCad: if dic...
# Copyright (C) 2019-2021 HERE Europe B.V. # SPDX-License-Identifier: MIT """Project version information.""" # Module version version_info = (1, 1, 1) # Module version accessible using here_map_widget.__version__ __version__ = "%s.%s.%s" % (version_info[0], version_info[1], version_info[2],) EXTENSION_VERSION = "^1...
"""Project version information.""" version_info = (1, 1, 1) __version__ = '%s.%s.%s' % (version_info[0], version_info[1], version_info[2]) extension_version = '^1.1.1'
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', } } SECRET_KEY = 1 INSTALLED_APPS = [ 'django_counter_cache_field', 'tests', ] DEBUG = False SITE_ID = 1
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3'}} secret_key = 1 installed_apps = ['django_counter_cache_field', 'tests'] debug = False site_id = 1
description = 'setup for the status monitor' group = 'special' _reactorBlock = Block('Reactor', [ BlockRow(Field(name='Reactor power', dev='ReactorPower', width=6), ) ], ) _shutterBlock = Block('Shutter', [ BlockRow(Field(name='Prim. shutter', dev='prim_shutt'), Field(name='Sec....
description = 'setup for the status monitor' group = 'special' _reactor_block = block('Reactor', [block_row(field(name='Reactor power', dev='ReactorPower', width=6))]) _shutter_block = block('Shutter', [block_row(field(name='Prim. shutter', dev='prim_shutt'), field(name='Sec. sutter', dev='sec_shutt'))]) _hover_block =...
size = int(input()) matrix = [] for c in range(size): col = [int(n) for n in input().split(' ')] matrix.append(col) primary_diagonal_sum = 0 for i in range(size): primary_diagonal_sum += matrix[i][i] print(primary_diagonal_sum)
size = int(input()) matrix = [] for c in range(size): col = [int(n) for n in input().split(' ')] matrix.append(col) primary_diagonal_sum = 0 for i in range(size): primary_diagonal_sum += matrix[i][i] print(primary_diagonal_sum)
class DetectBaseNotImplementedError(NotImplementedError): pass class DetectBase: def _notimplestr(self, param): return ( "resource detect must have " f"{param}\" property." ) @property def resource(self): raise DetectBaseNotImplementedError( ...
class Detectbasenotimplementederror(NotImplementedError): pass class Detectbase: def _notimplestr(self, param): return f'resource detect must have {param}" property.' @property def resource(self): raise detect_base_not_implemented_error(self._notimplestr('resource')) @property ...
# # PySNMP MIB module CISCO-LWAPP-DOT11-CCX-CLIENT-DIAG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-DOT11-CCX-CLIENT-DIAG-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:05:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 #...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ...
userInput = input("Enter your Sentence: ").upper() translated = "" i = len(userInput)-1 while i >= 0: translated += userInput[i] i-=1 print(translated)
user_input = input('Enter your Sentence: ').upper() translated = '' i = len(userInput) - 1 while i >= 0: translated += userInput[i] i -= 1 print(translated)
def part1(lines): return 0 def part2(lines): return 0 if __name__ == '__main__': with open('input.txt', 'r') as f: lines = f.read().splitlines() print(part1(lines)) print(part2(lines))
def part1(lines): return 0 def part2(lines): return 0 if __name__ == '__main__': with open('input.txt', 'r') as f: lines = f.read().splitlines() print(part1(lines)) print(part2(lines))
class ValidatorLR0001: value = None def __get__(self, obj, objtype=None): return self.value def __set__(self, obj, value): if value is not None: if not isinstance(value, LR0001): raise TypeError(f'Expected {value!r} to be LR0100 object') self.value = va...
class Validatorlr0001: value = None def __get__(self, obj, objtype=None): return self.value def __set__(self, obj, value): if value is not None: if not isinstance(value, LR0001): raise type_error(f'Expected {value!r} to be LR0100 object') self.value = va...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. load(":oss_shim.bzl", "target_utils") def _wrap_bash_build_in_common_boilerplate( self_dependency, bash, rule_type, ...
load(':oss_shim.bzl', 'target_utils') def _wrap_bash_build_in_common_boilerplate(self_dependency, bash, rule_type, target_name, volume_min_free_bytes=None): return '\n # CAREFUL: To avoid inadvertently masking errors, we should\n # only perform command substitutions with variable\n # assignments.\n set...
def generate_config(context): """ Generates config """ project_id = context.properties['project'] billing = context.properties['billing'] concurrent_api_activation = context.properties['concurrent_api_activation'] resources = [] for index, api in enumerate(context.properties['apis']): ...
def generate_config(context): """ Generates config """ project_id = context.properties['project'] billing = context.properties['billing'] concurrent_api_activation = context.properties['concurrent_api_activation'] resources = [] for (index, api) in enumerate(context.properties['apis']): ...
class Singleton: _instance = None def __new__(cls): if not isinstance(cls._instance, cls): cls._instance = super(Singleton, cls).__new__(cls) return cls._instance
class Singleton: _instance = None def __new__(cls): if not isinstance(cls._instance, cls): cls._instance = super(Singleton, cls).__new__(cls) return cls._instance
class Solution: def numJewelsInStones(self, J: str, S: str) -> int: d = {} for letter in J: d[letter] = 1 count = 0 for letter in S: if letter in d: count += 1 return count
class Solution: def num_jewels_in_stones(self, J: str, S: str) -> int: d = {} for letter in J: d[letter] = 1 count = 0 for letter in S: if letter in d: count += 1 return count
# -*- coding: utf-8 -*- # # class ResultStr(object): """docstring for ResultStr""" def __init__(self, arg=None): super(ResultStr, self).__init__() self.arg = arg def TrainingResultStr(self, epoch, loss, acc, duration, training=True): loss_str = self.Loss2Str(loss, decimal_places=...
class Resultstr(object): """docstring for ResultStr""" def __init__(self, arg=None): super(ResultStr, self).__init__() self.arg = arg def training_result_str(self, epoch, loss, acc, duration, training=True): loss_str = self.Loss2Str(loss, decimal_places=6) acc_str = self.Ac...
{ 'conditions': [ ['OS=="win"', { 'variables': { 'MAGICK_ROOT%': 'C:\\Program Files\\ImageMagick-6.9.12-Q16\\', # download the dll binary and check off for libraries and includes 'OSX_VER%': "0", } }], ['OS=="mac"', { 'variables': { # matches 10.9.X , 10.1...
{'conditions': [['OS=="win"', {'variables': {'MAGICK_ROOT%': 'C:\\Program Files\\ImageMagick-6.9.12-Q16\\', 'OSX_VER%': '0'}}], ['OS=="mac"', {'variables': {'OSX_VER%': "<!(sw_vers | grep 'ProductVersion:' | grep -o '10.[0-9]*')"}}, {'variables': {'OSX_VER%': '0'}}]], 'targets': [{'target_name': 'imagemagick', 'sources...
def main() -> None: K = 10**4 def normalize(number: str) -> int: parts = number.split(".") if len(parts) == 1: return int(parts[0]) * K a, b = parts return int(a) * K + int(b) * 10 ** (4 - len(b)) cx, cy, r = map(normalize, input().split()) def ...
def main() -> None: k = 10 ** 4 def normalize(number: str) -> int: parts = number.split('.') if len(parts) == 1: return int(parts[0]) * K (a, b) = parts return int(a) * K + int(b) * 10 ** (4 - len(b)) (cx, cy, r) = map(normalize, input().split()) def count_u...
# # PySNMP MIB module NBS-SFF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBS-SFF-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:17:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
farmer = { 'kb': ''' Farmer(Mac) Rabbit(Pete) Mother(MrsMac, Mac) Mother(MrsRabbit, Pete) (Rabbit(r) & Farmer(f)) ==> Hates(f, r) (Mother(m, c)) ==> Loves(m, c) (Mother(m, r) & Rabbit(r)) ==> Rabbit(m) (Farmer(f)) ==> Human(f) (Mother(m, h) & Human(h)) ==> Human(m) ''', # Note that this order of conjuncts # would r...
farmer = {'kb': '\nFarmer(Mac)\nRabbit(Pete)\nMother(MrsMac, Mac)\nMother(MrsRabbit, Pete)\n(Rabbit(r) & Farmer(f)) ==> Hates(f, r)\n(Mother(m, c)) ==> Loves(m, c)\n(Mother(m, r) & Rabbit(r)) ==> Rabbit(m)\n(Farmer(f)) ==> Human(f)\n(Mother(m, h) & Human(h)) ==> Human(m)\n', 'queries': '\nHuman(x)\nHates(x, y)\n'} weap...
"""Configuration of OSP-core warnings.""" attributes_cannot_modify_in_place = True """Warns when a user fetches a mutable attribute of a CUDS object. For example `fr = city.City(name='Freiburg', coordinates=[1, 2]); fr.coordinates`. """
"""Configuration of OSP-core warnings.""" attributes_cannot_modify_in_place = True "Warns when a user fetches a mutable attribute of a CUDS object.\n\nFor example `fr = city.City(name='Freiburg', coordinates=[1, 2]);\nfr.coordinates`.\n"
# Copyright 2010 Curtis McEnroe <programble@gmail.com> # Licensed under the GNU GPLv3 class Scope: def __init__(self, parent=None): self.bindings = {} self.parent = parent def __getitem__(self, key): # If bound in this scope, return that if self.bindings.has_key(key): ...
class Scope: def __init__(self, parent=None): self.bindings = {} self.parent = parent def __getitem__(self, key): if self.bindings.has_key(key): return self.bindings[key] elif self.parent: return self.parent[key] else: raise name_erro...
def soma(x: float, y: float) -> float: return x + y def main() -> None: print(soma(10, 40)) print(soma(30, 30)) if __name__== '__main__': main()
def soma(x: float, y: float) -> float: return x + y def main() -> None: print(soma(10, 40)) print(soma(30, 30)) if __name__ == '__main__': main()
rol_enviar_notificaiones_servidor = "Server" time_resend_mail = 300 minimo_nivel_bateria = 30 #3.0V
rol_enviar_notificaiones_servidor = 'Server' time_resend_mail = 300 minimo_nivel_bateria = 30
#!/usr/bin/env python __author__ = "Christopher and Cody Reichert" __copyright__ = "Copyright 2015, SimplyRETS Inc. <support@simplyrets.com>" __credits__ = ["Christopher Reichert", "Cody Reichert"] __license__ = "MIT" __version__ = "0.1" __maintainer__ = "Christopher Reichert" __email__ = "christopher@simplyrets.com" ...
__author__ = 'Christopher and Cody Reichert' __copyright__ = 'Copyright 2015, SimplyRETS Inc. <support@simplyrets.com>' __credits__ = ['Christopher Reichert', 'Cody Reichert'] __license__ = 'MIT' __version__ = '0.1' __maintainer__ = 'Christopher Reichert' __email__ = 'christopher@simplyrets.com' __status__ = 'Productio...
STDIN_FILENO = 0 STDOUT_FILENO = 1 STDERR_FILENO = 2 DEFAULT_PORT = 0xdb9 DEFAULT_IP = '127.0.0.1' DEFAULT_CONNECT_TIMEOUT = 10.
stdin_fileno = 0 stdout_fileno = 1 stderr_fileno = 2 default_port = 3513 default_ip = '127.0.0.1' default_connect_timeout = 10.0
""" A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value. Given the root to a binary tree, count the number of unival subtrees. """ class BinaryTree(object): def __init__(self, value): self.value = value self.left = None self.right = No...
""" A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value. Given the root to a binary tree, count the number of unival subtrees. """ class Binarytree(object): def __init__(self, value): self.value = value self.left = None self.right = No...
s=input().split() n1=str(s[0].replace('7','0')) op=s[1] n2=str(s[2].replace('7','0')) res=str(int(n1)+int(n2)) if op=='+' else str(int(n1)*int(n2)) res=int(res.replace('7','0')) print(res)
s = input().split() n1 = str(s[0].replace('7', '0')) op = s[1] n2 = str(s[2].replace('7', '0')) res = str(int(n1) + int(n2)) if op == '+' else str(int(n1) * int(n2)) res = int(res.replace('7', '0')) print(res)
class MyMsp430Constants: ACT_PXY_ADC = 0x40 ACT_PXY_DACDMA = 0x41 ACT_PXY_NMI = 0x42 ACT_PXY_PORT1 = 0x43 ACT_PXY_PORT2 = 0x44 ACT_PXY_TIMERA0 = 0x45 ACT_PXY_TIMERA1 = 0x46 ACT_PXY_TIMERB0 = 0x47 ACT_PXY_TIMERB1 = 0x48 ACT_PXY_UART0RX = 0x49 ACT_PXY_UART0TX = 0x4...
class Mymsp430Constants: act_pxy_adc = 64 act_pxy_dacdma = 65 act_pxy_nmi = 66 act_pxy_port1 = 67 act_pxy_port2 = 68 act_pxy_timera0 = 69 act_pxy_timera1 = 70 act_pxy_timerb0 = 71 act_pxy_timerb1 = 72 act_pxy_uart0_rx = 73 act_pxy_uart0_tx = 74 act_pxy_uart1_rx = 75 a...
# A Python program to demonstrate both packing and # unpacking. # A sample python function that takes three arguments # and prints them def fun1(a, b, c): print(a, b, c) # Another sample function. # This is an example of PACKING. All arguments passed # to fun2 are packed into tuple *args. def fun2(*args): ...
def fun1(a, b, c): print(a, b, c) def fun2(*args): args = list(args) args[0] = 'Wikitechy' args[1] = 'awesome' fun1(*args) fun2('Hello', 'beautiful', 'world!')
# Coding Challenge 2 ### Chelsea Lizardo ### NRS 528 # # #3 Ask the user for an input of their current age, and tell them how many years until they reach retirement (65 years old). name = input("What is your name: ") age = int(input("How old are you: ")) year = str((2021 - age)+65) #print name input + " will b...
name = input('What is your name: ') age = int(input('How old are you: ')) year = str(2021 - age + 65) print(name + ' will be 65 years old in the year ' + year)
__name__ = "bootstrap-scoped" __version__ = "0.1.0" __url__ = "https://github.com/achillesrasquinha/bootstrap-scoped" __author__ = "Achilles Rasquinha" __email__ = "achillesrasquinha@gmail.com" __description__ = "Scope your Bootstrap assets in a jiffy!" __license__ = "MIT" __keywords__...
__name__ = 'bootstrap-scoped' __version__ = '0.1.0' __url__ = 'https://github.com/achillesrasquinha/bootstrap-scoped' __author__ = 'Achilles Rasquinha' __email__ = 'achillesrasquinha@gmail.com' __description__ = 'Scope your Bootstrap assets in a jiffy!' __license__ = 'MIT' __keywords__ = ['bootstrap', 'scoped', 'css', ...
""" Copy out of the top of sympy.core.compatibility as of b8aa2de87d537eddde044c13f2eaaab99a5dcfe7 This can be deleted when we depend on sympy 0.7.0 or later """ """ Reimplementations of constructs introduced in later versions of Python than we support. """ # These are in here because telling if something is an itera...
""" Copy out of the top of sympy.core.compatibility as of b8aa2de87d537eddde044c13f2eaaab99a5dcfe7 This can be deleted when we depend on sympy 0.7.0 or later """ '\nReimplementations of constructs introduced in later versions of Python than we\nsupport.\n' def iterable(i, exclude=(basestring, dict)): """ Retu...
def process_image(img): # 1) Define source and destination points for perspective transform dst_size = 5 source = np.float32([[200, 95],[300, 140],[10, 140],[118, 95]]) destination = np.float32([[165, 135],[165, 145],[155, 145],[155, 135]]) # 2) Apply perspective transform warped = perspect_tran...
def process_image(img): dst_size = 5 source = np.float32([[200, 95], [300, 140], [10, 140], [118, 95]]) destination = np.float32([[165, 135], [165, 145], [155, 145], [155, 135]]) warped = perspect_transform(img, source, destination) rgb_nav_min = (170, 170, 170) rgb_nav_max = (255, 255, 255) ...
class Solution: def isPalindrome(self, s): """ :type s: str :rtype: bool """ i, j = 0, (len(s) - 1) while i < j: while i < j and not s[i].isalnum(): i += 1 while i < j and not s[j].isalnum(): j -= 1 i...
class Solution: def is_palindrome(self, s): """ :type s: str :rtype: bool """ (i, j) = (0, len(s) - 1) while i < j: while i < j and (not s[i].isalnum()): i += 1 while i < j and (not s[j].isalnum()): j -= 1 ...
# -*- encoding: utf-8 -*- def spam(): pass def grok(): pass blah = 42 __all__ = {'spam', 'grok'}
def spam(): pass def grok(): pass blah = 42 __all__ = {'spam', 'grok'}
description = 'NOK5a using Beckhoff controllers' group = 'lowlevel' instrument_values = configdata('instrument.values') showcase_values = configdata('cf_showcase.showcase_values') optic_values = configdata('cf_optic.optic_values') tango_base = instrument_values['tango_base'] code_base = instrument_values['code_base...
description = 'NOK5a using Beckhoff controllers' group = 'lowlevel' instrument_values = configdata('instrument.values') showcase_values = configdata('cf_showcase.showcase_values') optic_values = configdata('cf_optic.optic_values') tango_base = instrument_values['tango_base'] code_base = instrument_values['code_base'] i...
DATA_DIR = '/floyd/input' PTB_DIR = '_ptb' BROWN_DIR = '_brown' GUTENBERG_DIR = '_gutenberg' BIBLE_DIR = '_bible' WIKITEXT2_DIR = '_wikitext2' WIKITEXT103_DIR = '_wikitext103' TRAIN = 'train' TEST = 'test' VAL = 'val' MODEL_DIR = 'bin' FLOYD = True
data_dir = '/floyd/input' ptb_dir = '_ptb' brown_dir = '_brown' gutenberg_dir = '_gutenberg' bible_dir = '_bible' wikitext2_dir = '_wikitext2' wikitext103_dir = '_wikitext103' train = 'train' test = 'test' val = 'val' model_dir = 'bin' floyd = True
#!/usr/bin/env python for n in range(2, 10): print("== %d ==" % (n)) for x in range(2, n): print("x = ", x) if n % x == 0: print(n, 'equals', x, '*', n//x) break else: # loop fell through without finding a factor print(n, 'is a prime number')
for n in range(2, 10): print('== %d ==' % n) for x in range(2, n): print('x = ', x) if n % x == 0: print(n, 'equals', x, '*', n // x) break else: print(n, 'is a prime number')
# Copyright 2019 The Bazel Authors. 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 required by applicable la...
"""Repository external dependency resolution functions.""" load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def _include_if_not_defined(repo_rule, name, **kwargs): if not native.existing_rule(name): repo_rule(name=name, **kwargs) jinja2_build_file = '\npy_library(\n name = "jinja2",\...
class TvshowsData: def __init__(self): self.NetflixData=[] self.HBOData = [] self.DisneyData = [] def add_NetflixData(self,data): self.NetflixData.append(data) def get_NetflixData(self): return self.NetflixData def add_HBOData(self,data): self.H...
class Tvshowsdata: def __init__(self): self.NetflixData = [] self.HBOData = [] self.DisneyData = [] def add__netflix_data(self, data): self.NetflixData.append(data) def get__netflix_data(self): return self.NetflixData def add_hbo_data(self, data): self...
class ColumnAttachmentJustification(Enum,IComparable,IFormattable,IConvertible): """ Control the column extent in cases where the target is not a uniform height. enum ColumnAttachmentJustification,values: Maximum (2),Midpoint (1),Minimum (0),Tangent (3) """ def __eq__(self,*args): """ x.__eq__(y) <==>...
class Columnattachmentjustification(Enum, IComparable, IFormattable, IConvertible): """ Control the column extent in cases where the target is not a uniform height. enum ColumnAttachmentJustification,values: Maximum (2),Midpoint (1),Minimum (0),Tangent (3) """ def __eq__(self, *args): """ x.__eq...
#!/usr/bin/env python admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ['MANAGED_SERVER_NAME'] ########...
admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ['MANAGED_SERVER_NAME'] def set_server_tunning_config(_se...
# 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 ) : mpis = [ 0 ] * ( n ) for i in range ( n ) : mpis [ i ] = arr [ i ] for i in range (...
def f_gold(arr, n): mpis = [0] * n for i in range(n): mpis[i] = arr[i] for i in range(1, n): for j in range(i): if arr[i] > arr[j] and mpis[i] < mpis[j] * arr[i]: mpis[i] = mpis[j] * arr[i] return max(mpis) if __name__ == '__main__': param = [([1, 1, 4, 7,...
# -*- coding: utf-8 -*- """ Created on Wed Nov 24 20:14:29 2019 @author: nehap """ """ Input: 5 Output : 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 """ if __name__=="__main__": n = int(input("Input: ")) #Initial spaces k = 2*n-2 print("Output :") #Outer Loop - controlling number of row...
""" Created on Wed Nov 24 20:14:29 2019 @author: nehap """ '\nInput: 5\nOutput :\n 1\n 2 1\n 3 2 1\n 4 3 2 1 \n5 4 3 2 1\n' if __name__ == '__main__': n = int(input('Input: ')) k = 2 * n - 2 print('Output :') for i in range(0, n): for j in range(0, k): print(end=' '...
#!/usr/bin/python # -*- coding: utf-8 -*- CONTRASTA = [0.84, 0.37, 0, 1] # orange CONTRASTB = [0.53, 0.53, 1, 1] # lightblue CONTRASTC = [0.84, 1, 0, 1] CONTRASTA = [0, 0.7, 0.8, 1] CONTRASTB = [1, 1, 1, 0.5] def show_detail(render, edges_coordinates, fn=None): render.clear_canvas() render_circle = render...
contrasta = [0.84, 0.37, 0, 1] contrastb = [0.53, 0.53, 1, 1] contrastc = [0.84, 1, 0, 1] contrasta = [0, 0.7, 0.8, 1] contrastb = [1, 1, 1, 0.5] def show_detail(render, edges_coordinates, fn=None): render.clear_canvas() render_circle = render.circle small = render.pix * 3.0 large = render.pix * 10.0 ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeKLists(self, lists: 'List[ListNode]') -> 'ListNode': res = [] for l in lists: while l: res.append(l.val) ...
class Solution: def merge_k_lists(self, lists: 'List[ListNode]') -> 'ListNode': res = [] for l in lists: while l: res.append(l.val) l = l.next return sorted(res)
def find_sum(arr): ''' using divide and conquer technique to recursively find the sum of a list of numbers ''' result = 0 if len(arr) == 1 : result = arr[0] else: result = arr.pop() + find_sum(arr) return result def count_list(arr): ''' rec...
def find_sum(arr): """ using divide and conquer technique to recursively find the sum of a list of numbers """ result = 0 if len(arr) == 1: result = arr[0] else: result = arr.pop() + find_sum(arr) return result def count_list(arr): """ recursive counter ...
environment = 'test' preservica_base_url = 'https://test_preservica_url' input_stream_name = 'shared_services_output_test' invalid_stream_name = 'message_invalid_test' error_stream_name = 'message_error_test' adaptor_aws_region = 'eu-west-2' organisation_buckets = { '44': 's3://some_bucket', }
environment = 'test' preservica_base_url = 'https://test_preservica_url' input_stream_name = 'shared_services_output_test' invalid_stream_name = 'message_invalid_test' error_stream_name = 'message_error_test' adaptor_aws_region = 'eu-west-2' organisation_buckets = {'44': 's3://some_bucket'}
def soma_lista(x): soma = 0 for c in x: soma += c return soma print(soma_lista([1, 2, 3, 4, 5]))
def soma_lista(x): soma = 0 for c in x: soma += c return soma print(soma_lista([1, 2, 3, 4, 5]))
with open("input.txt") as f: dat = f.readlines() dat = [line.strip() for line in dat] maxid = 0 for ele in dat: hr = 127 lr = 0 hc = 7 lc = 0 chrs = [ c for c in ele] chrsR = chrs[0:7] chrsC = chrs[7:] for c in chrsR: if(c == 'F'): hr = hr - ( hr - lr ) // 2 - 1 else: lr =...
with open('input.txt') as f: dat = f.readlines() dat = [line.strip() for line in dat] maxid = 0 for ele in dat: hr = 127 lr = 0 hc = 7 lc = 0 chrs = [c for c in ele] chrs_r = chrs[0:7] chrs_c = chrs[7:] for c in chrsR: if c == 'F': hr = hr - (hr - lr) // 2 - 1...