content
stringlengths
7
1.05M
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ############################################################################## # Thesis code # A model that emulates players' actions in the Settlers of Catan (SOC) game # based on linguistic references and previous actions. # # Data: jSettlers game logs (.soclog) # Autho...
class QuickUnion: def __init__(self, N): self._id = list(range(N)) self._count = N self._rank = [0] * N def find(self, p): id = self._id while p != id[p]: p = id[p] = id[id[p]] # Path compression using halving. return p def union(self, p, q): ...
""" Author: Michael Markus Ackermann ================================ The function above describes the main purpouse of this file. """ def air_properties(temp, hum, atm): """ Returns some of the air properties based on the ambient condition. Parameters: ----------- temp: int | float ...
class Solution: def intToRoman(self, num: int) -> str: roman_dict = { "I": 1, "IV": 4, "V": 5, "IX": 9, "X": 10, "XL": 40, "L": 50, "XC":90, "C": 100, "CD": 400, "D": 500, ...
""" exceptions.py Copyright © 2015 Alex Danoff. All Rights Reserved. 2015-08-02 This file defines custom exceptions for the iTunes funcitonality. """ class ITunesError(Exception): """ Base exception class for iTunes interface. """ pass class AppleScriptError(ITunesError): """ Represents an e...
class Node: def __init__(self, val, children): self.val = val self.children = children class Solution: def levelOrder(self, root: 'Node') -> list: q, ans = [root], [] while any(q): ans.append([item.val for item in q]) q = [child for item in q for child i...
avancer() droite() avancer() gauche() avancer() droite() for _ in range(16): avancer() ouvrir()
r1 = int(input('Digite a 1° reta: ')) r2 = int(input('Digite a 2° reta: ')) r3 = int(input('Digite a 3° reta: ')) if r1 > r2 + r3 or r2 > r1 + r3 or r3 > r1 + r2: print('Não forma um triângulo.') a = False else: print('Forma um triângulo') a = True if r1 == r2 == r3 and a == True : print('Esse tr...
def apply(df, remove_common=False, include_activity_timest_in_key=False): """ Dataframe to grouped stream Parameters ------------- df Dataframe Returns ------------- grouped_stream Grouped stream of events """ stream = df.to_dict('r') grouped_stream = {} ...
# E: 빈 공간(Empty) = 0, X: 선공 Player = 1, O: 후공 Player = 2 class TicTacToe: def __init__(self): self.N = 3 #: 정방행렬의 변 길이 self.map = [[0 for _ in range(self.N)] for _ in range(self.N)] self.map_index_description = [h * self.N + w for h in range(self.N) for w in range(self.N)] self.pla...
class Solution: def intToRoman(self, num): s = "M" * (num // 1000) s += "CM" if num % 1000 >= 900 else "D" *((num % 1000) // 500) s += "CD" if num % 500 >= 400 and s[-2:] != "CM" else "C" * ((num % 500) // 100) if num % 500 < 400 else "" s += "XC" if num % 100 >= 90 else "L" * ((num...
class Solution: def minScoreTriangulation(self, A: List[int]) -> int: memo = {} def dp(i, j): if (i, j) not in memo: memo[i, j] = min([dp(i, k) + dp(k, j) + A[i] * A[j] * A[k] for k in range(i + 1, j)] or [0]) return memo[i, j] return dp(0, len(A) - 1)
"""Kata for tuples""" print("Hello Tuples!") mytuple = ('abcd', 786, 2.23, 'john', 70.2) tinytuple = (123, 'john') print(mytuple) # Prints complete tuple print(mytuple[0]) # Prints first element of the tuple print(mytuple[1:3]) # Prints elements starting from 2nd till 3rd print(mytuple[2:]...
# FUNÇÃO LAMBDA: É UMA FUNÇÃO ANÔNIMA E SÓ É ÚTIL QUANDO USADO EM UMA LINHA. NO EXEPLO ABAIXO VOU REFAZER O CONTADOR DE LETRAS USANDO LAMBDA # contador_letras é minha váriavel lambda que recebe a função lambda de uma lista e retorna uma lisa [len(x) conta a quantidade de letras no for] contador_letras = lambda list...
S = input() check = [-1] * 26 for i in range(len(S)): if check[ord(S[i]) - 97] != -1: continue else: check[ord(S[i]) - 97] = i for i in range(26): print(check[i], end=' ')
# Crie um programa que tenha uma tupla # totalmente preenchida com uma contagem # de 0 a 20 por extenso. Leia um número # pelo teclado, e mostre esse número por # extenso. 'Tente novamente' até o # usuário digitar um número corretamente. stringifiedNumbers = ('Zero', 'Um', 'Dois', 'Três', 'Quatro', 'Cinco', ...
l=range(1,50) #l=[1,2,6,99,455,21111111,5] print(type(l)) max=0 for i in l: if i>max : max=i print(f"max is {max}")
class StorageInteractions: def __init__(self, **repositories): self._storage_repository = repositories["storage_repository"] def load(self, name): return self._storage_repository.load_file(name) def store(self, file): name = self._storage_repository.store_file(file) return...
"""The core module of ``soulsgym`` provides all necessary interfaces to the Dark Souls III process. At the lowest level we directly manipulate the game memory with the :mod:`.memory_manipulator`. The :mod:`.game_interface` acts as an abstraction layer and allows us to interact with the game as if we had access to the ...
########################################################## # Author: Raghav Sikaria # LinkedIn: https://www.linkedin.com/in/raghavsikaria/ # Github: https://github.com/raghavsikaria # Last Update: 16-5-2020 # Project: LeetCode May 31 Day 2020 Challenge - Day 16 ##########################################################...
n=int(input("Tabuada de: ")) x=1 while x<=10: print(n*x) x=x+1
# -*- coding: utf-8 -*- # # Copyright (C) 2021 CERN. # Copyright (C) 2021 Data Futures. # # OCFL Core is free software; you can redistribute it and/or modify it under the # terms of the MIT License; see LICENSE file for more details. """Storage implementations for OCFL.""" class Storage: """Base class for the st...
class BasePOI: def __init__(self, lat, lng,value): self.lat = lat self.lng = lng self.value = value def __repr__(self): return ','.join(list(map(str, (self.lat, self.lng, self.value)))) # models realted to the db tables class Anemity(BasePOI): def __i...
# Altere o Programa 6.22 de forma a solicitar ao usuário o produto e a quantidade vendida # Verifique se o nome do produto digitado existe no dicionário, e só então efetue a baixa em estoque # Programa 6.22 do livro, página 128 # Programa 6.22 - Exemplo de dicionário com estoque e operações de venda # # estoque = {'to...
# exception classes class Error(Exception): pass class ParameterError(Error): pass
class ListViewItemSelectionChangedEventArgs(EventArgs): """ Provides data for the System.Windows.Forms.ListView.ItemSelectionChanged event. ListViewItemSelectionChangedEventArgs(item: ListViewItem,itemIndex: int,isSelected: bool) """ def __getitem__(self,*args): """ x.__getitem__(y) <==> x[y] """ p...
#!/usr/bin/env python3 """example settings """ # list of ports to listen react upon ports = [ 8888 ] # broadcast address that triggers the forwarding olddest = "10.0.2.255" # list of new destination ranges for the modified packet newdestranges = [ "10.0.2.0/24" ] # show the original and modified packet? # Only enab...
# -*- coding: utf-8 -*- # @创建时间 : 11/10/18 # @作者 : worry1613(549145583@qq.com) # GitHub : https://github.com/worry1613 # @CSDN : http://blog.csdn.net/worryabout/ class StackError(ValueError): pass class Stack(): def __init__(self): self.__list = [] def is_empty(self): """栈是否为空,是空t...
input_file = "/Users/jrawling/Documents/Physics/DeadConeAnalysis/ATLASWork/samples/ttj/output.root" input_file = "/Users/jrawling/Documents/Physics/DeadConeAnalysis/ATLASWork/samples/ttj/410501_minisample.root" input_file = "/Users/jrawling/Documents/Physics/DeadConeAnalysis/ATLASWork/samples/ttj/410501.root" ...
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def middleNode(self, head): currNode = head count = 0 while currNode: currNode = currNode.next count += 1 middle = count // 2 + 1 ...
def pressureInFluid(f_perpendicular, A): """ variables: f_perpendicular = normal force A = area""" p=f_perpendicular/A return p def bulkStress(dp, dV, V0): """variables: dp=change in fluid pressure dV=change in subject volume V0=original s...
async def test_make_coro(make_coro): coro = make_coro(1) assert 1 == await coro()
# https://i.gyazo.com/38682c2adf56d01422a7266f62c4794f.png instruments = [ 'Acoustic Grand Piano', 'Bright Acoustic Piano', 'Electric Grand Piano', 'Honky tonk Piano', 'Electric Piano 1', 'Electric Piano 2', 'Harpsichord', 'Clavi', 'Celesta', 'Glockenspiel', 'Music Box', ...
trick.real_time_enable() trick.exec_set_software_frame(0.1) # Instantiate the keyboard. Make sure you change the arguments to match your keyboard's # vendor and product IDs keyboard = trick.UsbKeyboard(0x413C, 0x2101) example.add(keyboard) # SingleFlightController's construtor takes the six Inputs we want to use for ...
#pragma error #pragma repy global foo foo = 2
def input_natural(): num = int(input("Digite o valor de n: ")) return num num = input_natural() fatorial = 1 if num < 0: input_natural() else: for i in range(1, num+1): fatorial += fatorial * (num - i) print(fatorial)
"import rules" load("@io_bazel_rules_dotnet//dotnet/private:context.bzl", "dotnet_context") load("@io_bazel_rules_dotnet//dotnet/private:common.bzl", "as_iterable") load("@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetLibraryInfo") load("@io_bazel_rules_dotnet//dotnet/private:rules/common.bzl", "collect...
def authenticate_as(client, username, password): token = client.post( "/auth/authenticate/", {"username": username, "password": password} ).data["token"] client.credentials(HTTP_AUTHORIZATION=f"Bearer {token}")
class BinaryIndexedTree: """ A toy Binary Indexed Tree data structure that caches element sums (only numbers are considerred), for efficiently qurying/modifying subarray sums O(log(n)) modify and O(log(n)) query """ def __init__(self, A): """ :type A: list """ ...
class BaseDatabaseValidation: """Encapsulate backend-specific validation.""" def __init__(self, connection): self.connection = connection def check(self, **kwargs): return [] def check_field(self, field, **kwargs): errors = [] # Backends may implement a check_field_typ...
# Huu Hung Nguyen # 10/07/2021 # Nguyen_HuuHung_donuts.py # Constants for price dozen and single of plain donuts, # and price dozen and single of fancy donuts. # The program prompts the user for the number of plain and fancy donuts. # It then calculates and displays the number of dozens and single donuts # for e...
""" Tuple Length To determine how many items a tuple has, use the len() method: """ thistuple = ("apple", "banana", "cherry") print(len(thistuple))
file = open("input.txt", 'r') out_string = '' for segment in file.read().split('.'): out_string += segment.split(':')[0] + '@@' out = open('hello.html', 'w') out.write('<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<link rel=\"stylesheet\" href=\"https://www...
class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ if s is None: return False if len(s) == 0: return True stack = [] for i in range(len(s)): c = s[i] if self._isLeftParenthese...
""" API 5L Add dictionary of API pipe sizes """ sizes = {406.4: [4.8, 5.2, 5.6, 6.4, 7.1, 7.9, 8.7, 9.5, 10.3, 11.1, 11.9, 12.7, 14.3, 15.9, 17.5, 19.1, 20.6, 22.2, 23.8, 25.4, 27, 28.6, 30.2, 31.8], 457: [4.8, 5.6, 6.4, 7.1, 7.9, 8.7, 9.5, 10.3, 11.1, 11.9, 12.7, ...
class SingletonMeta(type): _instance = None def __call__(self): if self._instance is None: self._instance = super().__call__() return self._instance
#!/usr/bin/python3 # -*-coding:utf-8-*- # 数据类型 --- List类型 # 列表操作相关 # Python 内置的一种数据类型是列表:list。 list 是一种有序的集合,可以随时添加和删除其中的元素。 # 创建一个列表,只要把逗号分隔的不同的数据项使用方括号括起来即可,且列表的数据项不需要具有相同的类型 ## 定义 list l1 = list((1,2,3,4,5)) l2 = list(["huangbo",'xuzheng',1234, 55.55]) l3 = ["huangbo",'xuzheng',1234, 55.55...
def func1(): pass def func2(arg): print(arg)
def prefix_suffix(w, m): B, t = [-1] + [0] * m, -1 for i in range(1, m + 1): while t >= 0 and w[t + 1] != w[i]: t = B[t] # prefikso-sufiks to relacja przechodnia t = t + 1 B[i] = t return B
# data_list = [(x, y), ...] b = np.matrix(map(lambda pair: [pair[1]], data_list)) a = np.matrix(map(lambda pair: [e**(d * pair[0]), e**(-d * pair[0]), 1], data_list))
# Задача 2. Вариант 27. # Напишите программу, которая будет выводить на экран наиболее понравившееся # вам высказывание, автором которого является Овидий. Не забудьте о том, что # автор должен быть упомянут на отдельной строке. # Чернов Михаил Сергеевич # 28.05.2016 print("Верь опыту") print("\n\t\tОвидий") input("\n\...
#!/usr/bin/env python3 # _*_ coding:utf-8 _* # Parent class has to inherit from "object" class class Parent(object): def __init__(self): print("parent constructor called!")
def sieve(number): prime = [True for i in range(number+1)] p = 2 while (p * p <= number): if (prime[p] == True): for i in range(p * p, number+1, p): prime[i] = False p += 1 primes = [] for p in range(2, number+1): if prime[p]: primes.ap...
def main(): with open('input.txt', 'r') as f: lines = f.readlines() d = dict() for li in lines: s1, s2 = li.strip().split(')') d[s2] = s1 total_links = 0 for s2,s1 in d.items(): while s1: total_links += 1 s1 = d.get(s1, None) print(tota...
def reversible_count(d): if d % 4 == 1: return 0 # 2 digits: no carry over, and sum of two digits is odd # 2 digits => 20 # 4 digits: outer pair is the same as 2 digits # inner pair has 30 possibilities because 0 is allowed if d % 4 == 0 or d % 4 == 2: return 20 * 30 **...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None # 核心思路 # 层次遍历用BFS,用队列维护后面需要遍历的结点 # 考虑到需要按层保存,所以其实可以不用队列,新旧swap即可 class Solution(object): def levelOrder(self, root): """ :type ro...
def get_user_quota(user): """ Tiny helper for getting quota dict for user (left mostly for backward compatibility) """ return user.userplan.plan.get_quota_dict()
class Locators(): base_url = "https://www.amazon.com.tr/" search_box_locator_id = "twotabsearchtextbox" search_box_text = "samsung galaxy m12" search_summit_button_id = "nav-search-submit-button" close_cookie_name = "accept" product_title = "productTitle" product = "span[class='a-size-base-p...
""" Crie um programa onde o usuario digite uma expressão qualquer que use parenteses. seu aplicativo deverá analisar se a expressao passada está com os parenteses abertos e fechados na ordem correta. """ expr = str(input('Digite a expressão: ')) pilha = list() for simb in expr: if simb == '(': pilha.append(...
print('Digite o seu valor para converte-lo (cotação da moeda de acordo com o dia 27/03/20. ') real = float(input('Qaunto você possui R$?: ')) dolar = real / 5.11 euro = real / 5.56 iene = real / 0.047 peso = real / 0.22 rublo = real / 0.064 bitcoin = real / 33737.48 boliviano = real / 0.74 print('Com R$:{:.2f}, você po...
# -*- coding: utf-8 -*- ''' File name: code\totient_stairstep_sequences\sol_337.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #337 :: Totient Stairstep Sequences # # For more information see: # https://projecteuler.net/problem=337 # Pr...
n1 = float(input("\nPrimeira nota: ")) n2 = float(input("Segunda nota: ")) media = (n1 + n2) / 2 print("\nTirando {:.2f} e {:.2f}, a média do aluno é {:.2f}".format(n1, n2, media)) if (media >= 7): print("O aluno está APROVADO!") elif (media >= 5): print("O aluno está em RECUPERAÇÃO!") else: print("O aluno...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: lenA = 0 lenB = 0 tempA = h...
SEARCH_WORD_LIST = ['woman', 'wear', 'skirt']#['cat', 'and', 'dog'] SECRET_FILE = "./engine/data/refer/azure_secret_sample.json"# be careful not to expose! SAVE_DIR = "./engine/data/tmp" SAVE_PAR_DIR = "./engine/data/tmp/bingimgs" OBJINFO_PATH = "./engine/data/tmp/obj.json" AZURE_DICT = "./engine/data/tmp/azure_rel_di...
# Given a binary tree, find the length of the longest consecutive sequence path. # The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connections. # The longest consecutive path need to be from parent to child (cannot be the reverse). # Example 1: # Input: ...
class DottedDict(dict): __slots__ = () def __getattr__(self, item): return self[item] def __setattr__(self, name, value): self[name] = value
class xsort(): # to find the max number in list we can # use max() function in python def findMax(_list): mout = _list[0] for i in _list: if i >= mout: mout = i return mout def run(_list): list_ = [] for i in range(len(_list...
class Currying(object): def __init__(self, fun): self.fun = fun self.argc = fun.__code__.co_argcount self.argl = () def __call__(self, *args): tmp = self.argl + args if len(tmp) >= self.argc: return self.fun(*tmp) curr = Currying(self.fun) cur...
class Entity(object): def __init__(self, entity_input_config): if type(entity_input_config) is not dict: #self._ha_api.log("Config error, not a dict check your entity configs") self.entityId = "error" self.nameOverride = None self.iconOverride = None e...
imgurr = { 1: "https://i.imgur.com/ZF6TzS4.jpg", 2: "https://i.imgur.com/eaSvBJR.jpg", 3: "https://i.imgur.com/bDoDm2W.jpg", 4: "https://i.imgur.com/5mCbYFU.jpg", 5: "https://i.imgur.com/zfnmieg.jpg", 6: "https://i.imgur.com/lLCL9qv.jpg", 7: "https://i.imgu...
""" ============ constants.py ============ Physical constants for astronomy & astrophysics Classes ======= Constant: Defines a physical constant for use in astronomical or physical computation. A Constant instance is defined by its value, description, and units attributes. """ class Constant(float): "...
SEED_PORT = 12345 SEED_ADDR = ('192.168.1.100', 5000) UPDATE_INTERVAL = 20 BUFFER_SIZE = 102400 ALIVE_TIMEOUT = 20
'''Crie um programa que leia uma tupla unica com nomes e precos em seguida depois mostre os valores de forma tabular''' itens = ('Lápis', 1.75, 'Borracha', 2, 'Caderno', 15.9, 'Estojo', 25, 'Transferidor', 4.2, 'Compasso', 9.99, 'Mochila', 120.32, 'Canetas...
class Inside: """ check is value is in target or not value : any target : any """ def __init__(self, value): self.value = str(value) def is_in(self, target): """ check value in target :param target: any :return: bool """ validate = ...
''' Kapitel 11 - Reguläre Ausdrücke In diesem Kapitel geht es um reguläre Ausdrücke @see: https://www.py4e.com/html3/11-regex @see: https://www.python-kurs.eu/python3_re.php @see: https://www.python-kurs.eu/python3_re_fortgeschrittene.php '''
class Scanner(object): def __init__(self, regex, code): self.regex_list = regex self.code = code self.tokens = self.scan(code) def match_regex(self, i, line): start = line[i:] for regex, token in self.regex_list: tok = regex.match(start) if to...
CONFIGURATION_NAMESPACE = 'qmap' # It is here and not inside the manager module to avoid circular imports EXECUTION_ENV_FILE_NAME = 'execution' EXECUTION_METADATA_FILE_NAME = 'execution' class QMapError(Exception): """Base class for this package errors""" pass
def test_get_test(mocked_response, testrail_client, test_data, test): mocked_response(data_json=test_data) api_test = testrail_client.tests.get_test(test_id=1) assert api_test == test def test_get_tests(mocked_response, testrail_client, test_data, test): mocked_response(data_json=[test_data]) a...
""" Constants to be used during analysis """ # URLs ENVIR_URL = 'https://gsavalik.envir.ee/geoserver/wfs' GEOPORTAAL_KY_URL = 'https://geoportaal.maaamet.ee/url/xgis-ky.php' GEOPORTAAL_XYZ_URL = "https://geoportaal.maaamet.ee/url/xgis-xyz.php" GAZETTEER_URL = "https://inaadress.maaamet.ee/inaadress/gazetteer" X_GIS_URL...
""" 836. Rectangle Overlap Easy An axis-aligned rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) is the coordinate of its bottom-left corner, and (x2, y2) is the coordinate of its top-right corner. Its top and bottom edges are parallel to the X-axis, and its left and right edges are parallel to the...
# script that contains some path definitions path = '../' input_path = path + 'input_files/' output_path = path + 'output_files/' plot_path = path + 'plots/' rand_path = path + 'QBCHL_random_graphs/' rand_prefix = 'HQBCL_rand_network_'
#!/usr/bin/python # list_comprehension2.py lang = "Python" a = [] for e in lang: a.append(ord(e)) b = [ord(e) for e in lang] print (a) print (b)
''' Created on Sep 2, 2010 @author: Wilder Rodrigues (wilder.rodrigues@ekholabs.nl) '''
COINS = [25, 21, 10, 5, 1] def min_coins_dp(coin_values, change, min_coins): for cents in range(change + 1): coin_count = cents potential_coins_to_use = [coin for coin in coin_values if coin <= cents] for potential_coin in potential_coins_to_use: balance = cents - potential_c...
miTupla = ("Pablo", 35, "Jole", 33) print(miTupla[:]) print("Cambio la tupla a lista") miLista = list(miTupla) print(miLista[:]) print("Lo vuelvo a pasar a tupla") miTupla2 = tuple(miLista) print(miTupla2[:]) print("Cuento los elementos en la tupla") print(miTupla2.count("Jole")) print("Pido el tota...
""" 656. Multiply Strings The length of both num1 and num2 is < 110. Both num1 and num2 contains only digits 0-9. Both num1 and num2 does not contain any leading zero. You must not use any built-in BigInteger library or convert the inputs to integer directly. """ class Solution: """ @param num1: a non-negativ...
# Ganze Zahlen -> Integer (int) a = 10 # Fließkommazahlen -> Float (float) b = 4.5 # Zeichenketten -> String (str) c = "Hallo mein Name ist Hase" d = "und ich weiß von nichts." # Boolean -> Bool (bool) e = True f = False # Liste -> List (list) liste = ["Hallo", # 0 "Welt", # 1 2021, # 2...
###############lecture 1-1###################### # hello world.py print("*"*10,"Hellow world","*"*10,"\n") print("Hello World") print("*"*10,"Hellow world","*"*10,"\n") # test.py print("*"*10,"test 1","*"*10,"\n") x = 1 print(x) x = x+1 print(x) print("*"*10,"test 1","*"*10,"\n") # for문 print("*"*10,"test 2","*...
def isPerfect( n ): # To store sum of divisors sum = 1 # Find all divisors and add them i = 2 while i * i <= n: if n % i == 0: sum = sum + i + n/i i += 1 # If sum of divisors is equal to # n, then n is a perfect number return (True if s...
""" Make a program that asks for 2 whole numbers and a float number. Calculate and show. - The product of double the first with half the second - The sum of the first and third types - The third cubed """ num1 = int(input ('Digite um numero inteiro: -> ')) num2 = int(input ('Digite outro numéro inteiro: -> ')) num3 = f...
class Solution: def maxProduct(self, nums: List[int]) -> int: ans=cmin=cmax=nums[0] for i in nums[1:]: cmin,cmax = min(i,cmin*i,cmax*i),max(i,cmin*i,cmax*i) if cmax>ans: ans = cmax return ans...
# # PySNMP MIB module TY1250I-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TY1250I-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:20:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
# Exercício 5.13 - Escreva um programa que pergunte o valor inicial de uma dívida e # o juro mensal. Pergunte também o valor mensal que será pago. Imprima o número # de meses para que a dívida seja paga, o total pago e o total de juros pago. divida = float(input('\nInforme o valor da dívida: R$')) juros = float(input(...
#!/usr/bin/env python """ Memory Loss github.com/irlrobot/memory_loss """ QUESTIONS = [ { "question": "Remember these words, Epic, Bird, Taco, Sphere. "\ "Was the second word, bird?", "answer": "yes" }, # { # "question": "Remember these words, Map, Computer, Fish, ...
# list > list def op(x): return x * x # [1, 2, 3] > [1, 4, 9] # [1, 2, 3] > [op(1), op(2), op(3)] > [1, 4, 9] numbers = [1, 2, 3] squared = map(op, numbers) squared_lc = [op(x) for x in numbers] print(numbers) print(squared) """ a_list = [1,3,4,5,"aa"] def op(x): return "***{}***".format(x) adjust = m...
""" LeetCode Problem: 7. Reverse Integer Link: https://leetcode.com/problems/reverse-integer/ Language: Python Written by: Mostofa Adib Shakib Time Complexity: O(N) Space Complexity: O(N) """ class Solution: def reverse(self, x: int) -> int: if -9 <= x <= 9: return x ans = 0 ...
""" Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1. Example: Input: [1,2,3] Output: 3 Explanation: Only three moves are needed (remember each move increments two elements): [1,2,3] => [2,3,3]...
# 1417. Reformat The String - LeetCode # https://leetcode.com/problems/reformat-the-string/ class Solution: def reformat(self, s: str) -> str: ret = "" alphabets = [] numbers = [] for c in s: if c.isdigit(): numbers.append(c) if c.isa...
def decorator_type(Cls): class NewCls(object): def __init__(self, *args, **kwargs): self.oInstance = Cls(*args, **kwargs) def __getattribute__(self, s): try: x = super(NewCls, self).__getattribute__(s) except AttributeError: print(...
print("INFORMACION: ","si es Ejecutivo:0","Jefe:1","Externo:2") cargo=int(input("ingrese el cargo del trabajador")) if cargo==0: sueldo=90 elif cargo==1: sueldo=100 else: sueldo=50 print("Su sueldo es: ",sueldo)