content
stringlengths
7
1.05M
def if_pycaffe(if_true, if_false = []): return select({ "@caffe_tools//:caffe_python_layer": if_true, "//conditions:default": if_false }) def caffe_pkg(label): return select({ "//conditions:default": ["@caffe//" + label], "@caffe_tools//:use_caffe_rcnn": ["@caffe_rcnn//" + label], "...
frase = "Nos estamos procurando o rubi na floresta" rubi = frase[24:29] print (rubi)
def spiralTraverse(array): num_elements = len(array) * len(array[0]) n = len(array) m = len(array[0]) it = 0 result = [] while num_elements > 0: # Up side for j in range(it, m - it): result.append(array[it][j]) num_elements -= 1 if num_elemen...
""" This is the base class for any AI component. All AIs inherit from this module, and implement the getMove() function, which takes a Grid object as a parameter and returns a move. """ class BaseAI: def getMove(self,grid): pass
""" The Ceasar cipher is one of the simplest and one of the earliest known ciphers. It is a type of substitution cipher that 'shifts' a letter by a fixed amount in the alphabet. For example with a shift = 3: a -> d b -> e . . . z -> c Programmed by Aladdin Persson <aladdin.persson at hotmail dot com> * 2019-11-07 I...
class PantryModel: def get_ingredients(self, user_id): """Get all ingredients from in pantry and return a list of instances of the ingredient class. """ pass
# # @lc app=leetcode id=2 lang=python3 # # [2] Add Two Numbers # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: ...
{ PDBConst.Name: "paymentmode", PDBConst.Columns: [ { PDBConst.Name: "ID", PDBConst.Attributes: ["tinyint", "not null", "primary key"] }, { PDBConst.Name: "Name", PDBConst.Attributes: ["varchar(128)", "not null"] }, { PDBConst.Name: "SID", PDBC...
class Graph(object): def __init__(self, graph_dict=None): if graph_dict == None: graph_dict = {} self.__graph_dict = graph_dict
def add_reporter_email_recipients(client=None, project_key=None, scenario_id=None, recipients=[]): """Append additional recipients to a scenario email reporter. """ prj = client.get_project(project_key) ...
main = { 'General': { 'Prop': { 'Labels': 'rw', 'AlarmStatus': 'r-' } } } cfgm = { 'General': { 'Prop': { 'Blacklist': 'rw' } } } fm = { 'Status': { 'Prop': { 'AlarmStatus': 'r-' }, 'Cmd': ( ...
temp = input("Co chcesz sprawdzić? \n1 - Palindrom \n2 - Anagram \n\n") while (temp != "1") and (temp != "2"): temp = input("------\nCo chcesz sprawdzić? \n1 - Palindrom \n2 - Anagram \n\n") if temp == "1": word = input("Podaj słowo: ") if word == word[::-1]: print("Słowo jest palindromem.") ...
tiles = [ # Riker's Island - https://www.openstreetmap.org/relation/3955540 (10, 301, 384, 'Rikers Island'), # SF County Jail - https://www.openstreetmap.org/way/103383866 (14, 2621, 6332, 'SF County Jail') ] for z, x, y, name in tiles: assert_has_feature( z, x, y, 'pois', { 'kind':...
def median(x): sorted_x = sorted(x) midpoint = len(x) // 2 if len(x) % 2: return sorted_x[midpoint] else: return (sorted_x[midpoint]+sorted_x[midpoint-1])/2 assert median([1]) == 1 assert median([1, 2]) == 1.5 assert median([1, 2, 3]) == 2 assert median([3,1,2]) == 2 assert medi...
'''19 cows, 14 apples, 2 tables, a pig and an onion''' def count_things(words): vowels = ('a', 'e', 'o', 'i', 'u') words_set = set(words) res = [[i,words.count(i)] for i in words_set] res.sort(key = lambda x: -x[1]) result = [] for i in res: if i[1] > 1: i[0] = str(i[0])...
#!/usr/bin/python3 #https://codeforces.com/contest/1426/problem/F def f(s): _,a,ab,abc = 1,0,0,0 for c in s: if c=='a': a += _ elif c=='b': ab += a elif c=='c': abc += ab else: abc *= 3 abc += ab ab *=...
quantidade = 0 soma = 0 while True: n = int(input('Digite um número inteiro (digite "999" para parar): ')) if n == 999: break quantidade += 1 soma += n print(f'A soma dos {quantidade} números digitados é {soma}')
DEBUG = True INSTAGRAM_CLIENT_ID = '' INSTAGRAM_CLIENT_SECRET = '' INSTAGRAM_CALLBACK = 'http://cameo.gala-isen.fr/api/instagram/hub' MONGODB_NAME = 'cameo' MONGODB_HOST = 'localhost' MONGODB_PORT = 27017 REDIS_HOST = 'localhost' REDIS_PORT = 6379
npratio = 4 MAX_SENTENCE = 30 MAX_ALL = 50 MAX_SENT_LENGTH=30 MAX_SENTS=50
""" Module: 'upip_utarfile' on esp32 1.13.0-103 """ # MCU: (sysname='esp32', nodename='esp32', release='1.13.0', version='v1.13-103-gb137d064e on 2020-10-09', machine='ESP32 module (spiram) with ESP32') # Stubber: 1.3.4 DIRTYPE = 'dir' class FileSection: '' def read(): pass def readinto(): ...
class Solution: """ @param scores: two dimensional array @param K: a integer @return: return a integer """ def FindTheRank(self, scores, K): # write your code here tuple_scores = [] for idx, score in enumerate(scores): tuple_scores.append([score, idx]) ...
# -*- coding: utf-8 -*- """ Common use sicd_elements methods. """ def _get_center_frequency(RadarCollection, ImageFormation): """ Helper method. Parameters ---------- RadarCollection : sarpy.io.complex.sicd_elements.RadarCollection.RadarCollectionType ImageFormation : sarpy.io.complex.sicd_el...
# Solution to day 1 of AOC 2015, Not Quite Lisp. # https://adventofcode.com/2015/day/1 f = open('input.txt') whole_text = f.read() f.close() floor = 0 steps = 0 basement_found = False for each_char in whole_text: if not basement_found: steps += 1 if each_char == '(': floor += 1 elif each...
# coding=utf-8 # Author: Jianghan LI # Question: 056.Merge_Intervals # Date: 2017-04-04 10:43 - 10:51 # Complexity: O(NLogN) # Definition for an interval. # class Interval(object): # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution(object): def merge(self, interva...
String1="Hello World!" String2="AbCD123!" """ This shows the method startswith() and endswith() working. """ print(String1.endswith('World!')) print(String1.startswith('Hell')) print(String2.endswith('12')) print(String2.endswith('3')) print(String1.startswith('Hello ')) print(String2.startswith('A')) print(Strin...
''' Задача 5 Роберт успешно справился с вылазкой в тыл врага и раздобыл одну полоску из тетради в клетку длинной N клеток. Кроме этого, в руки Роберта попал лист изменений этой полоски. Враг выбирал две позиции i и j и записывал между ними новое сообщение. При этом, если новое сообщение накладывалось на старое, то стар...
""" 有一个1GB大小的文件,文件里的每一行是一个词,每个词的大小不超过16B,内存大小限制是1MB,要求返回频数最高的100个词. """ """ 解决思路: (1) 遍历文件,对遍历到的每一个词执行如下的Hash操作:hash(x) % 2000,将结果为i的词存放到文件ai中,通过这个分解步骤,可以使 每个子文件的大小约为400KB左右,如果这个操作后某个文件的大小超过了1MB了,那么可以采用相同的方法对这个文件继续分解, 直到文件的大小小于1MB为止. (2) 统计出每个文件中出现频率最高的100个词,最简单的方法为使用字典实现,具体实现方法为:遍历文件中的所有词,对于遍历到的词, 如果字典中不存...
ask = "time is time versus time" count = 0 for t in ask: if t == "t": count += 1 print(count) number = list(range(5, 20, 2)) print(number)
class CSVEmployeeRepository: def __init__(self, csv_intepreter): self._anagraphic = csv_intepreter.employees() def birthdayFor(self, month, day): return self._anagraphic.bornOn(Birthday(month, day)) class Anagraphic: def __init__(self, employees): self._employees = employees ...
PACKAGE_NAME = 'cdeid' SPACY_PRETRAINED_MODEL_LG = 'en_core_web_lg' # SPACY_PRETRAINED_MODEL_SM = 'en_core_web_sm' PROGRESS_STATUS = { 1: 'prepare data sets', 2: 'train spacy on balanced sets', 3: 'train stanza on balanced sets', 4: 'train flair on balanced sets', 5: 'train spacy on imbalanced sets'...
def handle(event, context): file = open("dynamicdns/scripts/dynamic-dns-client", "r") content = file.read() file.close() headers = { "Content-Type": "text/plain" } body = content response = { "statusCode": 200, "headers": headers, "body": body } re...
# Time: O(n) # Space: O(h) # Given a binary tree, you need to compute the length of the diameter of the tree. # The diameter of a binary tree is the length of the longest path between # any two nodes in a tree. This path may or may not pass through the root. # # Example: # Given a binary tree # 1 # ...
class Bird(): def __init__(self) : self.wings = True self.fur = True self.fly = True def isFly(self) : return self.fly Parrot = Bird() if Parrot.isFly() == "fly" : print("Parrot must be can fly") else : print("Why Parrot can't fly ?") ###### Inheritance ##### cla...
class MapMatcher: def __init__(self, rn, routing_weight='length'): self.rn = rn self.routing_weight = routing_weight def match(self, traj): pass def match_to_path(self, traj): pass
#-*- coding: utf-8 -*- # ------ wuage.com testing team --------- # __author__ : weijx.cpp@gmail.com def split(word): return [char for char in word] def test_crypt2(): letter :str = u"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z" let = letter.split("," ,maxsplit=26) # let = ["X", "Y"] # print...
def minion_game(string): # your code goes here #string = string.lower() vowel = ['A','E','I','O','U'] kev = 0 stu = 0 n = len(string) x = n for i in range(n) : if string[i] in vowel : kev += x else : stu += x x -= 1 if kev > stu ...
""" Entendendo Interadores e Iteraveis #Interador - Um objeto que poder ser iterado - Um objeto que retorna um dado, sendo um elemento por vez quando uma função next() é chamada; #Interaveis - Um objeto que irá retorna um interator quando inter() for chamada. """
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incor...
def day5(fileName, part): niceCount = 0 with open(fileName) as infile: for line in infile: vowels = sum(line.count(vowel) for vowel in "aeiou") if vowels < 3: continue foundDouble = any(line[i] == line[i+1] for i in range(len(line) - 1)) if not foundDouble: continue foundBadString = any(badSt...
class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: nums.sort() res = [] self.bt(nums, 0, [], res) return res def bt(self, nums, idx, tempList, res): res.append(tempList) for i in range(idx, len(nums)): self.bt(nums, i+1, tempList+[n...
''' 环形链表 给定一个链表,判断链表中是否有环。 如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中存在环。 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。注意:pos 不作为参数进行传递,仅仅是为了标识链表的实际情况。 如果链表中存在环,则返回 true 。 否则,返回 false 。 ''' # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x ...
''' Exception module ''' class CallGitServerException(Exception): ''' Base Exception for filtering Call Git Server Exceptions ''' STATUS_CODE = 127 class DuplicateRemote(CallGitServerException): ''' Exception throwed when there arent any match with the username ''' STATUS_CODE = 128 def __init_...
# This file contains the information for creating a socket for EACH # of the clients, it also contains the CLient class itself that is managed from the # server file (see server.py) class Command: """ Stores information about the every single command of the client. """ def __init__(self, command, resu...
def test(tested_mod, Assert): test_cases = [ # (expected, input) ([4], [4]), ([9,6], [6,9]), ([4,3,2,1], [4,3,2,1]), ([4,3,2,1], [1,2,3,4]), ([9,5,2,1], [1,5,2,9]) ] return Assert.all(tested_mod.sortierte_zettel, test_cases)
P, Q = map(float, input().split()) p, q = P / 100, Q / 100 a = p * q b = (1 - p) * (1 - q) print(a / (a + b) * 100)
# https://leetcode.com/problems/merge-sorted-array/ class Solution: # Input: # [1, 2, 2, 3, 5, 6], m = 3 # [2, 5, 6], n = 3 # [2, 0] # [1] # [1, 2, 0] # [4] def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ Do not return anyt...
##Patterns: E0116 while True: try: pass finally: ##Err: E0116 continue while True: try: pass finally: break while True: try: pass except Exception: pass else: continue
class ESError(Exception): pass class ESRegistryError(ESError): pass
# Exercício 01 # Faça um programa que leia 5 números inteiros e os coloque em uma lista. # Após, pergunte ao usuário uma posição na lista e apresente o valor que # está nessa posição. Faça o tratamento de erro para a leitura dos números # e também para a posição na lista. lista = [] for i in range(0,5): try: ...
def mobilenet_conv_block(x, kernel_size, output_channels): """ Depthwise Conv -> Batch Norm -> ReLU -> Pointwise Conv -> Batch Norm -> ReLU """ # assumes BHWC format input_channel_dim = x.get_shape().as_list()[-1] W = tf.Variable(tf.truncated_normal((kernel_size, kernel_size, input_channe...
class Solution: def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ maxprofit = 0 if (len(prices) == 0): return 0 left = 0 right = left + 1 while (right < len(prices)): ...
movies = ['The Matrix', 'Fast & Furious', 'Frozen', 'The life of Pi'] for movie in movies: print(movie) print('We\'re done here!')
# this code is not correct class Node: def __init__(self, data, next=None): self.data=data self.next = next def printList(head): print(head.data) if head.next == None: return return printList(head.next) def reverseList(head): if head.next == None: return head ne...
def rule(event): return event.get("action") == "Blocked" def title(event): return "Access denied to domain " + event.get("domain", "<UNKNOWN_DOMAIN>")
def static_vars(**kwargs): """ Decorates a function with the given attributes Parameters ---------- **kwargs a list of attributes and their initial value """ def decorate(func): for k in kwargs: setattr(func, k, kwargs[k]) return func return decorate...
# Config for OpenMX_viewer # For Gui fontFamilies=["Segoe UI", "Yu Gothic UI"] # font sizes are in unit of pixel fontSize_normal=16 fontSize_large=24 ContentsMargins=[5,5,5,5] tickLength=-30 sigma_max=5 Eh=27.2114 # (eV) # Pen for vLine and hLine pen1=(0, 255, 0) pen2=(255, 0, 0) pen3=(255, 255, 0) gridAlpha=50 # ...
# Also used on the Yamaha Reface CS? def compute_checksum(data): """Compute checksum from a list of byte values. This is appended to the data of the sysex message. """ return (128 - (sum(data) & 0x7F)) & 0x7F
viagem = int(input('Quantos KMs está a sua viagem: ')) if viagem <= 200: print(f'O custo da sua viagem será {viagem * 0.5}R$') else: print(f'O custo da sua viajem será {viagem * 0.45}')
#!/usr/bin/python3 """ Module Docstring """ __author__ = "Dinesh Tumu" __version__ = "0.1.0" __license__ = "MIT" # imports # init variables def main(): """ Main entry point of the app """ # Open a file for writing and create it if it doesn't exist f = open("textfile.txt","w+") # Open the file ...
destinations = input() while True: input_command = input() if input_command == "Travel": break arg = input_command.split(":") command = arg[0] if command == "Add Stop": index = int(arg[1]) string = arg[2] if 0 <= index < len(destinations): destination...
def html_tag(): # write body of decorator pass @html_tag('p') def foobar(): return 'foobar' if __name__ == "__main__": assert foobar() == '<p>foobar</p>'
def max_power(s: str) -> int: max_ = 1 curr = 1 for i in range(1, len(s)): if s[i] == s[i - 1]: curr += 1 else: if curr > max_: max_ = curr curr = 1 return max(max_, curr) if __name__ == '__main__': max_power("ccbccbb")
distancia = float(input('Entre com a distancia da sua viagem, em Km: ')) if distancia > 200: print('O valor da sua passagem é R${:.2f}!'.format(distancia*0.45)) else: print('O valor da sua passagem é R${:.2f}!'.format(distancia*0.5))
class TestThruster: def test_get(self, log_in, test_client): response = test_client.get('/thruster') data = response.get_json()[0] assert response.status_code == 200 assert 1 == data['id'] assert 'T10' == data['name'] assert 10 == data['thrust_power']
data = { "last-modified-date": { "value": 1523547463983 }, "name": { "created-date": { "value": 1523547463758 }, "last-modified-date": { "value": 1523547463983 }, "given-names": { "value": "Cecilia" }, "famil...
a = int(input()) t = input() b = int(input()) if t == '*': print(a*b) elif t == '+': print(a+b)
a1 = int(input('Digite o primeiro termo: ')) razão = int(input('Digite a razão: ')) for c in range(1, 11): print(f'a{c} = {a1}', end=' | ') a1 += razão
tablero_inicial = '♜\t♞\t♝\t♛\t♚\t♝\t♞\t♜\n♟\t♟\t♟\t♟\t♟\t♟\t♟\t♟\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n♙\t♙\t♙\t♙\t♙\t♙\t♙\t♙\n♖\t♘\t♗\t♕\t♔\t♗\t♘\t♖' a = open ("./aje.txt","w", encoding="utf-8") a.write(tablero_inicial) a.close tablero = [] def movimiento(fichero): for i in tablero_inic...
print("----\n") f = float(input("digite a temperatura em fahrenheit")) c = (f - 32) * 5 / 9 print("a temperatura é de ", c, "graus celcius") print("----\n")
meta_file = '/mnt/fs4/chengxuz/Dataset/yfcc/meta.txt' meta_file_dst = '/mnt/fs4/chengxuz/Dataset/yfcc/meta_short.txt' with open(meta_file, 'r') as fin: all_jpgs = fin.readlines() all_jpgs = [_jpg[len('/mnt/fs4/Dataset/YFCC/images/'):] for _jpg in all_jpgs] with open(meta_file_dst, 'w') as fout: fout.writelines...
''' Write a program to calculate calories for the fruit shop. The program must accept only one order per time, and the program must run until the user enters 5 to finish the program. The detail of the menu is as follows. 1 Apple 100 Cal 2 Papaya 120 Cal 3 Banana 200 Cal 4 Orange 60 Cal 5 Exit When the customer presses ...
def longToSizeString(longVal): if longVal >= 1073741824 : return str(round(longVal/1073741824,2))+"GB" elif longVal >= 1048576: return str(round(longVal/1048576,2)) + "MB" elif longVal >= 1024: return str(round(longVal/1024,2))+"KB" else: return str(longVal)+"B"
""" More info is available here: https://forums.codemasters.com/topic/54423-f1%C2%AE-2020-udp-specification/ """ PACKET_MAPPER = { 'PacketCarTelemetryData_V1': 'telemetry', 'PacketLapData_V1': 'lap', 'PacketMotionData_V1': 'motion', 'PacketSessionData_V1': 'session', 'PacketCarStatusData_V1': 'stat...
input = '361527' input = int(input) def walk(): number = 1 sign = 1 while True: for _ in range(number): yield sign, 0 for _ in range(number): yield 0, sign number += 1 sign = -sign def calc_position(index): pos = (0, 0) for i, (dx, dy) in e...
class Solution: def __init__(self, radius: float, x_center: float, y_center: float): self.radius = radius self.x_center = x_center self.y_center = y_center def randPoint(self) -> List[float]: length = sqrt(random.uniform(0, 1)) * self.radius degree = random.uniform(0, 1) * 2 * math.pi x = s...
# https://www.geeksforgeeks.org/minimum-of-two-numbers-in-python """ Given a list, write a Python code to find the Minimum of these two numbers. """ NUMBERS = ( 1, 2, 3, 4, 5, 6, 7, 8 ) if __name__ == "__main__": # The min() method print(min(NUMBERS))
class MediaState(Enum, IComparable, IFormattable, IConvertible): """ Specifies the states that can be applied to a System.Windows.Controls.MediaElement for the System.Windows.Controls.MediaElement.LoadedBehavior and System.Windows.Controls.MediaElement.UnloadedBehavior properties. enum MediaState,values...
# Copyright 2017 Janos Czentye # # 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, s...
{ 'ACHIEVEMENT_PAGES': { 0: { 'name': '页面一', 'background': 'main_back.png', 'pos': ((0, 0), (0, 0), (1, 0), (1, 0)) }, 1: { 'name': '页面二', 'background': 'frame_back.png', 'pos': ((0, 0), (0, 0), (1, 0), (1, 0)) }, 2: { 'name': '页面三', 'background': 'default.png', 'pos...
class BasisFunctionLike(object): @classmethod def derivatives_factory(cls, coef, *args, **kwargs): raise NotImplementedError @classmethod def functions_factory(cls, coef, *args, **kwargs): raise NotImplementedError
""" Exceptions Errors detected during execution are called exceptions. Examples: ZeroDivisionError This error is raised when the second argument of a division or modulo operation is zero. #>>> a = '1' #>>> b = '0' #>>> print int(a) / int(b) #>>> ZeroDivisionError: integer division or modulo by zero ValueError This...
def crop(image, height, width): ''' Function to crop images Parameters: image, a 3d array of the image (can be obtained using plt.imread(image)) height, integer, the desired height of the cropped image width, integer, the desired width of the cropped image Returns: cropped_image, a 3d...
entries = [ { 'env-title': 'atari-alien', 'env-variant': 'Human start', 'score': 128.30, }, { 'env-title': 'atari-amidar', 'env-variant': 'Human start', 'score': 11.80, }, { 'env-title': 'atari-assault', 'env-variant': 'Human start', ...
n1 = float(input('Minha primeira nota é?')) n2 = float(input('Minha segunda nota é?')) ma = (n1 + n2) / 2 print('Minha média entre {:.1f} e {:.1f}, é de: {:.1f}.'.format(n1, n2, ma))
class BoxField: BOXES = 'bbox' KEYPOINTS = 'keypoints' LABELS = 'label' MASKS = 'masks' NUM_BOXES = 'num_boxes' SCORES = 'scores' WEIGHTS = 'weights' class DatasetField: IMAGES = 'images' IMAGES_INFO = 'images_information' IMAGES_PMASK = 'images_padding_mask'
# # PySNMP MIB module HH3C-WAPI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-WAPI-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:30:34 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...
class Solution: def longestPalindromeSubseq(self, s: str) -> int: n = len(s) dp = [[0 for _ in range(n+1) ] for _ in range(n+1)] for i in range(1,n+1): for j in range(1,n+1): if( s[i-1] == s[n-j]): dp[i][j] = 1+dp[i-1][j-1] else...
class JsutCounter: __secretCount = 0 def count(self): self.__secretCount += 1 print(self.__secretCount) counter = JustCounter() counter.count() counter.count() # print(counter.__secretCount) print(counter._JustCounter.__secretCount) #public:normal variables #private:__ #protected:_
class Solution: def max_dp(self, nums2: List[int]) -> int: dp=[0,0,nums2[0]] for num in nums2[1:]: dp.append(num+max(dp[-2], dp[-3])) return max(dp[-1], dp[-2]) def rob(self, nums: List[int]) -> int: if len(nums)<=3: return max(nums) e...
#-*- coding:utf-8 -*- def display(name,age): print (name,age)
n = int(input("Digite o valor de n: ")) i=0 count = 0 while count<n: if (i % 2) != 0: print (i) count = count + 1 i = i + 1
# pylint: disable=missing-class-docstring """Exception classes for Eddington.""" class EddingtonException(Exception): # noqa: D101 pass # Interval Errors class IntervalError(EddingtonException): # noqa: D101 pass class IntervalIntersectionError(IntervalError): # noqa: D101 def __init__(self, *int...
# # PySNMP MIB module WWP-LEOS-BENCHMARK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-BENCHMARK-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:30:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
# -*- coding: UTF-8 -*- # Copyright 2013-2017 Luc Saffre # License: BSD (see file COPYING for details) """ Plugins ======= .. autosummary:: :toctree: cosi contacts b2c Not used ======== .. autosummary:: :toctree: orders delivery """
""" SE - number SE - symbols SE - (SE SE SE ...) EXAMPLES: 1 -> 1 ahoj -> ahoj (a ahoj) -> ( -> a -> ahoj -> ) ((ahoj a) (a) a) -> ( -> ( -> ahoj -> a -> ) -> ( -> ) -> ) """ STR_SURROUND = ["\"", "'"] ESCAPE_CHAR = "\\" def lexer(value): """Yield token""" buffer = list() last = '' ...
""" Word Search Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once. Example...
# # PySNMP MIB module CISCOSB-CDP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-CDP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:22:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
unique_symbols= { 1:'I', 5:'V', 10:'X', 50:'L', 100:'C', 500:'D', 1000:'M' } def calculateRoman(algarism, place): if algarism==0: return '' elif place>=4: return algarism * unique_symbols[1000] elif algarism>5: if algarism==9: return unique_symbols[10**(place-1)]+unique_symbols[10**place] e...
class Solution: """ @param grid: a list of lists of integers @return: An integer, minimizes the sum of all numbers along its path """ """ f[] """ def minPathSum(self, grid): # write your code here if grid is None or not grid:return 0 m = len(grid) n...
class MapAsObject: def __init__(self, wrapped): self.wrapped = wrapped def __getattr__(self, key): try: return self.wrapped[key] except KeyError: raise AttributeError("%r object has no attribute %r" % (self.__class__.__name__, ke...