content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def soma(n1,n2): r = n1+n2 return r def sub(n1,n2): r = n1-n2 return r def mult(n1,n2): r = n1*n2 return r def divfra(n1,n2): r = n1/n2 return r def divint(n1,n2): r = n1//n2 return r def restodiv(n1,n2): r = n1%n2 return r def raiz1(n1,n2): r = n1**(0.5) re...
def soma(n1, n2): r = n1 + n2 return r def sub(n1, n2): r = n1 - n2 return r def mult(n1, n2): r = n1 * n2 return r def divfra(n1, n2): r = n1 / n2 return r def divint(n1, n2): r = n1 // n2 return r def restodiv(n1, n2): r = n1 % n2 return r def raiz1(n1, n2): r...
# Edit and set server name and version test_server_name = '<put server name here>' test_server_version = '201X' # Edit and direct to your test folders on your server test_folder = r'\Tests' test_mkfolder = r'\Tests\New Folder' test_newfoldername = 'Renamed folder' test_renamedfolder = r'\Tests\Renamed folder' ...
test_server_name = '<put server name here>' test_server_version = '201X' test_folder = '\\Tests' test_mkfolder = '\\Tests\\New Folder' test_newfoldername = 'Renamed folder' test_renamedfolder = '\\Tests\\Renamed folder' test_file = '\\Tests\\TestModel.rvt' test_cpyfile = '\\Tests\\TestModelCopy.rvt' test_mvfile = '\\Te...
''' Created on Aug 8, 2017 Check permutation: Given two strings, write a method to decide if one is a permutation of the other Things to learn: - a python set orders set content - in a set, one uses == to compare same content @author: igoroya ''' def check_string_permuntation(str1, str2): if len(str1) is not le...
""" Created on Aug 8, 2017 Check permutation: Given two strings, write a method to decide if one is a permutation of the other Things to learn: - a python set orders set content - in a set, one uses == to compare same content @author: igoroya """ def check_string_permuntation(str1, str2): if len(str1) is not len...
# # PySNMP MIB module IEEE8021-MIRP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IEEE8021-MIRP-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:52:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ...
def comparison(start,end, path_to_file): file = open(path_to_file) for res in file: pred_start = int(res.split(" ")[1]) pred_end = int(res.split(" ")[2].split("\t")[0]) if not (pred_end < int(start) or pred_start > int(end)): return res.split("\t")[-1] return ''
def comparison(start, end, path_to_file): file = open(path_to_file) for res in file: pred_start = int(res.split(' ')[1]) pred_end = int(res.split(' ')[2].split('\t')[0]) if not (pred_end < int(start) or pred_start > int(end)): return res.split('\t')[-1] return ''
#!/usr/bin/env python3 class Key: def __init__(self, group_name=None, item_name=None, variable_name=None): self._group_name = group_name self._item_name = item_name self._variable_name = variable_name def group_name(self): return self._group_name def item_name(self...
class Key: def __init__(self, group_name=None, item_name=None, variable_name=None): self._group_name = group_name self._item_name = item_name self._variable_name = variable_name def group_name(self): return self._group_name def item_name(self): return self._item_na...
X = X[:2000,:] labels = labels[:2000] score = pca_model.transform(X) with plt.xkcd(): visualize_components(score[:,0],score[:,1],labels) plt.show()
x = X[:2000, :] labels = labels[:2000] score = pca_model.transform(X) with plt.xkcd(): visualize_components(score[:, 0], score[:, 1], labels) plt.show()
{ 'targets': [{ 'target_name': 'shoco', 'type': 'static_library', 'sources': ['shoco/shoco.c'], 'cflags': [ '-std=c99', '-fexceptions', '-Wall', '-march=native', '-Ofast' ], 'xcode_settings': { 'OTHER_CFLAGS': [ '-std=c99', '-fexceptions', ...
{'targets': [{'target_name': 'shoco', 'type': 'static_library', 'sources': ['shoco/shoco.c'], 'cflags': ['-std=c99', '-fexceptions', '-Wall', '-march=native', '-Ofast'], 'xcode_settings': {'OTHER_CFLAGS': ['-std=c99', '-fexceptions', '-Wall', '-march=native', '-Ofast']}, 'msvs_settings': {'VCCLCompilerTool': {'Exceptio...
# =========================================================================== # scores.py --------------------------------------------------------------- # =========================================================================== # class ------------------------------------------------------------------- # -----...
class Scores: def __init__(self, number=1, logger=None): self._len = number self._logger = logger def __len__(self): return self._len def __iter__(self): self._index = -1 return self def __next__(self): if self._index < self._len - 1: self....
def get_disc_loss(gen, disc, criterion, real, num_images, z_dim, device): ''' Return the loss of the discriminator given inputs. Parameters: gen: the generator model, which returns an image given z-dimensional noise disc: the discriminator model, which returns a single-dimensional prediction...
def get_disc_loss(gen, disc, criterion, real, num_images, z_dim, device): """ Return the loss of the discriminator given inputs. Parameters: gen: the generator model, which returns an image given z-dimensional noise disc: the discriminator model, which returns a single-dimensional prediction...
#!/usr/bin/env python def get_user_password(sockfile): """Given the path of a socket file, returns a tuple (user, password).""" return ("root", file('/etc/mysql/root.pw').read().strip())
def get_user_password(sockfile): """Given the path of a socket file, returns a tuple (user, password).""" return ('root', file('/etc/mysql/root.pw').read().strip())
load("//bazel:common.bzl", "get_env_bool_value") _IS_PLATFORM_ALIBABA = "IS_PLATFORM_ALIBABA" def _blade_service_common_impl(repository_ctx): if get_env_bool_value(repository_ctx, _IS_PLATFORM_ALIBABA): repository_ctx.template("blade_service_common_workspace.bzl", Label("//bazel/blade_service_common:blade...
load('//bazel:common.bzl', 'get_env_bool_value') _is_platform_alibaba = 'IS_PLATFORM_ALIBABA' def _blade_service_common_impl(repository_ctx): if get_env_bool_value(repository_ctx, _IS_PLATFORM_ALIBABA): repository_ctx.template('blade_service_common_workspace.bzl', label('//bazel/blade_service_common:blade_...
def get_leveshtein(s1, s2): """Returns levenshtein's length, i.e. the number of characters to modify to get a pattern string""" if s1 is None or s2 is None: return -1 if len(s1) < len(s2): return get_leveshtein(s2, s1) # len(s1) >= len(s2) if len(s2) == 0: return len(s1...
def get_leveshtein(s1, s2): """Returns levenshtein's length, i.e. the number of characters to modify to get a pattern string""" if s1 is None or s2 is None: return -1 if len(s1) < len(s2): return get_leveshtein(s2, s1) if len(s2) == 0: return len(s1) previous_row = range(...
"""Exceptions and errors for BondGraphTools""" class InvalidPortException(Exception): """Exception for trying to access a port that is in use, or does not exist """ pass class InvalidComponentException(Exception): """Exception for when trying to use a model that can't be found, or is of the wron...
"""Exceptions and errors for BondGraphTools""" class Invalidportexception(Exception): """Exception for trying to access a port that is in use, or does not exist """ pass class Invalidcomponentexception(Exception): """Exception for when trying to use a model that can't be found, or is of the wrong ...
def defuzz(fset, type): # check for input type if not isinstance(fset, dict): raise TypeError("First input argument should be a dictionary.") # check input dictionary length if len(list(fset.keys())) < 1: raise ValueError("dictionary should have at least one member.") for key, valu...
def defuzz(fset, type): if not isinstance(fset, dict): raise type_error('First input argument should be a dictionary.') if len(list(fset.keys())) < 1: raise value_error('dictionary should have at least one member.') for (key, value) in fset.items(): if not isinstance(key, int) and (n...
freq=int(input()) list1=[] list2=[] for i in range(0,freq): row=[] fn=input().split() fn=[int(i) for i in fn] for e in fn: row.append(e) #[row.append(e) for e in fn] list1.append(row) for row in list1: for i in range(0,freq): list2.append(list1[0][i]) #for...
freq = int(input()) list1 = [] list2 = [] for i in range(0, freq): row = [] fn = input().split() fn = [int(i) for i in fn] for e in fn: row.append(e) list1.append(row) for row in list1: for i in range(0, freq): list2.append(list1[0][i]) for row in list1: print(row) print(list...
# The code below almost works name = input("Enter your name") print("Hello", name)
name = input('Enter your name') print('Hello', name)
# -*- coding: utf-8 -*- # Copyright (c) 2018 Richard Hull & Contributors # See LICENSE.md for details. """ Alternative pin mappings for Orange PI 4 (https://drive.google.com/drive/folders/1jALhyhwjSVsxwSX1MwhjiOyQdx_fwlFg) Usage: .. code:: python import orangepi.4 from OPi import GPIO GPIO.setmode(orangepi...
""" Alternative pin mappings for Orange PI 4 (https://drive.google.com/drive/folders/1jALhyhwjSVsxwSX1MwhjiOyQdx_fwlFg) Usage: .. code:: python import orangepi.4 from OPi import GPIO GPIO.setmode(orangepi.4.BOARD) or GPIO.setmode(orangepi.4.BCM) """ board = {3: 64, 5: 65, 7: 150, 8: 145, 10: 144, 11: 33, 12...
""" VTGS Relay Daemon -- https://github.com/zleffke/cdh_sim """ __title__ = "CDH SIM" __version__ = "0.0.0" __author__ = "Zach Leffke, KJ4QLP" __email__ = "zleffke@vt.edu" __desc__ = "VCC CDH Simulator" __url__ = "vtgs.hume.vt.edu"
""" VTGS Relay Daemon -- https://github.com/zleffke/cdh_sim """ __title__ = 'CDH SIM' __version__ = '0.0.0' __author__ = 'Zach Leffke, KJ4QLP' __email__ = 'zleffke@vt.edu' __desc__ = 'VCC CDH Simulator' __url__ = 'vtgs.hume.vt.edu'
#!/usr/bin/env python3 class FilterModule(object): # my_vars: "{{ dom_dt.data.sub_domains | json_select('', ['ip','domain','phpversion','customlog','phpopenbasedirprotect']) }}" # my_vars: "{{ dom_dt | json_select(['data','sub_domains'], ['ip','domain','phpversion','customlog','phpopenbasedirprotect']) }}" # my_vars: "...
class Filtermodule(object): def filters(self): return {'json_select': self.json_select} def jmagik(self, jbody, jpth, jfil): countr = 0 countr1 = True if jpth != '' and type(jpth) is not int: jvar = jbody for i in jpth: jvar = jvar[i] ...
a = float(input()) b = float(input()) c = float(input()) d = float(input()) a = a*2 b = b*3 c = c*4 e = (a+b+c+d)/10 print("Media: %.1f"%e) if (e >= 7): print("Aluno aprovado.") elif(e < 5): print("Aluno reprovado.") else: print("Aluno em exame.") f = float(input()) print("Nota...
a = float(input()) b = float(input()) c = float(input()) d = float(input()) a = a * 2 b = b * 3 c = c * 4 e = (a + b + c + d) / 10 print('Media: %.1f' % e) if e >= 7: print('Aluno aprovado.') elif e < 5: print('Aluno reprovado.') else: print('Aluno em exame.') f = float(input()) print('Nota do exame...
x=('zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen') y=('twenty','thirty','fourty','fifty','sixty','seventy','eighty','ninety','hundred','thousand') ins=["one","hundred","fourty","nine"] d=t=h=T...
x = ('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen') y = ('twenty', 'thirty', 'fourty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', 'hundred', 'thousand') ins = ['one', 'hun...
# Michael Williamson # NATO Phonetic/Morse Code Translator # 7/29/2020 MORSE_CODE_DICT = { 'A':'.-', 'B':'-...', 'C':'-.-.', 'D':'-..', 'E':'.', 'F':'..-.', 'G':'--.', 'H':'....', 'I':'..', 'J':'.---', 'K':'-.-', 'L':'.-..', 'M':'--', ...
morse_code_dict = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--'...
# -- encoding:utf-8 -- """ Create by ibf on 2018/6/21 """
""" Create by ibf on 2018/6/21 """
def test_lowercase_spell(client): assert "Fireball" in client.post('/spellbook', data=dict(text="fireball", team_id='test-team-id', token='test-token', ...
def test_lowercase_spell(client): assert 'Fireball' in client.post('/spellbook', data=dict(text='fireball', team_id='test-team-id', token='test-token', user_id='asdf')).get_json()['text'] def test_uppercase_spell(client): assert 'Fireball' in client.post('/spellbook', data=dict(text='FIREBALL', team_id='test-t...
x = 1 if x == 1: # indented four spaces print("x is ASDJASJDJAJSAJD JASJD ASJD JASJD JASDJ AJSDJ ASJD JASJD JASJD JASJD AJS DJASJD JASJD JASDJ AJSD JASJD JSADJ ASJD JASD AJSD JASJD JASD AJSDJ ASJD JA1.")
x = 1 if x == 1: print('x is ASDJASJDJAJSAJD JASJD ASJD JASJD JASDJ AJSDJ ASJD JASJD JASJD JASJD AJS DJASJD JASJD JASDJ AJSD JASJD JSADJ ASJD JASD AJSD JASJD JASD AJSDJ ASJD JA1.')
description = 'Laser Safety Shutter' prefix = '14IDB:B1Bi0' target = 0.0 command_value = 1.0 auto_open = 0.0 EPICS_enabled = True
description = 'Laser Safety Shutter' prefix = '14IDB:B1Bi0' target = 0.0 command_value = 1.0 auto_open = 0.0 epics_enabled = True
""" file namers """ class Extension(): """ file extensions """ INFORMATION = '.yaml' INPUT_LOG = '.inp' OUTPUT_LOG = '.out' PROJROT_LOG = '.prot' TEMPLATE = '.temp' SHELL_SCRIPT = '.sh' ENERGY = '.ene' GEOMETRY = '.xyz' TRAJECTORY = '.t.xyz' ZMATRIX = '.zmat' VMATRIX = ...
""" file namers """ class Extension: """ file extensions """ information = '.yaml' input_log = '.inp' output_log = '.out' projrot_log = '.prot' template = '.temp' shell_script = '.sh' energy = '.ene' geometry = '.xyz' trajectory = '.t.xyz' zmatrix = '.zmat' vmatrix = '.v...
Matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] print('='*40) print('GERADOR DE MATRIZ') print('='*40) for i in range(0, 3): for j in range(0, 3): Matriz[i][j] = int(input(f'Insira um valor na linha {i}, coluna {j}: ')) print( '='*40) print('\n') print(f"{'A = ': ^17}") for i in range(0, 3): for j in range(0...
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] print('=' * 40) print('GERADOR DE MATRIZ') print('=' * 40) for i in range(0, 3): for j in range(0, 3): Matriz[i][j] = int(input(f'Insira um valor na linha {i}, coluna {j}: ')) print('=' * 40) print('\n') print(f"{'A = ': ^17}") for i in range(0, 3): for j in ra...
class ApiEndpoint(object): client = None parent = None def __init__(self, client, parent=None): self.client = client self.parent = parent
class Apiendpoint(object): client = None parent = None def __init__(self, client, parent=None): self.client = client self.parent = parent
__all__ = [ "SamplingError", "IncorrectArgumentsError", "TraceDirectoryError", "ImputationWarning", "ShapeError" ] class SamplingError(RuntimeError): pass class IncorrectArgumentsError(ValueError): pass class TraceDirectoryError(ValueError): """Error from trying to load a trace fro...
__all__ = ['SamplingError', 'IncorrectArgumentsError', 'TraceDirectoryError', 'ImputationWarning', 'ShapeError'] class Samplingerror(RuntimeError): pass class Incorrectargumentserror(ValueError): pass class Tracedirectoryerror(ValueError): """Error from trying to load a trace from an incorrectly-structur...
''' This package serves two purposes: 1. Define the interface for different parser adapters to implement. 2. Implement the completion generation logic based on the defined interface. Other packages should subclass the supplied classes and implement the interface. '''
""" This package serves two purposes: 1. Define the interface for different parser adapters to implement. 2. Implement the completion generation logic based on the defined interface. Other packages should subclass the supplied classes and implement the interface. """
__author__ = "Sylvain Dangin" __licence__ = "Apache 2.0" __version__ = "1.0" __maintainer__ = "Sylvain Dangin" __email__ = "sylvain.dangin@gmail.com" __status__ = "Development" class last_word(): def transform(input_data): """Get the last word of a string with more than one word. :param in...
__author__ = 'Sylvain Dangin' __licence__ = 'Apache 2.0' __version__ = '1.0' __maintainer__ = 'Sylvain Dangin' __email__ = 'sylvain.dangin@gmail.com' __status__ = 'Development' class Last_Word: def transform(input_data): """Get the last word of a string with more than one word. :param inp...
# @desc The 2nd character in a string is at index 1. def combine2(s1, s2): s3 = s1[1] s4 = s2[1] result = s3 + s4 return result def main(): print(combine2('Car', 'wash')) print(combine2(' Hello', ' world')) print(combine2('55', '88')) print(combine2('Snow', 'ball')) print(combine2...
def combine2(s1, s2): s3 = s1[1] s4 = s2[1] result = s3 + s4 return result def main(): print(combine2('Car', 'wash')) print(combine2(' Hello', ' world')) print(combine2('55', '88')) print(combine2('Snow', 'ball')) print(combine2('Rain', 'boots')) print(combine2('Reading', 'bat')...
""" Description =========== Write a simple function that take a input string, add a space after every 3rd character, and return the modified string """ def simple_function(input): """ Adds a space every 3rd character of an input :param input: String - some string :returns: String - A string with a s...
""" Description =========== Write a simple function that take a input string, add a space after every 3rd character, and return the modified string """ def simple_function(input): """ Adds a space every 3rd character of an input :param input: String - some string :returns: String - A string with a sp...
class Node: def __init__(self, data): self.data = data self.next = None def create_circular_linked_list(): head = Node(1) node2 = Node(2) node3 = Node(3) node4 = Node(4) node5 = Node(5) head.next = node2 node2.next = node3 node3.next = node4 node4.next = node5...
class Node: def __init__(self, data): self.data = data self.next = None def create_circular_linked_list(): head = node(1) node2 = node(2) node3 = node(3) node4 = node(4) node5 = node(5) head.next = node2 node2.next = node3 node3.next = node4 node4.next = node5 ...
# # PySNMP MIB module RADLAN-rlFft (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-rlFft # Produced by pysmi-0.3.4 at Mon Apr 29 20:42:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
a=1 for i in range(325): a=a*0.1 print(a)
a = 1 for i in range(325): a = a * 0.1 print(a)
""" Given a array of numbers representing the stock prices of a company in chronological order, write a function that calculates the maximum profit you could have made from buying and selling that stock once. You must buy before you can sell it. For example, given [9, 11, 8, 5, 7, 10], you should return 5, since you c...
""" Given a array of numbers representing the stock prices of a company in chronological order, write a function that calculates the maximum profit you could have made from buying and selling that stock once. You must buy before you can sell it. For example, given [9, 11, 8, 5, 7, 10], you should return 5, since you c...
#! /usr/bin/env python # -*- coding:utf-8 -*- """ @author: Vesper Huang """ class Solution(object): def convertInteger(self, A, B): """ :type A: int :type B: int :rtype: int """ tmp = A ^ B count = 0 for i in range(32): count += tmp & 1 ...
""" @author: Vesper Huang """ class Solution(object): def convert_integer(self, A, B): """ :type A: int :type B: int :rtype: int """ tmp = A ^ B count = 0 for i in range(32): count += tmp & 1 tmp = tmp >> 1 return coun...
class BasicSettingsApiCredentialsBackend(object): CLIENT_ERROR_MESSAGE = "Client implementations must define a `{0}` attribute" CLIENT_SETTINGS_ERROR_MESSAGE = "Settings must contain a `{0}` attribute" def __init__(self, client): self.client = client @property def base_url(self): ...
class Basicsettingsapicredentialsbackend(object): client_error_message = 'Client implementations must define a `{0}` attribute' client_settings_error_message = 'Settings must contain a `{0}` attribute' def __init__(self, client): self.client = client @property def base_url(self): r...
def fill_n(arr, offset_x, value, symbol=True): """Fill cells of arr starting from row offset_x with value in unary counting.""" value_left = value width = arr.shape[1] current_row = offset_x while value_left: add_this_iter = min(width, value_left) arr[current_row, :add_this_it...
def fill_n(arr, offset_x, value, symbol=True): """Fill cells of arr starting from row offset_x with value in unary counting.""" value_left = value width = arr.shape[1] current_row = offset_x while value_left: add_this_iter = min(width, value_left) arr[current_row, :add_this_iter] = [...
dial = {'A': 2, 'B': 2, 'C': 2, 'D': 3, 'E': 3, 'F': 3, 'G': 4, 'H': 4, 'I': 4, 'J': 5, 'K': 5, 'L': 5, 'M': 6, 'N': 6, 'O': 6, 'P': 7, 'Q': 7, 'R': 7, 'T': 8, 'U': 8, 'V': 8, 'W': 9, 'X': 9, 'Y': 9, 'S': 7, 'Z': 9} n, s = 0, input() for c in s: n += dial[c] print(n+len(s))
dial = {'A': 2, 'B': 2, 'C': 2, 'D': 3, 'E': 3, 'F': 3, 'G': 4, 'H': 4, 'I': 4, 'J': 5, 'K': 5, 'L': 5, 'M': 6, 'N': 6, 'O': 6, 'P': 7, 'Q': 7, 'R': 7, 'T': 8, 'U': 8, 'V': 8, 'W': 9, 'X': 9, 'Y': 9, 'S': 7, 'Z': 9} (n, s) = (0, input()) for c in s: n += dial[c] print(n + len(s))
input() l = [i for i,j in enumerate(input()) if j =='.'] ans = 11111111 for i in range(len(l)-1): ans = min(ans, l[i+1] - l[i]) print(ans - 1)
input() l = [i for (i, j) in enumerate(input()) if j == '.'] ans = 11111111 for i in range(len(l) - 1): ans = min(ans, l[i + 1] - l[i]) print(ans - 1)
coins = 0 price = round(float(input()), 2) while price != 0: if price >= 2: price -= 2 coins += 1 elif price >= 1: price -= 1 coins += 1 elif price >= 0.50: price -= 0.50 coins += 1 elif price >= 0.20: price -= 0.20 coins += 1 elif pric...
coins = 0 price = round(float(input()), 2) while price != 0: if price >= 2: price -= 2 coins += 1 elif price >= 1: price -= 1 coins += 1 elif price >= 0.5: price -= 0.5 coins += 1 elif price >= 0.2: price -= 0.2 coins += 1 elif price >=...
{ "targets": [{ "target_name": "krb5", "sources": [ "./src/module.cc", "./src/krb5_bind.cc", "./src/gss_bind.cc", "./src/base64.cc" ], 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'include_dirs': ["...
{'targets': [{'target_name': 'krb5', 'sources': ['./src/module.cc', './src/krb5_bind.cc', './src/gss_bind.cc', './src/base64.cc'], 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'include_dirs': ['<!@(node -p "require(\'node-addon-api\').include")'], 'dependencies': ['<!(node -p "require(\'node-addon...
class Solution: def validPalindrome(self, s: str) -> bool: left, right = self.twopointer(0, len(s) - 1, s) if left >= right : return True return self.valid(left + 1, right, s) or self.valid(left, right - 1, s) def valid(self, left, right, s) : l, r = self.twopoin...
class Solution: def valid_palindrome(self, s: str) -> bool: (left, right) = self.twopointer(0, len(s) - 1, s) if left >= right: return True return self.valid(left + 1, right, s) or self.valid(left, right - 1, s) def valid(self, left, right, s): (l, r) = self.twopoin...
def get_metrics(response): """ Extract asked metrics from api response @list_metrics : list of dict """ list_metrics = [] for i in response['reports'][0]['columnHeader']['metricHeader']['metricHeaderEntries']: list_metrics.append(i['name']) return list_metrics def get_dimensions(re...
def get_metrics(response): """ Extract asked metrics from api response @list_metrics : list of dict """ list_metrics = [] for i in response['reports'][0]['columnHeader']['metricHeader']['metricHeaderEntries']: list_metrics.append(i['name']) return list_metrics def get_dimensions(res...
SQLALCHEMY_DATABASE_URI = "postgresql:///test_freight" LOG_LEVEL = "INFO" WORKSPACE_ROOT = "/tmp/freight-tests" SSH_PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEArvyc+vZVxUjC5ZcFg1VN3jQOCOjO94gwQKFxlz0zOCrCz+Sq\nnWk28YdUpOU016Zinlh4ZZk2136nCKKTMnNMjd6cTTCn5fWomjR+F2CSdaYYpYfO\nNtVnq0SIDUgGmjyPncOGr...
sqlalchemy_database_uri = 'postgresql:///test_freight' log_level = 'INFO' workspace_root = '/tmp/freight-tests' ssh_private_key = '-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEArvyc+vZVxUjC5ZcFg1VN3jQOCOjO94gwQKFxlz0zOCrCz+Sq\nnWk28YdUpOU016Zinlh4ZZk2136nCKKTMnNMjd6cTTCn5fWomjR+F2CSdaYYpYfO\nNtVnq0SIDUgGmjyPncOGrxVT...
# # PySNMP MIB module SUPERMICRO-SMI (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SUPERMICRO-SMI # Produced by pysmi-0.3.4 at Mon Apr 29 21:04:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ...
# # PySNMP MIB module CISCO-WAN-ATM-CONN-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-ATM-CONN-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 18:03:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ...
s = 0 for i in range(101): s += i print("Suma liczb od 1 do 100 to: ", s)
s = 0 for i in range(101): s += i print('Suma liczb od 1 do 100 to: ', s)
def BinarySearch(Array, LowerBound, UpperBound, What): while LowerBound != UpperBound: mid = (LowerBound + UpperBound) // 2 if Array[mid] < What: LowerBound = mid elif Array[mid] > What: UpperBound = mid - 1 else: return mid re...
def binary_search(Array, LowerBound, UpperBound, What): while LowerBound != UpperBound: mid = (LowerBound + UpperBound) // 2 if Array[mid] < What: lower_bound = mid elif Array[mid] > What: upper_bound = mid - 1 else: return mid return None
''' immutable ''' letters = ("a", "b", "c", "d", "c") print(letters.count("c")) print(letters.index("d")) coordinates = (94, 6, 7) x, y, z = coordinates print(x, y, z)
""" immutable """ letters = ('a', 'b', 'c', 'd', 'c') print(letters.count('c')) print(letters.index('d')) coordinates = (94, 6, 7) (x, y, z) = coordinates print(x, y, z)
responses = { 'https://example.com/api/v1/something/': { 'count': 5, 'next': 'https://example.com/api/v1/something/?limit=3&offset=3', 'previous': None, 'results': [ {'id': 1}, {'id': 2}, {'id': 3} ], 'collection_links': {} }, 'https://example.com/...
responses = {'https://example.com/api/v1/something/': {'count': 5, 'next': 'https://example.com/api/v1/something/?limit=3&offset=3', 'previous': None, 'results': [{'id': 1}, {'id': 2}, {'id': 3}], 'collection_links': {}}, 'https://example.com/api/v1/something/?limit=3&offset=3': {'count': 5, 'next': 'https://example.co...
#!/usr/bin/env python # coding: utf-8 # # Author: Kazuto Nakashima # URL: https://github.com/kazuto1011 # Created: 2016-06-07 config = { 'server_IP': '192.168.4.170', 'PORT': 49952, 'xml_file': 'C:/Users/nemuriscan/Desktop/NemuriScanLog/NemuriScanStateInfo.xml' }
config = {'server_IP': '192.168.4.170', 'PORT': 49952, 'xml_file': 'C:/Users/nemuriscan/Desktop/NemuriScanLog/NemuriScanStateInfo.xml'}
# Replace the file path with an existing text file on your machine. with open("/home/aditya/Desktop/sample.txt", "r") as file_: lines = file_.readlines() for line in lines: print(lines)
with open('/home/aditya/Desktop/sample.txt', 'r') as file_: lines = file_.readlines() for line in lines: print(lines)
# uncompyle6 version 3.2.0 # Python bytecode 2.4 (62061) # Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] # Embedded file name: otp.uberdog.SpeedchatRelayGlobals NORMAL = 0 CUSTOM = 1 EMOTE = 2 PIRATES_QUEST = 3 TOONTOWN_QUEST = 4
normal = 0 custom = 1 emote = 2 pirates_quest = 3 toontown_quest = 4
# # PySNMP MIB module JUNIPER-PFE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-PFE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:00:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
def implement_each(folder, each): folder['tags'] = each['tags'] + folder['tags'] for key, tags in each['folders'].items(): folder['folders'][key] = {'tags': tags, 'folders': {}} return folder
def implement_each(folder, each): folder['tags'] = each['tags'] + folder['tags'] for (key, tags) in each['folders'].items(): folder['folders'][key] = {'tags': tags, 'folders': {}} return folder
class PointSegmentError(Exception): """ """ pass class AngleRotationSegmentError(Exception): """ """ pass class PointTranslateSegmentError(Exception): """ """ pass class NbPointSegmentDError(Exception): """ """ pass
class Pointsegmenterror(Exception): """ """ pass class Anglerotationsegmenterror(Exception): """ """ pass class Pointtranslatesegmenterror(Exception): """ """ pass class Nbpointsegmentderror(Exception): """ """ pass
# encoding: utf-8 # module System.ComponentModel.Design.Serialization calls itself Serialization # from System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 # by generator 1.145 """ NamespaceTracker represent a CLS namespace. """ # no imports # no functions # classes class ComponentSe...
""" NamespaceTracker represent a CLS namespace. """ class Componentserializationservice(object): """ Provides the base class for serializing a set of components or serializable objects into a serialization store. """ def create_store(self): """ CreateStore(self: ComponentSerializationService) ...
# Palindrome Permutation: # Given a string, write a function to check if it is a permutation of a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words. def palindromePerm...
def palindrome_permutation(string): string = string.lower() sort = sorted(string) sorted_string = ''.join(sort) is_perm = True odd_counter = 0 char_count = len(sortedString) if charCount % 2 == 0: for char in range(0, charCount, 2): if sortedString[char] == sortedString[c...
# Default colors STRONG = "5aa69d" # primary color (for highlighting etc) NEUTRAL = "999999" POSITIVE = "47b358" NEGATIVE = "ec6b56" FILL_BETWEEN = "F7F4F4" WARM = "ff808f" COLD = "4062bb" BLACK = "0F1108" DARK_GRAY = "42404F" LIGHT_GRAY = "C8C7D1" # For categorical coloring # picked from color brewer, but without to...
strong = '5aa69d' neutral = '999999' positive = '47b358' negative = 'ec6b56' fill_between = 'F7F4F4' warm = 'ff808f' cold = '4062bb' black = '0F1108' dark_gray = '42404F' light_gray = 'C8C7D1' qualitative = ['66c2a5', 'fc8d62', '8da0cb', 'e78ac3', 'a6d854', 'ffd92f', 'e5c494', 'b3b3b3']
values = [] values.append(1) values.append(3) values.append(5) print('first time:', values) values = values[1:] print('second time:', values)
values = [] values.append(1) values.append(3) values.append(5) print('first time:', values) values = values[1:] print('second time:', values)
s = list(map(int, input().split())) for i in range(1, len(s), 2): s[i - 1], s[i] = s[i], s[i - 1] print(*s)
s = list(map(int, input().split())) for i in range(1, len(s), 2): (s[i - 1], s[i]) = (s[i], s[i - 1]) print(*s)
#!/usr/bin/env python3 """The Western Exchange module""" def np_transpose(matrix): """transposes matrix""" return matrix.transpose()
"""The Western Exchange module""" def np_transpose(matrix): """transposes matrix""" return matrix.transpose()
""" Import from other sources to database. """
""" Import from other sources to database. """
for i in range(100): count=i+1 if count % 3==0 and count % 5==0: a= 'fizzbuzz' elif count % 3==0: a= "fizz" elif count % 5==0: a="buzz" else: a=count user=input("whats the next number in fizzbuzz?") a= str(a) if user==a: print("goodjob") else: ...
for i in range(100): count = i + 1 if count % 3 == 0 and count % 5 == 0: a = 'fizzbuzz' elif count % 3 == 0: a = 'fizz' elif count % 5 == 0: a = 'buzz' else: a = count user = input('whats the next number in fizzbuzz?') a = str(a) if user == a: prin...
# .py file for python maths exercises # convert degree to radian # x * pi/180 # in = 15 # out = 0.2619047619047619 def deg2rad(degrees): pi = 22/7 return degrees * pi / 180 # convert radian to degree # in = .52 # out = 29.781818181818185 def rad2deg(rad): pi = 22/7 return rad / pi * 180 # area of tra...
def deg2rad(degrees): pi = 22 / 7 return degrees * pi / 180 def rad2deg(rad): pi = 22 / 7 return rad / pi * 180 def area_of_trapezoid(a, b, h): ab = a + b return ab / 2 * h def area_of_parallelogram(b, h): return b * h def get_volume_surface_of_cylinder(r, h): pi = 22 / 7 a = 2 *...
# coding=utf-8 """Maximum sum increasing subsequence dynamic programming solution Python implementation.""" def msis(seq): dp = [x for x in seq] for i in range(1, len(seq)): for j in range(i): if seq[i] > seq[j] and dp[i] < dp[j] + seq[i]: dp[i] = dp[j] + seq[i] return ...
"""Maximum sum increasing subsequence dynamic programming solution Python implementation.""" def msis(seq): dp = [x for x in seq] for i in range(1, len(seq)): for j in range(i): if seq[i] > seq[j] and dp[i] < dp[j] + seq[i]: dp[i] = dp[j] + seq[i] return max(dp) if __nam...
def binary_search(input_array, value): """this function take an input array, and return the index of value if present in the input array or -1 if not""" min_index = 0 max_index = len(input_array)-1 while (min_index<=max_index): midle = (min_index+max_index)//2 if input_arra...
def binary_search(input_array, value): """this function take an input array, and return the index of value if present in the input array or -1 if not""" min_index = 0 max_index = len(input_array) - 1 while min_index <= max_index: midle = (min_index + max_index) // 2 if input_array[m...
def add_class_name(attrs, class_name): class_names = attrs.get('class') if class_names: class_names = [class_names] else: class_names = [] class_names.append(class_name) attrs['class'] = ' '.join(class_names) return attrs class ReadonlyValue: def __init__(self, value, huma...
def add_class_name(attrs, class_name): class_names = attrs.get('class') if class_names: class_names = [class_names] else: class_names = [] class_names.append(class_name) attrs['class'] = ' '.join(class_names) return attrs class Readonlyvalue: def __init__(self, value, human...
''' Segments which start with six zero-bits after the header are very often ascii files. ''' class R1k6ZeroSegment(): ''' Look for ascii files with six zero bits prefix ''' def __init__(self, this): if not this.has_note('R1k_Segment'): return bits = bin(int.from_bytes(b'\xff' + this...
""" Segments which start with six zero-bits after the header are very often ascii files. """ class R1K6Zerosegment: """ Look for ascii files with six zero bits prefix """ def __init__(self, this): if not this.has_note('R1k_Segment'): return bits = bin(int.from_bytes(b'\xff' + this[...
""" Given a string containing just the characters '(', ')', '{', '}', '[', ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the same type of brackets. 2. Open brackets must be closed in the correct order. Note that an empty s...
""" Given a string containing just the characters '(', ')', '{', '}', '[', ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the same type of brackets. 2. Open brackets must be closed in the correct order. Note that an empty s...
class BufAny: pass class Buffer: """An input buffer. Allows socket data to be read immediately and buffered, but fine-grained byte-counting or sentinel-searching to be specified by consumers of incoming data.""" def __init__(self): self._atinbuf = [] self._atterm = None self._atmark = 0 def set_term(...
class Bufany: pass class Buffer: """An input buffer. Allows socket data to be read immediately and buffered, but fine-grained byte-counting or sentinel-searching to be specified by consumers of incoming data.""" def __init__(self): self._atinbuf = [] self._atterm = None self._a...
""" This file is part of EmailHarvester Copyright (C) 2016 @maldevel https://github.com/maldevel/EmailHarvester EmailHarvester - A tool to retrieve Domain email addresses from Search Engines. This program is free software: you can redistribute it and/or modify it under the terms of the GNU...
""" This file is part of EmailHarvester Copyright (C) 2016 @maldevel https://github.com/maldevel/EmailHarvester EmailHarvester - A tool to retrieve Domain email addresses from Search Engines. This program is free software: you can redistribute it and/or modify it under the terms of the GNU...
def vote_registration_app(): print(f"\tWelcome to the Voter Registration App") name = input(f"\tPlease enter your name:\t") age = int(input(f"\tPlease enter your age:\t")) if age >= 18: print(f"\n\tCongratulations {name}! You are old enough to register to vote.\n") print(f"""\t\t-Repub...
def vote_registration_app(): print(f'\tWelcome to the Voter Registration App') name = input(f'\tPlease enter your name:\t') age = int(input(f'\tPlease enter your age:\t')) if age >= 18: print(f'\n\tCongratulations {name}! You are old enough to register to vote.\n') print(f'\t\t-Republica...
c = c2 = c3 = 0 while True: print('-' * 30) print(' CADASTRE UMA PESSOA ') print('-' * 30) idade = int(input('Idade: ')) sexo = str(input('Sexo: [F/M] ')).strip().upper()[0] while sexo not in 'FM': sexo = str(input('Sexo: [F/M] ')).strip().upper()[0] if idade < 18: c...
c = c2 = c3 = 0 while True: print('-' * 30) print(' CADASTRE UMA PESSOA ') print('-' * 30) idade = int(input('Idade: ')) sexo = str(input('Sexo: [F/M] ')).strip().upper()[0] while sexo not in 'FM': sexo = str(input('Sexo: [F/M] ')).strip().upper()[0] if idade < 18: c ...
# Copyright 2017 Google Inc. 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 law or a...
"""Module for performing common group operations.""" class Abstractgroupmanager(object): """The interface required for user grouping in Upvote.""" def does_group_exist(self, groupname): """Determines if a given group exists. Args: groupname: The group name to check. Returns: Whet...
#-*- coding:utf-8 -*- AbsoluteFreqMap = { 'C': 261, '#C': 276, 'bD': 276, 'D': 292, '#D': 310, 'bE': 310, 'E': 328, 'F': 348, '#F': 369, 'bG': 369, 'G': 391, '#G': 414, 'bA': 414, 'A': 438, '#A': 465, 'bB': 465, 'B': 492 } RelativeFreqMap = { '1'...
absolute_freq_map = {'C': 261, '#C': 276, 'bD': 276, 'D': 292, '#D': 310, 'bE': 310, 'E': 328, 'F': 348, '#F': 369, 'bG': 369, 'G': 391, '#G': 414, 'bA': 414, 'A': 438, '#A': 465, 'bB': 465, 'B': 492} relative_freq_map = {'1': 0, '#1': 1 / 12, 'b2': 1 / 12, '2': 2 / 12, '#2': 3 / 12, 'b3': 3 / 12, '3': 4 / 12, '4': 5 /...
def open_file(): file = input('Enter input file:') if file=="measles.txt": return file else: print("File should be \"measles.txt\"") exit() #Function compare income and the integers def ref(income): if income==1: income="WB_LI" return income elif income==2: ...
def open_file(): file = input('Enter input file:') if file == 'measles.txt': return file else: print('File should be "measles.txt"') exit() def ref(income): if income == 1: income = 'WB_LI' return income elif income == 2: income = 'WB_LMI' ret...
load( "@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install", ) PACKAGE_JSON = "@com_github_scionproto_scion//spec/tools:package.json" def install_yarn_dependencies(): node_repositories( package_json = [PACKAGE_JSON], ) yarn_install( name = "spec_npm", ...
load('@build_bazel_rules_nodejs//:index.bzl', 'node_repositories', 'yarn_install') package_json = '@com_github_scionproto_scion//spec/tools:package.json' def install_yarn_dependencies(): node_repositories(package_json=[PACKAGE_JSON]) yarn_install(name='spec_npm', exports_directories_only=False, package_json=PA...
def test_del_first_group(app): app.group.delete_first_group()
def test_del_first_group(app): app.group.delete_first_group()
class HttpFetchError(BaseException): pass class MaxExceptionError(BaseException): pass class KnownError(BaseException): pass
class Httpfetcherror(BaseException): pass class Maxexceptionerror(BaseException): pass class Knownerror(BaseException): pass
""" Modules are contained in this package. Modules are the lowest tier of the three-tiered processing chain. Each module is "owned" by a manager, that decides whether or not to invoke the module's processing abilities. A module does two things: first, it must decide if a chat or kmail is applicable to its task. ...
""" Modules are contained in this package. Modules are the lowest tier of the three-tiered processing chain. Each module is "owned" by a manager, that decides whether or not to invoke the module's processing abilities. A module does two things: first, it must decide if a chat or kmail is applicable to its task. If it...
print("Enter a number") num = int(input()) print("Type 1 or 0") num2 = int(input()) b = bool(num2) if(b == True): for i in range(1, num+1): for j in range(1, i+1): print("*", end=" ") print() elif (b == False): for i in range(num, 0, -1): for j in range(1, i+1): p...
print('Enter a number') num = int(input()) print('Type 1 or 0') num2 = int(input()) b = bool(num2) if b == True: for i in range(1, num + 1): for j in range(1, i + 1): print('*', end=' ') print() elif b == False: for i in range(num, 0, -1): for j in range(1, i + 1): ...
string = '012345678901234567890123456789012345678901234567890123456789' n = 10 lista = [string[i:i+n] for i in range(0, len(string), n)] listastring = '.'.join(lista) print(listastring)
string = '012345678901234567890123456789012345678901234567890123456789' n = 10 lista = [string[i:i + n] for i in range(0, len(string), n)] listastring = '.'.join(lista) print(listastring)
# OpenWeatherMap API Key weather_api_key = "4b6f407bc3690ac1562800a586bbda13" # Google API Key g_key = "AIzaSyBH17Xn87x8SM7waCAzHnS4gKMWRX96iDQ"
weather_api_key = '4b6f407bc3690ac1562800a586bbda13' g_key = 'AIzaSyBH17Xn87x8SM7waCAzHnS4gKMWRX96iDQ'
"""Shared constants for automation and script tracing and debugging.""" DATA_TRACE = "trace" STORED_TRACES = 5 # Stored traces per automation
"""Shared constants for automation and script tracing and debugging.""" data_trace = 'trace' stored_traces = 5
""" The model level of application. Contains modules which are the connectors between database and classes of application level of system. Contained classes are responsible for the execution of the right queries to access the required data. Then initializes classes or returns data to the classes of application level ...
""" The model level of application. Contains modules which are the connectors between database and classes of application level of system. Contained classes are responsible for the execution of the right queries to access the required data. Then initializes classes or returns data to the classes of application level ...
t=int(input()) for i in range(t): n=int(input()) h=0 for i in range(n+1): if i%2==0: h += 1 else: h *= 2 print(h)
t = int(input()) for i in range(t): n = int(input()) h = 0 for i in range(n + 1): if i % 2 == 0: h += 1 else: h *= 2 print(h)
""" Write a program to calculate no of possible triangles in given array Input: arr= {4, 6, 3, 7} 3, 4, 6, 7 Output: 3 Explanation: There are three triangles possible {3, 4, 6}, {4, 6, 7} and {3, 6, 7}. """ class Geometry: def __init__(self, arr, n): self.arr = arr self.n = n def possible_tri...
""" Write a program to calculate no of possible triangles in given array Input: arr= {4, 6, 3, 7} 3, 4, 6, 7 Output: 3 Explanation: There are three triangles possible {3, 4, 6}, {4, 6, 7} and {3, 6, 7}. """ class Geometry: def __init__(self, arr, n): self.arr = arr self.n = n def possible_tr...
# Same as sorted_list_permutation [3 (ii)], however we are counting the number of occurring *columns* in A instead of number of occurrences itself. # # Goal: *no runtime goal* def custom_sort(A,B): C=B i=1 while i < len(B): j=i while j > 0 and (count_occurring_columns(B[j-1],A) > count_occu...
def custom_sort(A, B): c = B i = 1 while i < len(B): j = i while j > 0 and (count_occurring_columns(B[j - 1], A) > count_occurring_columns(B[j], A) or (count_occurring_columns(B[j - 1], A) == count_occurring_columns(B[j], A) and B[j - 1] < B[j])): new_val = C[j] C[j] ...
""" For declaring inverse properties of GraphObjects """ InverseProperties = dict() class InversePropertyMixin(object): """ Mixin for inverse properties. Augments RealSimpleProperty methods to update inverse properties as well """ def set(self, other): ip_key = (self.owner_type, self.l...
""" For declaring inverse properties of GraphObjects """ inverse_properties = dict() class Inversepropertymixin(object): """ Mixin for inverse properties. Augments RealSimpleProperty methods to update inverse properties as well """ def set(self, other): ip_key = (self.owner_type, self.lin...
hello = '' with open('hello-world.txt', 'r') as f: hello = f.read() print(hello)
hello = '' with open('hello-world.txt', 'r') as f: hello = f.read() print(hello)
# This is just for socgen-k test, you make sure Socgen-k server is working well. # https://socgen-k-api.openbankproject.com/ # API server URL BASE_URL = "https://socgen-k-api.openbankproject.com" API_VERSION = "v2.0.0" API_VERSION_V210 = "v2.1.0" # API server will redirect your browser to this URL, should be non-funct...
base_url = 'https://socgen-k-api.openbankproject.com' api_version = 'v2.0.0' api_version_v210 = 'v2.1.0' callback_uri = 'http://127.0.0.1/cb' username = '1000203893' password = '123456' consumer_key = '45wpocdzh2uwnorvrk2sfy1rnwyc0h2ff3kdkr2s' from_bank_id = '00100' from_account_id = '83b96bb4-ae2c-3e90-ad2c-8ce0b4b002...
GOOD_HTTP_CODES = [200, 201, 202, 203] USER_FIELD = 'username' ACCESS_TOKEN_FIELD = 'access_token' REFRESH_TOKEN_FIELD = 'refresh_token' EXPIRE_TIME_TOKEN_FIELD = 'expires_in' ERROR_CODE_FIELD = 'errcode' MENSSAGE_FIELD = 'errmsg' LIST_FIELD = 'list' STATE_FIELD = 'state' PAGES_FIELD = 'pages' GATEWAY_MAC_FIELD = 'gat...
good_http_codes = [200, 201, 202, 203] user_field = 'username' access_token_field = 'access_token' refresh_token_field = 'refresh_token' expire_time_token_field = 'expires_in' error_code_field = 'errcode' menssage_field = 'errmsg' list_field = 'list' state_field = 'state' pages_field = 'pages' gateway_mac_field = 'gate...
def insertionSort(alist): for index in range(1, len(alist)): currentvalue = alist[index] position = index while position > 0 and alist[position - 1] > currentvalue: alist[position] = alist[position - 1] position = position - 1 alist[position] = currentvalue...
def insertion_sort(alist): for index in range(1, len(alist)): currentvalue = alist[index] position = index while position > 0 and alist[position - 1] > currentvalue: alist[position] = alist[position - 1] position = position - 1 alist[position] = currentvalue a...
# -*- coding: utf-8 -*- """save_princess_peach.constants.py Constants for save-princes-peach. """ # Default file used as grid DEFAULT_GRID = '/Users/JFermin/Documents/GitHub/itsMeMario/tests/test_grids/init_grid.txt' # players BOWSER = 'b' PEACH = 'p' MARIO = 'm' PLAYERS = [BOWSER, PEACH, MARIO] # additional tiles ...
"""save_princess_peach.constants.py Constants for save-princes-peach. """ default_grid = '/Users/JFermin/Documents/GitHub/itsMeMario/tests/test_grids/init_grid.txt' bowser = 'b' peach = 'p' mario = 'm' players = [BOWSER, PEACH, MARIO] hazards = '*' safe = '-' visited = 'v' all_positions = [BOWSER, PEACH, MARIO, HAZARD...