content
stringlengths
7
1.05M
n = int(input()) arr = [int(x) for x in input().split()] counter = [0]*1001 for i in range(n): counter[arr[i]] += 1 counts = [] for i in range(1001): if counter[i] > 0: counts.append((counter[i],i)) counts.sort(key=lambda x: (-x[0], x[1])) q = [] for freq,i in counts: q.extend([i]*freq) j = 0 o...
"""Ex015 Escreva um programa que pergunte a quantidade de km percorridos por um carro alugado e a quantidade de dias pelos quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro custa R$60 por dia e R$0.15 por km rodado.""" km = int(input('Qual a distância percorrida? (km)')) dia = int(input('Quantos dias...
def testIter(encoder, decoder, sentence, word2ix, ix2word, max_length=20): input_variable = sentence input_length = input_variable.size()[0] encoder_hidden = encoder.initHidden() encoder_outputs = Variable(torch.zeros(max_length, encoder.hidden_size)) if use_cuda: encoder_outputs = encoder_outputs.cuda() for ...
""" Faça um Programa que leia um vetor de 10 caracteres, e diga quantas consoantes foram lidas. Imprima as consoantes. """ caracteres = [ "f", "k", "i", "b", "i", "f", "j", "e", "a", "z" ] quant_consoantes = 0 lista_consoantes = caracteres.copy() for char in caracteres: if char != "a" and char != "e" and char != "i...
# -*- coding: utf-8 -*- # Part of BrowseInfo. See LICENSE file for full copyright and licensing details. { "name" : "Hospital Management in Odoo/OpenERP", "version" : "12.0.0.3", "summary": "Hospital Management", "category": "Industries", "description": """ BrowseInfo developed a new odoo/OpenERP m...
#!/usr/bin/python ''' From careercup.com Write a pattern matching function using wild char ? Matches any char exactly one instance * Matches one or more instances of previous char Ex text = "abcd" pattern = "ab?d" True Ex text = "abccdddef" pattern = "ab?*f" True Ex text = "abccd" pattern = "ab?*ccd" false (a...
# -*- coding: utf-8 -*- """ lytics ~~~~~~ Main file for lytics app. Usage: python lyrics.py :copyright: (c) 2016 by Patrick Spencer. :license: Apache 2.0, see LICENSE for more details. """
frase = str(input('Digite uma frase:\n->')).strip() separado = frase.split() junto = ''.join(separado) correto = list(junto.upper()) invertido = list(reversed(junto.upper())) print(correto) print(invertido) if correto == invertido: print('verdadeiro') else: print('falso')
# Copied from https://rosettacode.org/wiki/Trabb_Pardo%E2%80%93Knuth_algorithm#Python def f(x): return abs(x) ** 0.5 + 5 * x**3 def ask(): return [float(y) for y in input('\n11 numbers: ').strip().split()[:11]] if __name__ == '__main__': s = ask() s.reverse() for x in s: resu...
def toBaseTen(n, base): ''' This function takes arguments: number that you want to convert and its base It will return an int in base 10 Examples: .................. >>> toBaseTen(2112, 3) 68 .................. >>> toBaseTen('AB12', 12) 61904 .................. >>> toBaseTen('AB12', 16) 111828 ..............
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ buying_price = prices[0] max_profit = 0 for i in range(1, len(prices)): profit = prices[i] - buying_price if max_profit < profit: ...
vc = float(input('Qual o valor da casa: R$')) s = float(input('Qual o seu salario')) a = int(input('Em quantos anos voce quer pagar :')) m = a * 12 p = vc/m if s*(30/100) >= p : print ('O emprestimo sera feito em {} anos com prestacoes mensais de R${:.2f} e foi aprovado '.format(a,p)) else: print(' Emprestimo ...
""" Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than or equal to the node's key. The right subtree of a node contains only nodes with ke...
grid = [ [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0], ] goal = [len(grid) - 1, len(grid[0]) - 1] cost = 1 # the cost associated with moving from a cell to an adjacent one delta = [ [-1, 0], # go up [0, -1], # go left [1, 0], # g...
## Read input as specified in the question. ## Print output as specified in the question. # Pattern 1-212-32123... # Reading number of rows row = int(input()) # Generating pattern for i in range(1,row+1): # for space for j in range(1, row+1-i): print(' ', end='') # for decreasing pattern...
# This file implements some custom exceptions that can # be used by all bots. # We avoid adding these exceptions to lib.py, because the # current architecture works by lib.py importing bots, not # the other way around. class ConfigValidationError(Exception): """ Raise if the config data passed to a bot's vali...
#!/usr/bin/env python # -*- coding: utf-8 -*- def run(): print("run") main() return None def aaa(): print("aaa") return None def main():# print ("Hello, test is running") if __name__ == '__main__': main()
class GradientBoostingMachine(): def __init__(self, nEstimators = 100): self.nEstimators = nEstimators if __name__ == '__main__': gbm = GradientBoostingMachine(nEstimators=10)
def exp_sum(n): p = n # calculation taken from here # https://math.stackexchange.com/questions/2675382/calculating-integer-partitions def pentagonal_number(k): return int(k * (3 * k - 1) / 2) def compute_partitions(goal): partitions = [1] for n in range(1, goal + 1): ...
# Copyright 2018 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
def encode_for_get_list(src_data, thats_all_flag, default_keys, items_fetcher, item_handler): if not isinstance(src_data, dict): src_data = {"*": None} result = {} unknown_flag = False for name, value in src_data.items(): if name == "*": for name2 in items_fetcher(): ...
#!/usr/bin/python def generateSet(name, value, type, indentationLevel): finalLine = " "*indentationLevel finalLine += name finalLine += " = " if type == 'string': # Whatever you use for defining strings (either single, double, etc.) finalLine += '"' + value + '"' else: f...
'''variabile''' """a=8 a+=7 a=24 b=3 b-=2 c=2 d=2 nume = "it factory" a,b,c =1,2,3 print(a+b) print(a/b) print(a//b) print(a%b) print(a) print(b) print(c**d) """ check = False if 8>7: check = True print(check) print(type(check)) nume="ioan vasile anton" print(nume[0]) print(nume[5:11]) print(nume[0:10:2]) print(l...
# # PySNMP MIB module SIP-COMMON-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIP-COMMON-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:04:21 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...
if 3 > 4 or 5 < 10: # true pass if 3 > 4 or 5 > 10: # false pass
""" j is the index to insert when a "new" number are found. For each iteration, nums[:j] is the output result we currently have. So nums[i] should check with nums[j-1] and nums[j-2]. """ class Solution(object): def removeDuplicates(self, nums): j = 2 for i in xrange(2, len(nums)): ...
class Solution: # Runtime: 36 ms # Memory Usage: 16.3 MB def maxDepth(self, root: TreeNode) -> int: if root is None: return 0 return self.search(root, 0) def search(self, node, depth): depth += 1 depth_left = depth depth_right = depth ...
# Write a program that uses a for loop to print the numbers 8, 11, 14, 17, 20, ..., 83, 86, 89. for i in range(8, 90, 3): print(i)
puzzle_input = "359282-820401" pwd_interval = [int(a) for a in puzzle_input.split('-')] pwd_range = range(pwd_interval[0] , pwd_interval[1]+1) # Part 1 def is_valid_pwd(code): str_code = str(code) double = False increase = True for i in range(5): if str_code[i] == str_code[i+1]: do...
# Write a program which accepts a sequence of comma-separated numbers from console # and generate a list and a tuple which contains every number.Given the input: # 34,67,55,33,12,98 # Then, the output should be: # ['34', '67', '55', '33', '12', '98'] # ('34', '67', '55', '33', '12', '98') str = input("Enter list: ") ...
file = open('noTimeForATaxiCab_input.txt', 'r') lines_read = file.readlines() instructions = lines_read[0] steps = instructions.split(", ") x_blocks = 0 y_blocks = 0 # together, is_on_y_axis and is_facing_forward give you the cardinal direction you are facing # North: is_on_y_axis = True, is_facing_forward = True # ...
def factorial(num): fact = 0 if num == 0: return 1 else: fact = num * factorial(num-1) return fact num = 5 print("Factorial of",num,"is:",factorial(num))
# Copyright (C) 2015 UCSC Computational Genomics Lab # # 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 o...
class Role(object): id = None name = None color = None managed = None hoist = None position = None permissions = None def __init__(self, stores, id): self._stores = stores self.id = int(id) def update(self, role_data): self.name = role_data.get('name', self....
class Command: def __init__(self, callback, *args, **kwargs): self.callback = callback self.args = args self.kwargs = kwargs def __call__(self): return apply(self.callback, self.args, self.kwargs)
class Solution(object): def XXX(self, n): """ :type n: int :rtype: str """ dp = {1:'1'} for i in range(2, n+1): if not i in dp: dp[i] = self.say(dp[i-1]) return dp[n] def say(self, numstr): res = '' tmp ...
def main(): s = input() le = len(s) l = list(zip(s, range(le))) l = sorted(l, key = lambda x: (x[0], -x[1]), reverse=True) s = l[0][0] current_index = l[0][1] for i in l[1:]: if i[1]>current_index: s += i[0] current_index = i[1] print(s) if __name__=='__...
""" algoritmos primitivos para a elaboracao de um score para avaliar um dado tabuleiro """ sudoku = [[5, 3, 0, 0, 7, 0, 0, 0, 0], [6, 0, 0, 1, 9, 5, 0, 0, 0], [0 ,9 ,8, 0, 0, 0, 0, 6, 0], [8, 0, 0, 0, 6, 0, 0, 0, 3], [4, 0, 0, 8, 0, 3, 0, 0, 1], [7, 0, 0, 0,...
# # Exam Link: https://www.interviewbit.com/problems/implement-power-function/ # # Question: # # Implement pow(x, n) % d. # # In other words, given x, n and d, # # find (xn % d) # # Note that remainders on division cannot be negative. # In other words, make sure the answer you return is non negative. ...
# Define list = [1, 2, 3] # Insertion val = 4 list.append(val) # Deletion index = 0 del list[index] # Access print(list[index])
print("Enter the no of rows and starting number respectively: ") n, i = map(int, input().split()) b = n for j in range(0, n): for k in range(b, 0, -1): print(i, end=" ") i = i - 1 b = b - 1 print()
#a very useless function def hi(): return "Hello World!"
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def fun1(x,n=2): s = 1 while n > 0: n = n - 1 s = s * x return s def fun2(*numbers): s = 0 for n in numbers: s = s + n * n return s def add_end(L=None): if L is None: L = [] L.append('END') return L def ...
x = 1.10 y = 1.0 z = -35.59 print(type(x)) print(type(y)) print(type(z))
# Arquivo: forca.py (UTF-8) # Descrição: Jogo da forca # Autor: Pinheiro Jr. # Data: 15/06/2020 print('\n*********************************') print('***Bem vindo ao jogo da Forca!***') print('*********************************') palavra_secreta = 'banana' letras_acertadas = ['_','_','_','_','_','_'] acertou = False en...
#The MIT License (MIT) #Copyright (c) 2016 Dan Cinnamon # #Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, ...
BN_MOMENTUM = 0.95 BN_RENORM = False L2_REG = 1.25e-5 DROPOUT = 0.25 ACTIVATION = "relu" KERNEL_INIT = "he_uniform"
class InputItem: def __init__(self, id_list, index_list, data=None, label=None, receipt_time=0): self.query_id_list = id_list self.sample_index_list = index_list self.data = data self.label = label self.receipt_time = receipt_time
class Something: pass # No book version will cause an error.
# -*- coding: UTF-8 -*- class Testlib(object): def __init__(self,a):# 类初始化调用 print("准备就绪······") self.a = a def say(self,str): print("开始写入日志······") # r 读、指针在开始 # r+ 读、写、指针在开始 # w 写、创建、覆盖、指针在开始 # w+ 读、写、创建、覆盖、指针在开始 # a 写、创建、指针在结尾 # a+ 读、写...
# Solo una prueba # problem_type = str(input('Tipo de problema: serv_degr or serv_out ')) #serv_degr or serv_out dmark = str(input('¿equipo de demarcacion? true or false ')) #true or false # Solo una prueba # if problem_type == 'serv_degr': if dmark == 'true': problem_type = 'serv_degr' dmark = 'tr...
# # PySNMP MIB module A3Com-Filter-r5-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-FILTER-R5-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:03:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
# Copyright 2016 PerfKitBenchmarker Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
class Solution(object): def productExceptSelf(self, nums): """ :type nums: List[int] :rtype: List[int] """ res = [] p = 1 for i in range(len(nums)): res.append(p) p *= nums[i] p = 1 for i in range(len(nums) - 1, -1, -1)...
print('+$'* 13) print('\033[1;31m+ Analisador de crédito +\033[m') print('+$'* 13) valor_casa = float(input('\nQual o valor da casa que você quer comprar? R$')) salario = float(input('Qual o valor do seu salário? R$')) anos = int(input('Em quantos anos você quer pagar? ')) meses = anos * 12 parcela = valor_casa / meses...
__all__ = [ 'ALPHABET', 'DIGITS', 'LOWERCASE', 'UPPERCASE', ] DIGITS = '0123456789' ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' LOWERCASE = 'abcdefghijklmnopqrstuvwxyz' UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
BOT_NAME = 'councilman_scraper' SPIDER_MODULES = ['councilman.spiders.spider'] NEWSPIDER_MODULE = 'councilman.spiders' LOG_ENABLED = True ITEM_PIPELINES = { 'councilman.pipelines.CouncilmanPipeline': 300, }
def string_contains(string: str, substr: str) -> bool: """Determines whether substring is part of string or not >>> string_contains("hello", "he") True >>> string_contains("hello", "wo") False """ return substr in string def string_begins_with(string: str, substr: str) -> bool: """Dete...
def finder(data): ## define the finder argument (data) return finder_rec(data, len(data)-1) ## return the answer def finder_rec(data, x): ## define the finder_recursive argument as data and x if x == 0: ## compares if x is equal to 0, then true return data[x] ## return the answer v1 = data[x]...
#coding: utf-8 def merge_sort(array): if len(array) < 2: return; mid = len(array) / 2; left = array[:mid]; right = array[mid:]; leftI = 0; rightI = 0; arrayI = 0; while leftI < len(left) and rightI < len(right): if left[leftI] < right[rightI]: array[arrayI] = left[leftI]; ...
class ClientConfig(object): PUBLIC_KEY = 'coGBxfv6BmRyw3TuucG2Awds5gRlk5fwxiDwAIIQ5v4' APP_NAME = 'frumentarii' COMPANY_NAME = 'JackEaston' HTTP_TIMEOUT = 30 MAX_DOWNLOAD_RETRIES = 3 UPDATE_URLS = ['https://github.com/perseusnova/Frumentarii-Python']
# Tai Sakuma <tai.sakuma@gmail.com> ##__________________________________________________________________|| class ProgressReport(object): """A progress report Args: name (str): the name of the task. if ``taskid`` is ``None``, used to identify the task done (int): the number of the iterations do...
_base_ = [ '../_base_/datasets/waymo_cars_and_peds.py', '../_base_/models/pointnet2_seg.py', '../_base_/schedules/cyclic_20e.py', '../_base_/default_runtime.py' ] # data settings data = dict(samples_per_gpu=16) evaluation = dict(interval=50) # runtime settings checkpoint_config = dict(interval=50) # Point...
# -*- coding: utf-8 -*- ''' Created on 20.12.2012 @author: 802300 ''' c_cycle_dark = (32,88,103) c_cycle = (49,133,155) c_cycle_light = (139,202,218) c_cycle_alt = (146,208,80) c_due = (192,0,0) c_due_later = (255,86,30) c_sub = (255,238,87) c_sub_alt = (255,192,0) c_sub2 = (66,191,89) c_vorlauf = c_sub_alt c_submiss...
with open("program") as file: initialProgram = file.readlines()[0] initialProgram = initialProgram.split(",") def executeProgram(program): pointer = 0 result = 0 while 1: arg1 = program[pointer+1] arg2 = program[pointer+2] if program[pointer] == 1: result = program[...
# Решение с използването на dict comprehension: products = input().split() dict_products = {products[i]: int(products[i+1]) for i in range(0, len(products), 2)} print(dict_products) # Нормално решение с използването на for цикъл # products = input().split() # # dict_products = {} # key_index = 0 # # # for i in range...
####################################### #########Variaveis de mails############ ####################################### ADMIN_MAIL = "admin@mtgchance.com" SITE_NAME = "MTG CHANCE" SITE_LOCATION = "www.mtgchance.com" ####################################### ##########PAISES ADMITIDOS############# ##############...
""" This scripts shows how to train a POS tagger using trapper. However, intentionally, the dependency injection mechanism is not used, instead the objects are instantiated directly from concrete classes suitable for the job. Although we recommended config file based training using the trapper CLI instead, you can use ...
""" Contains configuration data for interacting with the source_data folder. These are hardcoded here as this is meant to be a dumping ground. Source_data is not actually user configurable. For customized data loading, use mhwdata.io directly. """ supported_ranks = ('LR', 'HR') "A mapping of all translations" all_l...
def distance(strand1, strand2): count = 0 for x, y in zip(strand1, strand2): if x != y: count += 1 return count
""" NOTE: This is a future consensus test not yet ready to merge Let the work below be a point of reference for testing import os import pathlib from mapmerge.constants import FREE, OCCUPIED, UNKNOWN from mapmerge.merge_utils import augment_map, combine_aligned_maps, detect_fault, load_mercer_map, acceptance_ind...
class Mapper(): prg_banks = 0 chr_banks = 0 def __init__(self, prg_banks, chr_banks): pass def cpuMapRead(self, addr): pass def cpuMapWrite(self, addr): pass def ppuMapRead(self, addr): pass def ppuMapWrite(self, addr): pass def reset(self): pass
HOST = "127.0.0.1" PORT = 1337 COMMAND_START = "docker start minecraft-server" COMMAND_STOP = "docker stop minecraft-server" MCSTATUS_COMMAND = "docker exec minecraft-server mcstatus localhost status" # Time to wait for the port to become available STARTUP_DELAY = 1 # Time to wait for the player to join STARTUP_TIME...
real = float(input('Valor a ser convertido: R$')) dolar = real / 5.26 euro = real / 6.00 iene = real / 0.046 print('########## CONVERSOR ##########') print('Com R${} você pode ter U${:.2f}'.format(real, dolar)) print('Com R${} você pode ter €{:.2f}'.format(real, euro)) print('Com R${} você pode ter ¥{:.2f}'.format(rea...
def Calc(number): if number%2 == 0: print('number / 2') return number / 2 elif number%2 == 1: print('3 * ' + str(number) + ' + 1') return 3*number+1 print('this is a Collatz array program. Type exit to exit.') quitFlag = '' #用户是否要继续计算的标记 conExit = '' #退出...
# FIRST CLASS FUNCTIONS: # a programming language is said to have first class functions if it treats functions as first class citizens. # FIRST CLASS CITIZEN (PROGRAMMING): # a first class citizen (sometimes called first class object) in a programming language is an entity # which supports all the operations generall...
''' Crie um módulo chamado MOEDA.PY que tenha as funções incorporadas AUMENTAR(), DIMINUIR(), DOBRO() e METADE(). Faça também um programa que importe esse módulo e use algumas dessas funções. ''' # Esse módulo foi criado para o exercício 107 e copiado para o exercício 108. Neste exercício irei acrescentar uma DEF # qu...
# # PySNMP MIB module BAY-STACK-UNICAST-STORM-CONTROL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAY-STACK-UNICAST-STORM-CONTROL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:19:32 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Usi...
""" Computer Architecture - Day 4 """ # === Stack frames === # # Stack grows downward # 701: # # 700: # return point 1 | # 699: a = 2 | main()'s stack frame # 698: b = ?? | # # 697: # return point 2 | # 696: x = 2 | # 695: y = 7 | mult2()'s stack ...
class SQLitePostProcessor: """Post processor classes are responsable for modifying the result after a query. Post Processors are called after the connection calls the database in the Query Builder but before the result is returned in that builder method. We can use this oppurtunity to get things like ...
peso = float(input('Qual é o seu peso: (KG) ')) altura = float(input('Qual é a sua altura: (m)')) imc = peso / (altura ** 2) if imc < 18.5: print('Abaixo do peso.') elif imc < 25: print('Peso Ideal.') elif imc < 30: print('Sobrepeso') elif imc < 40: print('obesidade') else: print('Obesidade mórbida...
with open("../input/day10.txt") as f: lines = [x.strip() for x in f.readlines()] score_p1 = { ')': 3, ']': 57, '}': 1197, '>': 25137 } score_p2 = { ')': 1, ']': 2, '}': 3, '>': 4 } rev = { ')': '(', '}': '{', ']': '[', ...
def new_user(active=False, admin=False): print(active) print(admin) config = {"active": False, "admin": True} new_user(config.get('active'),config.get('admin')) new_user(**config)
""" ID: groundsada LANG: PYTHON3 TASK: dualpal """ fin = open ('dualpal.in', 'r') fout = open ('dualpal.out', 'w') def decToBase(num,base): result = "" x = num while x > 1: remainder = x % base if remainder < 10: result += str(remainder) else: result += chr(6...
{ "cells": [ { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['2018-11-22 06:46:14', '0']\n", "['2018-11-22 06:52:11', '0']\n", "['2018-11-22 06:52:27', '1']\n", "['2018-11-22 06:5...
__title__ = 'cihai' __package_name__ = 'cihai' __version__ = '0.12.0' __description__ = 'Library for CJK (chinese, japanese, korean) language data.' __author__ = 'Tony Narlock' __email__ = 'tony@git-pull.com' __github__ = 'https://github.com/cihai/cihai' __docs__ = 'https://cihai.git-pull.com' __tracker__ = 'https://gi...
class Solution: def detectCapitalUse(self, word: str) -> bool: caps = False low = False first = False for i, c in enumerate(word): if i == 0: if c.isupper(): first = True else: if c.isupper(): ...
# # PySNMP MIB module HM2-NETOBJ-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-NETOBJ-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:19:03 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...
# The MIT License (MIT) # # Copyright (c) 2020-2022 Yury Gribov # # Use of this source code is governed by The MIT License (MIT) # that can be found in the LICENSE.txt file. """Source file locations.""" class Location: """Location in file.""" def __init__(self, filename=None, lineno=None): self.filename = ...
# -*- coding: utf-8 -*- """ Created on Tue Dec 26 18:29:24 2017 @author: User """ def multVals(vals, multiplier): newVals = [] for elements in vals: newVals.append(elements*multiplier) vals[:] = newVals # this is the way to change a global variable vals to the new values. If just vals i...
# -*- coding: utf-8 -*- """ Fallback to given artist name when no title/artist detected """ def fallback_artist(artist): """ Fallback method """ def fallback_a(title): return [artist, title] return fallback_a
numbers_to_word = { 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', } a = int(input('Number: ')) if a in numbers_to_word.keys(): print(numbers_to_word[a]) else: print('number too big')
def repeat_it(string,n): print( string) if type(string) == str: return string * n print(string*n) else: return 'Not a string'
class Utils: @staticmethod def parse_html(text): tag_dict = { "<b>": "**", "</b>": "**", "<i>": "_", "</i>": "_" } if text[0] == ">": text = "\\" + text new_text = text.replace('*', '\*') for i, j in tag_dict.ite...
""" A factory pattern defines a interface for creating an object, but defer object instantiation to run time. """ # abstract class (Interface) class ShapeInterface: def draw(self): raise NotImplementedError() # concrete classes class Circle(ShapeInterface): def draw(self): print('Circle.dr...
Filenames = { 'CONF': 'scenario.json', 'SOLU': 'solution.json' } Ratings = { 'MIN': 0, 'MAX': 100, }
# Copyright 2014 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. """ Exception classes raised by AdbWrapper and DeviceUtils. """ class BaseError(Exception): """Base exception for all device and command errors.""" pass...
class SelectionNotContinuousException(Exception): pass
load("//rules:common.bzl", "CljInfo") def clojure_ns_impl(ctx): runfiles = ctx.runfiles() clj_srcs = [] java_deps = [] transitive_aot = list(ctx.attr.aot) for dep in ctx.attr.srcs.keys() + ctx.attr.deps: if DefaultInfo in dep: runfiles = runfiles.merge(dep[DefaultInfo].default...
def bdms(n,k): if(n==0): return 0 else: # n not zero if(n%2==0): kick = n//2 n2 = kick n1 = 0 else: kick = (n//2) + 1 n2 = kick-1 n1 = 1 if(kick%k==0): return kick else: while(kick%k != 0 and n2>0): kick+=1 n2-=1 n1+=2 if(n2==0): return -1 return kick n,k=...