content
stringlengths
7
1.05M
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
def func(): print('first') print('second') return 3 print('third') func()
def add_(a,b): return a+b def sub_(a,b): return a-b
class Solution(object): def validIPAddress(self, IP): """ :type IP: str :rtype: str """ try: if '.' in IP: # IPv4 strs = IP.split('.') if len(strs) == 4: for s in strs: if ...
""" Ejercicio 2. Escribir un script que nos muestre por pantalla todos los numeros pares del 1 al 120 """ contador = 1 for contador in range(1,121): if contador%2 == 0: print(f"es par {contador}") """ else: print(f"{contador} es impar") """
def One(ax,ay, bx, by, a_width, a_height, b_width, b_height): #2차원, 2차원 충돌 s_x_l = ax s_x_r = ax+a_width s_y_l = ay s_y_r = ay +a_height p_x_l = bx p_x_r = bx+b_width p_y_l = by p_y_r = by+b_height return s_x_r >= p_x_l and s_x_l <= p_x_r and s_y_r >= p_y_l and s_y_l <= ...
'''Initialize biosql db ''' #biodb_conn_string = 'sqlite://biodb.sqlite' # biodb_conn_string = 'mysql://root:@127.0.0.1/mybiodb' #biodb_conn_string = 'postgres://mybiodb:mypass@127.0.0.1/mybiodb' # timestamps_db = 'sqlite://biodb.sqlite' biodb_handler = BioSQLHandler(settings.biodb_conn_string, compatibility_mode = Fal...
user_range = input("Type a range (star and end): ").split() for u in range(0, len(user_range)): user_range[u] = int(user_range[u]) even_sum = 0 for i in range(user_range[0], user_range[1]): if i % 2 == 0: even_sum += i print("The total even add is: {:d}".format(even_sum))
# Solution # O(nd) time / O(n) space # n - target amount # d - number of denominations def numberOfWaysToMakeChange(n, denoms): ways = [0 for amount in range(n + 1)] ways[0] = 1 for denom in denoms: for amount in range(1, n + 1): if denom <= amount: ways[amount] += ways[...
print(" Week 1 - Day-2 ") print("--------------------") print(" v = 6" + " AND "+ "c = 5") print("--------------------") v = 6 c = 5 if v < c: print(" c big than v") else: print(" c small than v") input('Press ENTER to continue...')
# A simple graph representing a series of cities and the connections between # them. map = { "Seattle": {"San Francisco"}, "San Francisco": {"Seattle", "Los Angeles", "Denver"}, "Los Angeles": {"San Francisco", "Phoenix"}, "Phoenix": {"Los Angeles", "Denver"}, "Denver": {"Phoenix", "San Francisco",...
RECEIVED_REQUEST = 'RT' REQUEST_SUCCESS = 'TS' REQUEST_FAILED = 'TF' REQUEST_PROCESSING = 'SP' NETWORK_ISSUE = 'NC' CONFIRMING_REQUEST = 'SC' UNIONBANK_RESPONSE_CODES = { RECEIVED_REQUEST: { 'message': 'Received Transaction Request', 'apis': 'all', 'description': 'Transaction has reached U...
# Write your check_for_name function here: def check_for_name(sentence, name) -> object: return name.lower() in sentence.lower() # Uncomment these function calls to test your function: print(check_for_name("My name is Jamie", "Jamie")) # should print True print(check_for_name("My name is jamie", "Jamie")) # ...
# loops with range for x in range(0, 10, 1): pass # insert what to do in each iteration # 0 represents the value to start iterating with # 10 represents the value to stop iterating at # 1 represents the value in which the iterator changes per iteration for x in range(0, 10, 1): pass # start iteration at 0, end...
sexo = '' s = '' while sexo != 'M' and sexo != 'F': sexo = str(input('Digite seu sexo [M/F]')).upper().strip() if sexo != 'M' and sexo != 'F': print('Sexo invalido! por favor, ',end='') if sexo == 'M': s = 'Masculino' if sexo == 'F': s = 'Feminino' print('Seu sexo é {}'.format(s)...
''' https://qna.habr.com/q/790553 ''' h1 = int(input()) h2 = int(input()) h3 = int(input()) result = ['Не по росту!', 'По росту!'] compare = h1 <= h2 <= h3 print(result[compare])
# sum = sum + 10 # sum += 10 # i = i + 1 # i += 1 # number = number / 10 # number /= 10 # number = number / divisor # number /= divisor # product = product * 45 # product *= 45 # factroial = factorial * func(3) # factorial *= func(3) """ var = var [operator] value var [operator]= value """
inputText = "{{{{{{<!>!>,<o!>},<a,\"i!!!>i!!,!>,<<e<i<<>,{{{<!>},<!><!>,<!!!>!!!>!!!>{\"!>},<!!!<!>},<oi!>!,'>}}}},{{<{!!!>},<!!,!!!>!!!>!!e!a!!!!<!>},<!!!>u!>,<!>!!u!!!!!>},<!>!>,<{>}},{<\"a!!!!'!>},<!}\"!>!!<o}i!<>,<<e,<eo!a}!!\"!>,<!>!>!>,<e{\"e\">}},{{<!oi'<!o!>ue>,{<!>},<i!>,<i>,{<'>}}}},{{<\"a,!>},<!!e!>,<e!!}!!o...
bedroom_choices = { '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10 } price_choices = { '100000': 'KES100,000', '200000': 'KES200,000', '300000': 'KES300,000', '400000': 'KES400,000', '500000': 'KES500,000', '600000': 'KES...
with open("./Day_Three/input.txt") as File: input = File.read().strip().split("\n") class Main(): def __init__(self, input): self.input = input def partOne(input: str) -> int: finalArr = [ {0:0, 1:0} for _ in range(len(input[0]))] for row in input: for i, v i...
######################################################### # Author: Zach, Dave and Feroz Farazi (msff2@cam.ac.uk) # # Date: 24 Nov 2020 # ######################################################### """This module defines SPARQL queries""" def get_lucode_label(): """Sets the curre...
# -*- coding: utf-8 -*- """ Created on Tue Jan 14 13:43:05 2020 @author: Tushar Saxena """ class Node: def __init__(self, val): self.left = None self.right = None self.val = val class Tree: def __init__(self): self.root = None def getRoot...
# Desenvolva um algoritimo em Python que exiba os números pares entre 1 e 10. for i in range(0, 11, 2): print(i)
# Single Number # Given a non-empty array of integers, every element appears twice except for one. Find that single one. # Note: # Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? # Example 1: # Input: [2,2,1] # Output: 1 # Example 2: # Input: [4,1,2,1,2] # Ou...
n = int(input()) cod = [] tmp = False for i in range(n): cod.append(input()) for i in range(n): for j in list(set(cod) - set(cod[i])): for k in list(set(cod) - set([cod[i],j])): if k in cod[i] + j or k in j + cod[i]: print(k) tmp = True break if tmp: break if tmp: break if not tmp: print('ok...
# Leo colorizer control file for splus mode. # This file is in the public domain. # Properties for splus mode. properties = { "doubleBracketIndent": "false", "indentCloseBrackets": "}", "indentNextLine": "\\s*(((if|while)\\s*\\(|else\\s*|else\\s+if\\s*\\(|for\\s*\\(.*\\))[^{;]*)", "indentOpenBr...
class Solution(object): def generateParenthesis(self, N): if N == 0: return [''] ans = [] for c in range(N): for left in self.generateParenthesis(c): for right in self.generateParenthesis(N-1-c): ans.append('({}){}'.format(left, right)) ...
########################################################### # Fixed parameters for speech recognition ########################################################### # Model and feature type model_type = 'Wav2Letter' # DeepSpeech or Wav2Letter feature_type = 'mfcc' # rawspeech (Wav2Letter), rawframes (DeepSpeech), spectro...
""" Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Output: 1->4->3->2->5->NULL Solution: 1. Recursion 2. Iteration """ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # se...
# -------------- # Code starts here class_1=[] class_2=[] class_1.append('Geoffrey Hinton') class_1.append('Andrew Ng') class_1.append('Sebastian Raschka') class_1.append('Yoshua Bengio') class_2.append('Hilary Mason') class_2.append('Carla Gentry') class_2.append('Corinna Cortes') new_class=class_1 + class_2 print(ne...
class ChannelBirthday: def __init__(self, channel_id, server_id): self.channel_id = channel_id self.server_id = server_id def __eq__(self, other): return self.server_id == other.server_id
# pylint: disable=R0903 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Exercise 24: Draw A Game Board This exercise is Part 1 of 4 of the Tic Tac Toe exercise series. The other exercises are: Part 2, Part 3, and Part 4. Time for some fake graphics! Let’s say we want to draw game boards that look like this: --- --- --- | | | | --...
class Trie: def __init__(self, name, isendofword = False ): self.name = name self.isendofword = isendofword self.elements = dict() def __repr__(self): return str( { 'name' : self.name, 'isendiftheword' : self.isendofword, ...
N = int(input()[-1]) if N in [2, 4, 5, 7, 9]: print("hon") elif N in [0, 1, 6, 8]: print("pon") else: print("bon")
""" Messenger class file """ class Messenger: """ Class that represents a messenger object (interface) """ def send(self, user_id: str, text: str): """ Sends to the user_id (backend must understand) the text message""" raise NotImplementedError("Abstract method MUST be implemented") def ...
# https://www.hackerrank.com/challenges/python-integers-come-in-all-sizes/problem if __name__ == '__main__': a = int(input()) b = int(input()) c = int(input()) d = int(input()) caculation = pow(a,b) + pow(c,d) print(caculation)
""" Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Input: [1,3,null,null,2] 1 / 3 \ 2 Output: [3,1,null,null,2] 3 / 1 \ 2 Example 2: Input: [3,1,4,null,null,2] 3 / \ 1 4 / 2 Output: [2,1,4,null,null,...
class Movie(): """ This Class provides a way to store movie related information Such as title, storyline, poster image url, and trailer. To create and instance of the Movie class, import media into your python file then create an instance by: variable = media.Movie(movie_title, ...
# В этой задаче вам предстоит научиться создавать ссылки. Вам нужно сгенерировать html-код на питоне и сдать на проверку # html-файл, в котором будет таблица размером 10 на 10, которая должна содержать таблицу умножения для чисел от 1 до 10. # Каждое число в таблице должно быть ссылкой на страницу http://<это число>.ru...
# Union-Find with path compression and union with rank class UF: def __init__(self, n): self.count = [1] * n self.parent = [_ for _ in range(n)] def find(self, i): # find root(i) and compress the path if self.parent[i] != i: self.parent[i] = self.find(self.parent[i]) ...
# Author: BHARATHI KANNAN N - Github: https://github.com/bharathikannann, linkedin: https://linkedin.com/in/bharathikannann # # ## Doubly Linked List # - A doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains three fields: two link fields...
class ApplicationException(Exception): ... class NoteExists(ApplicationException): ... class InputError(ApplicationException): ... class ActionAborted(ApplicationException): ... class PathIsNotDefined(ApplicationException): def __init__(self): super().__init__( "Path to n...
___assertEqual(len('123'), 3) ___assertEqual(len(()), 0) ___assertEqual(len((1, 2, 3, 4)), 4) ___assertEqual(len([1, 2, 3, 4]), 4) ___assertEqual(len({}), 0) ___assertEqual(len({'a':1, 'b': 2}), 2)
#1. Create a greeting for your program. print('welocme to brand name generator') #2. Ask the user for the city that they grew up in. city_name = input('enter your city name') print('city name is '+city_name) #3. Ask the user for the name of a pet. pet_name = input('enter your pet name') print('pet name is ' + pet_name)...
#Validate credit cards using Luhn's algorithm. Input should be 16 digits. def luhn(): card_number=input("Enter the card number to be checked: ") def digits_of(n): return [int(d) for d in str(n)] digits = digits_of(card_number) odd = digits[-1::-2] even = digits[-2::-2] checksum...
# E[0] = sum(Vi/N) # E[k] = sum(max(Vi, E[k-1])/N) def expectation(N, K, V, mean): # # Recursion form fails # if K == 0: return mean # e = expectation(N, K-1, V, mean) # return sum(max(v, e)/N for v in V) ek = mean for k in range(K): ek = sum(max(v, ek)/N for v in V) return ek def...
class Solution: def findMaxLength(self, nums: List[int]) -> int: """Hash table. """ res = 0 d = {0: -1} c = 0 for i, n in enumerate(nums): if n == 1: c -= 1 else: c += 1 if c in d: res...
class Msg: SERVER_BANNER = ''' ##### # ###### ####### ##### # # # ##### ####### ###### # # ####### ###### # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ...
sample_request = { 'id': '91b20aa5-9ccf-498d-8944-5d3a32ab1b37', 'timestamp': '2018-02-17T11:26:58.76Z', 'lang': 'en', 'result': { 'source': 'agent', 'resolvedQuery': 'hello', 'speech': '', 'action': 'hello', 'actionIncomplete': False, 'parameters': { ...
n = int(input()) A = [0] + [int(i) for i in input().split()] def maxHeapify(i): left = 2 * i right = 2 * i + 1 if left <= n and A[left] > A[i]: largest = left else: largest = i if right <= n and A[right] > A[largest]: largest = right if largest != i: A[i], A[l...
class SkString: def __init__(self, text): self.text = text def to_upper(self): return self.text.upper() def to_lower(self): return self.text.lower() def to_title(self): return self.text.title()
class Solution: """ @param s: The first string @param b: The second string @return true or false """ def anagram(self, s, t): # write your code here l1 = list(s) l2 = list(t) length1 = len(l1) length2 = len(l2) if length1 != length2: r...
"""Exceptions for versionner""" class VersionnerError(Exception): """Generic versionne error""" ret_code = 2 class ConfigError(VersionnerError): """Configuration error"""
print() '尝试利用字典的特性编写一个通讯录程序' ''' 1.查询联系人资料 存在打印,不存在提示 2.插入新的联系人 不存在直接新增 已存在提示是否修改 是,覆盖原来的电话,提示修改成功 否,跳出当前新增 3.删除联系人 联系人不存在 提示删除的联系人不存在 联系人存在 提示是否删除 是,删除,打印删除id 否,跳出当前选项 4.退出通讯录程序 打印提示语,终止循环 ''' print( ''' |---欢迎进入通讯录程序---| |---1.查询联系人资料 ---...
"""Parser classes for SIMBAD""" __author__ = "Felix Simkovic" __date__ = "04 May 2017" __version__ = "0.1" class _Parser(object): def __init__(self, fname): self.logfile = fname
def read_file(file_name): data = "" with open(file_name, "r") as file: data = file.read() return data def parse_input(text): lines = text.split("\n") return lines def part1(): lines = parse_input(read_file("day4_input.txt")) good_passphrases = 0 for line in lines: wor...
# s = set('hello') # print(s) # # #set 元素不可重复 用{} 表示 ,不同于字典的{key:value,key:value}的形式 # s = set(["alex",'alex','djf']) # print (s) # s = {1,2,23,4} # s.add(4)##只有当元素不同时,才能添加进集合中 # print(s) # # s.clear()##清空元素 # print(s) # s.pop()##清空其中的一个元素,随机删除 # s.remove(23)##制定删除其中一个元素,元素不存在时,无法进行删除,会报错 # s.discard(233)#指定删除,但是元素不...
#This script will read 3 numbers "n", "x" and "y" and print a validation for each number in the range 1:n of whether the number is divisible by x, divisible by y or divisible by both. def xyMultiple(n,x,y): for i in range(1,n+1): isDivX = False isDivY = False res = "Div by " if i % x...
# -*- coding: utf-8 -*- def salpeter(m, ksi0=1.0): return ksi0 * m ** -2.35
''' Una función que recibe un arreglo de palabras y una palabra debe retornar la cantidad de veces que aparece esa palabra en el arreglo y el largo del arreglo Al llamarla con (["ab","a"], "a") debería retornar (1,2) ''' def count(lista, palabra): for word in lista: if palabra in word: ...
v = float(input('Qual a velocidade atual do carro? ')) if v > 80: print('MULTADO! Você excedeu o limite permitido que é de 80Km/h') print('Você deve pagar uma multa de R${:.2f}'.format((v - 80)*7)) print('Tenha um bom dia! Dirija com segurança!')
class nmap_plugin(): # user-defined script_id = 'http-methods' script_source = 'service' script_types = ['port_info'] script_obj = None output = '' def __init__(self, script_object): self.script_obj = script_object self.output = script_object['output'] def port_info(se...
""" Errors about messages. """ class SendMessageFailed(Exception): """Raises when sending a message is failed.""" pass class CreateReactionFailed(Exception): """Raises when creating the reaction is failed.""" pass class DeleteReactionFailed(Exception): """Raises when deleting the reaction is...
sysconfig = dict( experiment = 'Exp', ) devices = dict( Sample = device('nicos.devices.sample.Sample', description = 'The currently used sample', ), Exp = device('nicos.devices.experiment.Experiment', description = 'experiment object', dataroot = 'data', sendmail = True,...
def order_square(a): right = 0 while right < len(a) and a[right] < 0: right +=1 left = right-1 output = [] while left >= 0 and right < len(a): if a[left]**2 < a[right]**2: output.append(a[left]**2) left -=1 else: output.append(a[...
# # PySNMP MIB module GENOSALARMNOTIFICATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GENOSALARMNOTIFICATION-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:19:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
def test_case_mme_update(populated_database, case_obj, user_obj, mme_patient, mme_submission): """ Test the function that registers an effected individual as submitted to MatchMaker """ adapter = populated_database mme_submission['server_responses'] = [ {'patient': mme_patient }] # Make sure no c...
def array123(arr): myarr = [1,2,3] for i in range(len(arr)): if arr[i: (i+3)] == myarr: return True return False result = array123([1, 1, 2, 3, 1]) print(result) result = array123([1, 1, 2, 4, 1]) print(result) result = array123([1, 1, 2, 1, 2, 3]) print(result)
def getListInFile(fileName): ''' DOCSTRING : Gets and reads a file in args INPUT : name of file to open OUTPUT : return list of colours ''' with open(fileName, mode='r') as cFile: listOfColours = cFile.readlines() return listOfColours cFile.close()
class DictAsObject(dict): def __getattr__(self, name): return self.__getitem__(name) def __getitem__(self, name): value = dict.__getitem__(self, name) if isinstance(value, dict) and not isinstance(value, DictAsObject): value = DictAsObject(value) dict.__setitem__(self, name, value) ret...
def find_median(Arr, start, size): myList = [] for i in range(start, start + size): myList.append(Arr[i]) myList.sort() return myList[size // 2] def fastSelect(array, k): n = len(array) if 0 < k <= n: setOfMedians = [] arr_less_P = [] arr_equal_P = [] ...
valores = [] par = [] impar = [] for i in range(0, 5): valores.append(int(input('Digite um número: '))) if valores[i] % 2 == 0: par.append(valores[i]) else: impar.append(valores[i]) print(f'Os números pares são {par}') print(f'Os números impares são {impar}') valores = par + impar print...
def BiRNN(x, weights, biases): lstm_fw_cell = rnn_cell.BasicLSTMCell(n_hidden, forget_bias=1.0) lstm_bw_cell = rnn_cell.BasicLSTMCell(n_hidden, forget_bias=1.0) outputs = rnn.bidirectional_rnn(lstm_fw_cell, lstm_bw_cell, x, dtype=tf.float32) return tf.matmul(outputs[-1], weights['out']) + biases['out']
# https://app.codesignal.com/arcade/code-arcade/mirror-lake/rNrF4v5etMdFNKD3s def isSubstitutionCipher(string1, string2): # Is one string able to be made with a substitution cipher? # We don't know what it is, but we can start comparing both # and inferring what a candidate substitution may be. Then, # ...
STACK_COUNT = 6 INITIAL_STACK_SIZE = 6 MAX_STACK_SIZE = 15 STACK_RANGE = range(STACK_COUNT) class GameState: def __init__(self): self.actions_taken = 0 # List of lists of tuples # Finished stacks become None - won state contains 4 Nones and 2 empty lists self.stacks = [] ...
class humano: def __init__(self, nombre, armadura, nivel, ataque, ojos=2, piernas=2, dientes=32,salud=100): self.ojos=ojos self.piernas=piernas self.dientes=dientes self.nombre=nombre self.armadura=armadura self.nivel=nivel self.ataque=ataque self.salu...
for _ in range(int(input())): c = [int(n) for n in input()] i_t = (c[3] ^ c[4] ^ c[5] ^ c[6]) << 2 | (c[1] ^ c[2] ^ c[5] ^ c[6]) << 1 | (c[0] ^ c[2] ^ c[4] ^ c[6]) if i_t: c[i_t - 1] ^= 1 print(''.join(map(str, [c[2], c[4], c[5], c[6]])))
#################################### User part start ################################## """ GUI Color Theme. Set True for light mode, Valid values True, False """ DARK_THEME = False """ Units for time expenses. Valid values are 'seconds', minutes', 'hours' """ UNITS = 'minutes' """ Time to process a single word """...
class Config: batch_size = 100 n_epochs = 50 init_lr = 1e-2 # this would not take effect as using cyclic lr momentum = 0.0 weight_decay = 5e-4 eta_min = 1e-5 eta_max = 1e-2 shuffle = False part_labeled = 0.3 # the percentage of labeled data n_features = 39 n_classes = 48 ...
# TO DO # Move constants/codes to new file class Tokenizer: """ Advances through raw Jack code, ignores irrelevant characters, separates tokens, and identifies token types. """ KEYWORD = 0 IDENTIFIER = 1 SYMBOL = 2 INT_CONSTANT = 3 STRING_CONSTANT = 4 SYMBOLS = r"{}()[].,;+-*/&|...
#!/usr/bin/env python # -*- coding:utf-8 -*- name = "popcorntime" source = "https://aur.archlinux.org/popcorntime-bin.git" def pre_build(): for line in edit_file("PKGBUILD"): if line.startswith("pkgname="): print("pkgname=popcorntime") else: print(line)
# 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 isValidBST(self, root: TreeNode) -> bool: return self.scanTree(root, None, None) def scanTr...
for c in range(10, -1, -1): print(c) print('FOGOOOOOS !!!')
class Animal: def __init__(self,*args,**kwargs): animalArgs = args[0] animalArgs.update(kwargs) self.__dict__.update(animalArgs) def update(self,val): self.__dict__.update(val) def get(self): print(self) return vars(self) def addSponsor(self,sponsor): self.sponsor = sponsor ...
# 6. * Реализовать структуру данных «Товары». Она должна представлять собой список кортежей. # Каждый кортеж хранит информацию об отдельном товаре. # В кортеже должно быть два элемента — номер товара и словарь с параметрами # (характеристиками товара: название, цена, количество, единица измерения). # Структуру нужно сф...
# # @lc app=leetcode.cn id=72 lang=python3 # # [72] 编辑距离 # # @lc code=start class Solution: def minDistance(self, word1: str, word2: str) -> int: wl1, wl2 = len(word1), len(word2) if wl1 * wl2 == 0: return wl1 + wl2 # 因为要考虑空字符串的缘故所以要+1后面的都需要+1 dp = [[0] * (wl2 + 1) f...
# -*- coding: utf-8 -*- """ Created on Thu Jun 20 16:17:26 2019 @author: Administrator """ class Solution: def trailingZeroes(self, n: int) -> int: # ans = [] # for num in n: # res = 1 # for k in range(1, num+1): # res = res * k # tmp = 0 # ...
# Copyright (c) 2015-2019 Patricio Cubillos and contributors. # MC3 is open-source software under the MIT license (see LICENSE). # MC3 Version: MC3_VER = 3 # Major version MC3_MIN = 0 # Minor version MC3_REV = 0 # Revision __version__ = '{}.{}.{}'.format(MC3_VER, MC3_MIN, MC3_REV)
class FactorUniverseSelectionModel(): def __init__(self, algorithm): self.algorithm = algorithm def SelectCoarse(self, coarse): # self.algorithm.Log("Generating universe...") universe = self.FilterDollarPriceVolume(coarse) return [c.Symbol for c in universe] def Se...
"Day 25: Combo Breaker" def find_loop_size_of(key: int) -> int: """Determine loop size from public key.""" value = 1 subject = 7 loop = 0 while value != key: value *= subject value = value % 20201227 loop += 1 return loop def calculate_encryption(first_key: int, secon...
def isAnagram(string1, string2): """Checks if two strings are an anagram An anagram is a word or phrase formed by rearranging the letters of a different word or phrase. This implementation ignores spaces and case. @param string1 The first word or phrase @param string2 The second word or phras...
# # PySNMP MIB module MITEL-IPFILTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MITEL-IPFILTER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:03:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
def title(string, rng, color=0): """ --> Function to create a title in the project. :param string: Written part of the title. :param rng: Title range. :param color: Title color. (30 = White; 31 = Red; 32 = Green; 33 = Yellow; 34 = Blue; 35 = Purple; 36 = Cyan; 37...
# Name: Yahya Eldarieby # Course: CS30 # Date: 01/10/2019 # Description: RPG Pseudocode # A text based game following the demo at: https://www.youtube.com/watch?v=higMRrO5AkU # Start # Display a welcoming branding image # Pick an intial location for snake # Pick an initial location for fruits and obstacles # Forever ...
class NotAllowedException(Exception): pass class CannotDeleteLoadedItem(Exception): pass class UnknownUserException(Exception): pass class UnknownLoanItemException(Exception): pass class InitialAdminRoleException(Exception): pass class InvalidTokenException(Exception): pass class Inv...
#!/usr/bin/env python # -*- coding: utf-8 -*- MESSAGE_INDENT_NUM = 'indent steps must be {} multiples' MESSAGE_DUPLICATED_SPACE = 'too many spaces' MESSAGE_COMMA_HEAD = 'comma must be head of line' MESSAGE_COMMA_END = 'comma must be end of line' MESSAGE_WHITESPACE_AFTER_COMMA = 'whitespace must be after comma: ,' MESS...
def max_sum(d): res = d[0] max_i = 0 max_j = 1 i = 0 j = 0 max_count = 0 for item in d: max_count += item j += 1 if max_count > res: res = max_count max_i, max_j = i, j if max_count <= 0: max_count = 0 i = j ...
#Create a Python script file named data_types_and_variables.py. Inside it, write some Python code, that is, variables and operators, to describe the following scenarios. Do not worry about the real operations to get the values, the goal of these exercises is to understand how real world conditions can be represented wi...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/krzysztof/Repos/ur3e-ird435-rg2/catkin_ws/src/fmauch_universal_robot/ur_msgs/msg/Analog.msg;/home/krzysztof/Repos/ur3e-ird435-rg2/catkin_ws/src/fmauch_universal_robot/ur_msgs/msg/Digital.msg;/home/krzysztof/Repos/ur3e-ird435-rg2/catkin_ws/src/fm...