content
stringlengths
7
1.05M
maior = 0 menor = 0 for c in range(0, 5): n1 = float(input("Digite o peso da {}° pessoa: ".format(c))) if c == 0: maior = n1 menor = n1 else: if n1 > maior: maior = n1 if n1 < menor: menor = n1 print("Dentre os 5 pesos citados acima o menor foi o de {}...
# author : @akash n=int(input()) a=[] for i in range(n): s=str(input()) a.append(s) b=sorted(a) #print(b) for i in range(n-1): aa=b[i] bb=b[i+1] nn=len(aa) mm=len(bb) if(mm>nn and aa==bb[:nn]): t=b[i] b[i]=b[i+1] b[i+1]=t for i in b: print(i)
'''while em Python - Aula 7 utilizando para realizar ações enquanto uma condição for verdadeira.''' """while True: nome = input(" Qual o seu nome ?") print(f'Olá {nome}!')""" '''x = 0 while x <101 : #'cotinue' pula o laço e 'break' finaliza o laço print(x) x = x+1 # ou x += 1 print("Fim do programa!!!")...
# Un diccionario no tiene por qué contener nada. Puede crear un diccionario vacío: empty_dict = {} my_empty_dictionary = {}
# https://adventofcode.com/2021/day/8 # load file infile = open('08/input.txt', 'r') lines = infile.readlines() infile.close() # parse input answer = 0 unique_number_of_segments_lengths = [2, 4, 3, 7] for line in lines: line = line.strip() print("line: {}".format(line)) line_parts = line.split(' | ') ...
a=int(input()) b=int(input()) sum=a+b dif=a-b mul=a*b if b==0: print('Error') return div=a//b Exp=a**b print('sum of a and b is:',sum) print('dif of a and b is:',dif) print('mul of a and b is:',mul) print('div of a and b is:',div) print('Exp of a and b is:',Exp)
#! /usr/bin/env python3 with open('../inputs/input14.txt') as fp: lines = [line.strip() for line in fp.readlines()] polymer, rules = lines[0], lines[2:] # build mappings chr_mappings = {} # character mappings: NN -> H ins_mappings = {} # insertion mappings: NN -> [NH, HN] for rule in rules: [key, val] = rule...
def inverno(): dias = list(map(int, input().split())) dia1 = dias[0] dia2 = dias[1] dia3 = dias[2] # 1 - ok if dia1 > dia2 and (dia2 < dia3 or dia2 == dia3): print(':)') # 2 - ok elif dia1 < dia2 and (dia2 > dia3 or dia2 == dia3): print(':(') # 3 - ok elif dia1 < ...
# @Title: 二叉树的最大深度 (Maximum Depth of Binary Tree) # @Author: KivenC # @Date: 2020-07-28 10:15:30 # @Runtime: 60 ms # @Memory: 15.5 MB # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: d...
number_of_days = int(input()) number_of_hours = int(input()) cost_for_all_period = 0 for day in range (1, number_of_days + 1): current_cost = 0 for hour in range (1, number_of_hours + 1): if day % 2 == 0: if hour % 2 != 0: cost_for_all_period += 2.50 current_...
RED = '\033[1;91m' GREEN = '\033[1;92m' YELLOW = '\033[1;93m' BLUE = '\033[1;94m' BROWN = '\033[1;95m' CYAN = '\033[1;96m' WHITE = '\033[1;97m' COL_END = '\033[0m'
while True: nota = int(input("Insira uma nota entre 0 e 10: ")) if nota >= 0 and nota <= 10: break; else: print("Nota inválida, digite novamente")
class Node(object): def __init__(self, Node1 = None, Node2 = None): """ A binary tree is either a leaf or a node with two subtrees. INPUT: - children, either None (for a leaf), or a list of size excatly 2 of either two binary trees or 2 obj...
# Time: O(n) # space: O(1) class Solution(object): def mincostTickets(self, days, costs): """ :type days: List[int] :type costs: List[int] :rtype: int """ durations = [1, 7, 30] W = durations[-1] dp = [float("inf") for i in range(W)] dp[0] = ...
int_float_err = "%i + %f" % ("1", "2.00") #Output """ Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> int_float_err = "%i + %f" % ("1", "2.00") TypeError: %i format: a number is required, not str """ int_float_err = "%i + %f" % (1, "2.00") #Output """ Traceback (most recent call la...
''' 6 kyu Your order, please https://www.codewars.com/kata/55c45be3b2079eccff00010f/train/python Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result. Note: Numbers can be from 1 to 9. So 1 will be the first word (not...
def armstrong(num): for x in range(1, num): if x>10: order = len(str(x)) sum = 0 temp = x while temp > 0: digit = temp % 10 sum += digit**order temp //= 10 if x == sum: yield print("T he First Armstrong Nubmer is : ", x) lst=list(armstrong(1000))
'''PROGRAM TO CALCULATE WHEN THE USER WILL TURN 100 YEARS OLD''' #Current Year Year = 2020 #Input for name and age Name = input('\nWhat is your name?: ') Age = int(input('How old are you?: ')) #Calculating year of birth YOB = Year-Age ...
"""ClipTools clipboard manager and text processing tools with a lines based GUI interface Test Controller part, driving the GUI and the Data """ # Placeholder for future tests pass
""" Module for preprocessing tools. Class List (in order): DataFrameSelector """ #Column Selectors #================= class DataFrameSelector(BaseEstimator, TransformerMixin): """ Description: A selection tranformer that will select columns of specific datatypes, e.g. numeric, categoric etc.. ...
''' Config file for CNN model ''' # -- CHANGE PATHS --# # Jamendo JAMENDO_DIR = '../jamendo/' # path to jamendo dataset MEL_JAMENDO_DIR = '../data/schluter_mel_dir/' # path to save computed melgrams of jamendo JAMENDO_LABEL_DIR = '../data/labels/' # path to jamendo dataset label # MedleyDB MDB_VOC_DIR = '/medi...
''' Created on Jul 1, 2015 @author: egodolja ''' ''' import unittest from mock import MagicMock from authorizenet import apicontractsv1 #from controller.ARBCancelSubscriptionController import ARBCancelSubscriptionController from tests import apitestbase from authorizenet.apicontrollers import * import test ''' ''' c...
# coding : utf8 # version : 0.0 class Object: """ Main class """ def size(): return self.size
katok = ['다현', '정연', '쯔위', '사나', '지효'] def delete_data(posotion): klen = len(katok) katok[posotion] = None for i in range(posotion + 1,klen,1): katok[i-1] = katok[i] katok[i] = None del(katok[klen-1]) print(katok) delete_data(1) print(katok) delete_data(3) print(katok) 1
''' Copyright © 2016 Franco Masotti <franco.masotti@student.unife.it> Danny Lessio <danny.lessio@gmail.com> This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the LICENSE file for ...
def translate(**kwargs): for key, value in kwargs.items(): print(key, ":", value) words = {"mother": "madre", "father": "padre", "grandmother": "abuela", "grandfather": "abuelo"} translate(**words)
# O(n) time | O(1) space class Solution: def minCostToMoveChips(self, position: List[int]) -> int: oddCount = 0 evenCount = 0 for p in position: if p & 1: oddCount += 1 else: evenCount += 1 return min(oddCount, evenCount)
class GroupHelper: def __init__(self, app): self.app = app def return_to_groups_page(self): wd = self.app.wd wd.find_element_by_link_text("group page").click() def go_to_home(self): wd = self.app.wd wd.find_element_by_link_text("home page").click() def creat...
welcome_message = "Hey there!" speech = "I became a developer because it's fascinates me how one can develop a thing and it can we use by many people around the world." art = """ ____/, _____) \ // / / _\/_ \ ( / \ ___\_|_ ____/ \_\/ \\ (\___/\\ \\ |...
scanners = [] with open('day19/input.txt') as f: lines = f.readlines() for line in lines: line = line.strip() if line == "": continue if line.startswith("---"): scanner = [] scanners.append(scanner) continue scanner.append(list(map(lambda s: int(s), line.split(",")...
db.session.execute(''' alter table "user" add column created timestamp ''') db.session.execute(''' update "user" set created = '1979-07-07' ''') db.session.execute(''' alter table "user" alter column created set not null ''') db.session.commit()
"""Generic gridworld environments A generic grid-world environment consists of: * An agent, which occupies a location on the grid * A rectangular 2D grid * A set of objects, which occupy (possibly overlapping) locations on the grid. * A set of actions, which allow the agent to interact with the grid and th...
#!/usr/bin/env python #pylint: skip-file # This source code is licensed under the Apache license found in the # LICENSE file in the root directory of this project. class PolicyInterruptInput(object): def __init__(self): """ Attributes: swaggerTypes (dict): The key is attribute name and...
"""Write a program to swap two numbers""" a = int (input("Enter first number \n")) b = int (input("Enter second number \n")) def swapper(af, bf): return bf, af a, b = swapper(a, b) print(F"The first number is {a}") print(F"The second number is {b}")
{ "targets": [ { "target_name": "civetkern", "sources": [ "src/lmdb/mdb.c", "src/lmdb/midl.c", "src/util/util.cpp", "src/util/pinyin.cpp", "src/interface.cpp", "src/database.cpp", "src/db_manager.cpp", "src/log.cpp", "src/DBThread...
class Solution: def findCenter(self, edges: List[List[int]]) -> int: edgeOne= edges[0][0] edgeTwo = edges[0][1] edgeOneCouner = 0 for i in range(len(edges)): if edgeOne == edges[i][0] or edgeOne == edges[i][1]: edgeOneCouner+=1 return edgeOne if e...
d=int(input("Enter d -> ")) e=int(input("Enter e -> ")) b=1 a=0 s=0 k=0 for i in range(max(d,e)): if (((d==0) and (e==1))) or (((d==1) and (e==0))): k=1 print("True") break else: if (((d==a) and (e==b))) or (((d==b) and (e==a))): k=1 print("T...
''' Builds a calculator that reads a string and addition and subtraction. Example: Input: '1+3-5+7' Output: 6 ''' def calculator(math_string): return sum([int(item) for item in math_string.replace('-', '+-').split('+')]) def test_calculator(): assert calculator('1+3-5+7') == 6, calculator('1+3-5+7...
#Faca um programa que mostre a tabuada de varios numeros, um de cada vez, para cada valor #digitado pelo usuario. O programa sera interrompido quando o numero solicitado for negativo #minha resposta while True: num = int(input('Quer ver a tabuada de qual valor? ')) if num < 0: break print('-'*30) ...
NUMBER_WORKER = 5 ITEM_DURATION = 60 INPUT_FILE_NAME = 'input.txt' class WorkItem: def __init__(self, name): self.name = name self.dependencies = [] self.completed = False self.completed_at = None def addDependency(self, item): self.dependencies.append(item) def is...
class IrisError(Exception): pass class IrisDataError(IrisError): pass class IrisStorageError(IrisError): pass
def fab(n): if n == 1 or n == 2: return 1 else: return fab(n - 1) + fab(n - 2) if __name__ == '__main__': print(fab(10))
# -*- coding: utf-8 -*- """ Spyder Editor @auther: syenpark Python Version: 3.6 """ def bubble_sort(L): """ inputs : A list outputs: The list in a reverse order """ swap = False while not swap: swap = True for i in range(1, len(L)): if L[i-1] < L[i]: ...
def f1(): x = 42 def f2(): x = 0 f2() print(x) f1()
""" Parent class: User holds deatils about an user has a function to show user details Child class: Bank stores detials about the account balance, amount deposits withdraw and view_balance """ # Class Parent: User. Login and Details about user class login(object): """docstring for login""" def __init__(self, us...
ACTION_ACK = 'ack' ACTION_UNACK = 'unack' ACTION_SHELVE = 'shelve' ACTION_UNSHELVE = 'unshelve' ACTION_OPEN = 'open' ACTION_CLOSE = 'close'
class Course(): """Documents the class. Useful for understanding what it's for.""" def __init__(self, id, name): self.id = id self.name = name def __repr__(self): return f"Course with {self.id} called {self.name}." def append_to_name(self, text_to_append): self.name ...
# https://codility.com/programmers/lessons/2-arrays/cyclic_rotation/ def solution(A, K): ''' Rotate an array A to the right by a given number of steps K. ''' N = len(A) if N == 0: return A # After K rotations, the -Kth element becomes first element of list return A[-K:] + A[:N-K] if ...
""" LC 128 Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. Example 1: Input: nums = [100,4,200,1,3,2] Output: 4 Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length...
#============================================================================# # subsets #============================================================================# def subsets(array): """iterative solution""" n = len(array) subsets_ = [] for i in range(1<<n): subsets_.append([array[j] for ...
n1 = int(input('\033[35mPrimeiro valor:\033[m ')) n2 = int(input('\033[33mSegundo valor:\033[m ')) n3 = int(input('\033[32mTerceiro valor:\033[m ')) menor = n1 if n2 < n1 and n2 < n3: menor = n2 if n3 < n2 and n3 < n1: menor = n3 maior = n1 if n2 > n1 and n2 > n3: maior = n2 if n3 > n1 and n3 > n2: mai...
# 23011 - Battle mage 1st job advancement quest sm.setSpeakerID(2151001) if not sm.canHold(1382000): sm.sendSayOkay("Please make some space in your equipment invetory.") sm.dispose() if sm.sendAskYesNo("Would you like to become a Battle Mage?"): sm.completeQuest(parentID) sm.jobAdvance(3200) sm.re...
print('====== DESAFIO 53 ======') phrase = str(input('Digite uma frase: ')).strip().split() junto = ''.join(phrase) cont = len(junto) recebe = '' for letra in range(cont-1, -1, -1): recebe = recebe + junto[letra] if recebe == junto: print(recebe) print(f'A frase: {junto} é um palíndromo!' ) else: print(...
class Pessoa: #As classes devem começar com letra maiúscula olhos = 2 #Atributo de classe (mesmo valor para todos os atributos), economia de alocação de memória def __init__(self, *filhos,nome = None,idade=35): #Atributo self.idade = idade self.nome = nome self.filhos = list(filhos) ...
n, k = map(int, input().split(' ')) arr = list(map(int, input().split(' '))) print ("0" if max(arr)-k<=0 else max(arr)-k)
__i = 0 LOGIN_FAILED_GENERIC = __i; __i += 1 LOGIN_FAILED_BAD_PASSWORD = __i; __i += 1 NIGHTLY_MAINTENANCE = __i; __i += 1 NOT_LOGGED_IN = __i; __i += 1 REQUEST_GENERIC = __i; __i += 1 REQUEST_FATAL = __i; __i += 1 INVALID_ACTION = __i; __i += 1 INVALID_ITEM = __i; __i += 1 INVALID_LOCATION = __i; __i += 1 INVALID_USER...
def Converter_mes(dia, mes, ano): meses = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'] resultado = str(dia) + ' de ' + meses[mes-1] + ' ' + str(ano) return resultado valor1 = int(input(('Digite o dia :'))) valor2 = int(i...
# 077 - Crie um programa que tenha uma tupla com várias palavras (não usar acentos). Depois disso, você dve mostrar, para cada palavra, #quais são as suas vogais: tupla = ('aprender', 'programar', 'linguagem', 'python', 'curso', 'gratis', 'estudar', 'praticar', 'trabalhar', 'mercado', 'programador', 'futuro') for c ...
def spin(n): def s(s): return s[-n:] + s[:-n] return s def exchange(a, b): def e(s): s[b], s[a] = s[a], s[b] return s return e def partner(a, b): def p(s): ai = s.index(a) bi = s.index(b) s[bi], s[ai] = s[ai], s[bi] return s re...
def factorial(n): # base case should be 0. n=1 is wrong. If testcase contains n=0 => dead. if n == 0 : return 1 return n*factorial(n-1) n = int(input("Enter n : ")) print(factorial(n))
#!/usr/bin/python3 """ Good morning! Here's your coding interview problem for today. This problem was asked by Google. An XOR linked list is a more memory efficient doubly linked list. Instead of each node holding next and prev fields, it holds a field named both, which is an XOR of the next node and the previous nod...
x = 344444444 b0,b1,b2,b3 = [c for c in x.to_bytes(4,"big")] y = b0 << 24 | b1 << 16 | b2 << 8 | b3 << 0 print(b0,b1,b2,b3) print(y)
def newlist(size): list = [] for i in range(size): list.append(i) return list for i in range(5): n = pow(10, i) print("%s: list(%s)" % (i+1, n)) x = newlist(n)
# Given a binary tree, determine if it is a valid binary search tree (BST). # # Assume a BST is defined as follows: # # The left subtree of a node contains only nodes with keys less than the node's key. # The right subtree of a node contains only nodes with keys greater than the node's key. # Both the left and right su...
class salaryError(Exception): pass while True: try: #salary = int(input("Enter your Salary")) salary = input("Enter your Salary") if not salary.isdigit(): raise salaryError() print(salary) break #except ValueError: except salaryError: print("...
x, y = 10, 20 def foo(): nonlocal x,\ y x = 20 y = 10 print(x,y) foo() print(x,y)
#!/usr/bin/env python vcfs = "$vcf".split(" ") with open("vcfList.txt", "w") as fh: for vcf in vcfs: print(vcf, file=fh)
vel = float(input('Qual é a velocidade atual do carro? ')) if vel <= 80: print('Tenha um bom dia! Dirija com segurança!') else: print('Tu ta correndo irmão, ta crazy?') multa = (vel - 80) * 7 #Pega a visão, a variavel multa recebe a variavel vel - o valor - o numero permitido pelo flinstons * 7 print('V...
def grau(valor,v1,v2): for i in range(valor): v1.sort() v2.sort() if v1[i] != v2[i]: return "nao" return "sim" def funcao(alf,num,lista,j,grau): a = lista[1:len(lista)] if alf in a: return grau[j] elif num in a: return grau[j] else: return 0 def repetido(lista): l = [...
# -*- coding: utf-8 -*- """ Copyright 2016 Anthony Shaw Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to i...
ano = int(input('Digite qual ano voce deseja saber')) if ano % 4 == 0: print(f'O ano de {ano} é bissexto') else: print(f'O ano de {ano} não é bissexto')
def moving_zeroes(arr): idx = 0 moved = 0 while idx < len(arr) - moved: if arr[idx] == 0: arr.pop(idx) arr.append(0) moved += 1 else: idx += 1 return arr
""" Day 6 """ class LanternSchool: """ Implementation of a school of lanternfish. """ def __init__(self, start): self.school = [LanternFish(age) for age in range(9)] for age in start.split(','): self.school[int(age)].add_fish(1) def __next__(self): reset_count...
""" Una juguetería tiene mucho éxito en dos de sus productos: payasos y muñecas. Suele hacer venta por correo y la empresa de logística les cobra por peso de cada paquete así que deben calcular el peso de los payasos y muñecas que saldrán en cada paquete a demanda. Cada payaso pesa 112 g y cada muñeca 75 g. Escribir ...
# -*- coding: utf-8 -*- # ============================================================================== # SET THE SCREEN SIZE # # default values: # SCREEN_WIDTH = 1000 # SCREEN_SIZE = 600 # ============================================================================== SCREEN_WIDTH = 1000 SCREEN_HEI...
# 1MB MAX_DATASET_SIZE = 1048576 MAX_TRAINING_COST = 100
# # PySNMP MIB module ALCATEL-IND1-UDLD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-UDLD-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:20:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
# # PySNMP MIB module CISCO-SECURE-SHELL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SECURE-SHELL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:54:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
""" The json-schema for the Molecule definition """ __all__ = ["Molecule"] Molecule = { "$schema": "http://json-schema.org/draft-04/schema#", "name": "mmschema_molecule", "version": "0.dev", "description": "The MolSSI Molecular Mechanics Molecule Schema", "type": "object", "properties": { ...
number = int(input("ingrese el numero de filas de su triangulo ")) def print_triangle(number): for i in range(1, number + 1): print(str(i) * i) print_triangle(number)
def change(n): if (n < 0): return 999 if (n == 0): return 0 best = 999 coins = [200, 100, 50, 20, 10, 5, 2, 1] for x in coins: best = min(best, change(n-x)+1) return best t = 0 n = int(input()) while n != -1: t += n n = int(input()) t %= 60 print(change(t))
tb = 0 lr = 0 for i in range(int(input())): n = list(input()) for i in range(len(n)): if int(n[i]) == 0: if i == 0 or i == 1: tb += 1 if i == 2 or i == 3: lr += 1 print(min(tb // 2, lr // 2), tb - min(tb // 2, lr // 2) * 2, lr - min(tb // 2, lr // 2) * 2)
#!/usr/bin/python # -*- coding: UTF-8 -*- proxy_web_list = { "http://www.kuaidaili.com/free/inha/", "http://www.kuaidaili.com/free/outha/", "http://ip84.com/dlgn/", "http://ip84.com/gwgn/", "http://www.xicidaili.com/wn/", "http://www.xicidaili.com/nn/", "http://www.ip3366.net/free/?stype=1&page=", "http://www.ip3366.n...
REWARDS = { 'star': 1, 'first_quest': 25, 'quest_of_the_day': 5, 'archived_quest': 1, 'personal_share': 3, 'streak_3': 3, 'streak_10': 10, 'streak_100': 100, } ONBOARDING_QUEST_ID = 926 COMMENTS_PER_PAGE = 150 WHITELIST_COMMENTS_PER_PAGE = 100
# IoT program by MicroPython # https://github.com/rnsk/micropython-iot # # MIT License # Copyright (c) 2021 Yoshika Takada (@rnsk) """App configration""" # wifi setting # config.WIFI_xxx WIFI_SSID = '' WIFI_PASSWORD = '' # Device setting # config.DEVICE_xxx DEVICE_ID = '' DEVICE_NAME = '' # MQTT setting # config.MQ...
# -*- coding: utf-8 -*- amount = int(input()) board = [] for i in range(amount): board.append(int(input())) for i in range(amount): bombs = 0 if i > 0: bombs += board[i-1] if i < (amount-1): bombs += board[i+1] bombs += board[i] print(bombs)
""" Projeto: Lista ordenada sem repetições """ listNumbers = [] for n in range(0, 5): number = int(input('Digite um número: ')) if number not in listNumbers: if n == 0 or number > listNumbers[-1]: listNumbers.append(number) else: for position in range(0, len(listNumb...
class Element: def __init__(self, value:int, previous = None): self.__value = value self.__previous = previous @property def value(self) -> int: return self.__value @value.setter def value(self, value:int): self.__value = value @property def previous(self...
# If you can't sleep, just count sheep!! # Task: # Given a non-negative integer, 3 for example, return a string with a murmur: "1 sheep...2 sheep...3 sheep...". Input will always be valid, i.e. no negative integers. def count_sheep(n): output = '' for i in range(1, n+1): output+=str(i) + " sheep..." ...
general_questions = 'general Questions' computer_questions = 'computer Questions' python_questions = 'python Questions' questions = [general_questions, computer_questions, python_questions] quiz = {general_questions: [("Amartya Sen was awarded the Nobel prize for his contribution to Welfare Economics.", True), ...
''' Biblioteca de funciones para ser empleada en las operaciones de lectura y cálculo de las variables en una matriz de relaciones. ''' def init_mat(matriz, n_ec, n_var): ''' Devuelve la matriz con celdas de valor 1 si la variable interviene en la ecuación y 0 en caso contrario matriz: es la matriz c...
"""Iteration utility functions.""" def build_filtered_func(func): def filtered_func(seq): """Filter out Nones and return the return of func.""" if not seq: return None seq = filter(None, seq) if not seq: return None return func(seq) return filter...
##### # Step 3 - Make your own Python Toolbox! ##### # Task - Using the code I provide below (basically , including the parameters that I have prepared for you (note, you can # find all the Python Toolbox Parameters here: # http://desktop.arcgis.com/en/arcmap/10.3/analyze/creating-tools/defining-parameters-in-...
class Link: """A link between a Tatoeba's sentence and its translation""" def __init__(self, sentence_id, translation_id): self._src_id = sentence_id self._tgt_id = translation_id @property def sentence_id(self): """The id of the source sentence""" return int(self._src...
class Cipher: letter_number_list = [[' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', ...
#: Describe the widgets to show in the toolbox, #: and anything else needed for the #: designer. The base is a list, because python dict don't preserve the order. #: The first field is the name used for Factory.<name> #: The second field represent a category name widgets = [ ('Label', 'base', {'text': 'A label'})...
def fib(i): count = 0 x = 0 y = 1 while count < i: count = count + 1 x, y = y, x + y return y
#!/usr/bin/env python ''' Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'pkSecurity IDS (pkSec)' def is_waf(self): schema1 = [ self.matchContent(r'pk.?Security.?Module'), self.matchContent(r'Security.Alert') ] schema2 = [ self.matc...
"""Calculate the exponential of a base""" __author__ = 'Nicola Moretto' __license__ = "MIT" def iterPower(base, exp): ''' Calculate iteratively the exponential of a base :param base: Base :param exp: Exponent :return: Exponential of the base ''' result = 1 while(exp > 0): resul...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def pathSum(self, root, sum): """ Basically keeps a dictionary that stores the frequency of occurances of previous sums. Di...