content
stringlengths
7
1.05M
def time_difference(was_hours, was_minutes, was_seconds, now_hours, now_minutes, now_seconds): now_hours -= was_hours now_minutes -= was_minutes now_seconds -= was_seconds seconds_passed = 0 now_minutes = now_minutes * 60 now_hours = now_hours * 3600 seconds_passed += now_seconds seconds...
# Plot the raw data before setting the datetime index df.plot() plt.show() # Convert the 'Date' column into a collection of datetime objects: df.Date df.Date = pd.to_datetime(df.Date) # Set the index to be the converted 'Date' column df.set_index('Date', inplace=True) # Re-plot the DataFrame to see that the axis is ...
a = 3 b = 5 print(f'Os valores são \033[31m{a}\033[m e \033[34m{b}\033[m') nome = 'Guanabara' cores = {'limpa': '\033[m', 'azul': '\033[34m', 'amarelo': '\033[33m', 'pretoebranco': '\033[7;29m'} print(f'{cores["azul"]}{nome}{cores["limpa"]}')
def binary(num): s = "" if num != 0: while num >= 1: if num % 2 == 0: s = s + "0" num = num/2 else: s = s + "1" num = num/2 else: s="0" return "".join(reversed(s)) print(binary(12))
_lookup = { # https://support.microsoft.com/en-us/kb/89879 'MS_ADPCM': 1, 'IMA_ADPCM': 1, 'PCM_S8': 1, 'PCM_U8': 1, 'PCM_16': 2, 'PCM_24': 3, 'PCM_32': 4, 'FLOAT': 4, 'DOUBLE': 8, # this is a guess, erring on the side of caution 'VORBIS': 3 } def chunk_size_samples(sf...
numbers = [int(s) for s in input().split()] command = input() while command != 'end': command = command.split() action = command[0] if action == 'swap': index_1 = int(command[1]) index_2 = int(command[2]) numbers[index_1], numbers[index_2] = numbers[index_2], numbers[index_1] e...
_base_ = [ '../_base_/models/stylegan/stylegan3_base.py', '../_base_/datasets/ffhq_flip.py', '../_base_/default_runtime.py' ] batch_size = 32 magnitude_ema_beta = 0.5**(batch_size / (20 * 1e3)) synthesis_cfg = { 'type': 'SynthesisNetwork', 'channel_base': 32768, 'channel_max': 512, 'magnitude_e...
potencia=int(input()) tempo=int(input()) calculo=(potencia/1000)*(tempo/60) print(f'{calculo:.1f} kWh')
def is_palindrome(input_string): """Check if a string is a palindrome irrespective of capitalisation Returns: True if string is a palindrome e.g >>> is_palindrome("kayak") OUTPUT : True False if string is not a palindrome e.g >>> is_palindro...
# Complexity O(n) def linear_search(array: list, elem): for index, number in enumerate(array): if number == elem: print(f"The elem {elem} is present ind array, on index {index}.") return index print(f"The elem {elem} isn't on array.") return -1 def linear_search...
# lcs = longest_consecutive_series # ccn = count_of_consecutive_numbers class Solution(object): #main function def longestConsecutive(self, values): #sub funcction lcs = 0 # Initializing for i in values: # Iteration the given value if i-1 not in values: # condition check value = i...
""" This module contains some constants and utilities for converting between stars and levels. The EXP system works as follows: - To advance to the next level, you need to acquare 8 banners. - Banners can be bought with stars. A banner costs a single star at level one, with the cost of a banner increasing by a sing...
# Uses python3 def lcm_naive(a, b): for l in range(1, a*b + 1): if l % a == 0 and l % b == 0: return l return a*b def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): d = gcd(a, b) return (a // d) * b if __name__ == '__main__': a, b = map(int, ...
""" app.py the main file for launching the web dashboard. By: Calacuda | MIT Licence | Epoch: Mar 25, 2021 """
# french verb conjugation (present) # greet the user print('welcome to the french verb conjugator') # user enter their word word = str(input('please enter the word you want to conjugate: ')).lower() # list of conjugated words word_conjugate = [] # function (and conditional) to check word ending def conjugate(): ...
class payload: def __init__(self): self.name = "next" self.description = "tell iTunes to play next track" self.type = "applescript" self.id = 121 def run(self,session,server,command): payload = "tell application \"iTunes\" to next track" server.sendCommand(self.n...
def draw_polygons(self, pipes, gaps): BLACK = (0, 0, 0) danger = [] # upper left of pipe[0] a = (0, 0) b = (pipes['upper'][0]['x'], 0) c = (pipes['upper'][0]['x'], gaps[0]['y']) d = (0, gaps[0]['y']) danger.append([a, b, c, d]) # lower left of pipe...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: f = open('myfile.txt') s = f.readline() i = int(s.strip()) except OSError as err: print("OS error: ", err) except ValueError: print("Could not convert data to integer.") raise except: print("Unexpected error!") raise
""" ######################################################################## The parameters.py module contains the Parameters class, which provides I/O tools for defining input parameters, as required for FAO-56 calculations. The parameters.py module contains the following: Parameters - A class for managing input ...
""" Iterator in Python is simply an object that can be iterated upon. An object which will return data, one element at a time. Technically, Python 'iterator object' must implement two special methods, __iter__(), and __next__(), collectively called the iterator protocol. Most of built-in containers in python like lis...
test = { 'name': 'q1.1', 'points': 1, 'suites': [ { 'cases': [ { 'code': '>>> assert abs(P[0] - 0.003819) < .1*0.003819;\n' '>>> assert abs(P[1] - 0.016803) < .1*0.016803;\n' '>>> assert abs(P[2] - 0.180881) ...
""" This module contains a class for sharing information on the state of the ACC, rover, and obstacle between the main process for the ACC and the listener process. It allows for this information to be relayed to the user. """ UNKNOWN = "-" # An initial value given to all of the values, so that the user interface has...
input = """ c num blocks = 1 c num vars = 250 c minblockids[0] = 1 c maxblockids[0] = 250 p cnf 250 1112 -32 148 249 0 169 -98 24 0 -122 -32 -128 0 -9 125 200 0 -216 193 138 0 196 54 31 0 -140 -121 -62 0 237 152 -122 0 91 -206 -247 0 172 -115 -101 0 220 -216 152 0 26 88 -69 0 -130 235 226 0 -96 -242 2 0 -184 -48 -190 0...
''' Write a Python program to make a chain of function decorators (bold, italic, underline etc.). ''' def make_bold(fn): def wrapped(): return "<b>" + fn() + "</b>" return wrapped def make_italic(fn): def wrapped(): return "<i>" + fn() + "</i>" return wrapped def make_underline(fn)...
# # @lc app=leetcode.cn id=1288 lang=python3 # # [1288] 删除被覆盖区间 # # https://leetcode-cn.com/problems/remove-covered-intervals/description/ # # algorithms # Medium (55.24%) # Likes: 21 # Dislikes: 0 # Total Accepted: 4.7K # Total Submissions: 8.6K # Testcase Example: '[[1,4],[3,6],[2,8]]' # # 给你一个区间列表,请你删除列表中被其他区...
"""Run module.""" class Run: """Class describing a TRNSYS simulation. - convention: left (00:00 is [00:00;01:00[ for an hourly series) - clock: tzt """ def __init__(self): """Initialize object.""" pass
# Program to calcualte LCM of two numbers # function to calculate LCM def lcm(x,y): if x > y: greater = x else: greater = y while True: if (greater % x) == 0 and (greater % y) == 0: lcm = greater break greater+=1 return lcm a = int(input("En...
def processRecord(RecordClass, row): record = RecordClass('mphillips') record.mapping('basic', 'title', row['title'], qualifier='officialtitle') record.mapping('agent', 'creator', row['author'], qualifier='aut', agent_type='per', info='born somewhere') ...
#!/usr/bin/env python # coding: utf-8 # In[1]: # assignment No 1 {day 3} # In[2]: # you all are pilots, & we have to land a plane, the altitiude required to land a plane is 1000ft. if its less than that ask the pilot to land #if its more than 1000ft but less than 5000ft ask the pilot to reduce the altitude t...
# -*- coding: utf-8 -*- """ Created on Tue Jul 27 13:17:41 2021 You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa. For Example: Www.HackerRank.com → wWW.hACKERrANK.COM Pythonist 2 → pYTHONIST 2 @author: Ashish """ de...
#========================================================================= # test_timing.py #========================================================================= # Additional timing assertions for special paths (e.g., feedthroughs) # #------------------------------------------------------------------------- # tes...
NAME_PREFIX_SEPARATOR = "_" ENDPOINTS_SEPARATOR = ", " CSI_CONTROLLER_SERVER_WORKERS = 10 # array types ARRAY_TYPE_XIV = 'A9000' ARRAY_TYPE_SVC = 'SVC' ARRAY_TYPE_DS8K = 'DS8K'
# optimizer optimizer = dict(type="SGD", lr=0.04, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict(policy="step", warmup="linear", warmup_iters=100, warmup_ratio=0.001, step=[7, 11]) total_epochs = 12
class SplitEnd: """Event used when the separation of a request into several files is completed""" NAME = "SPLIT_END" def __init__(self, directory): self.directory = directory def serialize(self): return { "name": self.NAME, "data": { "direc...
#Escreva um programa para aprovar empréstimo bancário para compra deuma casa. #O programa vai perguntar o valor da casa,o salario do comprador e em quantos anos ele vai pagar #Calcule o valor da prestação mensal, sabendo que ela nâo pode exceder 30%do salario ou #entao o emprestimo sera negado. #======== COMO EU FIZ==...
def pattern(n): s = '' for i in range(n): s += str(n) for ni in range(n-1,i,-1): s += str(ni) if n-1 == i: pass else: s += '\n' return s
class AlignmentState(basestring): """ aligned|misaligned|partial-writes|indeterminate Possible values: <ul> <li> "aligned" - All or most of the IO to the LUN is aligned to the underlying file, <li> "misaligned" - A significant amount of IO to the LUN is not aligned to ...
print("/"*20) # lol stlist = ["qwev", "kleb", "lew", "fvb", "eivf", "igsi", "ycgbayg"] for s in stlist: if s.startswith("A"): print("Found!") break else: print("Not found") print("/"*20) answer = 42 guess = 0 while answer != guess: guess = int(input("Guess the number: ")) else: pass...
# coding: utf-8 class Task: pass
class ProtoConverter: @classmethod def proto_to_dict(cls, proto_message): proto_dict = {} desc = proto_message.DESCRIPTOR for field in desc.fields: field_name = field.name proto_dict[field_name] = getattr(proto_message, field_name) return proto_dict
report = [] with open('input') as file: report = list(map(lambda x: x.strip(), file)) gamma = '' epsilon = '' for bits in zip(*report[::1]): zero = 0 one = 0 for bit in bits: if bit == '1': one += 1 else: zero += 1 if one > zero: gamma += '1' ...
""" Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], which looks like following: 4 -> 5 -> 1 -> 9 Example 1: Input: head = [4,5,1,9], node = 5 Output: [4,1,9] Explanation: You are given the second node with value 5,...
# make a player object health = 100 max_health = 100 level = 1 experience = 0 gold = 0 attack = 10 defense = 8 heal = 5
"""Mapping of recipe options to celery configuration directives. """ STRING_OPTIONS = { 'broker-url' : 'BROKER_URL', 'broker-password': 'BROKER_PASSWORD', 'broker-transport': 'BROKER_TRANSPORT', 'broker-user': 'BROKER_USER', 'broker-vhost': 'BROKER_VHOST', 'celeryd-log-file': 'CELERYD_LOG_FILE'...
f_1 = open("C:/repos/voc2coco/sample/valid.txt", "r") #f_2 = open("sample_ouput.txt", "r") f_3 = open("C:/repos/voc2coco/sample/annpaths_list.txt", "w") for l_1 in f_1: result = "./sample/Annotations/" + l_1.replace("\n", "") + ".xml\n" f_3.writelines(result) f_1.close() #f_2.close() f_3.close()
MAGIC = 'NICKNAME' # used for 3 way handshake ENCODING = 'utf-8' """ Localhost and port to be used for testing the server """ HOST_NAME = '127.0.0.1' PORT_NUM = 55555
""" General IaC constants """ PARAMETER_OVERRIDES = "parameter_overrides" GLOBAL_PARAMETER_OVERRIDES = "global_parameter_overrides"
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ConsumedThing and related entities. .. autosummary:: :toctree: _consumed wotpy.wot.consumed.interaction_map wotpy.wot.consumed.thing """
''' 9. Write a Python program to display the examination schedule. (extract the date from exam_st_date). exam_st_date = (11, 12, 2014) Sample Output : The examination will start from : 11 / 12 / 2014 Tools:slicing,indexing ''' #9 exam_st_date = (11, 12, 2014) x = exam_st_date[0] y = exam_st_date[1]...
""" Given two strings str1 and str2, find the length of the smallest string which has both, str1 and str2 as its sub-sequences. Example: Input: 2 abcd xycd efgh jghi Output: 6 6 SOLUTION: if str[i] == str[j], then dp[i][j] = dp[i-1][j-1] + 1 else, dp[i][j] = min(dp[i-1][j], dp[i][j-1]) + 1 Be careful when i-1 or j...
#!/usr/bin/env python # encoding: utf-8 """ @author:nikan @file: Request.py @time: 28/02/2018 12:19 PM """
VERSION = 1 SERVICE_URL_BASE = "/api/v" + VERSION + "/" PG_HOST = "localhost" PG_USER = "postgres" PG_PASSWORD = "postgres" PG_DB = "postgres" PG_CONNECTION = "host=" + PG_HOST + " user=" + PG_USER + " password=" + PG_PASSWORD + " dbname=" + PG_DB
def findAllSubset(nums): if len(nums) == 0: return [] results = [] cur_num = nums[0] results.append({cur_num}) rest_set = nums[1:] tmp = findAllSubset(rest_set) for ele in tmp: results.append({cur_num} | ele) results = results + tmp return results def findAllSubset_...
# FIXME 这个不是正确解, 不满足时间复杂度 class Solution: def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ pointer1 = 0 pointer2 = 0 merged_list = [] while pointer1 < len(nums1) or pointer...
class Queue: def __init__(self) -> None: self.items = [] def push(self, item): self.items.append(item) def pop(self): if self.size() > 0: return self.items.pop(0) return None def peek(self): if self.size() > 0: return self.items[...
class Maths: """Math methods akin to fractions""" def mdc(self, x, y): """Greatest Common Divisor""" while y != 0: resto = x % y x = y y = resto return x def controlador(op,x,y): """controls the calculation based on operator""" if...
t=int(input()) while(t): t-=1 b,s,m=map(int,input().split()) print(b+s-m)
class WXMPCode(object): SUCCESS = 0 ######################################################################### # Weixin Security Module Error Definition ######################################################################### # 校验签名失败 ERR_VALIDATE_SIGNATURE = -40001 # 解析xml失败 ERR_PARSE_XML = -4000...
# Example 1 - names.py: Output three names to the console. names = ['Issac Newton', 'Marie Curie', 'Albert Einstein'] for name in names: print(name)
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def isPalindrome(self, head: ListNode) -> bool: def reverseList(head: ListNode) -> ListNode: if head == None: return ...
# Copyright 2021 Edoardo Riggio # # 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 writin...
"""External dependencies for Dossier.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external") def dossier_repositories( omit_aopalliance_aopalliance = False, omit_args4j_args4j = False, omit_com_go...
def previously_valid_data(data: list, invalid_data: set): """ Return a list of valid data from a input list. When an element is in the invalid data set, is must be replaced with the previous valid data. >>> previously_valid_data(['0', '2', None, '1', None, '0', None, '2'], {None}) ['0', '2', '2', '...
class My_Rectangle: def __init__(self, region, is_white=False, model=(None, None)): self.region = region self.is_white = is_white self.model = model def is_white(self): return self.is_white def get_model(self): return self.model
i=0 arr=[65, 0, 0, 0, 66, 0, 0, 0, 67, 0, 0, 0, 68, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 71, 0, 0, 0, 72, 0, 0, 0, 73, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 77, 0, 0, 0, 78, 0, 0, 0, 79, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 83, 0, 0, 0, 84, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 86,...
class Hand: # poker hand __POINTS = { '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10, 'J': 11, 'Q': 12, 'K': 13, 'A': 14 } __RANKING = { 'straightflush': 9, 'qu...
# Copyright 2019 The Bazel Authors. All rights reserved. # # 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 la...
GlobalMarketCommandSchema = """ { "namespace": "confluent.io.examples.serialization.avro", "name": "CBPCommand", "type": "record", "fields": [ {"name": "timestamp", "type": "long", "logicalType": "timestamp-millis"}, {"name": "pair", "type": "string"}...
# -*- coding: utf-8 -*- """ Created on Tue Nov 12 09:19:40 2019 @author: PC """ """ liste=[7,2,6,9,-9] mini=456545 for each in liste: if(each<mini): mini=each else: continue print(mini) """ class Calisan: zam_oranı=1.8 counter=0 def __init__(self,isim,soyisim,...
a = [1, 2, 3] b = [*a, 4, 5, 6] print(b)
EXPECTED = {'EUTRA-InterNodeDefinitions': {'extensibility-implied': False, 'imports': {'EUTRA-RRC-Definitions': ['ARFCN-ValueEUTRA', 'AntennaInfoCommon', ...
#!/usr/bin/python # ============================================================================== # Author: Tao Li (taoli@ucsd.edu) # Date: Jul 7, 2015 # Question: 121-Best-Time-to-Buy-and-Sell-Stock # Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ # ====================================...
mandado=["naranja","manzana","pina"] for fruta in mandado: print(fruta) i=1 while i<=15: print(i) i=i+1 a=-3 while a<=3: print(a) a=a+1 #Imprimir los primeros 20 numeros pares iterador=0 print("Tope") #while iterador<40: # iterador+=2 # print(iterador) palabra="el elefante negro" #for ca...
STATUS_TO_ERROR = { # basic server errors 0: 'AS_OK', 1: 'AS_ERR_UNKNOWN', 2: 'AS_ERR_NOT_FOUND', 3: 'AS_ERR_GENERATION', 4: 'AS_ERR_PARAMETER', 5: 'AS_ERR_RECORD_EXISTS', 6: 'AS_ERR_BIN_EXISTS', 7: 'AS_ERR_CLUSTER_KEY_MISMATCH', 8: 'AS_ERR_OUT_OF_SPACE', 9: 'AS_ERR_TIMEOUT'...
"""Handles import of external/third-party repositories. """ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def optimus_repositories(): maybe( http_archive, name = "bazel_skylib", urls = ["https://github.co...
''' 6 kyu Convert string to camel case.py https://www.codewars.com/kata/517abf86da9663f1d2000003/train/python Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized (known as Up...
class FrankaArmCommException(Exception): ''' Communication failure. Usually occurs due to timeouts. ''' def __init__(self, message, *args, **kwargs): Exception.__init__(self, *args, **kwargs) self.message = message def __str__(self): return "Communication w/ FrankaInterface ...
""" This module contains all the exceptions that are specific to BGD. """ # errors.py # author : Antoine Passemiers, Robin Petit __all__ = [ 'RequiredComponentError', 'WrongComponentTypeError', 'NonLearnableLayerError' ] class RequiredComponentError(Exception): """ Exception raised when a :class:`bgd.nn....
class Solution(object): def getRow(self, rowIndex): """ :type rowIndex: int :rtype: List[int] """ row = [1] for _ in range(rowIndex): # pad 0, perform element-wise addition row = [x + y for x, y in zip([0] + row, row + [0])] return row ...
# # @lc app=leetcode.cn id=62 lang=python3 # # [62] 不同路径 # # https://leetcode-cn.com/problems/unique-paths/description/ # # algorithms # Medium (52.81%) # Total Accepted: 16.6K # Total Submissions: 31.3K # Testcase Example: '3\n2' # # 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。 # # 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(...
def created(data_json): # A user creates an issue for a repository. repository = data_json['repository'] # repository_scm = repository['scm'] repository_name = repository['name'] repository_link = repository['links']['html']['href'] # actor = data_json['actor'] # actor_name = actor['display...
class CheckPosture: def __init__(self, scale=1, key_points={}): self.key_points = key_points self.scale = scale self.message = "" def set_key_points(self, key_points): self.key_points = key_points def get_key_points(self): return self.key_points def...
#! python3 # __author__ = "YangJiaHao" # date: 2018/2/23 class Solution: def groupAnagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ result = {} for s in strs: # key = tuple(sorted(s)) # result[key] = result.get(key, []...
# 無效率作法 O(n^2) # def singleNumber(nums): # for i in range(len(nums)): # count = 0 # for j in range(len(nums)): # if nums[i] == nums[j]: # count += 1 # if count == 1: # return nums[i] # 用bitwise去解 XOR(^) # A XOR A = 0 # A XOR 0 = A # A XOR B = B ...
# Defining rule for gdrive command and config. def _gdrive(ctx): gdrive_cmd = ctx.attr.gdrive_cmd gdrive_cfg = ctx.attr.gdrive_config return struct(command=gdrive_cmd, config=gdrive_cfg) gdrive = rule( implementation=_gdrive, attrs={ "gdrive_cmd": attr.string(mandatory=True), ...
'''Function''' def read_input(path: str): """ Read game board file from path. Return list of str. >>> read_input("check.txt") ['***21**', '412453*', '423145*', '*543215', '*35214*', '*41532*', '*2*1***'] """ field = '' with open(path, 'r') as input_f: for line in input_f: ...
## Arruma os NCM ## Os registros nos grupos C180 e C190 são populados pelo PCMOV ## inserindo NCM diferente, com isso preciso pegar o ncm do produto ## no 0200 e propagar nos C180 e C190 def exec(conexao): cursor = conexao.cursor() print("RULE 01 - Inicializando",end=' - ') for i in ["C180","C190"]: ...
#python OrderedDict class LRUCache: def __init__(self, capacity: int): self.cache = collections.OrderedDict() self.capacity = capacity def get(self, key: int) -> int: if key not in self.cache: return -1 val = self.cache.pop[key] self.cache[key] = val ...
pessoa = dict() while True: nome = str(input("Nome: ")) media = float(input(f"Média de {nome}: ")) pessoa = {"media" : media} pessoa["nome"] = nome pessoa["situcao"] = "empty" if media < 7 and media >= 5: pessoa["situacao"] = "Recuperação" elif media < 5: pessoa["situcao"] = ...
# CENG 487 Assignment6 by # Arif Burak Demiray # December 2021 class Scene: def __init__(self): self.nodes = [] def add(self, node): self.nodes.append(node)
CONSUMER_KEY = 'CHANGE_ME' CONSUMER_SECRET = 'CHANGE_ME' ACCESS_TOKEN = 'CHANGE_ME' ACCESS_TOKEN_SECRET = 'CHANGE_ME'
li = list(map(int, input().split())) li.sort() print(li[0]+li[1])
# 二叉搜索树 class BST: class Node: def __init__(self,key,value): self.key = key self.value = value self.left_node = self.right_node = None def __init__(self): self.__root = None self.__count = 0 def get_size(self): return self.__count de...
class Solution: def strStr(self, haystack: str, needle: str) -> int: if not needle: return 0 if not haystack: return 0 if not needle else -1 for i in range(len(haystack)): for j in range(len(needle)): if i+j > len(haystack)-1: ...
# -*- coding: utf-8 -*- # @Author: 何睿 # @Create Date: 2018-12-18 17:28:42 # @Last Modified by: 何睿 # @Last Modified time: 2018-12-18 17:36:33 class Solution: def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ # 结果数组 res ...
{ "targets": [ { "target_name": "daqhats", "cflags!": [ "-fno-exceptions" ], "cflags_cc!": [ "-fno-exceptions" ], "sources": [ "./lib/cJSON.c", "./lib/gpio.c", "./lib/mcc118.c", "./lib/mcc128.c", "./lib/mcc134_adc.c", "./lib/mcc134.c", ...
#IMPORTANT: This syntax will create an empty dictionary and not an empty set a = {} print(type(a)) #An empty set can be created using the below syntax: b = set() print(type(b)) b.add(4) b.add(5)
class Config(object): def __init__(self): # Font Size # 1. Index, Distance, Degree self.fontSize = 10 # Font Family # 1. Index, Distance, Degree self.fontFamily = 'Consolas' # Shifting # 1. Index self.indexShifting = 3 # 2. Distance ...
###################################################### # dom SCROLL_BAR_WIDTH = getScrollBarWidth() def ce(tag): return document.createElement(tag) def ge(id): return document.getElementById(id) def addEventListener(object, kind, callback): object.addEventListener(kind, callback, False) class e: def...
N = int(input()) s_list = [input() for _ in range(N)] M = int(input()) t_list = [input() for _ in range(M)] tmp = s_list.copy() tmp.append("fdsfsdfsfs") s_set = list(set(tmp)) result = [] for s in s_set: r = 0 for i in s_list: if i == s: r += 1 for j in t_list: if j == s: ...