content
stringlengths
7
1.05M
### Left and Right product lists ### class Solution1: def productExceptSelf(self, nums: List[int]) -> List[int]: l = 1 r = 1 length = len(nums) ans = [1]*length for i in range( 0, length ): ans[i] *=l ans[length -i-1] *= r l *= num...
print("welcome to calculator \n") a=int(input("enter first value")) b=int(input("enter seconde value")) print("which operation you want two perform \n add sub mul div") c=input() if c=="add": d=a+b print(d) if c=="sub": d=a-b print(d) if c=="mul": d=a*b print(d) if c=="div": d=a/b print(...
#!/usr/bin/env python3 print('hello world') print('hello', 'world') ## use "sep" parameter to change output print('hello', 'world', sep = '_')
people=30 cars=40 trucks=15 if cars>people: print("We should take the cars") elif cars<people: print("We should not take the cars") else: print("We can't decide") if trucks>cars: print("That's too many trucks") elif trucks<cars: print("Maybe we could take the trucks") else: print("We still can't...
''' Description Given a continuous stream of data, write a function that returns the first unique number (including the last number) when the terminating number arrives. If the terminating number is not found, return -1. Example Example1 Input: [1, 2, 2, 1, 3, 4, 4, 5, 6] 5 Output: 3 Example2 Input: [1, 2, 2, 1, 3...
def armsinside(): i01.rightArm.rotate.attach() i01.rightArm.rotate.moveTo(0) sleep(7) i01.rightArm.rotate.detach()
Byte = { 'LF': '\x0A', 'NULL': '\x00' } class Frame: def __init__(self, command, headers, body): self.command = command self.headers = headers self.body = '' if body is None else body def __str__(self): lines = [self.command] skipContentLength = 'content-lengt...
"""文字列基礎 文字関連の判定メソッド ASCII文字であるかを判定する isascii [説明ページ] https://tech.nkhn37.net/python-isxxxxx/#ASCII_isascii """ print('=== isascii ===') print('abcdefgh'.isascii()) print('あいうえお'.isascii())
fin = open('input_24.txt') def getdir(text): while text: direction = text[:2] if direction in ['nw','ne','sw','se']: text = text[2:] yield direction else: text = text[1:] yield direction[0] ftiles = set() # (row,column) # row, column moves ...
""" Module to convert unit of area from one system of units to another """ # Units of length TYPES = { 'km2': { 'name_en': 'Square Kilometers', 'name_es': 'Kilómetros cuadrados', 'abbreviation': 'km²', 'value': 'km2', 'to_m2': 1000000 }, 'm2': { 'name...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: quantra class FlowType(object): Interest = 0 PastInterest = 1 Notional = 2
#!/usr/bin/env python3 list1 = ['cisco-nxos', 'arista_eos', 'cisco-ios'] print(list1) print(list1[1]) list1.extend(['juniper']) print(list1) list1.append(['10.1.0.1','10.2.0.1','10.3.0.1']) print(list1) print("4th element in list1 is ".format(list1[4])) print(list1[4][0])
#Listas # (Tuplas) --> São imutavéis # [Listas] --> Podem ser mutavéis # {Dicionário} num = [2, 5, 9, 1] print(num) num[2] = 3 print(num) num.append(7) print(num) num.sort() print(num) num.sort(reverse=True) print(num) print(len(num)) num.insert(2,0) print(num) #Elimina o último item da lista num.pop() print(num) num....
if __name__ == '__main__': print("TESTOUTPUT")
class Solution(object): def binaryTreePaths(self, root): if not root: return [] arrow = '->' ans = [] stack = [] stack.append((root, '')) while stack: node, path = stack.pop() path += arrow+str(node.val) if path else str(node.val) #a...
def insert_user_list(): keys = ['_id', 'name', 'is_zero_user', 'gender', 'location', 'business', 'education', 'motto', 'answer_num', 'collection_num', 'followed_column_num', 'followed_topic_num', 'followee_num', 'follower_num', 'post_num', 'question_num', 'thank_num', ...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: DeepSeaSceneLighting class LightUnion(object): NONE = 0 DirectionalLight = 1 PointLight = 2 SpotLight = 3
def ciagCyfr(x): lista = [] for i in range(x): if i%2 == 0: i = i+1 lista.append(i) else: i = (i+1)*(-1) lista.append(i) print(lista)
""" Largest Element in Array: Given an array find the largest element in the array """ """Solution: """ def largest_element(a) -> int: le = 0 for i in a: if i > le: le = i return le def main(): arr_input = [40, 100, 8, 50] a = largest_element(arr_input) print(a) # Usi...
def bubbleSort(l, n): for i in range(n): for j in range(n-1-i): if l[j][0] > l[j+1][0]: l[j], l[j+1] = l[j+1], l[j] return l[:] def selectionSort(l, n): for i in range(n): minj = i for j in range(i+1, n): if l[j][0] < l[minj][0]: ...
""" if statements Logické operátory: == != < > <= >= """ numA = int(input("Zadej celé číslo A: ")) numB = int(input("Zadej celé číslo B: ")) # if statement if numA > numB: print(f"{numA} > {numB}.") # if else statement if numA > numB: print(f"{numA} > {numB}.") else: print(f"{numA} <...
# Version of the migration tool VERSION = "0.6" LOG_DIR="/var/log" LOG_FILE_PATH="%s/filerobot-migrate.log" % LOG_DIR UPLOADED_UUIDS_PATH="%s/filerobot-migrate-uploaded-uuids.log" % LOG_DIR LOG_FAILED_PATH="%s/filerobot-migrate-failed" % LOG_DIR LOG_RETRY_FAILED_PATH="%s/filerobot-migrate-retry-failed.log" % LOG_DIR D...
md_icons = { 'md-3d-rotation': u"\uf000", 'md-accessibility': u"\uf001", 'md-account-balance': u"\uf002", 'md-account-balance-wallet': u"\uf003", 'md-account-box': u"\uf004", 'md-account-child': u"\uf005", 'md-account-circle': u"\uf006", 'md-add-shopping-cart': u"\uf007", 'md-alarm': ...
# Time: O(n) # Space: O(n) class Solution(object): def isPrefixOfWord(self, sentence, searchWord): """ :type sentence: str :type searchWord: str :rtype: int """ def KMP(text, pattern): def getPrefix(pattern): prefix = [-1] * len(pattern) ...
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # * RUNTIME SHENG TRANSLATOR - CORE * # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # * Welcome to Runtime Sheng translator. v1.0.0 * # * MIT License, Copyright(c) 2018, Antony Muga * # * All Rights...
# # PySNMP MIB module XYPLEX-IPX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYPLEX-IPX-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:40: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 2...
''' ''' def load(config): data = [] with open(config['SimLex-999']['Dataset_File'], 'r') as stream: # skip headers stream.readline() # load data for line in stream: (w1, w2, _, score, _) = [s.strip() for s in line.split('\t', 4)] data.append((w1, w2, floa...
class Solution: def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ sumStr = str(int(a) + int(b)) sumList = [int(sumStr[i]) for i in range(len(sumStr))] for i in range(0, len(sumList) - 1): k = len(sumList) - i - 1 ...
""" Provides Python modules such as; * LiteXXX referenced as submodules. * (Maybe?) pip installable libraries like; - colorterm - hexfile - etc """
class Missed(object): pass class Null: pass class RaiseKeyError: pass class LazyCache(object): """Wraps a Django cache object to provide more features.""" missed = Missed() def __init__(self, cache, default_timeout=None): self.cache = cache self.default_timeout = default_...
def poly_sum(xs, ys): # return the list representing the sum of the polynomials represented by the # lists xs and ys zs = [] l = min(len(xs), len(ys)) for i in range(0, l): zs.append(xs[i] + ys[i]) if len(xs) > len(ys): for i in range(l, len(xs)): zs.append(xs[i]) ...
class Stack: def __init__(self, data=[]): self.data = data def __repr__(self) -> str: return f"{self.data}" def peek(self): if self.data: return self.data[-1] else: return None def pop(self): return self.data.pop() def push(self, d)...
"""esta clase va a manejar las fracciones""" def validaEntero(funcion): def validar(*args): if len(args) == 2: numero1=args[0] numero2=args[1] numero1=convierteTipo(numero1) numero2=convierteTipo(numero2) return funcion(numero1, numero2) e...
_asmm_version = '1.3.2' _xml_version = '1.0b' _py_version = '3.5.1' _eclipse_version = '4.6.3' _qt_version = '5.9' _report_version = '3.4.0'
a = int(input("a :")) b = int(input("b :")) c = int(input("c :")) delta = (b**2) - (4*a*c) print(delta)
def test_hello_svc_without_param(hello_svc_client): """ Given: hello svc running on cluster And: I have cluster ip address And: I have service port When: I do a get call Then: I should get back 200 Ok And: I should get back string Hi there, !" """ status, response = hello_svc_client...
class Solution: # Count Consecutive Groups (Top Voted), O(n) time and space def countBinarySubstrings(self, s: str) -> int: s = list(map(len, s.replace('01', '0 1').replace('10', '1 0').split())) return sum(min(a, b) for a, b in zip(s, s[1:])) # Linear Scan (Solution), O(n) time, O(1) space...
# class FmeRenderer(object): RENDER_MODE_CONSOLE = 1 RENDER_MODE_GRAPH = 2 def __init__(self, render_mode=RENDER_MODE_CONSOLE): self.name = 'apps.fme.FmeRender' self.render_mode = render_mode def render_obs(self, obs): pass
# Set options for certfile, ip, password, and toggle off c.NotebookApp.certfile = '/tmp/mycert.pem' c.NotebookApp.keyfile = '/tmp/mykey.key' # Set ip to '*' to bind on all interfaces (ips) for the public server c.NotebookApp.ip = '*' # It is a good idea to set a known, fixed port for server access c.NotebookApp.port ...
class Solution: def canJump(self, nums: List[int]) -> bool: maxlen = 0 i = 0 while i <= maxlen and i < len(nums): maxlen = max(maxlen, i + nums[i]) i += 1 if maxlen >= len(nums) - 1: return True return False
class MomentumGradientDescent(GradientDescent): def __init__(self, params, lr=0.1, momentum=.9): super(MomentumGradientDescent, self).__init__(params, lr) self.momentum = momentum self.velocities = [torch.zeros_like(param, requires_grad=False) for param in params]...
self.description = "Install a package with a missing dependency (nodeps)" p = pmpkg("dummy") p.files = ["bin/dummy", "usr/man/man1/dummy.1"] p.depends = ["dep1"] self.addpkg(p) self.args = "-Udd %s" % p.filename() self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_EXIST=dummy") self.addrule("PKG_DEPENDS=d...
"""Loads the atlas library""" # Sanitize a dependency so that it works correctly from code that includes # Apollo as a submodule. def clean_dep(dep): return str(Label(dep)) # Installed via atlas-dev def repo(): # atlas native.new_local_repository( name = "atlas", build_file = clean_dep("//...
# dictionary fundamentals alien_0 = {'color': 'green', 'points': 5} print(alien_0['color']) print(alien_0['points']) # assigning a dictionary value to a variable new_points = alien_0['points'] print("You just earn " + str(new_points) + " points!") # adding more values to a dictionary # original dict print(alien_0)...
# Changes - 7/25/01 - RDS # -Added 'label' item to Menu and MenuItem definitions. # -StaticText.label => StaticText.text # { 'application': { 'type':'Application', 'name':'SourceForgeTracker', 'menubar': { 'type':'MenuBar', 'menus': [ {'type'...
class NoFreeRobots(Exception): pass class UnavailableRobot(Exception): pass
# Bit Manipulation # Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. # # Example: # # Input: [1,2,1,3,2,5] # Output: [3,5] # Note: # # The order of the result is not important. So in the above ...
expected_output = { "slot": { "1": { "ip_version": { "IPv4": { "route_table": { "default/base": { "prefix": { "1.1.1.1/32": { "next_hop": { ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Defines classes related to 2D polygons. """ class Vertex: def __init__(self, coordinates, **kwargs): self.coordinates = coordinates if 'prev' in kwargs: self.set_prev(kwargs['prev']) if 'next' in kwargs: self.set_ne...
{ "targets": [ { "target_name": "readpath", "sources": [ "src/dirread.cc", "src/async.cc" ], "include_dirs" : [ "<!(node -e \"require('nan')\")" ] } ], }
class TrieNode: def __init__(self): self.children: Dict[str, TrieNode] = defaultdict(TrieNode) self.word: Optional[str] = None class Solution: def findWords(self, board: List[List[str]], words: List[str]) -> List[str]: m = len(board) n = len(board[0]) ans = [] root = TrieNode() def in...
# This is a list of modules which are not required to build # in order to test out this extension. Mostly useful for CI. module_arkit_enabled = "no" module_assimp_enabled = "no" module_fbx_enabled = "no" module_bmp_enabled = "no" module_bullet_enabled = "no" module_camera_enabled = "no" module_csg_enabled = "no" modul...
class LegMovement(object): """Represents a leg movement.""" def __init__(self): """Initializes a new instance of the LegMovement class.""" self.empty = False self.coxa = 0.0 self.tibia = 0.0 self.femur = 0.0 self.coxaSpeed = 0.0 self.tibiaSpeed = 0.0 ...
"""Problem 009 A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ ans = next(a * b * c for a in range(1, 500) for...
TEST_DATA = [( 'donation_page', 'https://adblockplus.org/donate', ), ( 'update_page', 'https://new.adblockplus.org/update', ), ( 'first_run_page', 'https://welcome.adblockplus.org/installed' )]
casa = float(input('Valor da casa: R$ ')) salario = float(input('Salário do comprador: R$')) anos = int(input('Quantos anos de financiamento ? ')) prestacao = casa / (anos * 12) minimo = salario * 30 / 100 if prestacao <= minimo: print('Para pagar uma casa de R${:.2f} em {} anos a prestação será de R${:.2f}'.format...
""" Author: Ramiz Raja Created on: 29/02/2020 """ def fibonnoci_sum(): rangeEnd = 10_000 prev_prev_fibonnoci = 0 prev_fibonnoci = 1 total_sum = 1 next_fibonnoci = 1 while next_fibonnoci < rangeEnd: if next_fibonnoci % 2 != 0: total_sum += next_fibonnoci prev_prev_f...
set_name(0x800A2AB8, "VID_OpenModule__Fv", SN_NOWARN) set_name(0x800A2B78, "InitScreens__Fv", SN_NOWARN) set_name(0x800A2C68, "MEM_SetupMem__Fv", SN_NOWARN) set_name(0x800A2C94, "SetupWorkRam__Fv", SN_NOWARN) set_name(0x800A2D24, "SYSI_Init__Fv", SN_NOWARN) set_name(0x800A2E30, "GM_Open__Fv", SN_NOWARN) set_name(0x800A...
#Nicolas Andrade de Freitas - Turma 2190 #Exercicio 22 j = float(input("Digite o valor em jardas")) m = j*0.91 print("o valor {} jardas em metros é de:{}".format(j,m))
class SpatialElementTag(Element, IDisposable): """ A tag attached to an SpatialElement (room,space or area) in Autodesk Revit. """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def getBoundingBox(self, *args): """ getBoundingBox(self: Element,view: View) ...
# basic stack implementation # author: D1N3SHh # https://github.com/D1N3SHh/algorithms class StackOverflowError(BaseException): pass class StackEmptyError(BaseException): pass class Stack(): def __init__(self, max_size = 10): self.max_size = max_size self.s = [] def __repr__(self):...
class UniquenessError(ValueError): def __init__(self, index_name): ValueError.__init__(self, index_name) class NotFoundError(KeyError): pass
""" The module implements exceptions for Zserio python runtime library. """ class PythonRuntimeException(Exception): """ Exception thrown in case of an error in Zserio python runtime library. """
#Crie um programa que leia um número inteiro e mostre na tela se ele é PAR ou ÍMPAR. while True: num = input('Digite um número inteiro: ') try: num = int(num) except: print('Valor inválido, tente novamente!') else: break if(num % 2 == 0): print(f'O número {num} é par') else...
# encoding: utf-8 # module System.Collections.Generic calls itself Generic # from mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Resellers', 'category': 'Sales', 'website': 'https://www.odoo.com/page/website-builder', 'summary': 'Publish Your Channel of Resellers', 'version': '1.0', 'description': """ Publish and...
# -*- coding: utf-8 -*- """ Given a string and a pattern, find out if the string contains any permutation of the pattern. Permutation is defined as the re-arranging of the characters of the string. For example, “abc” has the following six permutations: abc acb bac bca cab cba If a string has ‘n’ distinct characte...
class DataTemplate(FrameworkTemplate,INameScope,ISealable,IHaveResources,IQueryAmbient): """ Describes the visual structure of a data object. DataTemplate() DataTemplate(dataType: object) """ def ValidateTemplatedParent(self,*args): """ ValidateTemplatedParent(self: DataTemplate,templatedParent:...
W = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] # 加权系数 M_run = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # 闰年每月天数 M_ping = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # 平年每月天数 def check(id_number): try: id_number = str(id_number) except: return None if len(id_numbe...
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'market_platform_backend', 'USER': 'postgres', 'HOST': 'postgres', 'PORT': '5432', 'PASSWORD': '' } } CELERY_BROKER_URL = 'redis://redis:6379' CELERY_RESULT_BACKEND = 'redis://redis:637...
numero = int(input("Digite um numero para calcular tabuada: ")) tab = 0 while (tab <= 10): print (tab ,"X",numero,"=", numero * tab) tab +=1
SPACE = 20 def print_stand_species(summary_stand): formatted = ['STAND METRICS'] for i, row in enumerate(summary_stand): formatted.append(''.join([j + (' ' * (SPACE - len(j))) for j in row])) if i == 0 or i == len(summary_stand) - 2: formatted.append('-' * (SPACE * len(row))) r...
def hashadNum(num): digitSum = sum([int(k) for k in str(num)]) if num % digitSum == 0: return True else: return False n = int(input()) while not (hashadNum(n)): n += 1 print(n)
# -*- encoding: utf-8 -*- """ Created by Ênio Viana at 22/09/2021 at 23:05:30 Project: py_dss_tools [set, 2021] """ class ESPVLControl: name = "ESPVLControl" name_plural = "ESPVLControls" columns = ['basefreq', 'element', 'enabled', 'forecast', 'kvarlimit', 'kwband', 'like', 'localcontrollist', ...
""" Módulo com configurações gerais """ # Campos customizado no VMM CAMPO_AGRUPAMENTO = ('VMM_MANAGER_AGRUPAMENTO', 'Agrupamento da máquina (script vmm_manager).') CAMPO_ID = ('VMM_MANAGER_ID', 'Nome da VM informada no inventário (script vmm_manager).') CAMPO_IMAGEM = ('VMM_MANAGER_I...
''' Matrix: Count the number of islands in a matrix ''' class Solution: def numIslands(self, grid): """ :type grid: List[List[str]] :rtype: int """ def getIsland(i,j): if 0<=i<len(grid) and 0<=j<len(grid[0]) and grid[i][j]=='1': grid[i][j]='0' ...
def parseExpression(expression): operators = ['**', '+', '-', '*', '/', '%'] operator = '+' for currOperator in operators: if expression.__contains__(currOperator): operator = currOperator break if bool(operator): operands = expression.split(operator) ...
# -*- coding: utf-8 -*- # --- Slack configuration --- # get your own at https://api.slack.com/docs/oauth-test-tokens SLACK_TOKEN = "xoxp-XXX" # the channel Slasher will send its messages to SLACK_CHANNEL = "#random" # Slasher's username SLACK_USERNAME = "Slasher" # Slasher's icon SLACK_USER_EMOJI = ":robot_face:" #...
""" http://pythontutor.ru/lessons/2d_arrays/problems/snowflake/ Дано нечетное число n. Создайте двумерный массив из n×n элементов, заполнив его символами "." (каждый элемент массива является строкой из одного символа). Затем заполните символами "*" среднюю строку массива, средний столбец массива, главную диагональ и по...
S = input().split() N = int(input()) print(*S) for _ in range(N): next_S = input().split() for i in range(4): p = i // 2 q = i % 2 if S[p] == next_S[q]: next_S[q] = S[p^1] S = next_S print(*S) break else: assert(False)
class Pessoa: olhos=2 def __init__(self, *filhos, nome=None, idade=23): self.idade = idade self.nome = nome self.filhos = list(filhos) def cumprimentar(self): return f'Olá, meu nome é {self.nome}' @staticmethod def metodo_estatico(): return 42 @classme...
nome = str(input('Informe seu nome: ')).strip() dividido = nome.split() print('Seu primeiro nome é: {}'.format(dividido[0])) print('Seu último nome é: {}'.format(dividido[len(dividido) - 1]))
"""Websocket errors""" class WebSocketInternalError(Exception): """Exception raised for a WebSocket internal error"""
# -*- coding: utf-8 -*- DESC = "solar-2018-10-11" INFO = { "DescribeSubProject": { "params": [ { "name": "SubProjectId", "desc": "子项目id" } ], "desc": "子项目详情" }, "DescribeProjectStock": { "params": [ { "name": "SubProjectId", "desc": "子项目id" }...
class User: """ class that generates new instances of user """ user_list=[] def __init__(self,first_name,last_name,create_pw,confirm_pw): ''' __init__ method that helps us define properties for our objects. Args: first_name: New user first name. ...
""" Problem: Given an array L with n elements. Inversion occurs when L[i] > L[j] when 0 < i < j < n. Example: count_inversions([1,3,5,2,4,6]) -> 3 Explanation: 3 pairs of inversions (3,2), (5,3), (5,4) """ def count_inversions(elems: list[any]) -> int: # return the number of inversions in the array without mutati...
#!/usr/bin/env python # coding: utf-8 # p677 class MapSum: def __init__(self): """ Initialize your data structure here. """ self._kv = dict() # type: dict self._prefix = dict() # type: dict def insert(self, key, val): """ :type key: str :type ...
def start() : driverType = irr.driverChoiceConsole(); if driverType == irr.EDT_COUNT : return 1; device = irr.createDevice(driverType, irr.dimension2d_u32(640, 480)); if device == None : return 1; driver = device.getVideoDriver(); smgr = device.getSceneManager(); device.getFileSystem().addZi...
class Node(): def __init__(self, name): self.name = name self.possValues = [] self.value = "" self.parents = [] self.children = [] self.CPD = {} # variables for use in Variable Elimination self.inDeg = 0 self.used = False
# first development commit # first feature commit my_str_var = "" new_var_feature = "" another_var_feature = "" def some_function(mylist=[]): _mylist = mylist for x in _mylist: print(f"x is {x}") mylist = ['one', 'two', 'three', 'four'] # here is another section a_var = 0 b_var = 1 c_var = a_var + b...
def convert24(time): if time[-2:] == "AM" and time[:2] == "12": return "00" + time[2:-2] elif time[-2:] == "AM": return time[:-2] elif time[-2:] == "PM" and time[:2] == "12": return time[:-2] else: return str(int(time[:2]) + 12) + tim...
# encoding: utf-8 class Config(object): # Number of results to fetch from API RESULT_COUNT = 9 # How long to cache results for CACHE_MAX_AGE = 20 # seconds ICON = "2B939AF4-1A27-4D41-96FE-E75C901C780F.png" GOOGLE_ICON = "google.png" # Algolia credentials ALGOLIA_APP_ID = "BH4D9OD16A" ...
############################ data loading ######################################## train_subject_ids = [1,6,7,8,9,11] """ training subject ids """ test_subject_ids = [5] """test subject id""" omit_one_hot = False """one-hot encoding when loading human3.6m dataset""" ############################ model #############...
'''input 100 4 16 4554 ''' '''input 20 2 5 84 ''' # -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem B def sum_digit(number): string = str(number) array = list(map(int, list(string))) return sum(array) if __name__ == '__main__': N, A, B = list(map(int, input().split...
SITE_TITLE = "Awesome Boilerplates" FRAMEWORK_TITLE = "" RESTRICT_PACKAGE_EDITORS = False RESTRICT_GRID_EDITORS = False ADMINS = [ ("Vinta", "awesomeboilerplates@vinta.com.br"), ]
class Node: def __init__(self, val): self.val = val self.left = None self.right = None def store_inorder(root, inorder): if root is None: return store_inorder(root.left, inorder) inorder.append(root.data) store_inorder(root.right, inorder) def count_nodes(root):...
# To store registered users registered_users = {} # To store User staus Ture for Login & False for Logout user_status = {} user_account = {} def total_users(): return len(registered_users)
grid = [ ['W', 'L', 'W', 'W', 'W'], ['W', 'L', 'W', 'W', 'W'], ['W', 'W', 'W', 'L', 'W'], ['W', 'W', 'L', 'L', 'W'], ['L', 'W', 'W', 'L', 'L'], ['L', 'L', 'W', 'W', 'W'], ] visited_land = [] def minimum_island(grid): min = 100 for i in range(0, len(grid)): for j in range(0, l...
#练习3-1 names = ['Jack','Mary','Thomas','Tom','Jerry'] print(names) #练习3-2 for i in range(len(names)): print(f'How are you? {names[i]}') #练习3-3 print('\n') vehicles = ['bicycle','car','bus','subway','feet'] for i in range(len(vehicles)): print(f'I would like to go to school by/on {vehicles[i]}.')
params = dict() class Param(object): def __init__(self, name, value=None): self._name = name self._value = value params[self.format()] = self @property def name(self): return self._name def format(self): string = self.name if self.value is not None: ...