content
stringlengths
7
1.05M
#!/usr/bin/python3 #------------------------------------------------------------------------------ class Solution: def romanToInt(self, s): """ :type s: str :rtype: int """ result = 0 for i in range(len(s)): if s[i] =='M': result += 1000 ...
# coding: utf-8 """Module test library.""" __version__ = '0.1-alpha' def keyword(a1='d', *a2): """A keyword See `get hello` for details""" pass def get_hello(): """Get the intialization variables See `importing` for explanation of arguments and `introduction` for introduction""" retur...
class Solution: def findErrorNums(self, nums: List[int]) -> List[int]: """Hash table. """ c = Counter(nums) res = [] m, d = None, None for i in range(1, len(nums) + 1): if i not in c: m = i if i in c and c[i] == 2: ...
""" Module docstring """ def well_formed(): """ Function docstring """ a = attr.string_list() if repr(a) != "<attr.string_list>": fail("Expected attr.string_list instance") a = attr.string_list(mandatory = True, doc = "Some string_list", default = ["foo"]) if repr(a) != "<attr.string_list>"...
""" You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string. You can swap the characters at any pair of indices in the given pairs any number of times. Return the lexicographically smallest string that s can be cha...
#!/usr/bin/env python # coding: utf-8 # vim: ai ts=4 sts=4 et sw=4 nu """ nnnnEmpty modules required for unit tests. """
SECRET_KEY = 'fake-key' ALLOWED_ADMIN_IP_LIST = ['xxx.xxx.xxx.xxx', 'xxx.xx.xx.xx'] MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'admin_ip_restrictor.middleware....
""" 57. Insert Interval https://leetcode.com/problems/insert-interval/ Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Example: Input: intervals = [[1,3],[6,9]], newInterv...
"""fire_incidents_pipeline - An opinionated, minimal cookiecutter template for Python packages""" __version__ = '0.1.0' __author__ = 'Juan Laverde <juanelveerde@outlook.com>' __all__ = []
print('====== DESAFIO 008 ======') medida = float(input('Digite um valor em metros: ')) cm = medida * 100 mm = medida * 1000 print('A medida de {}m corresponde a {:.0f}cm e a {:.0f}mm'.format(medida, cm, mm))
class BaseMatrix: """A basic matrix object class!""" def __init__(self, rows, cols, data = None): self._numRows = rows self._numCols = cols if data == None: self._data = [0]*rows*cols elif len(data)>rows*cols: raise BufferError("data must be able to fit i...
class Solution: def minFallingPathSum(self, A: List[List[int]]) -> int: if not A or not A[0]: return 0 m, n = len(A), len(A[0]) dp = [[0] * n for _ in range(m)] for i in range(m): for j in range(n): if i == 0: dp[i]...
def invoke(pkg): if not (pkg.destdir / "rdeps").is_file(): return pkg.logger.out_plain(" " + (pkg.destdir / "rdeps").read_text())
def flatten(aList): ''' aList: a list Returns a copy of aList, which is a flattened version of aList ''' flat = [] for e in aList: if (isinstance(e, list)): flat.extend(flatten(e)) else: flat.append(e) return flat
""" Copyright (c) 2021 Tilo van Ekeris / TMDT, University of Wuppertal Distributed under the MIT license, see the accompanying file LICENSE or https://opensource.org/licenses/MIT """ class ErrorCode: @staticmethod def extract(args): return args[2][5]
def saludar(): print("hola a todos") saludar() def dibujar_tabla(): for i in range(5): print("5 * {} = {}".format(i, 5 * i)) dibujar_tabla()
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class GcpTagTypeEnum(object): """Implementation of the 'GcpTagTypeEnum' enum. Specifies the tag attribute type of GCP. Going forward, there will be an additional TagTypes for AWS as well. Specifies the type of the tag GCP entity refers to. 'k...
class ProcessedTweet: def __init__(self,term,id_str,text,latitude,longitude,country,state,city,creation_date,polarity,subjectivity,classification,neg_score,pos_score): self.term = term self.id_str = id_str self.text = text self.latitude=latitude self.longitude=longitude ...
__all__ = [ 'AnalyzerUtility', 'CollectorUtility', 'common', 'constant', 'dependency', 'df_utility', 'digit_utility', 'FactorUtility', 'plugin_manager', 'securities_selector', 'TableViewEx', 'task_queue', 'time_utility', 'ui_utility', ]
KBsize = 1024 class ROM: sNES = "NES" # 3 byte def __init__(self, romFile): if (romFile.read(3) == self.sNES): _ = romFile.read(1) self.num16ROMBanks = int(romFile.read(1).encode('hex'), 16) self.num8ROMBanks = int(romFile.read(1).encode('hex'), 16) sel...
# -*- coding: UTF-8 -*- # Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. # If the last word does not exist, return 0. # # Note: A word is defined as a character sequence consists of non-space characters only. # # For example, # Give...
class Comment(object): """Object containing all comment information""" def __init__(self, text: str, author: int, time: float, **kwargs): super(Comment, self).__init__(**kwargs) self.author = author self.text = text self.time = time
# https://codeforces.com/contest/1327/problem/B for _ in range(int(input())): range_n = range(1, int(input()) + 1) available_women = set() available_men = set() for i in range_n: available_women.add(i) available_men.add(i) for woman in range_n: wanted_men = input().split()[1:] for man in wanted_men: ma...
op = 'Ss' c = 1 conth = contma = contmu =0 while op not in 'Nn': idade = int(input(f'{"=" * 40}\n' f'{"CADASTRO DE PESSOAS" :^40}\n' f'{"=" * 40}\n' f'Digite a idade da {c}ª pessoa: ')) sexo = str(input(f'Digite o sexo da {c}ª pessoa [M/F]: ')).s...
# -*- coding:utf-8 -*- """exceptions module""" __all__ = ['TimeframeError', 'SymbolError', 'CurrencyError', 'SideError'] class TimeframeError(ValueError): def __init__(self, timeframe, exchange=None): exchange = f' {str(exchange)}' if exchange else '.' super().__init__(f'{str(timeframe)} is not ...
def evenodd_mergesort(x): if len(x)<=1: return x else: first = evenodd_mergesort(x[:len(x)/2]) second = evenodd_mergesort(x[len(x)/2:]) return evenodd_merge(first + second) def evenodd_merge(x): if len(x) == 2: if x[1]< x[0]: #swap x[0], x[1] = x[1], x[0]...
#!/usr/bin/env python3 __author__ = "Vijini Mallawaarachchi" __copyright__ = "Copyright 2019-2022, GraphBin Project" __credits__ = ["Vijini Mallawaarachchi", "Anuradha Wickramarachchi", "Yu Lin"] __license__ = "BSD-3" __version__ = "1.6.0" __maintainer__ = "Vijini Mallawaarachchi" __email__ = "vijini.mallawaarachchi@a...
class Taxonomy(object): def __init__(self, name, taxons={}): self.name = name self.taxons = taxons def inherit(self, parentTaxonomy): for name, value in parentTaxonomy.get_taxons().iteritems(): if name in self.taxons: continue self.taxons[name] =...
notas = [50, 20, 10, 1] print('{:=^40}'.format(' CAIXA ELETRÔNICO ')) print(f'Cédulas disponíveis: R${notas[0]}.00, R${notas[1]}.00, R${notas[2]}.00 e R${notas[3]}.00') cedulas = [0, 0, 0, 0] valor = int(input('Digite o valor a ser sacado: R$')) print('='*40) for c in range(0, len(notas)): if valor // notas[c] > 0:...
# # PySNMP MIB module ADTRAN-AOS (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-AOS # Produced by pysmi-0.3.4 at Wed May 1 11:13:55 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:...
api_key = "" headers = {} prev_response = {} _base = 'http://api.football-data.org' endpoints = { 'fixture': _base + '/v1/fixtures/{}', 'all_fixtures': _base + '/v1/fixtures/', 'competition': _base + '/v1/competitions/{}', 'all_competitions': _base + '/v1/competitions/', 'comp_teams': _base + '/v1/...
carro = float(input('Qual foi a velocidade do carro? ')) km = 80 m = (carro - km) * 7 if carro > km: print('Voce foi multado, vai pagar R${:.2f}'.format(m)) else: print('Voce não ultrapassou o limite!')
# 1012 A, B, C = input().split(" ") A = float(A) B = float(B) C = float(C) triangle = (A * C) / 2 circle = 3.14159 * C ** 2 trapeze = ((A + B) * C) / 2 square = B * B rectangle = A * B print('TRIANGULO: %.3f' % triangle) print('CIRCULO: %.3f' % circle) print('TRAPEZIO: %.3f' % trapeze) print('QUADRADO: %.3f' % square) ...
def isPrime(n): ''' Checks for a prime number.<br> Input - `n`, any integer <br> Output - boolean value ''' c=0 for i in range(2,n): if n%i==0: c=c+1 if c==0 and n!=1: return 1 else: return 0 ############################### def sum(a,b): ''...
# Bubble Sort arr = [25, 15, -6, 8, 2] n = len(arr) for i in range(0,n-1,1): for j in range(0, n-i-1,1): if arr[j] > arr[j + 1] : arr[j], arr[j + 1] = arr[j + 1], arr[j] print ("Sorted array is:") for i in range(len(arr)): print (arr[i])
class NBCollectionCIException(Exception): pass class InstallException(NBCollectionCIException): pass class InvalidRepoPath(NBCollectionCIException): pass class VENVValidationException(NBCollectionCIException): pass class VENVInstallException(NBCollectionCIException): pass class RendererExc...
# -*- coding: utf-8 -*- class Schema(object): CLONE = "clone" COMMIT = "commit" DATE = "date" HOST = "host" LANGUAGE = "language" REPO = "repo" URL = "url" schemas = [ Schema.HOST, Schema.REPO, Schema.LANGUAGE, Schema.URL, Schema.CLONE, Schema.COMMIT, Schema.D...
""" Lecture 8 Functions return function should always be the last command in function """ #positional argument def my_function(a, b): result = a + b print('a is',a) print('b is',b) return result print(my_function(2, 1)) def my_function(a, b=0): result = a + b print('a is',a) print('b is'...
# Copyright (c) 2021, salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause """ This implementation is modified from https://github.com/BouchardLab/DynamicalComponentsAnalysis/tr...
def get_sync_data(): return { "status": "success", "data": { "id": 61, "label": None, "schedule_frequency": "never", "schedule_day": None, "schedule_hour": None, "schedule_minute": None, "created_at": "2021-10-22T00...
class TestConceptsSearch: def test_concepts_search(self, client): res = client.get("/concepts?search=science") json_data = res.get_json() assert json_data["meta"]["count"] == 125 assert "science" in json_data["results"][0]["display_name"].lower() for result in json_data["resu...
class Solution: def isValid(self, s): """ :type s: str :rtype: bool """ if not s: return True s = list(s) my_stack = [] if s[0] in [')', ']', '}']: return False for i in range(len(s)): if s[i] in ['(', '[', '...
# -*- coding: UTF-8 -*- # ------------------------------------------------------------------------------- # Name: fixtures # Purpose: fixtures for testing # # Author: Evgeniy Semenov # # Created: 25.03.2019 # Copyright: (c) evgeniy.semenov 2019 # Licence: MIT # --------------------------------...
# Settings used to fill the XML with data settings = { "product_page_url_prefix": "https://www.mysite.com/myproducts/", "filters": { "fieldType": ["Variant"], "name": ["Name1"] }, "category": "Product Category" }
class MinHeap: def __init__(self, heap, heap_size=None): self.heap = heap self.heap_size = heap_size if heap_size else len(heap) self.build() def left(self, index): left_index = 2 * index if left_index > self.heap_size: return None return left_index ...
class Token: def __init__(self, literal): self.literal = literal def __repr__(self): return f"{self.__class__.__qualname__}({self.literal})" class ILLEGAL(Token): def __init__(self, literal): self.literal = literal class EOF(Token): def __init__(self): self.literal = ...
class mockLight: def __init__(self): self.color = None self.curR = None self.curG = None self.curB = None def testInput(self, r, g, b, colorName): if isinstance(r, int) & isinstance(g, int) & isinstance(b, int) & isinstance(colorName, str): if 0 <= r <= 255 ...
""" Imagens vetoriais nao perdem qualidade quando sao redimensionadas, no exmeplo que se segue o redimensionamento e feito atraves da variável especial mouseX e a funçao shapeMode e utilizada para desenhar a forma no centro da tela ao inves do padrao, canto superior esquerdo""" network = None def setup(): global ...
#!/usr/bin/env python3 n = int(input()) a = n // 2 a = a * 2 print(n == a)
""" Hackerrank Problem: https://www.hackerrank.com/challenges/zipped/problem """ # Read in the input values for how many lines to read n, x = map(int, input().split(" ")) scores = [] # Iterate through inputs and get the number of scores for i in range(x): input_scores = list(map(float, input().split(" "))) scor...
class Solution: def moveZeroes(self, nums): """ Do not return anything, modify nums in-place instead. """ cnt = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[cnt] = nums[cnt], nums[i] cnt += 1 if __name__ == "__main_...
class LineFeeder: def __init__(self, parts): self.parts = parts self.number = 0 def read(self) -> str: return self.parts[self.number] def pop(self) -> str: text = self.parts[self.number] self.number += 1 return text def back(self): if self.numbe...
#!/usr/bin/env python # -*- coding: utf-8 -*- class PyOWMError(Exception): """Generic base class for PyOWM exceptions""" pass class ConfigurationError(PyOWMError): """Generic base class for configuration related errors""" pass class ConfigurationNotFoundError(ConfigurationError): """Raised whe...
""" Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Example 1: Input: [1,3,5,6], 5 Output: 2 Solution: 1. linear search 2. binary search """ # linear search # Time-...
# Set Stock Symbol as the index listings = listings.set_index('Stock Symbol') # Get ticker of the largest consumer services company listed after 1997 ticker = listings.loc[(listings.Sector == 'Consumer Services') & (listings['IPO Year'] > 1998), 'Market Capitalization'].idxmax() # Set the start date start = date(1998...
colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} ans = 1 while ans == 1: ch, n1, n2 = 4, 0, 0 while ch == 4: n1 = int(input("Enter a number:...
class Subject: def register_observer(): raise NotImplementedError def remove_observer(): raise NotImplementedError def notify_observers(): raise NotImplementedError class Observer: def update(): raise NotImplementedError class DisplayElement: def display(): ...
r1 = float(input('primeiro segmento ')) r2 = float(input('degundo segmento ')) r3 = float(input('terceiro segmento ')) if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2: print('Os segmento acima podem formar um triangulo ', end='') if r1 == r2 == r3: print('EQILATERO!') elif r1 != r2 != r3 != r1: ...
class Solution: def countDigitOne(self, n): ones, m = 0, 1 while m <= n: ones += (n//m + 8) // 10 * m + (n//m % 10 == 1) * (n%m + 1) m *= 10 return ones
def combination(n, m): if m == 0: return 1 if m == 1: return n if n == m: return 1 return combination(n-1, m) + combination(n-1, m-1) def factorial(n): if n == 0: return 1 sumBuf = 1 while n > 0: sumBuf = sumBuf * n n = n -1 return sumBuf ...
""" # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children """ class Solution: def levelOrder(self, root: 'Node') -> List[List[int]]: if not root: return [] q = deque([root]) ans = [] ...
"""No library.""" class BadCellException(Exception): """ BadCellException. This class exception is raise when a bad cell is selected. """ pass
VERSION = (0, 1, 1) GEO_LEVEL_COUNTRY = 0 GEO_LEVEL_REGION = 1 GEO_LEVEL_CITY = 2 LISTINGS_GEO_LEVELS = ( (GEO_LEVEL_COUNTRY, 'Country'), (GEO_LEVEL_REGION, 'Region'), (GEO_LEVEL_CITY, 'City') )
class InteractionAdapter: def agent_reset(self, agent, data): return agent.new_episode() def env_reset(self, env, state): return env.reset() def agent_act(self, agent, state): return agent.act(state) def env_step(self, env, action): return env.step(action) def ag...
n = int(input()) fs = [i*i for i in range(224)] dp = [4 for x in range(n+1)] visit = [0 for x in range(n+1)] dp[0] = 0 dp[1] = 1 exNum = 50000**2 for i in range(1, n+1): minNum = exNum j = 1 while(not visit[i] and fs[j] <= i): minNum = min(dp[i-fs[j]], minNum) j = j+1 visit[i] = 1 ...
welcome_text = '''********\U0001F389\U0001F389\U0001F389\U0001F389********\n 欢迎 @{}{} 加入本群!\n 新人进群请按群规修改昵称:\n 昵称|专业领域|擅长框架&语言&当前工作 \n 其中两个符号|为半角管道符 \n\n 更多帮助请看群公告,或者@ IT群助手 并发送:help\n *******************************''' kickout_final_text = ''' 经{}次提醒后不予理会,很遗憾要将下列群员一脚踢开/:bye: {}{} ''' kickout_last_warning_text =...
class PaginatedResult(object): """ An instance of this class is returned from paginated operations """ def __init__(self, total_items, page_size, current_page): self.total_items = total_items self.page_size = page_size self.current_page = current_page
# Ejercicio 3 # Localiza el error en el siguiente bloque de código. # Crea una excepción para evitar que el programa se bloquee y además explica en un mensaje al usuario la causa y/o solución: # colores = { 'rojo':'red', 'verde':'green', 'negro':'black' } # colores['blanco'] colores = { 'rojo':'red', 'verde':'green', ...
""" Spearman's rank correlation coefficient Link: https://www.hackerrank.com/challenges/s10-spearman-rank-correlation-coefficient """ def rank(X): """ Return the rank of each element in X """ sorted_X = sorted(X) rank = [0]*len(X) for i in range(len(X)): # since index is zero-based, plu...
# coding:utf-8 # 功能:获取配置参数的全局变量 # # import os config = { # 上报openstack名称的默认时间间隔 "host": "192.168.118.10", "port": 32102, "username": "admin", "password": "Rc9xv1SFCfoS+7wmfNS7pQ==", "interval": 30, "request_timeout": 60, "log_path": r'C:/', "log_level": "debug", ...
""" Enunciado Faça um programa que peça para o usuário digitar um número n e imprima uma lista com todos os números de 0 a n-1. Exemplo: se o usuário digitar 5, o programa deve imprimir [0, 1, 2, 3, 4] """ lista = [] n = int(input("Digite um número: ")) for c in range(0, n): lista.append(c) print(lista)
SUCCESS = "SUCCESS" FAILURE = "FAILURE" MISSING = "MISSING" START = "START" PROCESSING_TIME = "PROCESSING_TIME" def event_label(event): """Format event constants for Slack e.g. from `MISSING` to `*Missing*` """ return "{}".format(event.lower().title())
horas = int(input("Informe quantas horas você correu: ")) minutos = int(input("Informe também a quantidade de minutos: ")) segundos = int(input("E a quantidade de segundos: ")) horas_seg = horas * 3600 minutos_seg = minutos * 60 total_seg = horas_seg + minutos_seg + segundos print(f"Você correu um total de {total_seg...
# # PySNMP MIB module BROCADE-NP-TM-STATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BROCADE-NP-TM-STATS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:41:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
""" Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target, if it's parent node becomes a leaf node and has the value target, it should also be deleted (you need to continue doing that until you can't). Example 1: Input: ro...
n = int(input()) even = set() odd = set() for row in range(1, n + 1): name = input() ch_sum = sum([ord(ch) for ch in name]) value = ch_sum // row if value % 2 == 0: even.add(value) else: odd.add(value) even_sum = sum(even) odd_sum = sum(odd) result = set() if odd_sum == even_sum...
"""Zero Plentiful Code Kata, codewars.""" def zero_plentiful(arr): """.""" four_zero_plus = 0 count = 0 if arr == [0]: return 0 if len(arr) == arr.count(0): return 1 for idx, el in enumerate(arr): if el == 0: count += 1 if el != 0 or idx == len(n) - 1...
a1 = int(input('Primeiro termo: ')) r = int(input('Razão: ')) c = 0 c2 = 10 d = 0 while d == 0: while c < 10: print(a1,end=' -> ') a1 += r c += 1 if c == c2: c2 += int(input('PAUSA \nMais termos? 0 para encerrar. ')) if c2 == c: d = 1 while c < c2: ...
#link: https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/solution/ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): de...
PALETTES = [ ['NES_PALETTE_SMOOTH', 'Smooth (FBX)'], ['NES_PALETTE_CLASSIC', 'NES Classic (FBX)'], ['NES_PALETTE_COMPOSITE', 'Composite Direct (FBX)'], ['NES_PALETTE_PVM_D93', 'PVM Style D93 (FBX)'], ['NES_PALETTE_PC10', 'PC-10'], ['NES_PALETTE_SONY_CXA', 'Sony CXA'], ['NES_PALETTE_WAVEBEAM', 'Wavebeam'], ] if ...
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] for v in range(0, 3): for h in range(0, 3): matriz[v][h] = int(input(f'Posição [{v}, {h}]: ')) for vert in range(0, 3): for hori in range(0, 3): print(f'[{matriz[vert][hori]:^5}]', end='') print()
""" * Assignment: Unpack ParameterSyntax Mixed * Complexity: easy * Lines of code: 1 lines * Time: 2 min * Warning: This assignment will work only in Python 3.8+ English: 1. Create function `compute` 2. Function takes 4 arguments `a, b, c, func` and always returns `None` 3. Arguments `a, b, c` must be pass...
class Holder(object): """ A credit card holder. """ def __init__(self, first, last, street, post_code): """ Attaches holder data for later use. """ self.first = first self.last = last self.street = street self.post_code = post_code def __repr_...
''' Created on Sep 12, 2011 @author: Nich ''' vowels = ('a', 'e', 'i','o', 'u') #fuck y double_vowels = ('ea', 'ee', 'oo', 'ou') def makeVariants(word): variants = [] return variants def makeInflections(word): inflections = {} if word.category == "NOUN": #do plural inflections["plura...
class LoginException(Exception): def __init__(self, msg): super().__init__("Error while logging in: {}".format(msg)) class LoginUnknownError(LoginException): def __init__(self, matrix_exc): msg = "Unknown error, check debug log" if hasattr(matrix_exc, "code"): msg += " (co...
""" PASSENGERS """ numPassengers = 34614 passenger_arriving = ( (6, 10, 10, 7, 12, 4, 2, 4, 7, 2, 1, 0, 0, 12, 12, 6, 6, 9, 3, 4, 1, 2, 1, 0, 0, 0), # 0 (8, 15, 5, 5, 10, 2, 8, 2, 3, 0, 3, 0, 0, 11, 8, 8, 6, 7, 3, 3, 0, 2, 4, 2, 0, 0), # 1 (8, 11, 5, 12, 12, 5, 5, 4, 4, 1, 4, 1, 0, 10, 8, 7, 5, 9, 11, 6, 0, 4, ...
def a1_foo(): # reiz: tp ... def ___foo(): # reiz: tp ... def a2_foo_bar(): # reiz: tp ... def a__foo____(): # reiz: tp ... def aa1_foo(): ... def aa1foo(): ... def __afoo_bar(): ...
description = 'Temporary setup for the mota controller at AMOR' includes = ['detector_stage'] devices = dict( nu = device('nicos_sinq.amor.devices.logical_motor.DetectorAngleMotor', description = 'Intended detector angle', com = 'com', coz = 'coz', coz_scale_factor = 4100, ...
def count_words(filepath, words_list): """ [According documentation style 'numpydoc' at MODULE level] Terminal command | pyment -w -o numpydoc inches_to_feet.py Flags -w | overwrite -o <style> | styleput in NumPy documentation style Parameters ---------- filepath : <type...
''' fatiamento de strings com python ''' nome = 'Jose Dembo' vetor = [[10, 20, 30], 1, 4, 5, 7] print(nome[:5]) print(vetor[0][1:]) # pega o primeiro elemeto do vetor(outro vetor), # e ai pega novamente do segundo ao último elemento print(nome[::2]) # os '::' servem quando queremos pular elementos, indicando os espaç...
''' Faça um programa para imprimir: 1 2 2 3 3 3 ..... n n n n n n ... n para um n informado pelo usuário. Use uma função que receba um valor n inteiro e imprima até a n-ésima linha. ''' def matrizN(n): l=1 c=n matriz=[] for l in range(l): for c in range(1,c+...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def fibonacci(n): """ object: fibonacci(n) returns the first n Fibonacci numbers in a list input: n- the number used to calculate the fibonacci list return: retList- the fibonacci list """ if type(n) != int: print(n) print(":inp...
"""Something wrong with Leetcode's testing""" class Solution(object): def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ parts = S.split('-') words = list() buff = list() for i in xrange(len(parts)-1, -1, -1): ...
greet = ' *Hello bob* ' # strip() remove beginning and ending whitespace greet_new = greet.strip() #lstrip() remove left whitespace greet_new1 = greet.lstrip() #rstrip() remove right whitespace greet_new2 = greet.rstrip() print(greet_new) print(greet_new1) print(greet_new2)
# -*- coding: utf-8; -*- # # @file descriptorstypes.py # @brief Setup the types of descriptors. # @author Frédéric SCHERMA (INRA UMR1095) # @date 2017-01-03 # @copyright Copyright (c) 2017 INRA/CIRAD # @license MIT (see LICENSE file) # @details DESCRIPTORS = { 'organisations_types': { 'id': None, ...
"""djver - Ever wanted to know what version of Django someone else is running?""" __version__ = '0.1.0' __author__ = 'Brenton Cleeland <brenton@brntn.me>' __all__ = []
# # PySNMP MIB module Nortel-Magellan-Passport-UtpDpnTrunksMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-UtpDpnTrunksMIB # Produced by pysmi-0.3.4 at Wed May 1 14:28:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davw...
class ContaCorrente: def __init__(self, conta, nome, saldo=0): self.conta = conta self.nome = nome self.saldo = saldo def setNome(self, nome): self.nome = nome def depositar(self, dep): self.saldo += dep def sacar(self, saque): if saque >...
# coding: utf8 """Text Utils""" def get_code_point(char: str) -> str: """ Get Character unicode codepoint Args: char (str): single character Returns: str """ return '%04x' % ord(char)
#coding=utf-8 #需正确填写app对应的keystore信息 keystorePath = "你的.keystore" keyAlias = "android.keystore" keystorePassword = "XXXXXX" keyPassword = "XXXXXX" #加固后但未使用360签名的源apk(即只使用360软件加固,但不使用360软件签名的apk) protectedSourceApkName = ".apk" #需正确填写你安装的 Android SDK buidtools path please use above 25.0+ sdkBuildToolPath = "/Users/zhu...