content
stringlengths
7
1.05M
# Dany jest ciąg klocków (K1, ..., Kn). Klocek K[i] zaczyna sie na pozycji a[i] i ciągnie się do pozycji # b[i] (wszystkie pozycje to nieujemne liczby naturalne) oraz ma wysokość 1. Klocki układane są po # kolei–jeśli klocek nachodzi na któryś z poprzednich, to jest przymocowywany na szczycie poprzedzajacego # klocka)....
''' 0: 1: 2: 3: 4: aaaa .... aaaa aaaa .... b c . c . c . c b c b c . c . c . c b c .... .... dddd dddd dddd e f . f e . . f . f e f . f e . . f . f gggg .... gggg gggg .... ...
# Convert to str number = 18 number_string = str(number) print(type(number_string)) # 'str'
n = int(input("Informe a quantidade de caracteres: ")) caracteres = [] consoantes = 0 i = 1 while i <= n: c = input("Informe o %d caracter: " %i) caracteres.append(c) i += 1 i = 0 while i < n: if caracteres[i] not in "aeiou": consoantes += 1 i += 1 print("O total de consoantes eh: ", consoan...
# Advent of Code 2019 Solutions: Day 2, Puzzle 1 # https://github.com/emddudley/advent-of-code-solutions with open('input', 'r') as f: program = [int(x) for x in f.read().strip().split(',')] program[1] = 12 program[2] = 2 for opcode_index in range(0, len(program), 4): opcode = program[opcode_index] if ...
class Solution: def minDeletionSize(self, A: List[str]) -> int: minDel = m = len(A[0]) dp = [1] * m for j in range(m): for i in range(j): if all(A[k][i] <= A[k][j] for k in range(len(A))): dp[j] = max(dp[j], dp[i] + 1) minDel = min(...
""" https://leetcode.com/problems/power-of-two/ Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Output: true Explanation: 24 = 16 Example 3: Input: 218 Output: false """ # time complexity: O(logn), space complexity: ...
key = int(input()) n = int(input()) message = "" for x in range(n): letters = input() message += chr(ord(letters) + key) print(message)
def action_sanitize(): '''Make action suitable for use as a Pose Library ''' pass def apply_pose(pose_index=-1): '''Apply specified Pose Library pose to the rig :param pose_index: Pose, Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose) :type pose_index: in...
class TreeNode: def __init__(self, val): self.val = val self.left = None self.right = None class Solution(object): def is_same_tree(self, p, q): if p is None or q is None: if p != q: return False return True if p.val != q.val: ...
frase = str(input('Digite uma frase : ')).strip() lower=frase.lower() print('##########################################################################') print('################# A N A L I Z A N D O A F R A S E #################') print('##########################################################################'...
#!/usr/bin/env python3 n = int(input()) i = 1 while i < n + 1: if i % 3 == 0 and i % 5 != 0: print("fizz") elif i % 5 == 0 and i % 3 != 0: print("buzz") elif i % 5 == 0 and i % 3 == 0: print("fizz-buzz") else: print(i) i = i + 1
def _printf(fh, fmt, *args): """Implementation of perl $fh->printf method""" global OS_ERROR, TRACEBACK, AUTODIE try: print(_format(fmt, *args), end='', file=fh) return True except Exception as _e: OS_ERROR = str(_e) if TRACEBACK: if isinstance(fmt,...
region = 'us-west-2' vpc = dict( source='./vpc' ) inst = dict( source='./inst', vpc_id='${module.vpc.vpc_id}' ) config = dict( provider=dict( aws=dict(region=region) ), module=dict( vpc=vpc, inst=inst ) )
{ "targets": [ { "target_name": "userid", "sources": [ '<!@(ls -1 src/*.cc)' ], "include_dirs": ["<!@(node -p \"require('node-addon-api').include\")"], "dependencies": ["<!(node -p \"require('node-addon-api').gyp\")"], "cflags!": [ "-fno-exceptions" ], "cflags_cc!": [ "-fno-exc...
""" Single linked list based on two pointer approach. """ class Node: def __init__(self, val=0, next=None): self.val = val self.next = next class slist: """ singly linked list class """ def __init__(self): self._first = None self._last = None def _build_a_no...
algorithm_defaults = { 'ERM': { 'train_loader': 'standard', 'uniform_over_groups': False, 'eval_loader': 'standard', 'randaugment_n': 2, # When running ERM + data augmentation }, 'groupDRO': { 'train_loader': 'standard', 'uniform_over_groups': True, ...
"""django-anchors""" __version__ = '0.1.dev0' __license__ = 'BSD License' __author__ = 'Fantomas42' __email__ = 'fantomas42@gmail.com' __url__ = 'https://github.com/Fantomas42/django-anchors'
def isinteger(s): return s.isdigit() or s[0] == '-' and s[1:].isdigit() def isfloat(x): s = x.partition(".") if s[1]=='.': if s[0]=='' or s[0]=='-': if s[2]=='' or s[2][0]=='-': return False else: return isinteger(s[2]) elif isinteger(...
class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: if not root: return 0 elif not root.right and not root.left: return 0 elif not root.right: return max(self.diameterOfBinaryTree(root.left), 1 + self.height(root.l...
# Copyright (C) 2019 FireEye, Inc. All Rights Reserved. """ english letter probabilities table from http://en.algoritmy.net/article/40379/Letter-frequency-English """ english_letter_probs_percent = [ ['a', 8.167], ['b', 1.492], ['c', 2.782], ['d', 4.253], ['e', 12.702], ['f', 2.228], ['g'...
arima = { 'order':[(2,1,0),(0,1,2),(1,1,1)], 'seasonal_order':[(0,0,0,0),(0,1,1,12)], 'trend':['n','c','t','ct'] } elasticnet = { 'alpha':[i/10 for i in range(1,101)], 'l1_ratio':[0,0.25,0.5,0.75,1], 'normalizer':['scale','minmax',None] } gbt = { 'max_depth':[2,3], 'n_estimators':[100,500] } hwes = { 'trend':...
str_back = '↪ !Назад в меню%r' str_yes = '✅ Да%g' str_no = '❌ Нет%r' str_yes_or_no = '✅ Да или ❌ Нет ?' str_menu_out = 'Вышли в главное меню. ' str_maybe_later = 'Ну ладно) заходи потом' str_error = 'Опаньки... ошибка, повтори позже' str_help = '⚙ !Помощь%g'
"""Incoming data loaders This file contains loader classes that allow reading iteratively through vehicle entry data for various different data formats Classes: Vehicle Entry """ class Vehicle(): """Representation of a single vehicle.""" def __init__(self, entry, pce): # vehicle propertie...
# ---------全局变量-------- # 商品字典 dict_commodity_infos = { 1001: {"name": "屠龙刀", "price": 10000}, 1002: {"name": "倚天剑", "price": 10000}, 1003: {"name": "金箍棒", "price": 52100}, 1004: {"name": "口罩", "price": 20}, 1005: {"name": "酒精", "price": 30}, } # 订单列表 list_orders = [ {"cid": 1001, "count": 1}, ...
# n 回繰り返す N = 10 for i in range(N): print(i) print('Hello World') # インデントが異なるので、 # 'Hello World'を繰り返されない for i in range(N): print(i) print('Hello World')
# This is a pytest config file # https://docs.pytest.org/en/2.7.3/plugins.html # It allows us to tell nbval (the py.text plugin we use to run # notebooks and check their output is unchanged) to skip comparing # notebook outputs for particular mimetypes. def pytest_collectstart(collector): if ( collector....
# model model = Model() i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2, 2}") i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2, 2, 2}") model = model.Operation("RSQRT", i1).To(i3) # Example 1. Input in operand 0, input0 = {i1: # input 0 [1.0, 36.0, 2.0, 90, 4.0, 16.0, 25.0, 100.0, 23.0, 19.0, 40.0, 256.0, 4.0,...
#It's a simple calculator for doing Addition, Subtraction, Multiplication, Division and Percentage. first_number = int(input("Enter your first number: ")) operators = input("Enter what you wanna do +,-,*,/,%: ") second_number = int(input("Enter your second Number: ")) if operators == "+" : first_number...
description = 'system setup' group = 'lowlevel' sysconfig = dict( cache='localhost', instrument='Fluco', experiment='Exp', datasinks=['conssink', 'filesink', 'daemonsink',], ) modules = ['nicos.commands.standard', 'nicos_ess.commands.epics'] devices = dict( Fluco=device('nicos.devices.instrument...
i=2 while i < 10: j=1 while j < 10: print(i,"*",j,"=",i*j) j += 1 i += 1
# Program that asks the user to input any positive integer and # outputs the successive value of the following calculation. # It should at each step calculate the next value by taking the current value # if the it is even, divide it by two, if it is odd, multiply # it by three and add one # the program ends if the cur...
df =[['4', '1', '2', '7', '2', '5', '1'], ['9', '9', '8', '0', '2', '0', '8', '5', '0', '1', '3']] str='' dcf = ''.join(df) print(dcf) print()
parameters = { "results": [ { "type": "max", "identifier": { "symbol": "S22", "elset": "ALL_ELEMS", "position": "Element 1 Int Point 1 Sec Pt SPOS, (fraction = 1:0)" }, "referenceValue": 6...
numOne = int(input("Digite o primero número: ")) numTwo = int (input("Digite o segundo número: ")) numThree = int(input("Digite o terceiro número: ")) if numOne < numTwo and numTwo < numThree : print("crescente") else: print("não está em ordem crescente")
class Carro(): def __init__(self, tanque): self.__tanque = tanque#Atributo privado def andar(self, km): self.__tanque -= (km * 0.5) def abastecer(self, gasolina): self.__tanque += float(gasolina) def getTanque(self): return self.__tanque def setTa...
class Solution: def wordBreak(self, s: str, wordDict: List[str]) -> bool: def check(t, a, dp): n=len(t) for k in range(1, n): if dp[a+0][a+k-1] and dp[a+k][a+n-1]: return 1 return 0 n=len(s) dp=[[0 for j in r...
expected_output = { "clock_state": { "system_status": { "associations_address": "10.16.2.2", "associations_local_mode": "client", "clock_offset": 27.027, "clock_refid": "127.127.1.1", "clock_state": "synchronized", "clock_stratum": 3, ...
#!/usr/python3.5 #-*- coding: utf-8 -*- for row in range(10): for j in range(row): print (" ",end=" ") for i in range(10-row): print (i,end=" ") print ()
# SUM def twoSumI(nums, target): result = {} for k, v in enumerate(nums): sub = target - v if sub in result: return [result[sub], k] result[v] = k def twoSum(nums, target): l, r = 0, len(nums) - 1 result = [] while l < r: total = nums[l] + nums[r] ...
#!/usr/bin/python # -*- coding: utf-8 -*- CREDITS = { 'source': 'Wikipedia', 'url': 'https://en.wikipedia.org/wiki/Wonders_of_the_World' } WONDERS = { 'ancient world': [ { 'name': 'Great Pyramid of Giza', 'Location': 'Giza, Egypt', 'url': 'https://e...
nome = input('Digite seu nome completo: ').strip() print('Seu nome completo com todas as letras maiusculas: \n{}'.format(nome.upper())) print('Seu nome com todas as letras minusculas: \n{}'.format(format(nome.lower()))) print('Seu nome tem:\n{} caracteres sem os espaços.'.format(len(nome) - nome.count(' '))) dividido =...
# -*- coding: utf-8 -*- """ Created on 24 Dec 2019 20:40:06 @author: jiahuei """ def get_dict(fp): data = {} with open(fp, 'r') as f: for ll in f.readlines(): _ = ll.split(',') data[_[0]] = _[1].rstrip() return data def dump(data, keys, out_path): out_str = '' fo...
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '1/10/2021 10:53 PM' class Solution: def smallestStringWithSwaps(self, s: str, pairs) -> str: chars = list(s) pairs.sort(key=lambda item: (item[0], item[1])) for pair in pairs: a, b = pair[0], pair[1] ...
"""Exceptions for Ambee.""" class AmbeeError(Exception): """Generic Ambee exception.""" class AmbeeConnectionError(AmbeeError): """Ambee connection exception.""" class AmbeeAuthenticationError(AmbeeConnectionError): """Ambee authentication exception.""" class AmbeeConnectionTimeoutError(AmbeeConnect...
""" > Task Call two arms equally strong if the heaviest weights they each are able to lift are equal. Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right and the left), and so are their weakest arms. Given your and your friend's arms' lifting capabilities f...
# test bignum unary operations i = 1 << 65 print(bool(i)) print(+i) print(-i) print(~i)
def zeroes(n, cnt): if n == 0: return cnt elif n % 10 == 0: return zeroes(n//10, cnt+1) else: return zeroes(n//10, cnt) n = int(input()) print(zeroes(n, 0))
req = { "userId": "admin", "metadata": { "@context": [ "https://w3id.org/ro/crate/1.0/context", { "@vocab": "https://schema.org/", "osfcategory": "https://www.research-data-services.org/jsonld/osfcategory", "zenodocategory": "https:...
class GoogleException(Exception): def __init__(self, code, message, response): self.status_code = code self.error_type = message self.message = message self.response = response self.get_error_type() def get_error_type(self): json_response = self.response.json() ...
command = input().lower() in_progress = True car_stopped = True while in_progress: if command == 'help': print("start - to start the car") print("stop - to stop the car") print("quit - to ext") elif command == 'start': if car_stopped: print("You started the car") ...
class Solution: def __init__(self): pass def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ #遞回尋找排序後的真實數字 def answer_values(nums, target): total_nums = len(nums) index_ans=...
def create_xml_doc(text): JS(""" try //Internet Explorer { var xmlDoc=new ActiveXObject("Microsoft['XMLDOM']"); xmlDoc['async']="false"; xmlDoc['loadXML'](@{{text}}); } catch(e) { try //Firefox, Mozilla, Opera, etc. { var parser=new DOMParser(); xmlDoc=parser['parseFromString'](@{{text}},...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2014, Chris Hoffman <choffman@chathamfinancial.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r''' --- module: win_service short_description: Manage and query Windows services description: - M...
class Solution: """ @param candidates: A list of integers @param target: An integer @return: A list of lists of integers """ def combinationSum(self, candidates, target): # write your code here if not candidates or len(candidates) == 0: return [[]] candidates...
# test exception matching against a tuple try: fail except (Exception,): print('except 1') try: fail except (Exception, Exception): print('except 2') try: fail except (TypeError, NameError): print('except 3') try: fail except (TypeError, ValueError, Exception): print('except 4')
def printMaximum(num): d = {} for i in range(10): d[i] = 0 for i in str(num): d[int(i)] += 1 res = 0 m = 1 for i in list(d.keys()): while d[i] > 0: res = res + i*m d[i] -= 1 m *= 10 return res # Driver co...
NUMERIC = "numeric" CATEGORICAL = "categorical" TEST_MODEL = "test" SINGLE_MODEL = "single" MODEL_SEARCH = "search" SHUTDOWN = "shutdown" DEFAULT_PORT = 8042 DEFAULT_MAX_JOBS = 4 ERROR = "error" QUEUED = "queued" STARTED = "started" IN_PROGRESS = "in-progress" FINISHED = "finished" # This can be any x where np.exp(...
class TopTen: def __init__(self): self.num = 1 def __iter__(self): return self def __next__(self): if self.num <= 10: val = self.num self.num += 1 return val else: raise StopIteration values = TopTen() print(next(values)) f...
class cached_property: def __init__(self, func): self.__doc__ = getattr(func, "__doc__") self.func = func def __get__(self, obj, cls): if obj is None: return self value = obj.__dict__[self.func.__name__] = self.func(obj) return value
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 def tf_pack_ext(pb): assert (pb.attr["N"].i == len(pb.input)) return { 'axis': pb.attr["axis"].i, 'N': pb.attr["N"].i, 'infer': None }
class ZoomAdminAccount(object): """ Model to hold Zoom Admin Account info """ def __init__(self, api_key, api_secret): self.api_key = api_key self.api_secret = api_secret
#!/usr/bin/python3 ls = [l.strip().split(" ") for l in open("inputs/08.in", "r").readlines()] def run(sw): acc,p,ps = 0,0,[] while p < len(ls): if p in ps: return acc if sw == -1 else -1 ps.append(p) acc += int(ls[p][1]) if ls[p][0] == "acc" else 0 p += int(ls[p][1]) if (ls[p][0...
counter = 0 def merge(array, left, right): i = j = k = 0 global counter while i < len(left) and j < len(right): if left[i] <= right[j]: array[k] = left[i] k += 1 i += 1 else: array[k] = right[j] counter += len(left) - i ...
# Copyright 2004-2008 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) """ This file contains C++ code needed to export one dimensional static arrays. """ namespace = "pyplusplus::conven...
""" This module contains the error messages issued by the Cerberus Validator. The test suite uses this module as well. """ ERROR_SCHEMA_MISSING = "validation schema missing" ERROR_SCHEMA_FORMAT = "'%s' is not a schema, must be a dict" ERROR_DOCUMENT_MISSING = "document is missing" ERROR_DOCUMENT_FORMAT = "'%s' is not a...
# -*- encoding: latin-1 -*- # Latin-1 encoding needed for countries list. """Place names and other constants often used in web forms. """ def uk_counties(): """\ Return a list of UK county names. """ # Based on http://www.gbet.com/AtoZ_counties/ # Updated 2007-10-24 return [x.strip()[2:] for x ...
numeros = [[], []] temp = [] for c in range(1, 8): n = int(input(f'Digite o {c}º numero: ')) if n % 2 == 0: numeros[0].append(n) else: numeros[1].append(n) print('*^^*'*12) print(f'Os valores pares digitados foram {sorted(numeros[0])}') print(f'Os valores impares digitados foram {sorted(num...
class ExtDefines(object): EDEFINE1 = 'ED1' EDEFINE2 = 'ED2' EDEFINE3 = 'ED3' EDEFINES = ( (EDEFINE1, 'EDefine 1'), (EDEFINE2, 'EDefine 2'), (EDEFINE3, 'EDefine 3'), ) class EmptyDefines(object): """ This should not show up when a module is dumped! """ pass
# n = n # time = O(logn) # space = O(1) # done time = 5m class Solution: def firstBadVersion(self, n): """ :type n: int :rtype: int """ left = 1 right = n + 1 while left < right: mid = left + right >> 1 comp = isBadVersion(mid) ...
def fib(n: int) -> int: if n < 2: # base case return n return fib(n - 2) + fib(n - 1) if __name__ == "__main__": print(fib(2)) print(fib(10))
#!/usr/bin/env python3 class ApiDefaults: url_verify = "/api/verify_api_key" url_refresh = "/api/import/refresh" url_add = "/api/import/add"
""" entradas nbilletes50-->int-->n1 nbilletes20-->int-->n2 nbilletes10-->int-->n3 nbilletes5-->int-->n4 nbilletes2-->int-->n5 nbilletes1-->int-->n6 nbilletes500-->int-->n7 nbilletes100-->int-->n8 salidas total_dinero-->str-->td """ n1=(int(input("digite la cantidad de billetes de $50000 "))) n2=(int(input("digite la...
'''Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcule o preço da passagem, cobrando R$0,50 por Km para viagens de até 200Km e R$0,45 para viagens mais longas.''' # Meu num = float(input('Qual a distância da viagem: ')) if num <= 200: print('O valor da passagem é \033[1;33mR${:.2f}\033[m.'....
def display_best_portfolio(portfolio): print(f"\nLe meilleur portefeuille trouvé : \n \nComposition: \n \n{portfolio} \nPour un prix total de {portfolio.price} \nPour un profit total de {portfolio.profit}") def display_best_branch(branch): composition = "" for action in branch.composition: composi...
class Solution(object): def islandPerimeter(self, grid): """ :type grid: List[List[int]] :rtype: int """ sum = 0 for w in range(len(grid)): for h in range(len(grid[0])): if grid[w][h] == 1: add_length = 4 else: continue ...
"""Exceptions raised by this package.""" class MetaloaderError(Exception): """Base exception for all errors within this package.""" class MetaloaderNotImplemented(MetaloaderError): """Something is yet not implemented in the library."""
words = "sort the inner content in descending order" result = [] for w in words.split(): if len(w)>3: result.append(w[0]+''.join(sorted(w[1:-1], reverse=True))+w[-1]) else: result.append(w)
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def __init__(self): self.total = 0 def sumOfLeftLeaves(self, root: TreeNode) -> int: if not root: return 0 ...
""" As Organizações Tabajara resolveram dar um aumento de salário aos seus colaboradores e lhe contraram para desenvolver o programa que calculará os reajustes. Faça um programa que recebe o salário de um colaborador e o reajuste segundo o seguinte critério, baseado no salário atual: salários até R$ 280,00 (incluindo)...
val = list() for i in range(5): val.append(int(input('Entre um inteiro: '))) print('\nMaior valor:', max(val)) print('Posições:', end=' ') for i in range(5): if max(val) == val[i]: print(i, end=' ') print('\n\nMenor valor:', min(val)) print('Posições:', end=' ') for i in range(5): if min(val) == val[i]: pri...
class CalcularMedia: def total(self, a, b, c): p = a + b + c return p def calcular_media(a, b, c): p = a + b + c return p CalcularMedia = CalcularMedia() print('qtd numeros') n = int(input()) nums = [] for i in range(n): print('Digite o {} número'.format(i + 1)) v = int(i...
language_map = { 'ko': 'ko_KR', 'ja': 'ja_JP', 'zh': 'zh_CN' }
# Time: O(n) # Space: O(1) # Given an array nums of integers, you can perform operations on the array. # # In each operation, you pick any nums[i] and delete it to earn nums[i] points. # After, you must delete every element equal to nums[i] - 1 or nums[i] + 1. # # You start with 0 points. # Return the maximum number ...
global numbering numbering = [0,1,2,3] num = 0 filterbegin = '''res(); for (i=0, o=0; i<115; i++){''' o = ['MSI', 'APPV', 'Citrix MSI', 'Normal','Express','Super Express (BOPO)', 'Simple', 'Medium', 'Complex', 'May', 'June', 'July', 'August'] filterending = '''if (val1 == eq1){ if (val2 == eq2){ if (val3 =...
# 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 countUnivalSubtrees(self, root: TreeNode) -> int: self.count = 0 self.is_uni(root) ...
# Copyright 2021 BlobCity, Inc # # 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 in writing,...
#!/usr/bin/env python3 # Label key for repair state # (IN_SERVICE, OUT_OF_POOL, READY_FOR_REPAIR, IN_REPAIR, AFTER_REPAIR) REPAIR_STATE = "REPAIR_STATE" # Annotation key for the last update time of the repair state REPAIR_STATE_LAST_UPDATE_TIME = "REPAIR_STATE_LAST_UPDATE_TIME" # Annotation key for the last email ti...
###################################################################################################################### # Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
{ "targets": [ { "target_name": "ecdh", "include_dirs": ["<!(node -e \"require('nan')\")"], "cflags": ["-Wall", "-O2"], "sources": ["ecdh.cc"], "conditions": [ ["OS=='win'", { "conditions": [ [ "target_arch=='x64'", { "varia...
class Contact: def __init__(self, name, phone, email): self.name = name self.phone = phone self.email = email
""" Discover & provide the log group name """ class LogGroupProvider(object): """ Resolve the name of log group given the name of the resource """ @staticmethod def for_lambda_function(function_name): """ Returns the CloudWatch Log Group Name created by default for the AWS Lambda ...
# class juego: # def __init__(self, tablero): # self.tablero = tablero # for i in self.tablero: # print(i) # def __str__(): # return # def mover(self, letra, posicion): num=[["1","3","4","5"],["8","10","2","6"],["7","9","11"," "]] #t=[["a","h","ñ","u","b","i","o"], ["v"...
''' This module contains some exception classes ''' class SecondryStructureError(Exception): ''' Raised when the Secondry structure is not correct ''' def __init__(self, residue, value): messgae = ''' ERROR: Secondary Structure Input is not parsed correctly. Please make sure th...
class get_method_name_decorator: def __init__(self, fn): self.fn = fn def __set_name__(self, owner, name): owner.method_names.add(self.fn) setattr(owner, name, self.fn)
''' Exercise 2: from a resit paper. You must use the file textanalysis.py to answer this question. Write a function get_words_starting_with(text, letter) that returns the list of words starting with letter in the string text. The result should not be case sensitive, e.g. ’about’ should be returned if the letter ’a’ or ...
# https://www.devdungeon.com/content/colorize-terminal-output-python # https://www.geeksforgeeks.org/print-colors-python-terminal/ class CONST: class print_color: class control: ''' Full name: Perfect_color_text ''' reset='\033[0m' bold='\033[0...
found = False while not found: num = float(input()) if 1 <= num <= 100: print(f"The number {num} is between 1 and 100") found = True
# MathHelper.py - Some helpful math utilities. # Created by Josh Kennedy on 18 May 2014 # # Pop a Dots # Copyright 2014 Chad Jensen and Josh Kennedy # Copyright 2015-2016 Sirkles LLC def lerp(value1, value2, amount): return value1 + ((value2 - value1) * amount) def isPowerOfTwo(value): return (value > 0) an...
## Function def insertShiftArray(arr, num): """ This function takes in two parameters: a list, and an integer. insertShiftArray will place the integer at the middle index of the list provided. """ answerArr = [] middle = 0 # No math methods, if/else to determine odd or even to find middle index ...