content
stringlengths
7
1.05M
class Solution: def checkValidString(self, s: str) -> bool: left_count = 0 star_count = 0 for char in s: if char == '(': left_count += 1 elif char == '*': star_count += 1 else: if left_count > 0: ...
class SanSize(int): """ Size in bytes Range : [0..2^63-1]. """ @staticmethod def get_api_name(): return "san-size"
class FibonacciTable: def __init__(self): self.forward_look_up_table = {0: 0, 1: 1} self.backward_look_up_table = {0: 0, 1: 1} def _build_lookup_table(self, fib_index: int) -> None: if fib_index in self.forward_look_up_table.keys(): return current_highest_index = m...
# Given an array of ints length 3, return an array with the elements "rotated # left" so {1, 2, 3} yields {2, 3, 1}. # rotate_left3([1, 2, 3]) --> [2, 3, 1] # rotate_left3([5, 11, 9]) --> [11, 9, 5] # rotate_left3([7, 0, 0]) --> [0, 0, 7] def rotate_left3(nums): nums.append(nums.pop(0)) return nums print(rotate...
""" This module provides procedures to check if an instance describes preferences that are single-crossing. """ def isSingleCrossing(instance): """ Tests whether the instance describe a profile of single-crossed preferences. :param instance: The instance to take the orders from. :type instance: preflibtools.inst...
#!/usr/bin/env python3 # Parse input lines = [] with open("10/input.txt", "r") as fd: for line in fd: lines.append(line.rstrip()) illegal = [] for line in lines: stack = list() for c in line: if c == "(": stack.append(")") elif c == "[": stack.append("]") ...
class Node: def __init__(self, data): self.data = data self.next = None class Queue: def __init__(self): self.front = self.back = None def isEmpty(self): return self.front == None def EnQueue(self, item): temp = Node(item) if(self.back == None): ...
#/* *** ODSATag: RFact *** */ # Recursively compute and return n! def rfact(n): if n < 0: raise ValueError if n <= 1: return 1 # Base case: return base solution return n * rfact(n-1) # Recursive call for n > 1 #/* *** ODSAendTag: RFact *** */ #/* *** ODSATag: Sfact *** */ # Return n! def sfact(n): ...
""" Range range(stop) range(start, stop) range(start, stop, step) start = 0 step = 1 - iterable object - string is iterable """ r = range(5, 10, 2) print(r.start) print(r.stop) print(r.step)
# https://www.hackerrank.com/challenges/ctci-is-binary-search-tree """ Node is defined as class node: def __init__(self, data): self.data = data self.left = None self.right = None """ arr = [] inlen = 0 def checkBST(root): global arr if root is None: return True if chec...
nome = str(input("Qual é seu nome? ")) if nome == 'César': print("Que nome lindo!!") elif nome == "Enzo": print('Caralho mlk') elif nome in "Paula Bruna Marcela": print("Olha que coisa mais linda e mais cheia de graça...") else: print("Nomezinho xexelento viu..") print("Tenha um bom dia {}.".format(nome...
r1, c1 = map(int, input().split()) r2, c2 = map(int, input().split()) if abs(r1 - r2) + abs(c1 - c2) == 0: print(0) exit() # Move if abs(r1 - r2) + abs(c1 - c2) <= 3: print(1) exit() r3 = r2 t = abs(r1 - r2) if abs(c1 + t - c2) < abs(c1 - t - c2): c3 = c1 + t else: c3 = c1 - t # Bishop warp ...
age = 10 num = 0 while num < age: if num == 0: num += 1 continue if num % 2 == 0: print(num) if num > 4: break num += 1
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 25 19:01:56 2019 @author: joscelynec """ """ Iterative Binary Search of a Sorted Array Adapted from: https://codereview.stackexchange.com/questions/117180/python-2-binary-search """ def binary_search(array, value): start, stop = 0, len(array) ...
# -*- coding: utf-8 -*- """ Created on Tue Dec 24 15:29:32 2019 @author: mwhitten """ def g2d1(Fy, Aw, Cv): """Nominal shear strength The nominal shear strength, Vn, of unstiffened or stiffened webs, according to the limit states of shear yielding and shear buckling, is Vn = 0.6*Fy*Aw*Cv...
# This is Stack build using Singly Linked List class StackNode: def __init__(self, value): self.value = value self._next = None class Stack: def __init__(self): self.head = None # bottom self.tail = None # top self.size = 0 def __len__(self): return sel...
def create_data(n): temp = [i for i in range(n)] return temp n = 100 target = n + 11 ma_list = create_data(n) def binary_search(input_list,target): found = False low = 0 high = len(input_list) - 1 mid = int((high + low) / 2) while (low <=high) and (not found): curr = input_list[mi...
# @Author: Ozan YILDIZ@2022 # Simple printing operation val = 12 if __name__ == '__main__': #print operation print("Boolean True (True)", val)
#!/usr/bin/env python3 # Oppgave av Stian Knudsen # 2.a # x = 10 print("{:<21}{}".format("x = 10 :", "Datatypen til x er int")) # x = 10 + 10 print("{:<21}{}".format("x = 10 + 10 :", "Datatypen til x er int")) # x = 5.5 print("{:<21}{}".format("x = 5.5 :", "Datatypen til x er float")) # x = 10 + 5.5 print("{:<21}{}"....
class FlightParsingConfig(object): """ Configuration for parsing an IGC file. Defines a set of parameters used to validate a file, and to detect thermals and flight mode. Details in comments. """ # # Flight validation parameters. # # Minimum of fixes required before takeoff for fil...
"""URL creator for the evergreen API.""" class UrlCreator: """Class to create evergreen URLs.""" def __init__(self, api_server: str) -> None: """ Initialize a url creator. :param api_server: Hostname API server to connect to. """ self.api_server = api_server def ...
# Fonte: https://leetcode.com/problems/contains-duplicate-ii/ # Autor: Bruno Harlis # Data: 21/09/2021 """ PROBLEMA PROSPOSTO: Dado um array inteiro nums e um inteiro k, retorna true se houver dois índices distintos i e j no array tal nums[i] == nums[j] e abs(i - j) <= k. Exemplo 1: Entrada: nums = [1,2,3,1], k = 3 ...
#http://shell-storm.org/shellcode/files/shellcode-103.php """ \x7f\x45\x4c\x46\x01\x01\x01\x09\x00\x00\x00\x00\x00\x00\x00\x00 \x02\x00\x03\x00\x01\x00\x00\x00\x74\x80\x04\x08\x34\x00\x00\x00 \xa8\x00\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x02\x00\x28\x00 \x05\x00\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x80\x04\x...
#Finding least trial def least_trial_num(n): #making 1000001 size buffer buffer = [] for i in range(1000001): buffer += [0] #Minimum calculation of 1 is 0 times. buffer[1] = 0 #Minimum calculations of other values for i in range(2, n + 1): #Since calculations of...
#!/usr/local/bin/python3 # -*- coding: utf-8 -*- """ Date: 2019/11/27 Author: Xiao-Le Deng Email: xiaoledeng at gmail.com Function: get a list of each line in the file """ def read_file_to_list(file): """Return a list of each line in the file""" result=[] with open(file,'rt',encoding='utf-8') as f: ...
# environment variables ATOM_PROGRAM = '/home/physics/bin/atm' ATOM_UTILS_DIR ='/home/physics/bin/pseudo' element = "Al" equil_volume = 16.4796 # general calculation parameters calc = {"element": element, "lattice": "FCC", "xc": "pb", "n_core": 3, "n_val": 2, "is_spin_pol": Fa...
idir="<path to public/template database>/"; odir=idir+"output/"; public_dir='DPA_contest2_public_base_diff_vcc_a128_2009_12_23/' template_dir='DPA_contest2_template_base_diff_vcc_a128_2009_12_23/' template_index_file=idir+'DPA_contest2_template_base_index_file' public_index_file=idir+'DPA_contest2_public_base_inde...
def getNoZeroIntegers(self, n: int) -> List[int]: for i in range(1, n): a = i b = n - i if "0" in str(a) or "0" in str(b): continue return [a, b]
province = input('Enter you province: ') if province.lower() == 'surigao': print('Hi, I am from Surigao too.') else: print(f'Hi, so your from { province.capitalize() }')
def print_num(n): """Print a number with proper formatting depending on int/float""" if float(n).is_integer(): return print(int(n)) else: return print(n)
PrimeNums = [] Target = 10001 Number = 0 while len(PrimeNums) < Target: isPrime = True Number += 1 for x in range(2,9): if Number % x == 0 and Number != x: isPrime = False if isPrime: if Number == 1: False else: PrimeNums.append(Number) print...
# SET MISMATCH LEETCODE SOLUTION: # creating a class. class Solution(object): # creating a function to solve the problem. def findErrorNums(self, nums): # creating multiple variables to store various sums. actual_sum = sum(nums) set_sum = sum(set(nums)) a_sum = len(...
def modulo_pastel(key: int) -> str: """ Select a pastel color on a modulo cycle. Args: key (int): The index modulo index. Returns: str: The selected RGB pastel color code. """ hex_codes = [ "957DAD", "B5EAD7", "C7CEEA", "D291BC", "E0BBE4"...
# Copyright 2020 The Pigweed Authors # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
""" Copyright (C) 2004-2010 by Rong ZhengQin <rongzhengqin@honortech.cn> Distributed with BSD license. All rights reserved, see LICENSE for details. """
""" Bonus task: load all the available coffee recipes from the folder 'recipes/' File format: first line: coffee name next lines: resource=percentage info and examples for handling files: http://cs.curs.pub.ro/wiki/asc/asc:lab1:index#operatii_cu_fisiere https://docs.python.org/3/library/io.html https://do...
# Escreva um programaque leia a velocidade de um carro. Se ele ultrapassar 80Km/h, # moostre uma mensagem que ele foi multado. A multa vai custar R$7,00 por cada # Km acima do limite. velocidade = float(input('Qual a velocidade atual do veículo? ')) if velocidade > 80: print('VOCÊ FOI MULTADO! Pois você excedeu o...
s = input() t = input() print()
def front_back(str): if len(str) < 2: return str n = len(str) first_char = str[0] last_char = str[n-1] middle_chars = str[1:(n-1)] return last_char + middle_chars + first_char
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 3 11:54:10 2022 @author: mariaolaru """ def get_next_trial_params(df_trials, max_amp, STIM_AMP_INTERVAL, STIM_FREQ_INTERVAL, init_stim_freq, entrain_trial_kernel): #Place holder algorithm for now t = df_trials['entrained'].count()-1 c...
''' Mr. X's birthday is in next month. This time he is planning to invite N of his friends. He wants to distribute some chocolates to all of his friends after party. He went to a shop to buy a packet of chocolates. At chocolate shop, each packet is having different number of chocolates. He wants to buy such a packet wh...
# print ("hello world") # import sys # print(sys.version) # columns = [0,2,4,6,8,10,12,14,16,18,20,22,24,25,27,29,31,33,35,37,39,41,43,45,47,49,50,52,54,56,58,60,62,64,66,68,70,72,74,75,77,79,81,83,85,87,89,91,93,95,97,] for x in range(0, 125): print('P[c:{0}] (0,255,0), '.format(x%125), end='') # Green print...
class Morse: DOT = '.' DASH = '-' characters = { (DOT, DASH): 'A', (DASH, DOT, DOT, DOT): 'B', (DASH, DOT, DASH, DOT): 'C', (DASH, DOT, DOT): 'D', (DOT,): 'E', (DOT, DOT, DASH, DOT): 'F', (DASH, DASH, DOT): 'G', (DOT, DOT, DOT, DOT): 'H', ...
n = 5 # limit or size for x in range(1, n + 1): print(" " + str(2 * x - 1), end="") """ OUTPUT: 1 3 5 7 9 """
""" @Author: huuuuusy @GitHub: https://github.com/huuuuusy 系统: Ubuntu 18.04 IDE: VS Code 1.39 工具: python == 3.7.3 """ """ 思路: 滑动窗口 结果: 执行用时 : 1320 ms, 在所有 Python3 提交中击败了38.54%的用户 内存消耗 : 17.4 MB, 在所有 Python3 提交中击败了5.79%的用户 """ class Solution: def findMaxAverage(self, nums, k): res = _sum = su...
# ScalePairs.py # Chromatic definitions of different scale types # Guide: # C:1, Db:2, D:3, Eb:4, E:5, F:6, Gb:7, G:8, Ab:9, A:10, Bb:11, B:12 scalePairs = [] # Copied from NodeBeat's "NodeBeat Classic" scalePairs += [("KosBeat\nClassic", [1, 3, 6, 8, 10])] scalePairs += [("Major", [1, 3, 5, 6, 8, 10, 12])] scalePair...
# ================================== # Author : fang # Time : 2020/5/28 14:33 # Email : zhen.fang@qdreamer.com # File : config.py # Software : PyCharm # ================================== TOKEN_SIGN = "ihudongketang" TOKEN_ALGORITHM = 'HS256' TOKEN_EXP = 86400 # token超时时间(/s) 60 * 60 * 24(一天) ORIGINAL_PW...
valores = [] impares = [] pares = [] while True: valor = int(input('Digite um valor: ')) valores.append(valor) if valor % 2 == 0 and valor != 0: pares.append(valor) else: impares.append(valor) continuar = input('Quer continuar [S/N] ') str(continuar) while continuar != 's'...
# # PySNMP MIB module TIMETRA-SAS-FILTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-SAS-FILTER-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:21:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
# Singleton (from guido) class Singleton(object): def __new__(cls, *args, **kwds): it = cls.__dict__.get("__it__") if it is not None: return it cls.__it__ = it = object.__new__(cls) it.init(*args, **kwds) return it def init(self, *args, **kwds): pass ...
""" Complete game implementations/engines. """
""" Asylo-specific copts. Flags specified here should not affect any ABI, but may influence warnings and optimizations. They are used on top of any flags provided by the crosstool in use and are intended to be only used within the Asylo project (not affecting consumers of the Asylo project). """ # Customization of c...
class Node: def __init__(self, type_, arity: int, value=None): self.type = type_ self.arity = arity self.value = value self.children = [] def __repr__(self): return "<Node {t} {v} {c}>".format(t=self.type, v=self.value, c=self.children) def _pprint(self, level): ...
"""Helper classes for defining translations between .stat file of different formats.""" class Function(object): """Define a column which is actually a function of other columns""" def __init__(self, fn, *input_arg_names): self.fn = fn self.input_arg_names = input_arg_names def __call__(sel...
#!/usr/bin/python3 def readfile(filename): ''' :param filename: input is a text file for input :return: Equations: lines with potential equations on them num_line: number of equation lines ''' # open file with open(filename, mode='r') as f: line_l...
# Configuration file for ipython-notebook. c = get_config() # ------------------------------------------------------------------------------ # NotebookApp configuration # ------------------------------------------------------------------------------ c.GitHubConfig.access_token = '' c.JupyterApp.answer_yes = True c.L...
# # PySNMP MIB module JUNIPER-WX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-WX-GLOBAL-REG # Produced by pysmi-0.3.4 at Mon Apr 29 19:50:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, M...
# # 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, software # distributed under the ...
float_types = ['x', 'y', 'alt', 'md'] valid_columns = { 'name': [ 999.999 ], 'field': [ 'field', 'месторождение', 'мр', 'м/р', ], 'well': [ 'well', 'скважина', 'скв', 'скв.', '№ скв.', '№ скв.', 'скв.', ...
class Point: def __init__(self, x, y): self.x = x self.y = y def __str__(self): return f'Точка: ({self.x}, {self.y})' def __add__(self, other): return Point(self.x + other.x, self.y + other.y) def distance(self): return (self.x ** 2 + self.y ** 2) ** 0.5 d...
# -*- coding: utf-8 -*- """ hon.structure.readme ~~~~~ The structure module for parsing the README.md file. """ def parse_readme(app, text): pass
def f(n): if n <=0: return 1 res = 0 for i in range(n): res += f(i) * f(n-i-1) return res
# # PySNMP MIB module TPLINK-CLUSTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-CLUSTER-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:24:19 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
v = int(input('Velocidade do carro ao passar no radar = ')) m = v-80 if v > 80: print('O carro estava acima da velocidade permitida') print('A multa irá custar R${}'.format(m*7))
x = 1 # int print(type(x)) x = 1.1 # float print(type(x)) x = 1 + 2j # complex number print(type(x)) print(10 + 3) print(10 - 3) print(10 * 3) print(10 / 3) print(10 // 3) print(10 % 3) print(10 ** 3) x = 10 x = x + 3 x += 3 print(x)
## Python Crash Course # Exercise 3.10: Every Function: # Think of something you could store in a list. # For example, you could make a list of mountains, rivers, countries, cities, languages, or any- thing else you’d like. # Write a program that creates a list contain...
S = input() d = {} c = 0 t = '' for i in range(len(S)): if S[i] != 'w': if c > 0: if t != '': d.setdefault(c, []) d[c].append(t) t = '' c = 0 t += S[i] elif S[i] == 'w': c += 1 if c > 0 and t != '': d.setdefault...
nome = '' idade = 0 sexo = '' soma_idade = 0 idade_mais_velho = 0 homem_mais_velho = '' cont = 0 for i in range(4): nome = input('Escreva o nome: ').strip() idade = int(input('Escreva a idade: ')) sexo = input('Escreva o sexo M ou F: ').upper().strip() soma_idade += idade if sexo == 'F' and idade < ...
__title__ = 'mudrex' __version__ = '0.1.2' __summary__ = 'Send external webhook signals to Mudrex platform.' __uri__ = 'https://github.com/surajiyer/mudrex' __author__ = 'Suraj Iyer' __email__ = 'me@surajiyer.com' __license__ = 'MIT'
""" Exercício 3 Faça um programa em Python que recebe um número inteiro e imprime seu dígito das dezenas. Observe o exemplo abaixo: Exemplo 1: Entrada de Dados: Digite um número inteiro: 78615 Saída de Dados: O dígito das dezenas é 1 Exemplo 2: Entrada de Dados: Digite um número inteiro: 2 Saí...
num = int(input('Digite um número: ')) if num < 20: print(f'{num} é menor que 20') elif num > 20: print(f'{num} é maior que 20') else: print(f'{num} é igual a 20')
c = 0 while c < 10: print(c) c = c + 1 print('FIM')
''' @description 【Python知识补充】get和set方法 2019/10/05 14:48 ''' class Plane(object): def __init__(self): # TODO: 存活状态 self.alive = True # TODO: 累计积分 self.score = 0 # TODO: 更改存活状态 def set_alive(self, value): self.alive = value if value == False: ...
class Request: def __init__(self, start, end): self.start = start self.end = end def __str__(self): return f'Request:{self.start},{self.end}' def Is_compatible(self, request): return request.start > self.end or request.end < self.start '''This Algorithm give 0...
# # PySNMP MIB module NSCRTV-ROOT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NSCRTV-ROOT # Produced by pysmi-0.3.4 at Wed May 1 14:25:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
S = input() S = S.replace('BC', 'D') cnt_a = 0 ans = 0 for i in range(len(S)): if S[i] == 'A': cnt_a += 1 elif S[i] == 'D': ans += cnt_a else: cnt_a = 0 print(ans)
#zip my_list = [1,2,3] your_list = [100,200,300] their_list = [1000,2000,3000] print(list(zip(my_list, your_list, their_list))[0][2]) print(list(zip(my_list, your_list, their_list)))
# https://leetcode.com/problems/minimum-falling-path-sum-ii/ # Given a square grid of integers arr, a falling path with non-zero shifts is a # choice of exactly one element from each row of arr, such that no two elements # chosen in adjacent rows are in the same column. # Return the minimum sum of a falling path with...
""" 83. 删除排序链表中的重复元素 https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/ """ class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def deleteDuplicates(head: ListNode): if head == None: return None # slow为慢指针,fast为快指针 slow = hea...
# Configuration # [Yoshikawa Taichi] # version 1.3 (Jan. 28, 2020) class Configuration(): ''' Configuration ''' def __init__(self): # ----- k-means components ----- ## cluster numbers self.centers = 3 ## upper limit of iterations self.upper_limit_...
""" Initialize a Metadata object once and access the respective metadata as public variables. Following are the variable names: owner table = owner_metadata auto_sale table = auto_sale_metadata restriction table = restriction_metadata driving_condition table = driving_condition_metadata ticket table = t...
################### PEAK FINDING ################### # 1D peak finding COMPLEXITY --> O(theta)(log n) def peak_1D(l): if len(l) == 1: # if a singleton list then simply returns the element return l[0] elif not len(l): # if a null list then returns None ...
# problem : https://leetcode.com/problems/binary-tree-postorder-traversal/ # time complexity : O(N) # data structure : stack # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def postord...
""" 抽象工厂方法--对象创建型模式 1. 目标 定义一个用于创建对象的接口, 让子类决定实例化哪一个类, 使一个类的实例化延迟到子类。 """ class CakeFactory(object): def make_cake(self): print('make a cake') class CreamCakeFactory(CakeFactory): def make_cake(self): print('make a cream cake') return CreamCake() class FruitCakeFactory(CakeFactory...
# # PySNMP MIB module GARP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GARP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:04:38 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...
# Construct arrays of data: dems, reps dems = np.array([True] * 153 + [False] * 91) reps = np.array([True] * 136 + [False] * 35) def frac_yea_dems(dems, reps): """Compute fraction of Democrat yea votes.""" frac = np.sum(dems) / len(dems) return frac # Acquire permutation samples: perm_replicates perm_repl...
class IIDError: INTERNAL_ERROR = 'internal-error' UNKNOWN_ERROR = 'unknown-error' ERROR_CODES = { 400: 'invalid-argument', 401: 'authentication-error', 403: 'authentication-error', 500: INTERNAL_ERROR, 503: 'server-unavailable' }
a, b, n = (int(i) for i in raw_input().split()) if n == 1: print(a) elif n == 2: print(b) else: for x in range(2, n): tn = a + b*b a = b b = tn print(tn)
# Copyright BigchainDB GmbH and BigchainDB contributors # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 class BigchainDBError(Exception): """Base class for BigchainDB exceptions.""" class CriticalDoubleSpend(BigchainDBError): """Data integrity error that req...
# Name : Exercise7-2.py # Author : Ryan Carr # Date : 02/03/19 # Purpose : Open a file, calculate average spam confidence # Display result to user # Text files are stored in the data folder one level up filename = input('Enter a filename: ') if filename == 'mbox-short.txt': filename = '../data/mbo...
sexo = str(input('Informe seu sexo [M/F]: ')).upper().strip()[0] while sexo not in 'MmFf': sexo = str(input('Informação incorreta, digite novamente [M/F]: ')).upper().strip()[0] print(f'Obrigado! Seu sexo foi computado como {sexo}!')
# # PySNMP MIB module CISCO-BITS-CLOCK-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-BITS-CLOCK-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:34:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
def allASDTIRpairs(): """ Iterate through all possible ASD TIR pairs and find the ones with the highest average binding energies with host TIRs We wish to find the ASDs that do not bind well with the host translation initiation regions to assure orthogonality of the ribosomes, so here we choose the...
# https://www.acmicpc.net/problem/16167 class Node: def __init__(self, node, cost): self.node = node self.cost = cost def __lt__(self, other): return self.cost < other.cost def bfs(): queue = __import__('collections').deque() queue.append(1) cnt = 1 while queue: ...
LEVEL_MAP = [ ' ', ' ', ' XX ', ' XX XXX XX XX ', ' XX P XX ', ' XXXX XX XX ', ' XXXX XX ...
{ 'targets': [ { 'target_name': 'example1', 'sources': ['manifest.c'], 'libraries': [ '../../target/release/libnapi_example1.a', ], 'include_dirs': [ '../napi/include' ] } ] }
# Crie um programa que receba do usuário 5 números inteiros e os exiba na tela na ordem contrária a que foi inserido. A leitura dos números deve ser feita em uma função e a exibição dos valores em ordem contrária deve ocorrer em outra função. def inteiro(n): l = [] for i in n: l.append(int(i)) print(l) def ...
#!/usr/bin/python3 Rectangle = __import__('1-rectangle').Rectangle my_rectangle = Rectangle(4) print("{} - {}".format(my_rectangle.width, my_rectangle.height))
# Problem 1 - Paying Debt off in a Year def calculateBalance(balance, annualInterestRate, monthlyPaymentRate): ''' Input: balance: integer or float - the outstanding balance on the credit card annualInterestRate: float - annual interest rate as a decimal monthlyPaymentRate: float - mi...
# ControlRequest RESPONSE_sendControlRequestTrue = ( 'CMD M601 Received.\r\nControl Success V2.1.\r\nok\r\n' ) RESPONSE_sendControlRequestFalse = ( 'CMD M601 Received.\r\nControl failed.\r\nok\r\n' ) # ControlRelease RESPONSE_sendControlRelease = ( 'CMD 602 Received.\r\nok\r\n' ) # InfoRequest RESPONSE_s...