content
stringlengths
7
1.05M
join_date = '19.5.21' time_join = '16:00' name = 'EJ Studios#3379' exp = 0 next_level_up = 100 level = 0 health = 100 gold = 0 healthpotion = 1 food = 0 wood = 0 stone = 0 iron = 0 active_weapon = 'WOODEN_SWORD' wood_owned = True wood_durability = 100 wood_attack = 10 stone_owned = False stone_durability = 100 stone...
''' с помощью встроенного цикла выводит квадрат из звезд ''' a = int(input("сколько звезд в строке: ")) for i in range(a): for j in range(a): print("* ", end="") print()
class ListUtility: def list_formating(data): data_split = data.split() removers = ["\n", "\r", "\r\n", "\n\r", "\t"] data_remove = [i for i in data_split if i not in removers] data_fixed = ' '.join(data_remove) return data_fixed.split("."...
class Solution: def correctBinaryTree(self, root: TreeNode) -> TreeNode: q = deque([root]) seen = set() while q: node = q.popleft() if node.right: if node.right.right in seen: node.right = None return root ...
# Global Variables P1 = "x" # token for player 1 P2 = "o" # token for player 2 BL = "0" # token for BL/blank space def isThereAWinInAnyRow(a): # checking for a wins if a[0] == P1 and a[1] == P1 and a[2] == P1: return True # checking for o wins if a[0] == P2 and a[1] == P2 and a[2] == P2: re...
__version__ = '0.9.1' __version_name__ = 'Morino Kirin-chan' def version_string(): return '%(prog)s version %(version)s "{}"'.format(__version_name__)
def find_duplicates(arr1, arr2): """ differing sizes >= ints sorted unique ints in each arr arr1 = [1, 2, 3, 5, 6, 7], arr2 = [3, 6, 7, 8, 20] # Brute force - - iterative - quadratic # Idea - Sets {1, 2, 3, 5, 6, 7} [3] {3, 6, 7} = [3, 6, 7] S = smaller arr...
# !/usr/bin/env python # coding: utf-8 ''' Description: Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. Tags: Linked List ''' # Definition for singly-linked list. # class ListNode(...
############################################################################### # Author: Jayden Lee # Date: 27/06/19 # Purpose: Simple list concatecation and looping example. ############################################################################### maxPosition = int(input("Please enter the size of the list: "...
class Solution: def maxDepth(self, root): if not root: return 0 height = 0 for node in root.children: height = max(self.maxDepth(node), height) return height + 1 ''' Success Details Runtime: 52 ms, faster than 30.42% of Python3 Memory Usage: 15.9 MB, less th...
# # @lc app=leetcode.cn id=413 lang=python3 # # [413] arithmetic-slices # None # @lc code=end
#!/usr/bin/env python3 def mulf(*vars): """Returns vars[0] * ... >>> mulf(1,2,3,4) 24 >>> mulf(1,2,3,4, "Z") 'ZZZZZZZZZZZZZZZZZZZZZZZZ' """ v = 1 for i in vars: v *= i return v
""" /////////////////////////////////////////////////////// │ │ Filename: automate_3_plot_close_distal.py │ Description: │ To print close scores (and distal scores) │ so that you can copy paste them into analyze.py │ in order to make a scatter plot with labels │ ================================================== │ Au...
# -*- coding: utf-8 -*- def main(): n = int(input()) xs = [0 for _ in range(n)] ys = [0 for _ in range(n)] d = dict() # KeyInsight (◯:気がつけた,△:解説を読んでなんとなく理解,×:理解できず): # ◯ 任意の二点について,ベクトルを計算 # △ 同じベクトルの頻度を計算する # △ 頻度の最大値が減らせるコストの最大値 # See: # https://www.youtube.com/...
''' list comprehension ''' def traco(valor=30): return print('-'*valor) lista1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] ex2 = [variavel for variavel in lista1] print(f'Lista 1 >> {lista1}') print(f'Lista 2 >> {ex2}') traco(40) ex3 = [variavel*2 for variavel in lista1] print(f'Lista 3 >> {ex3}') traco(40) ex4 = [(v, v2) for ...
ACTIVE_ALARMS_HEADER = 'ACTIVE ALARMS' ACTIVE_PROFILES_HEADER = 'ACTIVE PROFILES' AGENTS_HEADER = 'AGENTS' DASHBOARD_HEADER = 'DASHBOARD' LAST_INACTIVE_ALARMS = 'Last 20 Inactive Alarms' NO_ACTIVE_ALARMS_MSG = 'No active alarms at this time.' NO_PROFILES_CONFIGURED_MSG = 'No Profiles Configured' SETUP_PROFILE_HEADER =...
""" # copy of taiwanReliefData inside armor module # to create the taiwan coastlines etc for display given a particular grid size # use: kwargs = {'files' :['100','1000','2000','3000', 'Coast'], 'width' : 921, 'height' : 881, 'lowerLeft' : (115, 18), 'upperRight...
print('state dummy{') parser = open('a_chains.p4').read() for line in open('a_hdrlist.p4'): line = line.strip() if line == '': continue handle = line.split()[1].strip(';') if handle in parser: continue print('\tpkt.extract(hdr.{});'.format(handle)) print('\ttransition accep...
#defining a dictionary data structure example_dict = { #key : value of element "class" : "Astr 119", "prof" : "Brant", "awesomeness" : 10 } print(type(example_dict)) #says "dict" course = example_dict["class"] #to get a value via the key above print(course) example_dict["awesomeness"] += 1 #to change a...
def lucky_sum(a, b, c): retSum = 0 for i in [a, b, c]: if i == 13: break retSum += i return retSum
def find_combinations(puzzle_input): unnecessary_numbers = [] index = 1 while index < len(puzzle_input) - 1: if puzzle_input[index+1] - puzzle_input[index-1] <= 3: unnecessary_numbers.append(puzzle_input[index]) del puzzle_input[index] else: index += 1 ...
class Connect4Board(): def __init__(self): self.grid = [[' '] * 7 for i in range(6)] self.turn = True self.winner = '' self.legal_moves = [i for i in range(7)] self.num_total_moves = 7 def is_game_over(self): for i in range(6): for j in range(7): ...
# -*- coding: UTF-8 -*- #thinkpad-is-saikou #Copyright (c) 2016 Atnanasi #Released under the MIT license #https://github.com/Atnanasi/thinkpad-is-saikou/blob/master/LICENSE def ThinkpadIs(): return "Saikou" if __name__=="__main__": print("Thinkpad is",ThinkpadIs())
''' Created on December 12, 2020 @author: rosed2@mskcc.org '''
""" https://adventofcode.com/2020/day/1 """ def two_add_up(inputs, target=2020): inputs_two = inputs[:] inputs_two.sort(reverse=True) for first_input in inputs_two: temp = first_input for second_input in inputs_two: if target - temp - second_input == 0: result =...
class Solution: def hasPathSum(self, root, sum): if not root: return False if root.left is None and root.right is None and sum == root.val: return True left = self.hasPathSum(root.left, sum - root.val) right = self.hasPathSum(root.right, sum - root.val) return left or right ...
__version__ = "1.0.1" __changelog__ = { "1.0.1":""" - update required minimal pip-tools version to support pip 20.1 see https://github.com/open-zaak/open-zaak/issues/585#issuecomment-626666736 """, "1.0": """ - Removed dump_changelog - Added load_version utility - Added upda...
#!/usr/bin/env python # encoding: utf-8 ''' @license: (C) Copyright 2013-2020, Node Supply Chain Manager Corporation Limited. @time: 2021/6/4 11:13 @file: config.py @author: baidq @Software: PyCharm @desc: ''' # 注意,这里每一个意图下都有"Disease"这个槽位 # 只要在最开始将该槽位填充后,后面就可以不断的就填充的槽值进行多轮对话 # 因为槽位填充的逻辑里面有一个是获取上一步的槽值 semantic_slot = { ...
# Remove Duplicates from Sorted List II # https://www.interviewbit.com/problems/remove-duplicates-from-sorted-list-ii/ # # Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. # # For example, # Given 1->2->3->3->4->4->5, return 1->2->5. # Given...
#!usr/bin/env python3 # _*_ coding:utf-8 _*_ """ ------------------------------- @Author: yuxy @Time: 2018/2/2 14:47 @File: Student.py @Project: PythonSyntax -------------------------------- """ class Student(object): def __init__(self, name, score, gender): self.__name = name self...
class Category: def __init__(self, name): self.name = name self.ledger= list() def deposit(self, amount, description= ""): to_add= {} to_add["amount"] = amount to_add["description"] = description self.ledger.append(to_add) def withdraw (self, amount, description= ""): apporv...
#The function mySum is supposed to return the sum of a list of numbers (and 0 if that list is empty), but it has one or more errors in it. #Use this space to write test cases to determine what errors there are. You will be using this information to answer the next set of multiple choice questions. assert mySum(0) mlist...
def calculate_score(word): VOWELS = ['A', 'E', 'I', 'O', 'U'] vowels = consonants = 0 for ix, letter in enumerate(reversed(word)): if letter in VOWELS: vowels += ix + 1 else: consonants += ix + 1 return vowels, consonants def minion_game(word): kevin, stua...
s = input().split() d = {} for i in s: if i not in d: d[i] = 0 d[i] += 1 for k, v in d.items(): print(k, v)
# Ao receber o nome do usuário, digite # 'olá, $nome', é um prazer te conhecer nome = input('Qual é o seu nome? ') print('Olá, ' + nome + '! é um prazer te conhecer.') # Ou, com formatação print('Olá, {}! é um prazer te conhecer.'.format(nome))
def urlencode(query, doseq=False, safe='', encoding=None, errors=None): """Encode a dict or sequence of two-element tuples into a URL query string. If any values in the query arg are sequences and doseq is true, each sequence element is converted to a separate parameter. If the query arg is a sequence...
AES_128_ECB_test_vectors = ( {"key": "911500915E8514174402A13118EA362C", "plain": "4163F3BEABA14D6C1E406BD5646CAC9A", "cipher": "39610A1E8F66501D952C27AB52C4DC9A"}, {"key": "BCCF986A4D74B719EEB1D93CDABE96D5", "plain": "A6325414DDE2E367AABA669766316976", "cipher": "666C5668ECAAD6E66C7FB569E52...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ''' Very simple spatial image class The image class maintains the association between a 3D (or greater) array, and an affine transform that maps voxel coordinates to some real world space. It also has a `...
#organizador de código, def about(alt, name): print('=' * 20) print('Vinicius Ederman', name) print('data = 20/12', alt) print('=' * 20) print('teste inicío') about() print('teste fim') #alterando o about about('data = 25/12/2021', 'Vinicius Junior') ## about('data = 01/01/2022', 'Carlos Jose') def cubo(...
def binary_search(list, value): low = 0 high = len(list) - 1 # 这是索引,注意减1 while low <= high: mid = int((low+high)/2) # int() 取整 mid_value = list[mid] if value == mid_value: return mid elif value > mid_value: low = mid + 1 # 动起来 else: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- class Tools: """Tools class, tools needed in most of the code all the same""" #unicode safe code (https://code.djangoproject.com/ticket/170) def unicode_safe(self,word): if type(word) == unicode: word = word.encode('utf-8') return word #calculate median for an...
#Ex.07 A = int(input('Termo antecessor: ')) C = int(input('Termo sucessor: ')) B = (A + C) / 2 print(f'O termo médio é {B}')
# Update this text to match your story. start = ''' You wake up one morning and find that you aren't in your bed; you aren't even in your room. You're in the middle of a giant maze. A sign is hanging from the ivy: "You have one hour. Don't touch the walls." There is a hallway to your right and to your left. ''' print(...
""" :author: john.sosoka :date: 5/10/2018 """
sol_space = {} def foo(n, d): '''Recursive function to find number of valid expression with given length and depth''' global sol_space if n ==0 and d == 0: return 1 # invalid cases if n < 2*d: return 0 if n % 2 == 1: return 0 if n == 0 or d == 0: return 0 # Base cases if n...
# just a bunch of assert methods to use. class AssertionFailedException(Exception): """ Just an exception that we throw when failing an assert """ def __init__(self, message): super(AssertionFailedException, self).__init__(message) def assert_equals(expected, actual, message = None): "...
# 即一次训练所抓取的数据样本数量 batch_size = 32 window_size = int(256) # must be a multiple of batch_size # 验证集大小 设为数据集的1% validation_size = 162 * batch_size # must be a multiple of batch_size # 测试集大小 test_size = 162 * batch_size # must be a multiple of batch_size # 简单移动平均线周期长度 ma_periods = 14 # Simple Moving Average periods le...
# See: https://www.codewars.com/kata/56a5d994ac971f1ac500003e def longest_consec(s, k): return max([''.join(i) for i in zip(*[s[i:] for i in range(k)])]+[''], key=len)
__version__ = "0.6.0" __title__ = "pygbif" __author__ = "Scott Chamberlain" __license__ = "MIT"
#!/usr/bin/env python3 # # # Copyright (c) 2021 Facebook, inc. and its affiliates. All Rights Reserved # # LATEX = r""" \documentclass{{article}} \usepackage{{booktabs}} \title{{Report}} \author{{DLP and MIB}} \date{{\relax}} \begin{{document}} \section{{In-domain evaluation}} {indomain_table} \section{{Out-of-domain...
""" PASSENGERS """ numPassengers = 15249 passenger_arriving = ( (3, 1, 2, 3, 3, 1, 1, 1, 1, 1, 0, 1, 0, 4, 1, 4, 3, 4, 2, 3, 1, 1, 1, 2, 0, 0), # 0 (2, 4, 6, 3, 3, 2, 3, 0, 3, 0, 0, 1, 0, 11, 1, 4, 2, 9, 2, 3, 1, 0, 0, 1, 0, 0), # 1 (6, 3, 3, 4, 6, 4, 0, 1, 2, 1, 1, 0, 0, 3, 10, 4, 1, 2, 1, 0, 0, 3, 1, 1, 1, 0)...
class RgbdFrame: """ Contains: rgb : numpy [H, W, C] depth : numpy [H, W] where unavailable pixels equal 0 timestamp : second """ def __init__(self, rgb, depth, timestamp=0): self.rgb = rgb self.depth = depth self.timestamp = timestamp
print('Start') done_flag = False total = 0 while not done_flag: num = int(input('Please input an integer: ')) if num > 0: total = total + num else: done_flag = True print('Total: ', total) print('Stop')
''' Given two strings, print the longest common subsequence x = "abcdgh" y = "aebdghr" LCS = 5 ie. "abdgh" ''' def print_lcs(x, y, n, m): dp = [[0 for _ in range(m+1)] for _ in range(n+1)] for i in range(1, n+1): for j in range(1, m+1): if x[i-1] == y[j-1]: dp[i][j] = 1 + ...
txt_help_text = """ This app will predict the probability of you developing type-2 diabetes. In order to use it, fill in all the fields and press send. To make sure everything runs smoothly, there are some restrictions: 1) Negative numbers cannot be given. 2) The correct type of information must be entered e.g no ...
""" 1 - Funções nomeadas (def) 2 - Funções Anônimas (lambda) 3 - Funções de classe (class) """ def nomeada_soma(x, y): return x + y anonima_soma = lambda x, y: x + y class classe_soma: def __init__(self, x, y): self.x = x self.y = y def __call__(self): return self.x + self.y
# encoding: utf-8 """Initialization module for gdcapiwrapper package.""" __version__ = "0.2"
# optimizer optimizer = dict(type='AdamW', lr=1e-3, betas=(0.9, 0.999), weight_decay=0.05) # learning policy lr_config = dict( policy='CosineAnnealing', min_lr=0., warmup='linear', warmup_iters=5, warmup_ratio=1e-4, # cannot be 0 warmup_by_epoch=True) # runtime settings runner = dict(type='Ep...
# # PySNMP MIB module SA-CM-MTA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SA-CM-MTA-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:51:39 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...
""" PLUGIN for print function - action : ACTION_NAME print will print the result of action execution to STDOUT """ #import logging #logger = logging.getLogger() ############################################ # Exec if comman execution was NOT successful def grep( output, lines ): result = [] for line i...
# Copyright 2021 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...
""" Created on 9 Oct 2012 @author: konmik """ class Connect(object): """represents connect tag""" def __init__(self, node, converter): self.gate = node.get("gate") self.pin = node.get("pin") self.pad = node.get("pad") class Technology(object): """represents technology tag""" ...
# -*- coding: utf-8 -*- """ Created on Sun Mar 22 20:48:37 2020 @author: Ravi """ n,m = map(int,input().split(" ")) arr = [0]*n for i in range(m): mx = 0 a,b,k = map(int,input().split(" ")) for i in range(a,b+1): arr[i-1]+=k if arr[i-1]>mx: mx =arr[i-1] print(...
class Solution(object): def superPow(self, a, b): """ :type a: int :type b: List[int] :rtype: int """ MODULI = 1337 if a == 0: return 0 ans = 1 for n in b: ans = pow(ans, 10, MODULI) ans = (ans * pow(a, n, MO...
t = int(input()) while t: t -= 1 c, d = map(int, input().split()) if (26**c) * (10**d) == 1: print(0) else: print((26**c) * (10**d))
def longestCommonSubsequence(self, text1: str, text2: str) -> int: """ >>> dynammic programming This question is known as LCS problem and is presented together with LIS: longest increasing subsequence. """ # current solution can be optimized using O(N) space ...
def make_shirt(size='large', words='I love the world'): print("The T-shirt is " + size + " and the words '" + words + "' are on it.") make_shirt() make_shirt('middle') make_shirt(words='I love you')
class info: def __init__(self, L, AE, r): self.L = L self.AE = AE self.r = r
# FILE = 'dictionary.txt' LETTER = 'abcdefghijklmnopqrstuvwxyz' class Dictionary_Set: def __init__(self, diction_file): self.diction_file = diction_file self.diction_set = set() def diction_s(self): with open(self.diction_file, 'r') as f: for line in f: ...
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None self.last_node = None def append(self, data): if self.last_node is None: self.head = Node(data) self.last_node...
def main(request, response): try: code = int(request.GET.first("code", None)) except: code = None if request.method == "OPTIONS": if code: response.status = code response.headers.set("Access-Control-Max-Age", 1) response.headers.set("Access-Control-Allow-...
# ordem de precedencia # 1 == () # 2 == ** # 3 == * , / , // , % # 4 == + , - n1 = int(input('Digite um numero: ')) n2 = int(input('Digite outro numero: ')) s = n1 + n2 m = n1 * n2 d = n1 / n2 di = n1 // n2 e = n1 ** n2 print('A soma e: {} o produto e: {} a divisao e: {:.3f}'.format(s, m, d), end=' ') print('Divisa...
NB_KEYS = 42 REGION_ID_CODES = {"alphanum": 0x2a, "enter": 0x0b, "modifiers": 0x18, "numpad": 0x24} def make_key_colors_packet(region, colors_map): packet = [] region_hexcode = REGION_ID_CODES[region] header = [0x0e, 0x00, region_hexcode, 0x00] packet += header k = 0 for keycode, rgb in col...
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../build/common.gypi', ], 'conditions': [ ['OS=="win"', { 'targets': [ { 'target_name': 'cld', ...
# Frequency Type MONTHLY = 12 ANNUALLY = 1 FREQUENCY_TYPE = { MONTHLY: 'Monthly', ANNUALLY: 'Anually' } # Loan Type CONVENTIONAL = 0 HARD_MONEY = 1 PRIVATE_MONEY = 2 OTHER = 3 LOAN_TYPE = { CONVENTIONAL: 'Conventional', HARD_MONEY: 'Hard Money', PRIVATE_MONEY: 'Private Money', OTHER: 'Other' }
""" Given a string, find out if its characters can be rearranged to form a palindrome. palindromeRearranging(inputString) = true. """ def palindromeRearranging(inputString): dictionary = {} for string in inputString: if string not in dictionary: dictionary[string] = 1 else: ...
numbersArray = [12, 23, 5, 12, 92, 5,12, 5, 29, 92, 64,23] numbersAmount = {} def analizeArray(): for number in numbersArray: addNumber(number) def addNumber(newNumber): if(newNumber in numbersAmount): numbersAmount.update({newNumber: numbersAmount[newNumber]+1}) else: numbersAmount.update({newNumbe...
camp_id = '' # 아이디 camp_pw = '' # 비밀번호 friends = { '훈련병이름': { 'name': '훈련병이름', 'birth': 19990101, 'unit_code': 1, 'group_id': 1, 'relationship': '친구' } } NEWS_API_TOKEN = '' # https://newsapi.org TELEGRAM_TOKEN = '' # not required TELEGRAM_CHAT_ID =...
# Finicky Counter # Demonstrates the break and continue statements count = 0 while True: count += 1 # end loop if count greater than 10 if count > 10: break # skip 5 if count == 5: continue print(count) input("\n\nPress the enter key to exit.")
def add(num1, num2): return num1 + num2 def subtract(num1, num2): return num1 - num2 def multiply(num1, num2): return num1 * num2 def divide(num1, num2): return num1 / num2 select = int(input("Please select operation -\n" "1. Add\n" "2. Subtract\n" ...
pkgname = "gnu-getopt" pkgver = "0.0.1" pkgrel = 0 build_style = "makefile" make_cmd = "gmake" hostmakedepends = ["gmake"] pkgdesc = "GNU getopt compatibility package for musl" maintainer = "roastveg <louis@hamptonsoftworks.com>" license = "BSD-4-Clause AND ISC" url = "https://github.com/sabotage-linux/gnu-getopt" sour...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': s = input('Введите слово: ') s = s[-1:] + s[0] + s[1:-1] print(s)
# -*- coding: utf-8 -*- """ Created on Mon Oct 21 09:26:56 2019 @author: prevotge """ amqp_url='amqp://qiwsedps:WMXj527zSKlGKFACO2IRj_ZEr4LRU3jg@dove.rmq.cloudamqp.com/qiwsedps'
#练习2-8 # print(5 + 3) # print(10 - 2) # print(2 * 4) # print(int(32 / 4)) #练习2-9 my_favorite_number = 88 message = f'my favorote number is {my_favorite_number}!' print(message)
# # PySNMP MIB module DNOS-LLPF-PRIVATE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNOS-LLPF-PRIVATE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:36:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
# Parse different FHIR Profiles # FHIR Version 3.0.2 # flake8: noqa OBSERVATION_PROFILE = {"resourceType": "Observation", "displayFields": ["text", "subject.display", "valueQuantity.value", ...
class Models: RANDOMFORESTCLASSIFIER = 'RandomForestClassifier' LOGISTICREGRESSION = 'LogisticRegression' MULTINOMIALNB = 'MultinomialNB' MLPCLASSIFIER = 'MLPClassifier' class Datasets: ADULT = 'adult' GERMANCREDIT = 'german_credit' TWENTYNEWSGROUPS = '20_newsgroups' BREASTCANCER = 'bre...
class AliasCollector: def __init__(self): self.aliases = {} self.functions = {} self.commands = {} self.info_entries = [] def cmd(self, function, alias=None, info=None, name=None): """ Registers a command as "turboshell [name]" where name is the name of the fun...
# https://leetcode.com/problems/longest-substring-without-repeating-characters/ # 방법 1 def lengthOfLongestSubstring(s): wordCnt = {} cnt = 0 l, r = 0, 0 ans = 0 while r < len(s): if not wordCnt.get(s[r]): cnt += 1 wordCnt[s[r]] = 1 r += 1 ans...
sal = float(input('Meu salário atual é: ')) aum = float(input('Recebi um aumento de (em %): ')) n1 = sal + (sal * aum / 100) n2 = sal * aum / 100 print('Com {:.1f}%. Eu recebi um aumento de {:.2f}, portanto, meu novo salário será de: {:.2f}.'.format(aum, n2, n1))
class TrainConfig: def __init__(self): self.task = 't5_finetune' self.model_name = 't5-small' self.outer_lr = 1e-5 self.epochs = 1 self.max_iter = 20000 self.debug = False self.model_save_pt = 5000 self.write_loc = '..' self.silent = False
# coding: UTF-8 #A part of NonVisual Desktop Access (NVDA) #Copyright (C) 2017 Takuya Nishimoto (NVDA Japanese Team) SRC_FILE = "6ten kanji characters table-UTF8.txt" with open(SRC_FILE, encoding='utf-8-sig') as f: for s in f.readlines(): if s and s[0] != '#': s = s.strip('"\n') a ...
_squares = tuple(x*x for x in range(10)) def _sum_squares_of_digits(n: int) -> int: s = 0 while n > 0: s += _squares[n % 10] n //= 10 return s def solve(): eighty_nine, limit = 0, 10000000 map_limit = (len(str(limit))) * 81 mapped = [0 for _ in range(map_limit)] mapped[1...
# -*- coding: utf-8 -*- MONTH_COLOR = "#c1c1c1" DAY_COLOR = "#c6c6c6" TARGET_COLOR = "#212121" CALENDAR_PUZZLE_COLUMN = 7 class Block(object): row = 1 col = 1 def __init__(self, row=None, col=None, entity=None, index=None): if row: self.row = int(row) if col: sel...
Memory = \ { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, ...
BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) YELLOW = (255, 255, 0) BLUE = (0, 0, 255) MAGENTA = (255, 0, 255) CYAN = (0, 255, 255) WHITE = (255, 255, 255)
class TestingContent: introduction = ( "Arguably, understanding the current and future state of the COVID-19 " "pandemic begins with testing. Without testing, we do not understand " "which counties are managing the spread of this disease effectively " "and which are simply under-repo...
load("//spm/private/modulemap_parser:declarations.bzl", "declarations") load(":test_helpers.bzl", "do_failing_parse_test", "do_parse_test") load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") def _parse_test(ctx): env = unittest.begin(ctx) do_parse_test( env, "module with umbrella d...
class RenderingImageExposureSettings(object, IDisposable): """ Represents the exposure settings of rendering. """ def Dispose(self): """ Dispose(self: RenderingImageExposureSettings) """ pass def ReleaseUnmanagedResources(self, *args): """ ReleaseUnmanagedResources(self: Re...
input = open("input/input_14.txt").read().split("\n\n") rules = {element.split(" -> ")[0]: element.split(" -> ")[1] for element in input[1].split("\n")} str_new = input[0] for i in range(10): str_old = str_new str_new = "" for char in range(len(str_old)-1): str_new += str_old[char] if str_o...