content
stringlengths
7
1.05M
# # PySNMP MIB module ISIS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ISIS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:02:34 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, 09:23:1...
#065_Maior_e_menor_valores.py j = soma = maior = menor = 0 resp = 'S' while (resp == "S"): n = int(input("Entre com o número: ")) soma += n j += 1 if j == 1: maior = menor = n else: if n > maior: maior = n if n < menor: menor = n resp = str(input...
""" the first index is the power of ten and the second index is the digit between 0 and 8 """ BaseElements = ( #milliers ( ( (100, 350, 200, 350) ), ( (100, 250, 200, 250) ), ( (100, 250, 200, 350) ), ...
class State: POMODORO = 'pomodoro' SHORT_BREAK = 'short break' LONG_BREAK = 'long break' COUNTDOWN = 'countdown' class AlertPath: POMO_START = '/app/bot/sounds/pomo_start.mp3' POMO_END = '/app/bot/sounds/pomo_end.mp3' LONG_BREAK_START = '/app/bot/sounds/long_break.mp3'
#!/usr/bin/env python # -*- coding: utf-8 -*- symbol_to_currency = { '₪': 'ILS', '฿': 'THB', 'kr': 'SEK', '€': 'EUR', 'zł': 'PLN', 'руб': 'RUB', 'Rp': 'IDR', '$': 'USD', '¥': 'CNY', '₩': 'KRW', 'lei': 'RON', 'Php': 'PHP', '£': 'GBP', 'Ft': 'HUF', 'R': 'ZAR', ...
class ExcelProcessor: def __init__(self, xlsfilepath) -> None: super().__init__() self.xlsfilepath = xlsfilepath def bound(self)->tuple: pass def readCellValue(self, row, col): pass def writeCellValue(self, row, col, val): pass def insertRowBefore(self, ro...
def _dump_llvm(f, output_func): d = f.inspect_llvm() if isinstance(d, dict): for ty, code in d.items(): output_func("\n===== {}\n{}".format(ty, code)) else: output_func("\n" + d) def dump_numba_llvm(func): out = print module = __import__(func.__module__) if hasattr(...
class Individual: def __init__(self): self.dna = [] self.fit_value = 0
class CFNType(object): def __init__(self, parameter_type): """Represents a CloudFormation Parameter Type. :class`CFNType`` can be used as the `type` for a Blueprint variable. Unlike other variables, a variable with `type` :class:`CFNType`, will be submitted to CloudFormation as a...
#W.A.P TO FIND THE SUM OF DIGITS OF A NUMBER x=int(input('Enter a no.')) sum=0 t=x while(t!=0): sum=sum+int(t%10) t=t/10 print('Sum of digits of',int(x),'is:',sum)
while True: try: rooms = int(input("\nHow many rooms total? ")) break except: print("Only integers are accepted for total rooms.") inches = 0 for i in range(rooms): length = 0 while True: try: length = int(input("\nLength of room " + str(i+1) + " in inches? "...
########################################################### # Populate the following variables with your desired values. # When done editing this file, rename it to _settings.py and leave it in the same directory. ### local directory to save data. # This is relevant to the decorator called _backupDFs in ReadWrite. ...
class RequestParameter: name: str value: str def __init__(self, name: str, value: str): self.name = name self.value = value
# -*- coding: utf-8 -*- type_table = { -2: 'Undefined device type.', -1: 'All devices type.', 0: 'Regulator type.', 1: 'Transformer type.', 2: 'Breaker type.', 3: 'LVCB type.', 4: 'Recloser type.', 5: 'Sectionalizer type.', 6: 'Switch type.', 7: 'Fuse type.', 8: 'Series Capacitor type.', 9: 'Seri...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def insertNode(root, data): if root == None: root = Node(data) else: if root.data > data: root.left = insertNode(root.left, data) elif root.data < data: ...
# Python program to demonstrate creation of list # creating a list List = [] print(List) # creating a list of strings List = ['GeeksForGeeks', 'Geeks'] print(List) # Creating a Multi-Dimensional List List = [['Geeks', 'For'], ['Geeks']] print(List) # adding element to a list List = [] # using append...
K280 = 0x1c K281 = 0x3c K282 = 0x5c K283 = 0x7c K284 = 0x9c K285 = 0xbc K286 = 0xdc K287 = 0xfc K237 = 0xf7 K277 = 0xfb K297 = 0xfd K307 = 0xfe K_K = K285 K_R = K280 K_A = K283 SOF = K281 EOF = K287 EIGTHS = {} EIGTHS[0x1c] = 'K280' EIGTHS[0x3c] = 'K281' EIGTHS[0x5c] = 'K282' EIGTHS[0x7c] = 'K283' E...
n = int(input('Enter a range : ')) t1, t2 = 0,1 count = 0 for i in range(count, n, 1): print(t1, end = ' ') t3 = t1+t2 t1 = t2 t2 = t3 print()
def convert_to_closest_value_divisible_by_5(num): """ :param num: input :return: either ?5 or ?0 for two-digit number """ last_digit = int(num % 10) base = num - last_digit if last_digit >= 5: base += 5 return base def find_factorial_zeros(num): count = 0 base = conve...
#Base or parent class class Employee(): def __init__(self, name, age, level, salary): self.name = name self.age = age self.level = level self.salary = salary def work(self): print(f"{self.name} is working..........") #child class that will inherit the attributes and met...
def column_to_dict(data_list, index): """Transforma uma coluna da lista de linhas em um dictionary, onde a key é o valor encontrado e o value é o num de ocorrencias. INPUT: data: list de linhas que serão filtradas pela coluna index, ex: { 'foo1', 'bar1', 'foo11' ,'bar11'} { 'foo2', 'bar2', 'foo2...
class Padlock(object): def __init_(self, combination): self.combination = combination self.isOpen = False def open(self, combination_entered): if self.isOpen: print("The lock is alread open") else: if self.combination != combination_entered: ...
t = int(input()) def sumdig(arr, s): sum = 0 for a in arr: sum+=int(a) if(sum<=s): return True else: return False answer = [] for a in range(t): line = input().split() n = int(line[0]) copn = n s = int(line[1]) copx = list(str(n)) if(sumdig(copx,s)): ...
# 1. Accepts Nothing | Returns None def greet(): print("Hello Python") # 2. Accepts data | Returns None def greet_v2(name: str): print(f"Hello {name}") # 3. Accepts Nothing | Returns Value def greet_v3() -> str: return "Hello Python (V3)" # 4. Accepts data | Returns Value def greet_v4(name: str) -> str:...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Computational graph definition. ''' class Graph(object): ''' Graph containing all computing nodes. ''' def __init__(self): ''' Graph constructor. ''' self.operations, self.constants, self.placeholders = [], [], [] self.variab...
#!/usr/bin/python3 """We have system to system conversion (metric <-> U.S. System)""" def catch_given_input(): print(f'\n\033[1m**Enter your desired conversion...\033[0m\n') from_qty = input(f'\033[1;33m - From:\033[0m ') to_qty = input(f'\033[1;32m - To:\033[0m ') return from_qty, to_qty def del...
N = int(input())#Número de elementos na lista A A = [] Ai = [] #A invertido B = [] f = 1 for i in range(N): A.append(int(input())) for j in range (len(A)): Ai = [A[j]] + Ai for K in range (len(Ai)): H = Ai[K] if H>=0 : for M in range (1,H+1,1): f = f*M Ai[K] ...
# Function for checking the divisibility # Notice the indentation after function declaration # and if and else statements def checkDivisibility(a, b): if a % b == 0 : print ("a is divisible by b") else: print ("a is not divisible by b") #Driver program to test the above function checkDivisibilit...
OPEN = { '{': '}', '[': ']', '(': ')', '<': '>', } CLOSED = {v: k for k, v in OPEN.items()} def check_balanced(s): """Check for balanced parentheses, braces and brackets.""" stack = [] for i, c in enumerate(s): if c in OPEN: stack.append((i, c)) elif c in CLOSED...
class Tri(object): p1 = PVector(0,0) p2 = PVector(0,0) p3 = PVector(0,0) w = 10 h = 10 def __init__(self, _p1, _p2, _p3): #constructor self.p1 = _p1 self.p2 = _p2 self.p3 = _p3 def display_lines(self, col): # method of class display fill(col,1...
class AbstractEnv: def reset(self): raise NotImplementedError() def step(self): raise NotImplementedError() def setup_test(self): raise NotImplementedError()
# -*- coding:utf-8 -*- # Create by 27 # @Time : 2020/2/21 22:35 __author__ = '27' def is_isbn_or_key(word): ''' 判断word是isbn还是普通关键字 :param word: 客户端传参 :return: string, isbn13 13个0-9的数字组成 isbn10 10个0-9的数字,还有一些" - "组成 现在的新书一般都是isbn13 ''' isbn_or_key = 'key' if len(word) == 13 and wo...
a = int(input('Digite o primeiro valor: ')) b = int(input('Digite o segundo valor: ')) resto_a = a % 2 resto_b = b % 2 if resto_a == 0 and resto_b == 0: print('Os valores são pares') elif resto_a == 0 or resto_b == 0: print('Pelo menos um valor é par.') elif not resto_a == 0 or not resto_b == 0: print('Ne...
num = int(input()) for i in range(num): person = int(input()) hshake = person*(person - 1)//2 print(hshake)
class Solution: def longestDupSubstring(self, S: str) -> str: nums = [ord(S[i])-ord('a') for i in range(len(S))] left, right = 1, len(S)-1 while left<=right: mid = left+(right-left)//2 if self.helper(mid, nums)!=-1: left = mid + 1 else: ...
class IProvider(object): def normalizedAlias(self, metaStr, aliasStr): raise NotImplementedError("Subclass must implement this method!") def aggr(self): raise NotImplementedError("Subclass must implement this method!")
# -*- coding: utf-8 -*- ''' File name: code\number_of_lattice_points_in_a_hyperball\sol_596.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #596 :: Number of lattice points in a hyperball # # For more information see: # https://projecteul...
'''Exercício Python 081: Crie um programa que vai ler vários números e colocar em uma lista. Depois disso, mostre: A) Quantos números foram digitados. B) A lista de valores, ordenada de forma decrescente. C) Se o valor 5 foi digitado e está ou não na lista.''' numeros = [] while True: numeros.append(int(in...
opt_xgb = "xgb" opt_cut_negatives = "cut_negatives" opt_validation_size_negatives = "validation_size" opt_validation_size_positives = "validation_size_gt" opt_predict_test = "predict_test" opt_num_boost_round = "num_boost_round" opt_early_stopping_rounds = "early_stopping_rounds" opt_verbose_eval = "verbose_eval" opt_p...
#!/usr/bin/env python3 # Get the input file with open('input', 'r') as input_file: input_list = [line.strip() for line in input_file.readlines()] answer_p1 = 0 answer_p2 = 0 # Pre-process our input answers_list = [] curr_line = "" for line in input_list: # If we have a empty line, then the info about this answer i...
""" Module containing submodules and/or scripts covering downloading, generation, processing or cleaning of data. Author ------ Tom Fleet License ------- MIT """
# 创建列表 numbers = [1,2,3,4,5,6,7,8,9] # 遍历列表 for number in numbers: if number == 1: print(str(number) + "st") elif number == 2: print(str(number) + "nd") elif number == 3: print(str(number) + "rd") else: print(str(number) + "th")
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: dt=Counter(nums) op=[] for i in nums: dt[i]-=1 tp=1 if dt[i]==0: del dt[i] for t in dt.keys(): tp*=t**dt[t] op.append(tp) ...
# Write a short Python function, is_even(k), that takes an integer value and returns True if k is even, and False otherwise. However, your function cannot use modulo, multiplication, or division operators def is_even(k): temp = str(k)[-1] return temp == '0' or temp == '2' or temp == '4' or temp == '6' or temp ...
# key: value dict1 = {x: x**2 for x in range(10)} print(dict1) # nur gerade dict2 = {x: x**2 for x in range(10) if x % 2 == 0} print(dict2) # wenn > 5 quadrieren ansonsten hoch 1/2 dict3 = {x: x**2 if x > 5 else x**(1/2) for x in range(10) if x % 2 == 0} print(dict3) friends = ['hans', 'peter', 'max'] friend_keys = ...
# Exercício 096 - Função que Calcula Área def main(): print('Controle de Terrenos') print(20 * '-') l = float(input('Largura (m): ')) c = float(input('Comprimento (m): ')) print(f'A área de um terreno {l:.1f}x{c:.1f} é de {area(l, c):.1f}m².') def area(a, b): return a * b # ---------------...
def hail_friend(name): print("Hail, " + name + "!") def add_numbers(num1, num2): return num1+num2
class Employee: 'Common base class for all employees' emp_count = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.emp_count += 1 def display_count(self): print("Total Employee %d" % Employee.emp_count) def display_employee(self): print...
m_start = 'Hello! \nYou are in an anonymous dating chat! \n' \ 'Press the button below to start chatting with the patner. '\ 'If you want to get to know a person better - press the like button and with mutual sympathy ' \ 'you will be able to find out the nickname of the par...
''' File: __init__.py Project: metrics File Created: Monday, 17th August 2020 3:14:39 pm Author: Sparsh Dutta (sparsh.dtt@gmail.com) ----- Last Modified: Monday, 17th August 2020 3:14:39 pm Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>) ----- Copyright 2020 Sparsh Dutta '''
"""A class with an instance variable.""" class MyClass(object): def __init__(myself, value): #print(value) myself.instance_var = value myself.var2 = 2 def print_me(myself): myself.var3 = 1234 print(myself.instance_var) def add(self, x): print(x+2) def ...
x = 10 y = 20 z = x+y print('z is: %s' % z)
#frase = input('Digite uma frase:') #frase1 = frase.replace('a','A') #frase1 = frase1.count('A') #print(f'A letra A aparece {frase1} vezes') #frase1 = frase.find('A') #frase = frase.find('a'[0:]) #print(f'A primeira letra A apareceu na posição {frase1+1} ') #print(f'A ultima letra A apareceu na posição {frase}') #print...
# Crie um algorítmo que leia um número e mostre o seu dobro, triplo e raiz quadrada. n = float(input('digite um número inteiro: ')) print(f'Seu dobro é: {n*2}\n' f'Seu triplo é: {n*3}\n' f'Sua raiz quadrada é: {n**(1/2)}')
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def verticalTraversal(self, root: Optional[TreeNode]) -> List[List[int]]: # method for preorder tra...
### SET x = {1,2,3} x.add(4) print(x) x.remove(2) print(x) x.discard(100) print(x) x= {1,2,4} y ={"Three",4} print(x.intersection(y)) x.update(y) print(x) x = set('aAbcd') y =set('Ax') print(x-y) print(x|y) print(x&y) print(x^y) # Practice any other methods from SET
class TwoSum(object): def __init__(self): """ initialize your data structure here """ self.internal = [] self.dic = {} def add(self, number): """ Add the number to an internal data structure. :rtype: nothing """ self.internal.appe...
# d - cijeli broj # f - realni broj # s - string #primjer formatiranog ispisa a=3.12345 print('{0:f},{1:0.1f}'.format(a, a))
x = 1 y = 2 print("x is {}".format(x)) print("y is {}".format(y)) print("swapping... ") (x, y) = (y, x) # a, b, c = foo() returning multiple print('swapped.') print("x is {}".format(x)) print("y is {}".format(y))
# -*- coding: utf-8 -*- """ Created on Wed Mar 13 11:30:05 2019 @author: Jongmin Sung custom_funcs.py In projectname/projectname/custom_funcs.py, we can put in custom code that gets used across more than notebook. One example would be downstream data preprocessing that is only necessary for a subset of not...
# Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre quantos dólares ela pode comprar. # considere US$1,00 = R$5,58 real = float(input('Quando dinheiro você tem na carteira? ')) dolar = real / 5.58 print('Com R${:.2f} você pode comprar US${:.2f}'.format(real, dolar))
# The goal is sum the digits. valor = int(input('Enter a whole number: ')) sum = 0 while valor > 0: rest = valor % 10 valor = (valor - rest) / 10 sum += rest print(int(sum))
def add(filename, siglas, carrera): with open(filename, 'a') as f_obj: f_obj.write(f'\n{siglas} {carrera}') def sacacarrera(linea): siglas = '' carrera = '' counter = 0 for c in linea: if c == ' ': counter=1 if counter != 1: siglas+=c if count...
NODE, EDGE, ATTR = range(3) class Node: def __init__(self, name, attrs): self.name = name self.attrs = attrs def __eq__(self, other): return self.name == other.name and self.attrs == other.attrs class Edge: def __init__(self, src, dst, attrs): self.src = src self...
prov_cap = { "Hebei": "Shijiazhuang", "Shanxi": "Taiyuan", "Liaoning": "Shenyang", "Jilin": "Changchun", "Heilongjiang": "Harbin", "Jiangsu": "Nanjing", "Zhejiang": "Hangzhou", "Anhui": "Hefei", "Fujian": "Fuzhou", "Jiangxi": "Nanchang", "Shandong": "Jinan", "Henan": "Zhe...
''' 面试题55 - II. 平衡二叉树 输入一棵二叉树的根节点,判断该树是不是平衡二叉树。如果某二叉树中任意节点的左右子树的深度相差不超过1,那么它就是一棵平衡二叉树。 示例 1: 给定二叉树 [3,9,20,null,null,15,7] 3 / \ 9 20 / \ 15 7 返回 true 。 示例 2: 给定二叉树 [1,2,2,3,3,null,null,4,4] 1 / \ 2 2 / \ 3 3 / \ 4 4 返回 false 。 限制: 1 <= 树的结点个数 <= 10000 ''' # Defini...
# Get the aggregated number of a specific POI category per H3 index at a given resolution def get_pois_by_category_in_polygon( dbt_controller, category, resolution, polygon_coords ): return dbt_controller.run_macro( macro_category="poi", macro_name="get_pois_in_polygon", args="{" + f"h3_...
__all__ = [ "sis_vs_smc", "ekf_vs_ukf", "ekf_vs_ukf_mlp", "eekf_logistic_regression", "ekf_mlp_anim", "linreg_kf", "kf_parallel", "kf_continuous_circle", "kf_spiral", "kf_tracking", "bootstrap_filter", "pendulum_1d", "ekf_continuous" ]
''' representations qumis/qasm input: script ordered list: arrays containing the 1Q and the 2Q steps rotation list: arrays, but instead of strings, su2 operations on the same mw step are packed into one euler list: arrays, but instead of su2 rotations, we already have their szxz representation compiled list: z gates ar...
n=int(input())*300 n1=int(input())*1500 n2=int(input())*600 n3=int(input())*1000 n4=int(input())*150 resp=(n+n1+n2+n3+n4)+225 print(resp)
myinput=list(input("Enter a String : " )) word = "" for x in myinput: if (myinput.index(x) % 2 == 0): word += x print(word)
class BindingsCollection(BaseCollection,ICollection,IEnumerable): """ Represents a collection of System.Windows.Forms.Binding objects for a control. """ def Add(self,*args): """ Add(self: BindingsCollection,binding: Binding) Adds the specified binding to the collection. binding: The System.W...
def alphabet_position(text): alphabet = {} chars = [chr(x) for x in range(97, 123)] for i in range(len(chars)): alphabet[chars[i]] = str(i+1) return ' '.join([alphabet[x] for x in text.lower() if x in alphabet])
""" T="/Users/james/cache/hg18/align/multiz28way/chr10.maf" def test(): s = os.stat( T ).st_size real_f = open( T ) f = filecache.FileCache( real_f, s ) for i in range( 1000 ): f.readline() def test_random_seeking(): s = os.stat( T ).st_size raw = open( T ) f = filecache.FileCache...
class HypothesisSpace: def __init__(self, *params, **kw_params): self.hypotheses = self.create_hypothesis_space(*params, **kw_params) def __len__(self): return len(self.hypotheses) def __iter__(self): return self.hypotheses.__iter__() def create_hypothesis_space(self, *params...
load("@rules_jvm_external//:defs.bzl", "maven_install") load("@rules_jvm_external//:specs.bzl", "maven") def selenium_java_deps(): netty_version = "4.1.63.Final" opentelemetry_version = "1.2.0" maven_install( artifacts = [ "com.beust:jcommander:1.81", "com.github.javaparser...
### Noisy DQN Pong_ML-Agents Config ### env = {"name": "pong_mlagent", "train_mode": True} agent = { "name": "noisy", "network": "noisy", "gamma": 0.99, "explore_ratio": 0.1, "buffer_size": 50000, "batch_size": 32, "start_train_step": 25000, "target_update_period": 1000, # noisy ...
class Solution: def preorderTraversal(self, root: TreeNode) -> List[int]: res = [] self.traverse(root, res) return res def traverse(self, root, res) : if not root: return res.append(root.val) self.traverse(root.left, res) self.traverse(roo...
CELERY_BROKER_URL_DOCKER = 'amqp://admin:mypass@rabbit:5672/' CELERY_BROKER_URL_LOCAL = 'amqp://localhost/' CM_REGISTER_Q = 'rpc_queue_CM_register' CM_NAME = 'CM - Heat load profiles' RPC_CM_ALIVE= 'rpc_queue_CM_ALIVE' RPC_Q = 'rpc_queue_CM_compute' # Do no change this value CM_ID = 9 PORT_LOCAL = int('500' + str(C...
class Box: def __init__(self, length, width, height): self.length = length self.width = width self.height = height def pack(self, something): print(f"pack {something}")
# This is a python script for adding package information # To modify syntax rule, you must: # 1. modify JavaParser.g4 # 2. Execute `antlr4 JavaParser.g4` # 3. Run this script # import os # os.chdir('./src/main/java/mastery.translator/java') # import subprocess # subprocess.run(['antlr4', 'JavaParser.g4'], stdout=subp...
''' Description: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths...
# Dua buah data yang tersimpan dalam tipe list data1 = [70, 70, 70, 100, 100, 100, 120, 120, 150, 150] data2 = [50, 60, 60, 50, 70, 70, 100, 80, 100, 90] # Definisikan fungsi hitng_rata_rata def hitung_rata_rata(data): jumlah = 0 for item in data: jumlah += item rata_rata = jumlah/len(data) retu...
''' Faça um programa que leia 5 números e informe o maior número. ''' print ('**' * 18) print ('**** Bem Vindo ao Meu Programa ****') n_1 = float(input('Digite um número: ')) n_2 = float(input('Digite um número: ')) n_3 = float(input('Digite um número: ')) n_4 = float(input('Digite um número: ')) n_5 = float(...
GITHUB_OAUTH_CLIENT_ID = "XXXXX" GITHUB_OAUTH_CLIENT_SECRET = "XXXXX" GITHUB_TOKEN = "XXXXX" DISQUS_TOKEN = "XXXXX" SECRET_KEY = "XXXXX"
# HARD # build 2 stacks store successor and predecssor with O(H) time # merge 2 stack with O(K) time # Time: O(H) class Solution: def closestKValues(self, root: TreeNode, target: float, k: int) -> List[int]: def initSucc(root,tar): large = [] while root: if root.v...
def ex_situ_hardxray(t=1): # samples = ['PLA2','PLA1','CON6','CON5', 'CON4','CON3','CON2','CON1', # '05_Ca_1', '05_Ca_2', '05_UT_1', '05_UT_2', 'PLA6','PLA4','PLA3', # ] # samples = ['B5_1','B5_2','B5_3', 'B6_1','B6_2','B6_3','B7_1','B7_2','B7_3','B12_1','B12_2','B12_3'] # x_list = [45550, 41200, ...
class Sources: ''' source class that defines the news source ''' def __init__(self,id,name,description,url,category,language,country): self.id=id self.name=name self.description=description self.url=url self.category=category self.language=l...
class Solution: def smallestRangeII(self, A, K): """ :type A: List[int] :type K: int :rtype: int """ # + 0 or 2 * K # to which index: add 2 * K A.sort() res = A[-1] - A[0] for i in range(0, len(A) - 1): mn = min(A[0] + 2 * K...
# # @lc app=leetcode id=918 lang=python3 # # [918] Maximum Sum Circular Subarray # # @lc code=start class Solution: def maxSubarraySumCircular(self, A: List[int]) -> int: def ka(nums): res = float('-inf') current = float('-inf') for num in nums: current =...
def configure(configuration_context): third_party_node = configuration_context.path.make_node('bugengine/3rdparty') for category in third_party_node.listdir(): if category[0] != '.': category_node = third_party_node.make_node(category) for third_party in category_node.listdir(): ...
# Copyright 2021 Code Intelligence GmbH # # 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 ...
ano = int(input('Digite um ano: ')) print() if ano % 4 == 0 and (ano % 400 == 0 or ano % 100 != 0): print('O ano {} é bissexto.'.format(ano)) else: print('O ano {} não é bissexto.'.format(ano))
_base_ = '/home/jj/Documents/mmdetection/configs/_base_/models/faster_rcnn_r50_fpn.py' # model settings model = dict( neck=[ dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), dict( type='BFP', ...
def print1ToN(n): if n<=1: print("1",end =" ") return 0 print1ToN(n-1) print(n,end = " ") def printNto1(n): if n<=1: print("1",end =" ") return 0 print(n,end = " ") printNto1(n-1) n = int(input("Enter Input : ")) print1ToN(n) printNto1(n)
users = [ { 'id': 0, 'photo': 'img0.jpg', 'firstname':'calvin', 'lastname':'settachatgul', 'nickname':'cal', 'email': 'calvin.settachatgul@gmail.com', 'aboutme': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In condimentum neque a enim bibendum tempus. Proin condimentum, nisi s...
# # PySNMP MIB module FDDI-SMT73-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FDDI-SMT73-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:53:32 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...
#!/usr/bin/python """ This module contains helper functions to parser Multi2Sim trace """ def parser(keyword, line): """ Main parser function """ try: for item in line.split(' '): if keyword in item: return item.split('=')[1] except IndexError: return "[ERR] par...
class ODLIRD(): def load_odl_ird(self, odl_ird): self.content = odl_ird return self def rfc_ird(self): return { 'meta': self.to_rfc_meta(self.content['meta']), 'resources': self.to_rfc_resources(self.content['resources']) } def to_rfc_meta(self, odl_...
N, A, B, C = map(int, input().split()) l_list = [int(input()) for _ in range(N)] inf = float("inf") def dfs(cur, a, b, c): if cur == N: return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else inf ans0 = dfs(cur + 1, a, b, c) ans1 = dfs(cur + 1, a + l_list[cur], b, c) + 10 an...