content
stringlengths
7
1.05M
cidade = 'São francisco' cidade2 = 'santo antonio' cidade2 = cidade2.split() print('santo' == cidade[0]) print('santo' == cidade2[0]) #solucao professor cid = str(input('digite o nome de sua cidade')).strip() print(cid[:5].upper() == 'SANTO')
class AdditionExpression: def __init__(self, left, right): self.right = right self.left = left def print(self, buffer): buffer.append('(') self.left.print(buffer) buffer.append('+') self.right.print(buffer) buffer.append(')') def eval(self): ...
''' 3. Swap string variable values fname = "rahul" lname = "dravid" Swap the value of variable with fname & fname with lname Output:: print(fname) # dravid print(lname) # rahul ''' fname = "rahul" lname = "dravid" #fname.swap(lname) #lname.swap(fname) fname="dravid" lname="rahul" print(fname) print(...
{ 'includes': [ '../common.gypi', '../config.gypi', ], 'targets': [ { 'target_name': 'linuxapp', 'product_name': 'mapbox-gl', 'type': 'executable', 'sources': [ './main.cpp', '../common/settings_json.cpp', '../common/settings_json.hpp', '../commo...
#Source : https://leetcode.com/problems/linked-list-cycle/ #Author : Yuan Wang #Date : 2018-08-01 ''' ********************************************************************************** *Given a linked list, determine if it has a cycle in it. * *Follow up: *Can you solve it without using extra space? ****************...
""" Farey Sequence The Farey sequence of order n is the set of all fractions with a denominator between 1 and n, reduced and returned in ascending order. Given n, return the Farey sequence as a list, with each fraction being represented by a string in the form "numerator/denominator". Examples farey(1) ➞ ["0/1", "1/1"...
class State: def __init__(self): self.StateId = 0 self.StateName = "" class City: def __init__(self): self.CityId = 0 self.CityName = "" self.StateId = 0 class Properties: def __init__(self): self.Area=0 self.Age=0 self...
# substituindo com o metodo replace s1 = 'Um mafagafinho, dois mafagafinhos, tres mafagafinhos...' print(s1.replace('mafagafinho', 'gatinho')) # podemos adicionar a quantidade substituicao que sera feitas print(s1.replace('mafagafinho', 'gatinho', 1))
class Movies(object): def __init__(self, **kwargs): short_plot = kwargs.get('Plot')[0:170] self.title = kwargs.get('Title') self.poster_link = kwargs.get('Poster') self.rated = kwargs.get('Rated') self.type = kwargs.get('Type') self.awards = kwargs.get('Awards') ...
class Solution: def maxLength(self, arr: List[str]) -> int: results = [""] max_len = 0 for word in arr: for concat_str in results: new_str = concat_str + word if len(new_str) == len(set(new_str)): results.append(new_str) ...
# Escreve os 10 primeiros termos de uma PA(Progresão Aritmétrica) dado o # primeiro termo e a razão. # Baseado no desafio051, mas em vez de usar estrutura "For", usar com "While". primeiro = int(input('Digite o primeiro termo da PA(Progressão Aritmétrica): ')) r = int(input('Digite o valor da razão da PA(Progressão Ar...
class Solution: def longestCommonSubsequence(self, text1: str, text2: str) -> int: # The idea is to use 2D dynamic programming from the top-left # if the characters are match, # we set the cell = 1 + top-left # if the characters aren't match, # we set the ...
N=int(input()) for i in range (-(N-1),N): for j in range (-2*(N-1),2*(N-1)+1): if j%2==0 and (abs(j//2)+abs(i))< N: print (chr(abs(j//2)+abs(i)+ord('a')),end='') else: print('-',end='') print()
# coding: utf8 # try something like def index(): rows = db((db.activity.type=='project')&(db.activity.status=='accepted')).select() if rows: return dict(projects=rows) else: return plugin_flatpage() @auth.requires_login() def apply(): project = db.activity[request.args(1)] partaker...
N = int(input()) C = set() for _ in range(N): S, T = map(str, input().split()) C.add(tuple([S, T])) if len(C) == N: print("No") else: print("Yes")
class DoubleLinkedList: def __init__(self, value): self.prev = self self.next = self self.value = value def get_next(self): return self.next def get_prev(self): return self.prev def get_value(self): return self.value def move_clockwise(self, steps=...
golfcube = dm.sample_data.golf() stratcube = dm.cube.StratigraphyCube.from_DataCube(golfcube, dz=0.05) stratcube.register_section('demo', dm.section.StrikeSection(distance_idx=10)) fig, ax = plt.subplots(5, 1, sharex=True, sharey=True, figsize=(12, 9)) ax = ax.flatten() for i, var in enumerate(['time', 'eta', 'veloci...
def tam(): '''Futuramente facilitar o mudo de como mundar o tamanho das peças.''' tel = 1.25 return tel
# Квадратное уравнение - 1 def quadratic_equation_1(a, b, c): d = b**2 - (4 * a * c) if d == 0 and a != 0: x = (- b / (2 * a)) ans = (round(x, 2), ) elif d > 0: x1 = round((- b - d**0.5) / (2 * a), 6) x2 = round((- b + d**0.5) / (2 * a), 5) ans = (x2, x1) if x1 > x2...
def test_malware_have_actors(attck_fixture): """ All MITRE Enterprise ATT&CK Malware should have Actors Args: attck_fixture ([type]): our default MITRE Enterprise ATT&CK JSON fixture """ for malware in attck_fixture.enterprise.malwares: if malware.actors: assert getattr(...
__all__ = ['USBQException', 'USBQInvocationError', 'USBQDeviceNotConnected'] class USBQException(Exception): 'Base of all USBQ exceptions' class USBQInvocationError(USBQException): 'Error invoking USBQ' class USBQDeviceNotConnected(USBQException): 'USBQ device not connected.'
""" [2017-11-13] Challenge #340 [Easy] First Recurring Character https://www.reddit.com/r/dailyprogrammer/comments/7cnqtw/20171113_challenge_340_easy_first_recurring/ # Description Write a program that outputs the first recurring character in a string. # Formal Inputs & Outputs ## Input Description A string of alphab...
print('=' * 30) print('{:^30}'.format('LOJA ALBUQUERQUE')) print('=' * 30) tot = contmil = cont = menor = 0 batato = '' while True: continuar = ' ' produto = str(input('Nome do Produto: ')).capitalize() preco = float(input('Preço: R$')) tot = tot + preco cont = cont + 1 if cont == 1: men...
def test_exposed(ua): """Test if the UnitAgent exposes all required methods.""" assert ua.update_forecast is ua.model.update_forecast assert ua.init_negotiation is ua.planner.init_negotiation assert ua.stop_negotiation is ua.planner.stop_negotiation assert ua.set_schedule is ua.unit.set_schedule ...
# skrypt do wykonywania w trybie REPL # każda linia jako kolejne polecenie name = input() print(name) name = input("Please, give me your name:") print(f"Your name is: {name}") current_year = input("What is current year? ") print(f"Current year is: {current_year}") type(current_year)
test = { 'name': 'nodots', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (nodots '(1 . 2)) (1 2) """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (nodots '(1 2 . 3)) ...
# Copyright (c) 2009 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. { 'variables': { 'chromium_code': 1, }, 'targets': [ { 'target_name': 'security_tests', 'type': 'shared_library', 'source...
""" generates high value cutoff filtered versions for case study 1 and 2 converted delay measurements """ DATA_PATHS = [ 'CS1_SendFixed_50ms_JoinDupFilter', 'CS1_SendFixed_50ms_JoinNoFilter', 'CS1_SendFixed_100ms_JoinDupFilter', 'CS1_SendFixed_100ms_JoinNoFilter', 'CS1_SendVariable_50ms_JoinDupFilt...
""" 0845. Longest Mountain in Array Medium Let's call any (contiguous) subarray B (of A) a mountain if the following properties hold: B.length >= 3 There exists some 0 < i < B.length - 1 such that B[0] < B[1] < ... B[i-1] < B[i] > B[i+1] > ... > B[B.length - 1] (Note that B could be any subarray of A, including the e...
#!/usr/bin/env python # encoding: utf-8 ''' @author: Jason Lee @license: (C) Copyright @ Jason Lee @contact: jiansenll@163.com @file: money_dp.py @time: 2019/4/22 23:17 @desc: find least number of money to achieve a total amount ''' def money_dp(total): money = [1, 5, 11] # value of each money number ...
class Solution: def majorityElement(self, nums) -> int: dic={} for num in nums: dic[num]=dic.get(num,0)+1 #guess,dic.get(num,0)=dic.get(num,0)+1 is non-existential,for in syntax field,we can't assign to function call for num in nums: i...
class BaseAnnotationAdapter(object): def __iter__(self): return self def __next__(self): """ Needs to be implemented in order to iterate through the annotations :return: A tuple (leaf_annotation, image_path, i) where leaf annotation is a list of coordina...
[2,8,"t","pncmjxlvckfbtrjh"], [8,9,"l","lzllllldsl"], [3,11,"c","ccchcccccclxnkcmc"], [3,10,"h","xcvxkdqshh"], [4,5,"s","gssss"], [7,14,"m","mmcmqmmxmmmnmmrmcxc"], [3,12,"n","grnxnbsmzttnzbnnn"], [5,9,"j","ddqwznjhjcjn"], [8,9,"d","fddddddmd"], [6,8,"t","qtlwttsqg"], [7,15,"m","lxzxrdbmmtvwhgm"], [6,10,"h","hhnhhhhxhkh...
# Rename this to keys.py if running locally, # and replace the API keys with your own information. # This project uses an EC2 instance with # Elasticache providing the redis broker and an # RDS instance of postgresql. EMAIL_HOST_USER = 'YOUR_EMAIL_ADDRESS@gmail.com' EMAIL_HOST_PASSWORD = 'YOUR_EMAIL_PASSWORD' SETTING...
a = [2, 3] for n in range(5, 10 ** 7, 2): i = 1 while a[i] <= n ** .5: if n % a[i] == 0: break i = i + 1 else: a.append(n) print(a)
listaMaster = [[], []] for c in range(1, 8): num = int(input(f'Digite o {c}º valor: ')) if num % 2 == 0: listaMaster[0].append(num) else: listaMaster[1].append(num) listaMaster[0].sort() listaMaster[1].sort() print('==-' * 10) print(f'Os valores pares: {listaMaster[0]}') print(f'Os valores í...
# Time: O(n + m), m is the number of targets # Space: O(n) class Solution(object): def findReplaceString(self, S, indexes, sources, targets): """ :type S: str :type indexes: List[int] :type sources: List[str] :type targets: List[str] :rtype: str """ ...
# Crie um programa que simule o funcionamento de um caixa eletrônico. # No início, pergunte ao usuário qual será o valor a ser sacado (número inteiro) e # o programa vai informar quantas cédulas de cada valor serão entregues. OBS: # # considere que o caixa possui cédulas de R$50, R$20, R$10 e R$1. print('=' * 30) pr...
""" The Procedure to add new version: 1.New Version created 2.Add the new version to GATHER_COMMANDS_VERSION dictionary 3.Ask the developer about new files on new version 4.Add file names to relevant list OCS4.6 Link: https://github.com/openshift/ocs-operator/blob/fefc8a0e04e314801809df2e5292a20fae8456b8/must-gather/c...
""" Write a function named uses_only that takes a word and a string of letters, and that returns True if the word contains only letters in the list. Can you make a sentence using only the letters acefhlo? Other than “Hoe alfalfa”? """ def uses_only(word, only): for letter in word.lower(): if letter...
def extract_coupon(description): coupon = '' for s in range(len(description)): if description[s].isnumeric() or description[s] == '.': coupon = coupon + description[s] #print(c) if description[s] == '%': break try: float(coupon) except: ...
key = [int(num) for num in input().split()] data = input() length = len(key) results_dict = {} while not data == 'find': message = "" counter = 0 for el in data: if counter == length: counter = 0 asc = ord(el) asc -= key[counter] ord_asc = chr(asc) messag...
# use the with key word to open file ass mb_object with open("mbox-short.txt", "r") as mb_object: # Iterate over each line and remove leading spaces; # print contents after converting them to uppercase for line in mb_object: line = line.strip() print(line.upper())
################ # First class functions allow us to treat functions as any other variables or objects # Closures are functions that are local inner functions within outer functions that remember the arguments passed to the outer functions ################# def square(x): return x*x def my_map_function(func , arg_l...
#Faça um Programa que leia um vetor de 10 números reais #e mostre-os na ordem inversa. vetor=[] for c in range(0,5): vetor.append(int(input("Informe um numero: "))) print(vetor) vetor.reverse() print(vetor)
class AbstractPlayer: def __init__(self): raise NotImplementedError() def explain(self, word, n_words): raise NotImplementedError() def guess(self, words, n_words): raise NotImplementedError() class LocalDummyPlayer(AbstractPlayer): def __init__(self): pass def e...
""" 1108. Defanging an IP Address Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". Example 1: Input: address = "1.1.1.1" Output: "1[.]1[.]1[.]1" Example 2: Input: address = "255.100.50.0" Output: "255[.]100[.]50[.]0" Con...
def dados(jog='<desconhecido>', gol=0): print(f'O jogador {jog} fez {gol} gol(s) no campeonato!') jogador = str(input('Nome do jogador: ')) gols = str(input('Número de gols: ')) if gols.isnumeric(): gols = int(gols) else: gols = 0 if jogador.strip() == '': dados(gol=gols) else: dados(jogador, gols...
# coding: utf-8 def g(): n = 0 r = yield while r != 'exit': n += 1 r = yield n return 'over' def f(g): g.send(None) while True: s = input('press [exit] to stop: ') try: n = g.send(s) print('natural number:', n) except StopIterati...
# Acesso as elementos da tupla numeros = 1,2,3,5,7,11 print(numeros[0]) print(numeros[1]) print(numeros[2]) print(numeros[3]) print(numeros[4]) print(numeros[5])
__title__ = 'contactTree-api' __package_name = 'contactTree-api' __version__ = '0.1.0' __description__ = '' __author__ = 'Dionisis Pettas' __email__ = '' __github__ = 'https://github.com/deepettas/contact-tree' __licence__ = 'MIT'
def add_native_methods(clazz): def nOpen__int__(a0, a1): raise NotImplementedError() def nClose__long__(a0, a1): raise NotImplementedError() def nSendShortMessage__long__int__long__(a0, a1, a2, a3): raise NotImplementedError() def nSendLongMessage__long__byte____int__long__(a0...
""" django: https://docs.djangoproject.com/en/3.0/ref/settings/#allowed-hosts https://docs.djangoproject.com/en/3.0/ref/settings/#internal-ips """ ALLOWED_HOSTS = "*" INTERNAL_IPS = ("127.0.0.1", "localhost", "172.18.0.1")
i = 4 # variation on testWhile.py while (i < 9): i = i+2 print(i)
"""TODO Ecrire un paquet de tools Ecrire un outil XSS Ecrire un README avec https://github.com/RichardLitt/standard-readme/blob/master/README.md Completer touts les script avec PayloadAllTheThing pour ajouter des payloads a chaque exploit Rassembler toutes les LFI dans une classe / pareil pour les RFI -Faire un analyse...
class RelayOutput: def enable_relay(self, name: str): pass def reset(self): pass
''' Create a tuple with some words. Show for each word its vowels. ''' vowels = ('a', 'e', 'i', 'o', 'u') words = ( 'Learn', 'Programming', 'Language', 'Python', 'Course', 'Free', 'Study', 'Practice', 'Work', 'Market', 'Programmer', 'Future' ) for word in words: print(f'\nThe word \033[34m{word}\033[...
f = open('surf.txt') maior = 0 for linha in f: nome, pontos = linha.split() if float(pontos) > maior: maior = float(pontos) f.close() print (maior)
""" errors module """ class PyungoError(Exception): """ pyungo custom exception """ pass
#!/usr/bin.env python # Copyright (C) Pearson Assessments - 2020. All Rights Reserved. # Proprietary - Use with Pearson Written Permission Only memo = {} class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ ...
'''https://leetcode.com/problems/palindrome-linked-list/''' # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None # Solution 1 # Time Complexity - O(n) # Space Complexity - O(n) class Solution: def isPalindrome(self, head: ListNode) -...
print('=' * 12 + 'Desafio 83' + '=' * 12) pilha = [] str = input('Digite a expressão: ') resposta = True for char in str: if char == '(': pilha.append(char) elif char == ')': if len(pilha) == 0: resposta = False break else: pilha.pop() if len(pilha) !=...
def calculate(**kwargs): operation_lookup = { 'add': kwargs.get('first', 0) + kwargs.get('second', 0), 'subtract': kwargs.get('first', 0) - kwargs.get('second', 0), 'divide': kwargs.get('first', 0) / kwargs.get('second', 1), 'multiply': kwargs.get('first', 0) * kwargs.get('second', ...
# --------------------------------------------------------------------------------------- # # Title: Permutations # # Link: https://leetcode.com/problems/permutations/ # # Difficulty: Medium # # Language: Python # # -----------------------------------------------------------------------------------...
"""Top-level package for nesc-coo.""" __author__ = """Betterme""" __email__ = 'yuanjie@example.com' __version__ = '0.0.0'
"""APIv3-specific CLI settings """ __all__ = [] # Abaco settings # Aloe settings # Keys settings
''' modifier: 01 eqtime: 25 ''' def main(): info('Jan Air Script x1') gosub('jan:WaitForMiniboneAccess') gosub('jan:PrepareForAirShot') gosub('jan:EvacPipette2') gosub('common:FillPipette2') gosub('jan:PrepareForAirShotExpansion') gosub('common:ExpandPipette2')
def SaveOrder(orderDict): file = open("orderLog.txt", 'w') total = 0 for item, price in orderDict.items(): file.write(item+'-->'+str(price)+'\n') total += price file.write('Total = '+str(total)) file.close() def main(): order = { 'Pizza':100, 'Snak...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu """ 类继承 """ """ 1.让子类重写了父类的方法但是仍然调用父类的方法 """ class A(object): def show(self): print("A show") class B(A): def show(self): print("B show") class C(object): def print(self): # 输入类的名字 print('name of th...
# Generator A starts with 783 # Generator B starts with 325 REAL_START=[783, 325] SAMPLE_START=[65, 8921] FACTORS=[16807, 48271] DIVISOR=2147483647 # 0b1111111111111111111111111111111 2^31 def next_a_value(val, factor): while True: val = (val * factor) % DIVISOR if val & 3 == 0: return ...
# -*- coding: utf-8 -*- class ArgumentTypeError(TypeError): pass class ArgumentValueError(ValueError): pass
""" Manage stakeholders like a pro! """ __author__ = "critical-path" __version__ = "0.1.6"
# VALIDAR SE A CIDADE DIGITADA INICIA COM O NOME SANTO: cidade = str(input('Digite a cidade em que nasceu... ')).strip() print(cidade[:5].upper() == 'SANTO')
ls = list(map(int, input().split())) count = 0 for i in ls: if ls[i] == 1: count += 1 print(count)
def abc(a,b,c): for i in a: b(a) if c(): if b(a) > 100: b(a) elif 100 > 0: b(a) else: b(a) else: b(100) return 100 def ex(): try: fh = open("testfile", "w") fh.write("a") except IOError: print("b...
# 4. Write a Python program to check a list is empty or not. Take few lists with one of them empty. fruits = ['apple', 'cherry', 'pear', 'lemon', 'banana'] fruits1 = [] fruits2 = ['mango', 'strawberry', 'peach'] # print (fruits[3]) # print (fruits[-2]) # print (fruits[1]) # # # print (fruits[0]) # print (fruits) # # f...
# convert taco label to detect-waste labels # based on polish recykling standards # by Katrzyna łagocka def taco_to_detectwaste(label): glass = ['Glass bottle','Broken glass','Glass jar'] metals_and_plastics = ['Aluminium foil', "Clear plastic bottle","Other plastic bottle", "Plastic ...
class Solution: def isPalindrome(self, x): """ :type x: int :rtype: bool """ y = [i for i in str(x)] y.reverse() try: y = int(''.join(y)) except ValueError: pass return x == y
include("common.py") def cyanamidationGen(): r = RuleGen("Cyanamidation") r.left.extend([ '# H2NCN', 'edge [ source 0 target 1 label "#" ]', '# The other', 'edge [ source 105 target 150 label "-" ]', ]) r.context.extend([ '# H2NCN', 'node [ id 0 label "N" ]', 'node [ id 1 label "C" ]', 'node [ id 2...
number = int(input()) divider = number // 2 numbers = '' while divider != 1: if 0 == number % divider: numbers += " " + str(divider) divider -= 1 if 0 == len(numbers): print('Prime Number') else: print(numbers[1:])
class Solution: def XXX(self, nums: List[int]) -> List[List[int]]: return reduce(lambda x, y: x + [i + [y] for i in x], nums, [[]])
sal = float(input('Qual é o salário do funcionário? R$')) ajuste = sal + (sal*15/100) print('Um funcionário que ganhava R${}, com 15%de aumento, passa a receber R${}'.format(sal, ajuste))
HEARTBEAT = "0" TESTREQUEST = "1" RESENDREQUEST = "2" REJECT = "3" SEQUENCERESET = "4" LOGOUT = "5" IOI = "6" ADVERTISEMENT = "7" EXECUTIONREPORT = "8" ORDERCANCELREJECT = "9" QUOTESTATUSREQUEST = "a" LOGON = "A" DERIVATIVESECURITYLIST = "AA" NEWORDERMULTILEG = "AB" MULTILEGORDERCANCELREPLACE = "AC" TRADECAPTUREREPORTR...
# Given two integers, swap them with no additional variable # 1. With temporal variable t def swap(a,b): t = b a = b b = t return a, b # 2. With no variable def swap(a,b): a = b - a b = b - a # b = b -(b-a) = a a = b + a # b = a + b - a = b...Swapped return a, b ...
# Definiran je rjecnik s parovima ime_osobe:pin_kartice rj = {"Branka":3241, "Stipe":5623, "Doris":3577, "Ana":7544} # Napišite program koji od korisnika prima ime osobe, a zatim traži pin. Ukoliko je unesen ispravan pin, korisnik unosi novi pin koji se pohranjuje u rječniku rj = {'Branka':3241,'Stipe':5623,'Doris':35...
# Time: O(n) # Space: O(1) # dp class Solution(object): def minimumTime(self, s): """ :type s: str :rtype: int """ left = 0 result = left+(len(s)-0) for i in xrange(1, len(s)+1): left = min(left+2*(s[i-1] == '1'), i) result = min(resu...
class Solution: def subarrayBitwiseORs(self, A): """ :type A: List[int] :rtype: int """ res, cur = set(), set() for x in A: cur = {x | y for y in cur} | {x} res |= cur return len(res)
def merge_sort(sorting_list): """ Sorts a list in ascending order Returns a new sorted list Divide: Find the midpoint of the list and divide into sublist Conquer: Recursively sort the sublist created in previous step Combine: Merge the sorted sublist created in previous step Takes...
# -*- coding: utf-8 -*- """ Created on Wed Jun 8 11:21:27 2016 @author: ericgrimson """ mysum = 0 for i in range(5, 11, 2): mysum += i if mysum == 5: break print(mysum)
# coding: utf-8 def test_default_value(printer): assert printer._inverse is False def test_changing_no_value(printer): printer.inverse() assert printer._inverse is False def test_changing_state_on(printer): printer.inverse(True) assert printer._inverse is True def test_changing_state_off(pri...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class RenameObjectParamProto(object): """Implementation of the 'RenameObjectParamProto' model. Message to specify the prefix/suffix added to rename an object. At least one of prefix or suffix must be specified. Please note that both prefix and ...
# program to merge two linked list class Node: def __init__(self, data, next): self.data = data self.next = next def merge(L1,L2): L3 = Node(None, None) prev = L3 while L1 != None and L2 != None: if L1.data <= L2.data: prev.next = L2.data ...
local_webserver = '/var/www/html' ssh = dict( host = '', username = '', password = '', remote_path = '' )
class FibIterator(object): def __init__(self, n): self.n = n self.current = 0 self.num1 = 0 self.num2 = 1 def __next__(self): if self.current < self.n: item = self.num1 self.num1, self.num2 = self.num2, self.num1+self.num2 self.current...
''' @author: Sergio Rojas @contact: rr.sergio@gmail.com -------------------------- Contenido bajo Atribución-NoComercial-CompartirIgual 3.0 Venezuela (CC BY-NC-SA 3.0 VE) http://creativecommons.org/licenses/by-nc-sa/3.0/ve/ Creado en abril 21, 2016 ''' def biseccion(f, a, b, tol=1.e-6): """ Funcion que impl...
cpgf._import(None, "builtin.debug"); cpgf._import(None, "builtin.core"); class SAppContext: device = None, counter = 0, listbox = None Context = SAppContext(); GUI_ID_QUIT_BUTTON = 101; GUI_ID_NEW_WINDOW_BUTTON = 102; GUI_ID_FILE_OPEN_BUTTON = 103; GUI_ID_TRANSPARENCY_SCROLL_BAR = 104; def makeM...
""" The api endpoint paths stored as constants """ PLACE_ORDER = 'PlaceOrder' MODIFY_ORDER = 'ModifyOrder' CANCEL_ORDER = 'CancelOrder' EXIT_SNO_ORDER = 'ExitSNOOrder' GET_ORDER_MARGIN = 'GetOrderMargin' GET_BASKET_MARGIN = 'GetBasketMargin' ORDER_BOOK = 'OrderBook' MULTILEG_ORDER_BOOK = 'MultiLegOrderBook' SINGLE_ORD...
class SoftplusParams: __slots__ = ["beta"] def __init__(self, beta=100): self.beta = beta class GeometricInitParams: __slots__ = ["bias"] def __init__(self, bias=0.6): self.bias = bias class IDRHyperParams: def __init__(self, softplus=None, geometric_init=None): self.so...
# Coin Change 8 class Solution: def change(self, amount, coins): # Classic DP problem? dp = [0] * (amount + 1) dp[0] = 1 for coin in coins: for am in range(1, amount + 1): if am >= coin: dp[am] += dp[am - coin] return dp[amoun...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def insertIntoMaxTree(self, root: TreeNode, val: int) -> TreeNode: if root is None or root.val < val: node = TreeNode(val) ...