content
stringlengths
7
1.05M
"""Constants of the aqara protocol""" MCAST_ADDR = "224.0.0.50" MCAST_PORT = 4321 LISTEN_IP = "0.0.0.0" LISTEN_PORT = 9898 GATEWAY_PORT = 9898 AQARA_DEVICE_HT = 'sensor_ht' AQARA_DEVICE_MOTION = 'motion' AQARA_DEVICE_MAGNET = 'magnet' AQARA_DEVICE_SWITCH = 'switch' AQARA_DEVICE_GATEWAY = 'gateway' AQARA_SWITCH_ACT...
a = 1 b = 2 c = 3 dd = 4 efg = 6666
""" Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. """ class Solution(object): def generateParanthesisHelper(self, left, right, current, result, n): if right == 0: result.append(current) if left > 0: self.generatePara...
class Solution(object): def twoSum(self, nums: list[int], target: int) -> list[int]: """ :type nums: List[int] :type target: int :rtype: List[int] """ dict = {} for index,number in enumerate(nums): if number in dict: retur...
meu_diionario = {1 : 'Fabio', 2: 'Maria', 3 : 'José'} print(type(meu_diionario)) print(meu_diionario[3]) usuarios = { 10000: 'Joao Victor Lopes dos santos'} print(usuarios[10000]) for chave, valor in meu_diionario.items(): print(valor) #get() print(meu_diionario.get(2)) #len() print(len(meu_diionario)) #pop() m...
""" Backend structure of web application AutoGram. .. module:: backend :platform: Unix :synopsis: Backend structure of web application AutoGram. .. moduleauthor:: Jakub Drahos <drahoja9@fit.cvut.cz>, Dominika Kralikova <kralidom@fit.cvut.cz> """ class AlgorithmTypes: """ Simple enum class represe...
def listify(obj): """ Wraps all non-list or tuple objects in a list; provides a simple way to accept flexible arguments. """ if obj is None: return [] else: return obj if isinstance(obj, (list, tuple, type(None))) else [obj]
peptide = 'NIIDV' #peptide = 'NQEL' #peptide = 'MPYENCCCWMFNIRKGQPDFFRKGAVPYVVPMNCIRWS' #peptide = 'HCKCDMKGWECEWSGRKDFTNYESSQLDGRTKMIHSCCK' amino_acid_mass = {'G':57,'A':71,'S':87,'P':97,'V':99,'T':101,'C':103,'I':113,'L':113, 'N':114,'D':115,'K':128,'Q':128,'E':129,'M':131,'H':137,'F':147, ...
""" Events and global state for controlling the validation actions. """
# Matrix Search # https://www.interviewbit.com/problems/matrix-search/ # # Write an efficient algorithm that searches for a value in an m x n matrix. # # This matrix has the following properties: # # Integers in each row are sorted from left to right. # The first integer of each row is greater than or e...
# We need to support # if, else, while, or, and, print, input, int # readSankya # # if-then # # ఒకవేల (నెల == 2) అయితే: # ==> # if(నెల == 2): # regex = r"(?m)^(\s*)ఒకవేల(\s*)(\(.*\))(\s*)అయితే(\s*):" # test_str = " ఒకవేల (నెల == 2) అయితే:" subst = "\\1if\\3:" # # else # # కాకపోతే : # ==> # else: ...
def iterator_mean(iterator): n = 0 sum_value = 0.0 for value in iterator: sum_value += value n += 1 return sum_value / n
''' ex001: Crie um programa que escreva “Olá, Mundo” na tela ''' print('{}{}{}'.format('\033[1;34m', 'Olá, mundo!', '\033[m'))
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack Foundation # # 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 # # Unle...
#!/usr/bin/env python3 #------------------------------------------------------------------------------- # Optimal Solution O(n) #------------------------------------------------------------------------------- class Solution: def productExceptSelf(self, nums): """ :type nums: List[int] :rty...
# Time Complexity: O(n) # Space Complexity: O(1) def is_duplicate(input_string): if len(input_string)>256: return True flags = [False]*256 for char in input_string: if not flags[ord[char]]: flags[ord[char]] else: return True return False
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def cusip_check(cusip: str) -> bool: if len(cusip) != 9: raise ValueError('CUSIP must be 9 characters') cusip = cusip.upper() total = 0 for i in range(8): c = cusip[i] if c.isdigit(): v = int(c) elif c.isalpha(...
def resolve(): ''' code here ''' S = input() N = len(S) a_list = [ 0 for _ in range(N+1)] for i in range(N): if S[i] == '<': a_list[i+1] = a_list[i] + 1 # print(a_list) for i in range(N): if S[-1*(i+1)] == '>': a_list[-1*(i+2)] = max(a_list...
# function my_fun def myfun(): # return 1 return 1 # call myfun myfun()
# Global tax rate taxRate = 0.13 # Data fields used for the item class class Item: def __init__(self, info): self.number = info[0:4] self.intNumber = int(self.number.strip()) self.name = info[8:19].strip() self.price = info[24:30] self.floatPrice = float(self.pri...
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ # Quick exit if not prices: return 0 # First transaction going forward min_price = sys.maxint max_profit = 0 profits = [] ...
# BOJ 10250 # bjHotel T = int(input()) for _ in range(T): h, w, n = map(int, input().split()) res = "" cnt = 1 while n > h: n -= h cnt += 1 res += str(n) if cnt < 10: res += "0" res += str(cnt) else: res += str(cnt) print(res)
# Definition for a binary tree node class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # @param A : root node of tree # @return a list of integers # pre order traversal is L R N def pre_order_traversal(self, A): c...
def count(V): V = sorted([int(v) for v in V.split()]) base = V[0] tot = 0 for i, v in enumerate(V[1:], 1): v -= base steps = v // 5 tot += steps V[i] -= 5 * steps d = v % 5 return tot def add(N, step, V, i): s = N // step if s: V[i] -= s * st...
class Field(object): """ A schema field composed of a name and a type. A geometric attribute also contains a :class:`Projection <geoscript.proj.Projection>`. """ def __init__(self, name, typ, proj=None): self.name = name self.typ = typ self.proj = proj def __repr__(self): return '%s: %s' % ...
numero = (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) valor = int(input('Digite um número entre 0 e 20: ')) extenso = ('zero', 'um', 'dois', 'tres', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez', 'onze', 'doze', 'treze', 'quatorze', 'quinze', 'dezesseis', 'dezessete', 'dezoito...
''' Pytorch implementation for ResNeXt. Original paper: https://arxiv.org/abs/1611.05431 '''
# Philius's Request PHILIUS = 1033202 sm.setSpeakerID(PHILIUS) sm.sendNext("Maybe we're the lucky ones. " "While we sleep, Maple World will heal from the terrible things the Black Mage has done. " "I wonder what kind of world we'll wake up to?") response = sm.sendAskYesNo("Your Highness, I w...
# Detlev Aschhoff info@vmais.de # 433 RC Remote for Quigg GT 7000, Tevion, GT-FSI-04 # # first 12 bit = Adresse 0 to 11 # 12,13 Units 0=00 1=10 2=11 3=01 4 to 7 same wiith dim bit 16 # 14 Command to all units # 15 1 = on 0 = off oder Dimmer up/ down # 16 0= Switch 1 = Dimmer # 17 allways 0 # 18...
class Grafo: def __init__(self): self.vertices = [] self.arestas = {} self.pesos = {} def adiciona_vertice(self,valor): self.vertices.append(valor) self.arestas[valor] = [] def adiciona_aresta(self,origem,destino,peso): if origem not in sel...
# ============LICENSE_START======================================================= # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use ...
first_employee_efficiency = int(input()) second_employee_efficiency = int(input()) third_employee_efficiency = int(input()) students_count = int(input())
def binarySearchAscending(array,value): l=0 u=len(array)-1 while l<=u: mid=(l+u)//2 if array[mid]==value: return mid elif array[mid]<value: l=mid+1 else: u=mid-1 return -1 def binarySearchDescending(array,value): l=0 u=len(arra...
__author__ = 'yinjun' class Solution: def strStr(self, source, target): # write your code here if source == None or target == None: return -1 if source == target: return 0 ls = len(source) lt = len(target) if lt >= ls: ...
numeros = [] for i in range(2): numero = -1 while numero < 0 or numero > 10: numero = int(input((f'Digite o {i + 1}° número: '))) numeros.append(numero) print(f'Média: {sum(numeros) / 2}')
# -*- coding: utf-8 -*- main_sheet = { "example": "example", }
# -*- coding: utf-8 -*- """ Created on Sat Mar 21 20:19:45 2020 @author: willi """ def search(arr, item): for i in range(len(arr)): if arr[i] == item: return i return -1 arr = [1, 2, 3, 4] print(search(arr, 5)) print(search(arr, 3)) print(search(arr, 1))
class Circle: def __init__(self,radius): self.radius=radius def area(self): return (3.14*self.radius*self.radius) def perimeter(self): return (2*3.14*self.radius) radius=int(input("Enter the radius :")) my_obj=Circle(radius) print("Area of the circle: "+str(my_obj.area())) prin...
# TD Ameritrade API Key # Get one for free at https://developer.tdameritrade.com/ API_KEY = "" # Ticker of the stock you want spreads of, no $ needed SYMBOL = "" # Price where you want the strike to break even TARGET_PRICE = 0 # Price where you do not expect the stock to exceed UPPER_LIMIT = 0 # CONFIDENCE INTERVAL - ...
bodysize = int(input("Gib die Größe ein: ")) chestsize = int(input("Gib den Brustumfang an: ")) gender = (input("Gib ein Geschlecht ein: ")) def computeGarmentSiz(bodysize, chestsize, gender): if gender == "w" or "weiblich": back = chestsize / 2 - 6 if bodysize > 170: back = back * 2 ...
# Given n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree. # # Example 1: # # Input: n = 5, and edges = [[0,1], [0,2], [0,3], [1,4]] # Output: true # Example 2: # # Input: n = 5, and edges = [[0,1], [1,2], [2,3...
""" https://www.hackerrank.com/challenges/one-week-preparation-kit-diagonal-difference/problem """ def _solve_method_1(a): """Literally did this first and was surprised when it didn't work on any other test case, and then found out about the problem inputs.""" first_d = a[0][0] + a[1][1] + a[2][2] sec...
#-*-coding:utf-8-*- patience = 9 warm_up = 6 patience_decay = {1:0.8,2:0.5,3:0} device = "cuda:0" computer = 'sean' epoch = 20 convert_weight = True weight_dest = "grayE-4" sparse_param = [] # Hyperparameters (j-series, 50.5 mAP yolov3-320) -d by @ktian08 https://github.com/ultralytics/yolov3/issues/310 hyp = {'giou': ...
"""Byte-related utility functions""" def hexstr_to_byte(string: str, pad: bool = True) -> int: """Converts a hexstring to a byte; items less than 4 characters 'wide' are padded""" if pad: return int(string.rjust(4, '0'), 16) return int(string, 16)
health = 100 bitcoins = 0 you_are_died = False dungeons_zode = input().split('|') for i in range(0, len(dungeons_zode)): room = dungeons_zode[i].split(' ') command = room[0] number = int(room[1]) if command == 'potion': if health + number <= 100: health += number p...
for _ in range(int(input())): a, b = map(int, input().split()) if a < b: a, b = b, a if a > 2 * b: print("NO") elif (a + b) % 3 == 0: print("YES") else: print("NO")
# Created by MechAviv # ID :: [914000200] # Black Road : Burning Forest 1 sm.killMobs() sm.removeSkill(20000014) sm.removeSkill(20000015) sm.giveSkill(20000014) sm.giveSkill(20000015) sm.warp(914000210, 1)
""" link: https://leetcode-cn.com/problems/generalized-abbreviation problem: 输出字符串的所有缩写,缩写规则为将连续n位用字符串n替代,不可以连续替换 solution: dfs + 备忘录。记录上一操作是否转换了数字。 solution-fix: 所有缩写可能数量定为 2**n 个,n为原串长度。可以将缩写串表达成长度为 n 的一个二进制数,第 i 为 0 时表示缩写,1 代表不变取原字符。 更高的时间复杂度,但空间复杂度更好。 """ class Solution: def generateAbbreviat...
# The isBadVersion API is already defined for you. # @param version, an integer # @return an integer # def isBadVersion(version): class Solution: def firstBadVersion(self, n): left, right = 1, n while left < right: i = (left + right) // 2 if isBadVersion(i): ...
def pascal_triangle(num_rows): # init list for all the rows rows = list([list() for _ in range(num_rows)]) # create the rows for row_index in range(num_rows): # A: at each index in the overall matrix, create an array as long as that # row position new_row = list([1 for i in range...
l = [10,20,30,40,50] del l print(l)
Parameters='''(kvalue:int,nei:[?D1] int, start_i:[?D2] int,src:[?D3] int, dst:[?D4] int, neiR:[?D11] int, start_iR:[?D12] int,srcR:[?D13] int, dstR:[?D14] int,TriCount:[?D5] int):string throws{''' ParametersAtomic='''(kvalue:int,nei:[?D1] int, start_i:[?D2] int,src:[?D3] int, dst:[?D4] int, ...
"""Dummy init module for the price_monitor package. It will be overwritten when docker mounts the real package.""" def get_version(): """ Returns DEV as version. Just a placeholder while building the web docker image, will be overwritten by mounted docker volume. :return: the version identifier """ ...
class Solution: def longestCommonSubsequence(self, s1: str, s2: str) -> int: m = len(s1) n = len(s2) t = [[-1 for j in range(n+1)] for i in range(m+1)] for i in range(m+1): t[i][0] = 0 for j in range(n+1): t[0][j] = 0 ...
""" Calculate the tank wanter based on the slab (brackets) Calculation is as below: 0 to 500 - 2 rupees 501 to 1500 - 3 rupees 1501 to 3000 - 5 rupees 3001 above - 8 rupees The method calculates similar to how tax gets calculated """ def tank_water_slab(consumption:int) -> int: brackets ...
#percorrendo valores do dicionário com for dicionario_full = {'usuario':'Peter','lingua':'pt-br','pet':['cachorro_1','cachorro_2']} for a in dicionario_full.values(): print(a) dicionario_full = {'usuario':'Peter','lingua':'pt-br','pet':['cachorro_1','cachorro_2']} for a in dicionario_full.keys(): print(a)
class Recipient: def __init__(self, recipient): if isinstance(recipient, (list, tuple)): recipient = ",".join(recipient) self.recipient = recipient def header(self): headers = [] for address in self.recipient.split(","): if "<" in address: ...
def minSubsetSumDiff(n, arr): summ = sum(arr) dp = [[0]*(summ + 1) for i in range(n + 1)] for i in range(n + 1): dp[i][0] = 1 for i in range(n + 1): for j in range(summ + 1): if arr[i - 1] <= j: dp[i][j] = dp[i - 1][j] | dp[i - 1][j - arr[i - 1]] ...
class Solution: def fib(self, n): if n in memo: return memo[n] if n < 2: return 1 else: f = self.fib(n-1) + self.fib(n-2) memo[n] = f return f obj = Solution() num = 10 memo = {} print("Fibonacci Number at Index: {}" .format(num)) print("Answer: {}" .format(obj.fib(num)))
# ----------------------------------------------------------------------------- # Copyright (c) 2005-2020, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is in the file COPYING.tx...
""" PASSENGERS """ numPassengers = 30505 passenger_arriving = ( (8, 6, 10, 8, 6, 1, 3, 1, 4, 2, 0, 0, 0, 7, 0, 1, 5, 11, 4, 4, 1, 1, 1, 0, 2, 0), # 0 (5, 6, 3, 8, 7, 1, 4, 1, 5, 0, 1, 2, 0, 12, 8, 4, 3, 9, 6, 4, 5, 5, 1, 1, 1, 0), # 1 (12, 8, 7, 6, 3, 1, 2, 2, 1, 3, 0, 0, 0, 9, 9, 5, 4, 10, 10, 6, 2, 4, 2, 2, 2...
big_factories = ['ByteDance','Alibaba','Tencnet','Google','Meituan'] for index in range (len(big_factories)): print(big_factories[index],end=',')
input = """ 1 2 0 0 1 3 0 0 1 4 0 0 1 5 0 0 1 6 0 0 1 7 0 0 1 8 0 0 1 9 0 0 1 10 0 0 1 11 0 0 1 12 0 0 1 13 0 0 1 14 0 0 1 15 0 0 1 16 0 0 1 17 0 0 1 18 0 0 1 19 0 0 1 20 0 0 1 21 0 0 1 22 0 0 1 23 0 0 1 24 0 0 1 25 0 0 1 26 0 0 1 27 0 0 1 28 0 0 1 29 0 0 1 30 0 0 1 31 0 0 1 32 0 0 1 33 0 0 1 34 0 0 1 35 0 0 1 36 0 0 1...
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/hyperxai01/can-autoware/install/include".split(';') if "/home/hyperxai01/can-autoware/install/include" != "" else [] PROJECT_CATKIN_DEPENDS = "roscpp;geometry_msgs;rosconsole;autoware_msgs;messag...
def coinChangePer(coins, targetSum): dp = [0] * (targetSum+1) dp[0] = 1 for amount in range(1, targetSum+1): for coin in coins: if coin <= amount: reamingAmount = amount - coin dp[amount] += dp[reamingAmount] return dp[targetSum] ...
# time complexity: O(n^2) # https://en.wikipedia.org/wiki/Bubble_sort def recursive_bubble(arr): for i, num in enumerate(arr): try: if arr[i+1] < num: arr[i] = arr[i+1] arr[i+1] = num recursive_bubble(arr) except IndexError: pa...
dog_names = ['ages/train/001.Affenpinscher', 'ages/train/002.Afghan_hound', 'ages/train/003.Airedale_terrier', 'ages/train/004.Akita', 'ages/train/005.Alaskan_malamute', 'ages/train/006.American_eskimo_dog', 'ages/train/007.American_foxhound', 'ages/train/008.American_staffordshire_terrier', 'ages/train...
#weights file PRETRAIN_WEIGHTS = '/save/yolo_weights/YOLO_small.ckpt' WEIGHTS_FILE = None # image parameters IMAGE_SIZE = 448 VIEW_POINTS = 30 # model parameters CELL_SIZE = 7 LOCATION_SCALE = 2.0 CONFIDENCE_SCALE = 1.0 NOOBJ_CONFIDENCE_SCALE = 0.1 VIEW_POINTS_SCALE = 2.0 LEAKY_RELU_ALPHA = 0.1 # training pa...
class Candlestick: def __init__(self): self.startTime = 0 self.closeTime = 0 self.symbol = "" self.interval = "" self.firstTradeId = 0 self.lastTradeId = 0 self.open = 0.0 self.close = 0.0 self.high = 0.0 self.low = 0.0 ...
# empty dictionary adjLists_dict = {} # insert (vertex, list) pairs into dictionary adjLists_dict[0] = [1,2] adjLists_dict[1] = [2,3] adjLists_dict[2] = [4] adjLists_dict[3] = [4,5] adjLists_dict[4] = [5] adjLists_dict[5] = [] # testing print("Neighbors of vertex 0: ", adjLists_dict[0]) print("Neighbors of vertex 3: ...
print("este programa conta de um a dez") for x in range(1,11): print(x)
# Copyright 2016 by Stephen Marshall. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """ This module provides code to work with the cellosaurus.txt file from http://web.expasy....
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : # AUTHOR : # PROJECT : # # ---------------------------------------------------------------------------- # Docstring """**DOCSTRING**. description Routine Listings ---------------- """ __author__ =...
# python3 def linear_search(keys, query): for i in range(len(keys)): if keys[i] == query: return i return -1 def binary_search(arr, l, r, x): # Check base case if r >= l: mid = l + (r - l) // 2 # If element is present at the middle itself if arr[mid] == x...
# # DEEP EXTENSIONS # DEEP_EXT_LOG = ".log" DEEP_EXT_YAML = ".yaml" DEEP_EXT_JPG = ".jpg" DEEP_EXT_CSV = ".csv" DEEP_EXT_NPY = ".npy" DEEP_EXT_NPZ = ".npz" DEEP_EXT_ONNX = ".onnx" DEEP_EXT_PYTORCH = ".pt"
a, b, c = map(int, input().split()) if b + c > a: print(b+c - a) else: print(0)
class Token : def __init__(self,type_,value = None,position=None): self.type = type_ self.value = value if position: self.position = position.copy() def matches(self,type_,value): return self.type == type_ and self.value == value def __repr__(self): return f'{sel...
def power(a: float, n: int) -> float: if n == 0: return 1 return a * power(a, n - 1) a = float(input()) n = int(input()) print(power(a, n))
class Solution: def topKFrequent(self, words, k): """ :type words: List[str] :type k: int :rtype: List[str] """ pairs = [(-cnt, word) for word, cnt in collections.Counter(words).items()] return [word for _, word in heapq.nsmallest(k, pairs)]
""" Calling conventions """ class CallingConvention: def __init__(self, name): self.name = name
# [callable(getattr(__builtins__, attr)) for attr in dir(__builtins__)] # [(attr,type(getattr(__builtins__, attr))) for attr in dir(__builtins__)] # print('hello'*100) class Test: def __repr__(self): return "test" def __str__(self): return "test2" t = Test() print(t)
def pick_pens(writing_colours, is_marking): if is_marking is True: writing_colours.append('red') return writing_colours
def writeToFile(array): f = open('points', 'w') f.write(array[0] + '\n' + array[1] + '\n') f.close() def getPoint(): x = raw_input("X Coordinate: ") y = raw_input("Y Coordinate: ") write = [x,y] writeToFile(write) def main(): while 1: getPoint()
''' Максимум последовательности ''' max = int(input()) _input = max while (_input != 0): _input = int(input()) if (max < _input and _input != 0): max = _input print(max)
N = int(input()) L = list(map(int, input().split())) L.sort() print(sum(L[::2]))
class Cola: def __init__(self, tamano): self.cola = [] self.tope = 0 self.size = tamano def push(self,tamaño): if self.size > self.tope: for x in range (tamaño): dato = input('Ingrese un dato a la cola: ') self.cola.append(da...
#!/usr/bin/python3 class Rectangle(): number_of_instances = 0 def __init__(self, width=0, height=0): self.height = height self.width = width Rectangle.number_of_instances += 1 def area(self): return self.__height * self.__width def perimeter(self): if self.wid...
class GameBoard: def __init__(self, size=3): # TODO: make dynamic self.board = [ [0, 0, 0], [0, 0, 0], [0, 0, 0] ] def make_move(self, value, pos_x, pos_y): if pos_x > 3 or pos_y > 3: print("invalid index") return ...
""" 将列表中所有元素转换为一个字符串 列表:["我", "爱", "你", "p", "y", "t", "h", "o", "n", 666] 结果:我爱你python666 注意:列表中包含非字符串数据 """ list01=["我", "爱", "你", "p", "y", "t", "h", "o", "n", 666] list02=[] for item in list01: list02.append(str(item)) result = "".join(list02) print(result) # result="".join([str(item) for item i...
# # PySNMP MIB module STN-SNMP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-SNMP-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:11:41 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,...
"""""" TYPE_CPP2PY = { "int": "int", "char": "char", "double": "double", "short": "int", } class DataTypeGenerator: """DataType生成器""" def __init__(self, filename: str, prefix: str): """Constructor""" self.filename = filename self.prefix = prefix def run(self): ...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None """ The following is a solution of Add two numbers problem which is described as: You are given two non-empty linked lists representing two non-negative integers. The digits are...
# model settings embed_dims = 448 num_classes = 1000 model = dict( type='ImageClassifier', backbone=dict( type='T2T_ViT', img_size=224, in_channels=3, embed_dims=embed_dims, t2t_cfg=dict( token_dims=64, use_performer=False, ), num_...
# # PySNMP MIB module AIHUBPORT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AIHUBPORT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:00:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
L = int(raw_input()) B = int(raw_input()) area = L * B peri = 2*(L + B) if area > peri: print("Area") print(area) else: print("Peri") print(peri)
print('\033[1;35m===== EX 027 =====\033[m') x = input('Escreva seu nome completo: ') y = x.upper() z = y.split() f1 = z[0] f2 = y.split() f3 = f2[-1] print(f'Seu primeiro nome é: {f1}') print(f'Seu ultimo nome é: {f3}')
def _push_state(self): self._state_stack.append({ self._SK_POS: self._pos, self._SK_ROW: self._row, self._SK_COL: self._col, self._SK_TOK_IDX: self._token_index, self._SK_OCC: 0, }) def _pop_state(self): res = self._state_stack.pop() self._pos = res[self._SK_POS...
#!/usr/bin/env python3 secret = [0x0E,0x05,0x06,0x1A,0x39,0x7D,0x60,0x75,0x7B,0x54,0x18,0x6A] seed = [0x61,0x75,0x63,0x74,0x66] for i in range(len(secret)): for j in range(0x20,0x7F): bar = seed[i%5] ^ j if bar == secret[i]: print(chr(j), end='') seed[i%5] = bar break print()
class urls : def __init__(self) : self.base_info_url = 'https://infoapi.webull.com/api' self.base_options_url = 'https://quoteapi.webullbroker.com/api' self.base_options_gw_url = 'https://quotes-gw.webullbroker.com/api' self.base_paper_url = 'https://act.webullbroker.com/webull-paper...
CANVAS_WIDTH = 50 CANVAS_HEIGHT = 50 LV_COLOR_CHROMA_KEY = lv.color_hex(0x00ff00) def LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h): return int(((w / 8) + 1) * h) def LV_IMG_BUF_SIZE_INDEXED_1BIT(w, h): return LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2 def LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h): return LV_IMG_BUF_SI...