content
stringlengths
7
1.05M
if __name__ == '__main__': x = 1 y = [2] x, = y print(x)
class Decoder: def __init__(self, alphabet, symbol): self._alphabet = alphabet self._symbol = symbol self._reconstructed_extended_dict = { int(symbol): letter for letter, symbol in self._alphabet.copy().items() } def decode(self, encoded_input): output = "" ...
listanum = [[],[]] #Primeiro colchete numeros pares e segundo colchete numeros impares valor = 0 for cont in range(1,8): valor = int(input("Digite um valor: ")) if valor % 2 ==0: listanum[0].append(valor) else: listanum[1].append(valor) listanum[0].sort() listanum[1].sort() print(f"Os numero...
""" --- Day 3: Toboggan Trajectory --- With the toboggan login problems resolved, you set off toward the airport. While travel by toboggan might be easy, it's certainly not safe: there's very minimal steering and the area is covered in trees. You'll need to see which angles will take you near the fewest trees. Due to ...
# -*- coding: utf-8 -*- # Copyright (c) 2016 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
path = "../data/stockfish_norm.csv" scores = open( path) last_scores = open( "last_scores.fea", "w") for row in scores: last_scores.write( row.rsplit(" ", 1)[1]) scores.close() last_scores.close()
""" noop.py: An event filter that does nothing to the input. """ def main(event): return event
class MudCommand: """ This is the base class for all commands in the MUD. """ def __init__(self): self.info = {} self.info['cmdName'] = '' self.info['helpText'] = '' self.info['useExample'] = '' def setType(self, type): self.info['actiontype'] = ...
def get_human_readable_time(seconds: float) -> str: """Convert seconds into a human-readable string. Args: seconds: number of seconds Returns: String that displays time in Days Hours, Minutes, Seconds format """ prefix = "-" if seconds < 0 else "" seconds = abs(seconds) int...
def mutation(word_list): if all(i in word_list[0].lower() for i in word_list[1].lower()): return True return False print(mutation(["hello", "Hello"])) print(mutation(["hello", "hey"])) print(mutation(["Alien", "line"]))
"""Kata url: https://www.codewars.com/kata/5556282156230d0e5e000089.""" def dna_to_rna(dna: str) -> str: return dna.replace('T', 'U')
def index(req): req.content_type = "text/html" req.add_common_vars() env_vars = req.subprocess_env.copy() req.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">') req.write('<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:l...
# coding=utf-8 """ A basic rules engine, as well as a set of standard predicates and transformers. * Predicates are the equivalent of a conditional. They take the comparable given in the rule on the left and compare it to the value being tested on the right, returning a boolean. * Transformers can be considered a...
class Vehicle: name = "" kind = "car" color = "" value = 00.00 def description (self): desc ="%s is a %s %s worth $%.2f." % (self.name,self.color,self.kind,self.value) return desc car1 = Vehicle() car1.name = "Fuso" car1.color = "grey" car1.kind = "lorry" car1.value = 1000 car2 = Vehicle() car2.name ...
class ContactHelper: def __init__(self, app): self.app = app def create(self, contact): wd = self.app.wd # init contact creation wd.find_element_by_link_text("add new").click() # foll contact form wd.find_element_by_name("firstname").click() wd.find_elem...
class Solution(object): def arrayNesting(self, nums): """ :type nums: List[int] :rtype: int """ dict = {} ans = 0 for i in nums: if i in dict: continue label = nums.index(i) dict[label] = 1 x = i ...
# # Copyright (c) 2017 Amit Green. All rights reserved. # @gem('Gem.Codec') def gem(): require_gem('Gem.Import') PythonCodec = import_module('codecs') python_encode_ascii = PythonCodec.getencoder('ascii') @export def encode_ascii(s): return python_encode_ascii(s)[0]
num1 = 1.5 num2 = 6.3 sum = num1 + num2 print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
""" 875. 爱吃香蕉的珂珂 https://leetcode-cn.com/problems/koko-eating-bananas/ """ # n根香蕉以speed吃完需要的时间 def timeof(n, speed): return (n // speed) + (1 if n % speed > 0 else 0) # piles堆香蕉,以speed的速度,H小时内能否吃完 def canFinish(piles, speed, H): # 累加吃每堆香蕉的时间 time = 0 for n in piles: time += timeof(n, s...
"""This problem was asked by Palantir. In academia, the h-index is a metric used to calculate the impact of a researcher's papers. It is calculated as follows: A researcher has index h if at least h of her N papers have h citations each. If there are multiple h satisfying this formula, the maximum is chosen. For e...
a = [] while True: k = 0 resposta = str(input('digite uma expressao qualquer:')).strip() for itens in resposta: if itens == '(': a.append(resposta) elif itens == ')': if len(a) == 0: print('expressao invalida') k = 1 ...
# -*- coding: utf-8 -*- """XML Utilities. XML scripts in Python. * ppx: pretty print XML source in human readable form. * xp: use XPath expression to select nodes in XML source. * validate: validate XML source with XSD or DTD. * transform: transform XML source with XSLT. """ # Xul version. __version_info__ = (...
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] spar = mai = scol = 0 for linha in range (0, 3): for coluna in range(0, 3): matriz[linha][coluna] = int(input(f'Digite um valor para [{linha}, {coluna}]: ')) print("-"*30) for linha in range(0,3): for coluna in range(0,3): print(f'[{matriz [linha] [c...
def number(year): for i in range(2010,2021): if i % 4 == 0 and i % 100 != 0 or i % 400 ==0: print(str(i)+"年共有366天哦!!!") else: print(str(i)+"年共有365天哦!!!") def start(): number(2010) start()
# Copyright (c) 2019 Damian Grzywna # Licensed under the zlib/libpng License # http://opensource.org/licenses/zlib/ __all__ = ('__title__', '__summary__', '__uri__', '__version_info__', '__version__', '__author__', '__maintainer__', '__email__', '__copyright__', '__license__') __title__ =...
class Array: n = 0 arr = [] def print_array(self): print(self.arr) def get_user_input(self): self.n = int(input('Enter the size of array: ')) print('Enter the elements of array in next line (space separated)') self.arr = list(map(int, input().split()))
#!/usr/bin/env python3 """ Xtremeloader reloaded... Lookup for lx products sample curl calls: curl -d 'state=productlist&substate=categorized&category=Cellphone+EPINs' -X POST 'https://loadxtreme.ph/cgi-bin/ajax.cgi' (refer to xtremeloader repo) List of cat: [Cellphone EPINs] [Internet / Broadband] - Inter...
def hello(name): print("hello", name, "!") hello("xxcfun")
# def fun(num): # if num>5: # return True # else: # return False fun=lambda x: x>5 l=[1,2,3,4,45,35,43,523] print(list(filter(fun,l)))
# DFS class Solution: def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: # 存储每种课的依赖的所有课程 # 根据课程的依赖关系建立的图结构 graphic = [[] for _ in range(numCourses)] for pre in prerequisites: graphic[pre[0]].append(pre[1]) # 存储每个课程的调查状态 # 0表示还没有...
class Node: def __init__(self, value): self.value = value self.next = None self.previous = None def remove_node(self): if self.next: self.next.previous = self.previous if self.previous: self.previous.next = self.next self.next = None ...
path = "./Inputs/day5.txt" # path = "./Inputs/day5Test.txt" def part1(): seats = getSeats() highestSeat = max(seats) print("Part 1:") print(highestSeat) def part2(): seats = getSeats() # get the missing seat difference = sorted(set(range(seats[0], seats[-1] + 1)).diff...
def max(*args): if len(args) == 0: return 'no numbers given' m = args[0] for arg in args: if arg > m: m = arg return m print(max()) print(max(5, 12, 3, 6, 7, 10, 9))
def solution(N): n = 0; current = 1; nex = 1 while n <N-1: current, nex = nex, current+nex n +=1 return 2*(current+nex)
a = [2012, 2013, 2014] print (a) print (a[0]) print (a[1]) print (a[2]) b = 2012 c = [b, 2015, 20.1, "Hello", "Hi"] print (c[1:4])
# SB1 may have terrible calibration (is 2x as faint, and wasn't appropriately # statwt'd b/c it didn't go through the pipeline) vis = [#'16B-202.sb32532587.eb32875589.57663.07622001157.ms', '16B-202.sb32957824.eb33105444.57748.63243916667.ms', '16B-202.sb32957824.eb33142274.57752.64119381944.ms', '...
class Solution: def _breakIntoLines(self, words: List[str], maxWidth: int) -> List[List[str]]: allLines = [] charCount = 0 # list of strings for easy append currLine = [] for word in words: wordLen = len(word) if wordLen + charCount > maxWidth: ...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\xc2\xce\xc6\x9e\xff\xa7\x1b:\xc7O\x919\xdf=}d' _lr_action_items = {'TAG':([20,25,32,44,45,],[-21,-19,39,-22,-20,]),'LBRACE':([10,13,15,24,],[-9,17,20,-10,]),'RPAREN':([14,18,19,26,31,],[-...
class Solution: def romanToInt(self, s: str) -> int: symbol_map = { "I": (0, 1), "V": (1, 5), "X": (2, 10), "L": (3, 50), "C": (4, 100), "D": (5, 500), "M": (6, 1000) } position = 0 value = 0 ...
class Error(): def __init__(self, error): self.code = error self.get_name() def get_name(self, *args, **kwargs): if self.code == 'UP_001': self.name = 'File not allowed' self.name_ger = 'Datei nicht erlaubt' self.description = 'Der Dateityp ist ni...
class PolicyNetwork(ModelBase): def __init__(self, preprocessor, input_size=80*80, hidden_size=200, gamma=0.99): # Reward discounting factor super(PolicyNetwork, self).__init__() self.preprocessor = preprocessor self.input_...
# coding:utf-8 def request_parameter_checker(check_rules, force_ajax=False): ''' 用于校验request中的参数是否符合check_rules中的设定 check_rules - 参数校验规则,为一个list,每条规则如下 {'p_name':'para_1', 'method':'GET/POST', 'regex':'*', 'must': True, 'desc':u'描述信息'} force_ajax - 当参数校验出错时,无论request是否是ajax, 返回数据均按照ajax方式处理 ''...
#!/bin/python #This script is made to remove ID's from a file that contains every ID of every contig. def file_opener(of_file): with open(of_file, 'r') as f: return f.readlines() def filter(all, matched): filterd = [] for a in matched: if a not in matched: filterd.append(a...
''' © 2014 Richard A. Benson <richardbenson91477@protonmail.com> ''' class Path: # curves, curves_n def __init__ (self): self.curves = [] self.curves_n = 0 def curve_eval (self, t): # NOTE: returns ints if not self.curves_n: return curve_c = int(t) ...
""" 백준 16199번 : 나이 계산하기 """ by, bm, bd = map(int, input().split()) ny, nm, nd = map(int, input().split()) print(ny-by if nm > bm or (nm == bm and nd >= bd) else ny - by - 1) print(ny-by+1) print(ny-by)
""" You are given a binary tree and you need to write a function that can determine if it is height-balanced. A height-balanced tree can be defined as a binary tree in which the left and right subtrees of every node differ in height by a maximum of 1. """ # # Binary trees are already defined with this interface: # cl...
# This is to write an escape function to escape text at the MarkdownV2 style. # # **NOTE** # The [1]'s content provides some notes on how strings should be escaped, # but let the user deal with it himself; there are such things as "the string # ___italic underline___ should be changed to ___italic underline_\r__, # wh...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: def node2num(node): val = 0 while node: val = val * 10 + no...
#generator2.py class Week: def __init__(self): self.days = {1:'Monday', 2: "Tuesday", 3:"Wednesday", 4: "Thursday", 5:"Friday", 6:"Saturday", 7:"Sunday"} def week_gen(self): for x in self.days: yield self.days[x] if(__name__ == "__main__"):...
s1 = '854' print(s1.isnumeric()) # -- ISN1 s2 = '\u00B2368' print(s2.isnumeric()) # -- ISN2 s3 = '\u00BC' print(s3.isnumeric()) # -- ISN3 s4='python895' print(s4.isnumeric()) # -- ISN4 s5='100m2' print(s5.isnumeric()) # -- ISN5
# class LLNode: # def __init__(self, val, next=None): # self.val = val # self.next = next class Solution: def solve(self, node, k): # Write your code here n = 0 curr = node while curr: curr = curr.next n += 1 if k%n==0: ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def nextLargerNodes(self, head: ListNode) -> List[int]: if not head: return [0] node = head ...
class Config(): API_KEY = '9b680a8b-22d4-4069-b0e6-f6cc97cd9d71' API_URL = 'https://api.demo.11b.io' API_ACCOUNT = 'A00-000-030' config = Config()
''' One cool aspect of using an outer join is that, because it returns all rows from both merged tables and null where they do not match, you can use it to find rows that do not have a match in the other table. To try for yourself, you have been given two tables with a list of actors from two popular movies: Iron Man 1...
# # PySNMP MIB module CISCO-ANNOUNCEMENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ANNOUNCEMENT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:50:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
# Will you make it? def zero_fuel(distance_to_pump, mpg, fuel_left): if ( distance_to_pump - mpg*fuel_left )>0: result = False else: result = True return result
""" So we gonna need a way to check quest progress. This might be as simple as checking if Admiral has a Ship or we might have to check if he completed 1-1 4 times while jumping in one leg I have no idea. At first I intended to write a simple function for each Quest, but the Admiral can activate and deactivate stuff a...
def fib(n, calc): if n == 0 or n == 1: if len(calc) < 2: calc.append(n) return calc[n], calc elif len(calc)-1 >= n: return calc[n], calc elif n >= 2: res1, c = fib(n-1, calc) res2, c = fib(n-2, calc) res = res1 + res2 calc.append(res) ...
def urandom(n): # """urandom(n) -> str # Return a string of n random bytes suitable for cryptographic use. # """ #try: # _urandomfd = open("/dev/urandom", O_RDONLY) #except (OSError, IOError): # raise NotImplementedError("/dev/urandom (or equivalent) not found") #try: # bs...
#!/usr/bin/env python """List of hedge funds/institution names **for educational purposes only. MIT License""" __author__ = "Aneesh Panoli" __copyright__ = "MIT License" def institutions(): keywords = ["Natixis", "TIAA", "Deutsche", "Invesco", "Franklin", "Rowe", "AXA", "Legg", "Sumitomo"\ ...
# # @lc app=leetcode id=114 lang=python3 # # [114] Flatten Binary Tree to Linked List # # https://leetcode.com/problems/flatten-binary-tree-to-linked-list/description/ # # algorithms # Medium (51.57%) # Likes: 4378 # Dislikes: 411 # Total Accepted: 451.1K # Total Submissions: 847.4K # Testcase Example: '[1,2,5,3...
def clone_runoob(li1): li_copy = li1[:] # li_copy = [] # li_copy.extend(li1) # li_copy = list(li1) return li_copy li1 = [4, 8, 2, 10, 15, 18] li2 = clone_runoob(li1) li1[0] = 5 print("原始列表:", li1) print("复制后列表:", li2)
def Tproduct(arg0, *args): p = arg0 for arg in args: p *= arg return p
mylist = input('Enter your list: ') mylist = [int(x) for x in mylist.split(' ')] points = [0,15,10,10,25,15,15,20,10,25,20,25,25,5,20,30,20,15,10,5,5,15,20,20,20,20,15,15,20,25,15,20,20,20,15,40,15,30,35,20,25,15,20,15,25,20,25,20,25,20,10] total = 0 for index in mylist: total += points[index] print (total)
"""Pipelines for features generation.""" __all__ = [ "base", "lgb_pipeline", "image_pipeline", "linear_pipeline", "text_pipeline", "wb_pipeline", ]
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
catalog = "fichier.html" # The function write in HTML the title which has a level 1 title def h1(title_lv1): with open(catalog , "a") as htm_file: sorting = title_lv1 cont = sorting.split("#") useless = "".join(cont) matter = useless.split("\n") matter[1] = matter[0] ...
''' 对链表进行插入排序。 插入排序的动画演示如上。从第一个元素开始,该链表可以被认为已经部分排序(用黑色表示)。 每次迭代时,从输入数据中移除一个元素(用红色表示),并原地将其插入到已排好序的链表中。 插入排序算法: 插入排序是迭代的,每次只移动一个元素,直到所有元素可以形成一个有序的输出列表。 每次迭代中,插入排序只从输入数据中移除一个待排序的元素,找到它在序列中适当的位置,并将其插入。 重复直到所有输入数据插入完为止。   示例 1: 输入: 4->2->1->3 输出: 1->2->3->4 示例 2: 输入: -1->5->3->4->0 输出: -1->0->3->4->5 来源:力扣(LeetCod...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # FreeType high-level python API - Copyright 2011-2015 Nicolas P. Rougier # Distributed under the terms of the new BSD license. # # ----------------------------------------------------------------------------- ""...
INPUT_FILE = "../../input/01.txt" def parse_input() -> list[int]: """ Parses the input and returns a list of depth measurements. """ with open(INPUT_FILE, "r") as f: return [int(line) for line in f] def count_increases(measurements: list[int]) -> int: """ Counts the number of times a...
URLS = 'app.urls' POSTGRESQL_DATABASE_URI = "" DEBUG = True BASE_HOSTNAME = 'http://192.168.30.101:8080' HOST = '0.0.0.0' USERNAME = 'user' PASSWORD = 'pass'
class ModelMetrics: def __init__(self, model_name, model_version, metric_by_feature): self.model_name = model_name self.model_version = model_version self.metrics_by_feature = metric_by_feature
{ "name": "Attachment Url", "summary": """Use attachment URL and upload data to external storage""", "category": "Tools", "images": [], "version": "13.0.2.1.0", "application": False, "author": "IT-Projects LLC, Ildar Nasyrov", "website": "https://apps.odoo.com/apps/modules/13.0/ir_attach...
class Sample: """A representation of a sample obtained from IRIDA""" def __init__(self, name, paired_path, unpaired_path): """ Initialize a sample instance :type name: str :param name: the name of the sample :type path: str :param path: the URI to obtain the sa...
class QuotesType: """ Checks whether quotation marks are double or single in source file. """ NEED_TO_USE_SINGLE_QUOTES = 'need_to_use_single_quotes' NEED_TO_USE_DOUBLE_QUOTES = 'need_to_use_double_quotes' discrete_groups = [ { 'name': 'single_quotes' }, { 'name': 'double_quotes' }, ...
def get_xoutput_ref(self): """Return the reference XOutput (or Output) either from xoutput_ref or output_list Parameters ---------- self : XOutput A XOutput object Returns ------- xoutput_ref: XOutput reference XOutput (or Output) (if defined) """ if self.xoutput_re...
def constraint_in_set(_set = range(0,128)): def f(context): note, seq, tick = context if seq.to_pitch_set() == {}: return False return seq.to_pitch_set().issubset(_set) return f def constraint_no_repeated_adjacent_notes(): def f(context): note, seq, tick = co...
#!/usr/bin/env LANG=en_UK.UTF-8 /usr/local/bin/python3 ''' Multiple language title article splitting script Takes arguments of full title, and title language in ISO Country Code alpha-2 Handles the potential for title entries to be upper case or lower case. Loads TITLE_ARTICLES dictionary, which returns a list of titl...
load("@rules_scala_annex//rules:providers.bzl", "LabeledJars") def labeled_jars_implementation(target, ctx): if JavaInfo not in target: return [] deps_labeled_jars = [dep[LabeledJars] for dep in getattr(ctx.rule.attr, "deps", []) if LabeledJars in dep] java_info = target[JavaInfo] return [ ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
def check_for_wildcard(policy): """ Checks for wildcards in policy statements """ # Make sure Statement is a list if type(policy.policy_json['Statement']) is dict: policy.policy_json['Statement'] = [ policy.policy_json['Statement'] ] for sid in policy.policy_json['Statement']: ...
# Exercício 030 - Par ou Ímpar? x = int(input('Me diga um número qualquer: ')) resultado = 'PAR' if x % 2 == 0 else 'ÍMPAR' print(f'O número {x} é {resultado}')
def main(): print(("강한친구 대한육군" + "\n") * 2) if __name__ == "__main__": main()
# -*- coding: utf-8 -*- FILTER_RULE = ( (-1, u'发送'), (1, u'接收'), ) RULE_LOGIC = ( ("all", u'满足所有条件'), ("one", u'满足一条即可'), ) DISABLED_STATUS = ( (-1, u'启用'), (1, u'禁用'), ) COND_LOGIC = ( ("all", u'满足所有'), ("one", u'满足任意'), ) #################################################### ALL_CO...
#Escreva um programa que leia a velocidade de um carro. velocidade = float(input('Velocidade: ')) # Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado if velocidade > 80: print(f'Passou a {velocidade} numa pista de 80 !!! \nVai pagar R${((velocidade-80)*30):.2f} de multa') #A multa vai custa...
# This is the version string assigned to the entire egg post # setup.py install __version__ = "0.0.9" # Ownership and Copyright Information. __author__ = "Colin Bell <colin.bell@uwaterloo.ca>" __copyright__ = "Copyright 2011-2014, University of Waterloo" __license__ = "BSD-new"
#This file was created by Diego Saldana TITLE = " SUPREME JUMP " TITLE2 = " GAME OVER FOO :( " # screen dims WIDTH = 480 HEIGHT = 600 # frames per second FPS = 60 # player settings PLAYER_ACC = 0.5 PLAYER_FRICTION = -0.12 PLAYER_GRAV = 0.8 PLAYER_JUMP = 100 FONT_NAME = 'arcade' # platform settings PLATFO...
# # PySNMP MIB module XYLAN-HEALTH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-HEALTH-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:38:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
# parrot = "Norwegian Blue" # # for character in parrot: # print(character) number = '9,223;372:036 854,775;807' seperators = "" for char in number: if not char.isnumeric(): seperators = seperators + char print(seperators) things = ["bed", "computer", "red", "desk"] space = "" for i ...
""" Settings for running tests. """ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } SECRET_KEY = '8ij$(7l2!w0f8kggntbv=+$bd=^2xs$cl+3v^_##qjw@2py9_3' INSTALLED_APPS = ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.co...
expected_output = { 'vll': { 'MY-UNTAGGED-VLL': { 'vcid': 3566, 'vll_index': 37, 'local': { 'type': 'untagged', 'interface': 'ethernet2/8', 'state': 'Up', 'mct_state': 'None', 'ifl_id': '--', 'vc_type': 'tag', 'mtu': 9190, 'cos': '-...
# # @lc app=leetcode id=72 lang=python3 # # [72] Edit Distance # # https://leetcode.com/problems/edit-distance/description/ # # algorithms # Hard (40.50%) # Likes: 2795 # Dislikes: 44 # Total Accepted: 213.4K # Total Submissions: 526.3K # Testcase Example: '"horse"\n"ros"' # # Given two words word1 and word2, fi...
n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) ans = 0 # 再帰で書くと遅い # def bin_search(li_sorted, val): # global ans # m = len(li_sorted) # l = int(m / 2) # if val == li_sorted[l]: # ans += 1 # elif m > 1: # li_left = li_sorte...
""" Reverse Words in a String III Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Input: "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc" Note: In the string, each word is separated by si...
class User: def __init__(self, id = None, email = None, name = None, surname = None, password = None, wallet = 0.00, disability = False, active_account = False, id_user_category = 2): # id_user_category = 2 -> Student self._id = id self._email = email self._name = name self._surna...
n1=int(input('primerio número: ')) n2=int(input('segundo número: ')) if n1 > n2: print('o primeiro é maior.') elif n2 > n1: print('o segundo é maior.') else: print('os dois são iguais.')
# 487. Max Consecutive Ones II # Runtime: 420 ms, faster than 12.98% of Python3 online submissions for Max Consecutive Ones II. # Memory Usage: 14.5 MB, less than 11.06% of Python3 online submissions for Max Consecutive Ones II. class Solution: _FLIP_COUNT = 1 # Sliding Window def findMaxConsecutiveOne...
# -*- coding:utf-8 -*- # --------------------------------------------- # @file options # @description options # @author WcJun # @date 2021/08/02 # --------------------------------------------- class RequestOptions(object): def __init__(self, url, method='post', body=None, parameters=None, heade...
def simple_separator(): print('**********') return simple_separator simple_separator() print('Привет всем!') def long_separator(count): print('*' * count) return long_separator long_separator(10) def long_separator(simbol, count): print(simbol * count) return long_sepa...
x1, y1, x2, y2 = map(int, input().split()) dx = x2 - x1 dy = y2 - y1 ans = [] for i in range(2): dx, dy = -dy, dx x2 += dx y2 += dy ans.append(x2) ans.append(y2) print(*ans)