content
stringlengths
7
1.05M
num1 = input() num2 = input() print(num1+num2)
#!/usr/bin/env python # coding:utf-8 """ function: @author: zkang kai @contact: 474918208@qq.com """ class strategy_center(object): """ 用来管理所有加载的策略 """ def __init__(): pass def add_strategy(): """ 加载新的策略 """ pass def delete_strategy(): """ ...
# Word Pattern 290 # ttungl@gmail.com class Solution(object): def wordPattern(self, pattern, str): """ :type pattern: str :type str: str :rtype: bool """ # sol 1 s = pattern t = str.split() return map(s.find, s)==map(t.index, t) ...
"""**TODO** .. autosummary:: :toctree: Ord """ class Ord(): """**TODO**"""
__author__ = "Nicolas Delplanque" __credits__ = ["Nicolas Delplanque"] __version__ = "1.0.1" __maintainer__ = "Nicolas Delplanque" __email__ = "nicolas.delplanque@student.umons.ac.be" class Ope: pass
""" Module to handle data operations for freqtrade """ # limit what's imported when using `from freqtrade.data import *` __all__ = [ 'converter' ]
#Maze 2020 history module prev_driven = [] prev_tile = [] def add_driven(new): prev_driven.append(new) def add_tile(new): prev_tile.append(new) def get_last_drive(): return prev_driven[-1] def get_last_tile(): return prev_tile[-1]
pytest_plugins = ['errbot.backends.test'] extra_plugin_dir = 'plugins' def test_cloudcv_lowercase(testbot): testbot.assertCommand('what is cloudcv?', 'cloudcv is always written with a lower case c') def test_cep(testbot): testbot.assertCommand('what is a CEP?', ...
helpstring = "part <channel>" minlevel = 4 arguments = ["self", "args"] def main(connection, args) : """Parts from the specifed channel""" connection.rawsend("PART %s \n" % (args[1]))
''' Created on 1.12.2016 @author: Darren '''''' Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). The above rectangle (with the red border) is defined by (row1, col1) = (2, 1) and (row2, col2) =...
class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items) - 1] def size(self): ...
num = 10 num3 = 20 num2 = 20 num4 = 50 num5 =100 num7 = 10000
# Cell if __name__ == "__main__" and not IN_NOTEBOOK: args = parse_args(sys.argv[1:]) config = {} if args.config: with open(args.config) as f: config.update(json.load(f)) hparams = HParams(**config) if hparams.data_sub == None: positions, randomindices = subset_data(hp...
# Deaarrollo de funciones def digit(a): if a == '0' or a == '1' or a == '2' or a == '3' or a == '4' or a == '5' or a == '6' or a == '7' or a == '8' or a == '9': return True else: return False def main(): # Entrada while True: letter = input('Ingrese un caracter: ') if le...
""" http://adventofcode.com/2017/day/5 """ def escapeMaze(numList): count = 1 instructions = numList[:] currentPos = 0 currentJump = instructions[currentPos] nextPos = currentPos+currentJump while ((currentPos>=0) & (currentPos<len(numList))): instructions[currentPos]+=1 #update jump ...
class Solution: def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]: dic = {} # First we add all people into dictionary where key will be the group size. for i in range(len(groupSizes)): if groupSizes[i] in dic: dic[groupSizes[i]].append(i) ...
lines = [li for li in open("input.txt").read().split()] # apparently readlines() was not working ok then pos = [0, 0] trees = 0 while pos[0] < len(lines): if lines[pos[0]][pos[1]] == "#": trees += 1 pos[0] += 1 pos[1] = (pos[1] + 3) % len(lines[0]) print(trees)
class TwoDArray(object): """ A class representing a 2D array. The first index is the row number, and the second is the column number. """ def __init__(self, dimensions, oned_list=None): """ Initialize the 2D array. dimensions should be a tuple with the number of rows a...
DEBUG = True THREADS_PER_PAGE = 2 CSRF_ENABLED = True DB_URL = 'http://localhost:5984' GOOGLE_OAUTH2_SCOPE = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email' GOOGLE_OAUTH2_URL = 'https://accounts.google.com/o/oauth2/' GOOGLE_API_URL = 'https://www.googleapis.com/oauth...
''' Create a game rank from a win-loss record Status: Accepted ''' ############################################################################### def main(): """Read input and print output""" rank_stars = [5] * 11 + [4] * 5 + [3] * 5 + [2] * 5 rank, stars, last3 = 25, 0, '' for game in input(): ...
x = 1 def __dir__(): return ['a', 'b', 'c'] def __getattr__(name): if name == "yolo": raise AttributeError("Deprecated, use whatever instead") return f"There is {name}" y = 2
TYPE_WEIGHTS = [5 * 10 ** 17, 2 * 10 ** 18] GAUGE_WEIGHTS = [2 * 10 ** 18, 10 ** 18, 5 * 10 ** 17] def test_total_weight(accounts, chain, gauge_controller, three_gauges): gauge_controller.add_gauge(three_gauges[0], 0, GAUGE_WEIGHTS[0], {'from': accounts[0]}) assert gauge_controller.get_total_weight() == (G...
# Copyright 2020 Traceable, 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 w...
class Solution: def searchMatrix(self, matrix, target) -> bool: m, n = len(matrix), len(matrix[0]) if len(matrix) > 0 else 0 if m == 0: return False i, j = m - 1, 0 while i >= 0 and j < n and matrix[i][j] != target: if matrix[i][j] > target: i ...
class Display: def __init__(self, width=1, height=1): self.grid = [] if width < 1 or height < 1: raise Exception('width and height must both be > 0') self.width = width self.height = height for y in range(height): row = [] for x in range...
class node: def __init__(self, id, heuristic, f): self.id=id self.heuristic=heuristic self.totalCost=0 self.f=f self.parent=None def setParent(self,parent): self.parent=parent def __lt__(self, other): return self.f < other.f def __repr__(self): ...
# i=1 # while i<=100: # print(i) # i=i+1 i=1 while i<=100: if i%5==0 and i%15==0: print("navgur") elif i%5==0: print(i,"nav") elif i%15==0: print(i,"gurkul") i=i+1
""" Greater Common Divisor. Wikipedia reference: https://en.wikipedia.org/wiki/Greatest_common_divisor """ def gcd(a, b): """Calculate Greater Common Divisor (GCD).""" return b if a == 0 else gcd(b % a, a) def main(): """Call GCD Function.""" try: nums = input("Enter two Integers separated ...
DATA = [ { "Url": "http://actransit.org/stops-closed-bancroft-at-dana-and-ellsworth", "NoticeText": "Due to construction, lines 6, 36, 51B, 52, 79, 604, 605, 851 ", "Title": "Stops Closed Bancroft at Dana and Ellsworth", "PostDate": "2019-05-31T16:10:01", "ImpactedRoutes": [ ...
# Time: O(n * 4^n) # Space: O(n) class Solution(object): # @return a list of strings, [s1, s2] def letterCombinations(self, digits): if not digits: return [] lookup, result = ["", "", "abc", "def", "ghi", "jkl", "mno", \ "pqrs", "tuv", "wxyz"], ...
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class Dbow2(CMakePackage): """DBoW2 is an improved version of the DBow library, an open source C++ library for in...
# Affine Cipher def egcd(a, b): x,y,u,v = 0,1,1,0 while a!=0: q, r = b//a, b%a m, n = x-u*q, y-v*q b,a, x,y, u,v = a,r, u,v, m,n gcd = b return gcd, x, y def modinv(a, m): gcd, x, y = egcd(a, m) if gcd != 1: return None # modular inverse does ...
class BaseError(Exception): pass class UnauthorizedError(BaseError): pass class WrongFormatInputError(BaseError): pass class ContactsLimitExceededError(BaseError): pass
""" Napisz program, który pobiera od użytkownika liczbę N, następnie tworzy słownik z kluczami od 1 do N z wartościami, które są kwadratami kluczy. """
"""Constants for Bravia TV integration.""" ATTR_CID = "cid" ATTR_MAC = "macAddr" ATTR_MANUFACTURER = "Sony" ATTR_MODEL = "model" CONF_IGNORED_SOURCES = "ignored_sources" BRAVIA_COORDINATOR = "bravia_coordinator" BRAVIA_CONFIG_FILE = "bravia.conf" CLIENTID_PREFIX = "HomeAssistant" DEFAULT_NAME = f"{ATTR_MANUFACTURER} ...
def jp(input, d, n): tmp = [] for s in input: try: tmp.append([helper(s, d)]) except: pass input = tmp while True: hasChanged = False res = [] for l1 in input: flag = False for l2 in res: if check(l1,...
""" Vision manager. """ class VisionManager: """ Keeps track of vision components """ def __init__(self): # Map of bot name and its location. self.locations = {} # How many bots are registered via vision system. self.counter = 0 def update_location(self, bot_name, ...
# 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 class Solution: def isPowerOfTwo(self, n): """ :typ...
def sequenzenfinder(gen, seq): copy = gen displ = 0 indizes = [] while True: if seq in copy: index = copy.index(seq) indizes.append(index+displ) copy = copy[index+1:] displ += index+1 else: return indizes filename = 'LongCovi...
#SimaDinisVC on GitHub dicionario = {2:['Inglês', 'Física-Química', 'Progr. e Sist.', 'Ed. Física'], 3:['Área de Integração', 'TIC', 'Português', 'Física-Química', 'Matemática'], 4:['Matemática', 'Progr. e Sist.'], 5:['Progr. e Sist.', 'Física-Química', 'Português', 'SEMat'], 6:['Inglês', 'Área de Integração', 'Sistema...
tasks = { 'calclib' : { 'features' : 'cshlib', 'source' : 'calclib/**/*.c', 'ver-num' : '1.2.4', }, 'printlib' : { 'features' : 'cstlib', 'source' : 'printlib/**/*.c', 'configure' : [ dict(do = 'check-headers', names = 'stdio.h'), ], ...
# -*- config:utf-8 -*- DEBUG = True TESTING = False
# -*- coding: utf-8 -*- """ ytelapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Status1Enum(object): """Implementation of the 'Status1' enum. Status to set the in-progress call to Attributes: CANCELED: TODO: type description ...
# ====================================================================== # Program Alarm # Advent of Code 2019 Day 02 -- Eric Wastl -- https://adventofcode.com # # Computer simulation by Dr. Dean Earl Wright III # ====================================================================== # =======================...
description = 'Detector stage' pvprefix = 'SQ:AMOR:motserial:' devices = dict( com = device('nicos_ess.devices.epics.motor.EpicsMotor', description = 'Detector tilt', motorpv = pvprefix + 'com', errormsgpv = pvprefix + 'com-MsgTxt', ), coz = device('nicos_ess.devices.epics.motor.Ep...
def solve(): n = int(input()) ans = [[0] * 10 for _ in range(n)] ans[0][1:] = [1] * 9 for i in range(1, n): ans[i][0] = ans[i - 1][1] for j in range(1, 9): ans[i][j] = ans[i - 1][j - 1] + ans[i - 1][j + 1] ans[i][9] = ans[i - 1][8] print(sum(ans[-1]) % 1000000000)...
# Python3 def chessKnight(cell): col, row = ord(cell[0]) - ord('a'), int(cell[1]) - 1 count = 0 for c, r in [(-1, 2), (1, 2), (-1, -2), (1, -2), (-2, 1), (2, 1), (-2, -1), (2, -1)]: if 0 <= (col + c) < 8 and 0 <= (row + r) < 8: count += 1 return count
''' Crie um programa que leia um número inteiro e mostre na tela se ele é PAR ou ÍMPAR.''' n1 = int(input('digite um numero inteiro para analise se o numero é impar ou par por favor,\n : ')) print('-*'*30) r1 = n1 % 2 if r1 >0: print('seu numero é IMPAR por que o resto da divisão é {}'.format(r1)) else: pri...
n = int(input("Digite o valor de n: ")) impar = 1 i = 1 while i <= n: print(impar) impar = impar + 2 i = i + 1
def subarraySort(array): minUnsorted = float("inf") maxUnsorted = float("-inf") for i in range(len(array)): num = array[i] if isUnsorted(i, num, array): minUnsorted = min(minUnsorted, num) maxUnsorted = max(maxUnsorted, num) if minUnsorted == float("inf") or maxUn...
num=int(input("enter the number :")) i=1 n={} while i<=num: square=i**2 n[i]=square i=i+1 print(n)
def index_is_in_range(index, length): return 0 <= index < lenght tanks = input().split(", ") commands_count = int(input()) for _ in range(commands_count): args = input().split(", ") command = args[0] if command == "Add": tank_name = args[1] if tank_name in tanks: print('T...
# source: https://www.bilibili.com/video/av21540971/?p=25 def insert_sort(alist): """select sort best: O(n) worst: O(n^2) stable """ n = len(alist) # 从右无序序列取多个元素 for j in range(1, n): # i 代表内层循环起始值 # 从右选1元素(i),插入正确位置 for i in range(j, 0, -1): if alis...
# # PySNMP MIB module ENLOGIC-PDU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENLOGIC-PDU-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:03:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
class Solution: def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ jump_table = {} def deepJump(idx): # if have already jumping if jump_table.get(str(idx), False) == False: jump_table[str(idx)] = True ...
# -*- coding: utf-8 -*- class ShiftType(object): def __init__(self, name, time, not_followed_by): self.name = name self.time = time self.not_followed_by = not_followed_by self.cover_requirements = [] def can_follow(self, shift): return self.name not in shift.not_followe...
# Query modes ASYNC_QUERY = 'broker' TALARIA_INDEXER = 'indexer' TALARIA_SERVER = 'server' ASYNC_INITIALIZED = 'INITIALIZED' ASYNC_RUNNING = 'RUNNING' ASYNC_COMPLETE = 'COMPLETE' ASYNC_FAILED = 'FAILED' TALARIA_KEY = 'talaria' TALARIA_SERVICE = 'talaria' # Talaria task filters ALL_LEADERS = 'ALL' WAITING_LEADERS =...
# model model = Model() start = Input("start", "TENSOR_FLOAT32", "{}") limit = Input("limit", "TENSOR_FLOAT32", "{}") delta = Input("delta", "TENSOR_FLOAT32", "{}") out = Output("output", "TENSOR_FLOAT32", "{8}") model = model.Operation("RANGE_EX", start, limit, delta).To(out) input0 = {start: [1], limit...
# calculate body mass in squared metres # weight 65 # height 180 # bmi 20.06 weight = float(input("weight in kg ")) height = float(input("height in cm ")) # bmi = weight / height # bmi - kg / m2 heightsquare = (height * height) # to calulate heightsqaure multiply height by height bmi = round(weight / heightsquar...
# Crie um programa que tenha uma função fatorial() que receba dois parametros: # o primeiro que indique o número a calcular e o outro chamado show, que será um valor # lógico (opcional) indicando se será mostrado ou não na tela o processo de cálculo # do fatorial. def fatorial(n, show=False): """ farotial() C...
# Worked out from https://raganwald.com/2017/04/30/transducers.html # JS -> Python conversion. def reduceWith(reducer, seed, iterable): """ reduceWith takes reducer as first argument, computes a reduction over iterable. Think foldl from Haskell. reducer is (b -> a -> b) Seed is b iterable is [a...
class Solution: def fullJustify(self, words: List[str], maxWidth: int) -> List[str]: count, cur_words = 0, [] res = [] for word in words: if count+ len(word) + len(cur_words) > maxWidth: spaces = maxWidth - count if len(cur_words) == 1: ...
# # PySNMP MIB module Nortel-Magellan-Passport-PorsTrunksMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-PorsTrunksMIB # Produced by pysmi-0.3.4 at Wed May 1 14:28:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
__author__ = 'Jan Růžička' __email__ = 'jan.ruzicka01@gmail.com' __version__ = '0.1' tree = ast[print('Hello world!')] print(dump[q[print(u[tree])]])
# Programa que calcula o fatorial de um número inserido pelo usuário. n = int(input('Digite o valor a ser calculado o fatorial: ')) i = n fat = 1 while i != 0: fat = fat * i i = i - 1 # end-while print('Resultado do fatorial de {} com while: {}.'.format(n, fat)) # Mesmo exercício, apenas usando a estrutura F...
class IConvertible: """ Defines methods that convert the value of the implementing reference or value type to a common language runtime type that has an equivalent value. """ def GetTypeCode(self): """ GetTypeCode(self: IConvertible) -> TypeCode Returns the System.TypeCode for this instance. Re...
img_wink_png_map = bytes([ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x32, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x3f, 0x88, 0xb1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0...
# o grafo supõe valores de vértices de 0 a N class Matriz(): def __init__(self, v, tipo): self.v = v self.tipo = tipo self.rep = 'matriz' self.matriz = [] self.linha_matriz = [] self.weight = [] for i in range(0, self.v): linha_matriz = [] ...
class VertexError(Exception): """顶点相关错误""" class VertexTypeError(VertexError): """顶点类型错误""" class NetworkError(Exception): """网异常""" class CannotConnectNetworkError(NetworkError): """试图将两个网络合并时产生的异常""" class RepeatVertexesError(VertexError): """同一网络下顶点重复导致的异常""" class VertexDifferentNetwor...
for i in range(1,16+1): if i%3==0 or i%5==0: print('fizz'*(i%3==0) + 'buzz'*(i%5==0)) else: print(i)
"""https://leetcode.com/problems/contains-duplicate/ Constraints: - 1 ≤ nums.length ≤ 105 - -109 ≤ nums[i] ≤ 109 Examples: >>> Solution().containsDuplicate([]) False """ class Solution: def containsDuplicate(self, nums: list[int]) -> bool: return contains_duplicate(nums) def contains_...
N = input() def counter(string): count = 0 for i in string: if i=='0' or i=='6' or i=='9': count += 6 elif i=='1': count += 2 elif i=='2' or i=='3' or i=='5': count += 5 elif i=='4': count += 4 elif i=='7': ...
''' Created on 29 Mar 2021 @author: thomasgumbricht ''' __version__ = '0.9.0' VERSION = tuple( int(x) for x in __version__.split('.') ) metadataD = { 'name':'numpyproc', 'author':'Thomas Gumbricht', 'author_email':'thomas.gumbricht@gmail.com', 'title':'numpyproc', 'label':'Spatial data processing using...
TEST_PATH = 'tests/text.txt' TEST_PURGE_PATH = 'text.txt' TEST_PURGE_PATH_1 = '1_text.txt' TEST_TEXT = 'text for the test' TEST_CHANGE_TEXT = 'some data to be written to the file' TEST_DIR_PATH = './' TEST_DIR_PATH_1 = './tests/test_a' TEST_DIR_PATH_2 = './tests/test_b' TEST_FILE_PATH = '/a.txt' TEST_FILE_PATH_1 = '/b....
num = 0 for c in range(1, 7): c = int(input('Digite um número inteiro: ')) if c % 2 == 0: num += c print('A soma dos números pares que você digitou é: {}'.format(num))
def extractTheludicroushattertranslationsWordpressCom(item): ''' Parser for 'theludicroushattertranslations.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('The Sales Executive\'s ...
TYPEID_ASDU = { 0x01: 'M_SP_NA_1 (1)', 0x03: 'M_DP_NA_1 (3)', 0x05: 'M_ST_NA_1 (5)', 0x07: 'M_BO_NA_1 (7)', 0x09: 'M_ME_NA_1 (9)', 0x0D: 'M_ME_NC_1 (13)', 0x1E: 'M_SP_TB_1 (30)', 0x1F: 'M_DP_TB_1 (31)', 0x24: 'M_ME_TF_1 (36)', 0x25: 'M_IT_TB_1 (37)', 0x2D: 'C_SC_NA...
""" .. todo:: WRITEME """ def is_iterable(obj): """ Robustly test whether an object is iterable. Parameters ---------- obj : object The object to be checked. Returns ------- is_iterable : bool `True` if the object is iterable, `False` otherwise. Notes --...
# # PySNMP MIB module MBG-SNMP-LT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MBG-SNMP-LT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:10:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
class Solution: """ @param grids: a matrix of integer @return: return a boarder sort matrix """ def BoarderSort(self, grids): # write your code here n = len(grids) rowStart = colStart = 0 rowEnd = colEnd = n - 1 while rowStart <= rowEnd and colStart <= colEnd:...
# Time: O(min(n, h)), per operation # Space: O(min(n, h)) # # Design a data structure that supports the following two operations: # # void addWord(word) # bool search(word) # search(word) can search a literal word or a regular expression string containing only letters a-z or .. # A . means it can represent any one le...
""" 29 - Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar os 80 km/h, mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$ 7,00 por cada quilômetro acima do limite. """ v = float(input('Qual é a velocidade atual do carro, em Km/h? ')) if v > 80: print(f'\33[31;7mMULTADO!\...
def binary_search_iterative(target: int, nums: list[int]) -> int: s_idx = 0 e_idx = len(nums) - 1 while s_idx <= e_idx: mid = (e_idx - s_idx + 1) // 2 + s_idx if target == nums[mid]: return mid elif target < nums[mid]: e_idx = mid - 1 else: ...
class UnknownWrapper(object): """ Wraps objects the marshaler should marshal as a VT_UNKNOWN. UnknownWrapper(obj: object) """ @staticmethod def __new__(self, obj): """ __new__(cls: type,obj: object) """ pass WrappedObject = property( lambda self: object(),...
# init mon = int(input("Enter monitor cost> ")) sys = int(input("Enter system unit cost> ")) key = int(input("Enter keyboard cost> ")) mou = int(input("Enter mouse cost> ")) num = int(input("Enter PC's number> ")) # out print("\nAll cost = %i$" % ((mon + sys + key + mou) * num))
x=set() y=set() include=[] for i in range(8): a,b=map(int,input().split()) include.append((a,b)) x.add(a) y.add(b) flag=1 if len(x)!=3 or len(y)!=3: flag=0 else: notinclude=[] x=sorted(x) y=sorted(y) for i in x: for j in y: if (i,j) not in include: ...
# Desafio nº 8 - Escreva um programa que leia um valor em metros e o exiba convertido em centímetros e milímetros. distancia = float(input('Insira um número em metros: ')) centimetros = distancia*100 milimetros = distancia*1000 print('A medida de {:.0f} metros corresponde a: \n{:.0f} centímetros \n{:.0f} milímetros!'...
def get_bloodlines(data, cur): for bloodlineID in data: obj = data[bloodlineID] cur.execute('INSERT INTO BloodLines Values(?, ?, ?)', [bloodlineID, obj.get('type'), obj.get('owner')] ) members = obj.get('member') if not isinstance(members, list): ...
def format_audit_message(error_message, user_message): message = error_message if user_message: message = message + ('\n' if message else '') + user_message return message
""" Model for DHCD DFD api """ APP_ID = 'bit4kvfmq' # TODO commented out mappings are b/c we are currently not using the # data from these other tables. When we want to add additional # data from these fields, we should uncomment them. TABLE_ID_MAPPING = { 'Projects' : 'bit4krbdh', ...
def convert_log_finished(out): re_compile = re.compile('\| Finished') # Finished matches = re_compile.findall(out) if matches: return {'par' : "100"} else: return None def convert_log_cycles(out): # {'wtime': '2020-05-17 14:44:15.342858', 'par': '100.0', 'frame': '0', 'mem': '151.45M', 'elapsed': '00:0...
m: int; n: int somalinha: float m = int(input("Qual a quantidade de linhas da matriz? ")) n = int(input("Qual a quantidade de colunas da matriz? ")) matriz: [[float]] = [[0 for x in range(n)] for x in range(m)] vetor: [float] = [0 for x in range(m)] for i in range(m): print(f"Digite os elementos da {i + 1} a. linha...
#conversão de temperatura c = float(input('Digite a temperatura em graus celsius: ')) f = (c*9/5) + 32 print('{} graus Celius é equivalente a {} Fahrenheit'.format(c, f))
def speed_test(model, iterations = 100): model.eval() input = torch.randn(1,3,1024,2048).to(device) with torch.no_grad(): torch.cuda.synchronize() torch.cuda.synchronize() t_start = time.time() for _ in range(20): model(input) torch.cuda.synchronize() torch.cuda.synchronize() ela...
# ######################## 公有实例变量(字段) ######################## # class Foo: # def __init__(self, name): # self.name = name # self.age = 123 # # def func(self): # print(self.name) # # # obj = Foo('张凯雄') # print(obj.name) # print(obj.age) # obj.func() # ######################## 私有实例变量(私有字...
class Incrementors: def increment(self, inValue): print('increment inValue', inValue) return inValue + 1
t=int(input()) s=[] se=set() for i in range(t): n=int(input()) for j in range(n): s.append(set(input())) se=s[0] for k in range(1,n): se=se.intersection(s[k]) print(len(se)) se=set() s=[]
#时间:2020.10.5 01点51分 #author by wmt #模拟交通警察的雷达测速仪。输入汽车速度,如果速度超出60 mph,则显示“Speeding”,否则显示“OK”。 #输入在一行中给出1个不超过500的非负整数,即雷达测到的车速。 #在一行中输出测速仪显示结果,格式为:Speed: V - S,其中V是车速,S或者是Speeding、或者是OK。 speed=int(input()) if speed<=60: print("Speed: %d - %s" %(speed,"OK")) else: print("Speed: %d - %s" %(speed,"Speeding"))
''' 1. Write a Python program to check whether two given circles (given center (x,y) and radius) are intersecting. Return true for intersecting otherwise false. Sample Output: True False 2. Write a Python program to compute the digit distance between two integers. The digit distance between two numbers is the a...
"""Provide a scene per viewpoint filter class for template-based file export. Copyright (c) 2021 Peter Triesberger For further information see https://github.com/peter88213/PyWriter Published under the MIT License (https://opensource.org/licenses/mit-license.php) """ class ScVpFilter(): """Filter Scene ...