content
stringlengths
7
1.05M
#!/usr/bin/env python3.7 class Responses: """ Agent Responses """ ANGRY = ["Stay back!!!", "I will kill the hostage, I swear!", "Back off, now!!", "Do you think this is a game???"] IRRITATED = ["Where are my demands?!", "What?!", "How about you start making sense?", "I am losing my patience!"] ...
g = 2402352677501852209227687703532399932712287657378364916510075318787663274146353219320285676155269678799694668298749389095083896573425601900601068477164491735474137283104610458681314511781646755400527402889846139864532661215055797097162016168270312886432456663834863635782106154918419982534315189740658186868651151358...
""" Modules for classes that are used as containers for global variables. Any function can import and modify/read the values stored in these classes. """ class HopliteServerSettings(): """ Holds global hoplite settings for the server. """ # Debug mode increases the amount of logging performed by certa...
def apply_slicing(data, slicing_string: str): """ Function to apply slicing without evaluating argument passed by user Parameters ---------- data : numpy.typing.ArrayLike slicing_string : str Returns ------- sliced_data : numpy.typing.ArrayLike """ if slicing_string == "":...
# # @lc app=leetcode id=108 lang=python3 # # [108] Convert Sorted Array to Binary Search Tree # # https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/ # # algorithms # Easy (60.07%) # Likes: 3685 # Dislikes: 269 # Total Accepted: 518.1K # Total Submissions: 851.2K # Testcase Examp...
""" This module demonstrates what happens with an invalid .py file """ def run(*args): echo("foo")
# Copyright (c) 2010 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. { 'variables': { 'chromium_code': 1, }, 'includes': [ 'app_base.gypi', ], 'targets': [ { 'target_name': 'app_unittests', ...
DATA_PATH = "data/day01-full.txt" def part1(data_path=DATA_PATH): with open(data_path) as f: lines = [line.strip() for line in f] return sum(int(b) > int(a) for a, b in zip(lines[:-1], lines[1:])) def part2(data_path=DATA_PATH): with open(data_path) as f: lines = [line.strip() for line ...
# Content layer where will pull our feature maps content_layers = ['block5_conv2'] # Style layer we are interested in style_layers = ['block1_conv1', 'block2_conv1', 'block3_conv1', 'block4_conv1', 'block5_conv1' ] num_content_layers = len(content_...
class TemplateFilter(): "Plugins that define jinja2 filters to be used in templates" @staticmethod def myfilter(filter_input, filter_arg): """Act as a jinja2 template Args: filter_input (str): the input passed to the filter filter_arg(str): optional arg to the filte...
num = int(input("Enter a number\n")) for i in range(2,num): if (num%i==0): print("Not prime") break else: print("Prime")
def peng(x): rest = x % 3 eat = x - (rest) service = eat / 3 if service + rest < 3: return service + rest else: eat += peng(service + rest) return eat print(peng(20))
#!/usr/bin/env python3 def selectionSort(input_list): for i in range(len(input_list)-1): minn = i for j in range(i,len(input_list)): if input_list[j]<input_list[minn]: minn = j input_list[i],input_list[minn] = input_list[minn],input_list[i] return input_list ...
"""" Crie uma tupla preenchida com os 20 primeiros colocados da tabela do campeonato brasileiro de futebol. na ordem de colocação. Depois mostre: A) Apenas os 5 primeiros colocados. B) Os últimos 4 colocados da tabela. C) Uma lista com os times em ordem alfabética. D) Em que posição da tabela esta o time do Corinthian...
# Public Domain (-) 2018-present, The Elko Website Authors. # See the Elko Website UNLICENSE file for details. ALTERNATIVE_HOSTS = frozenset(['www.elko.io']) CANONICAL_HOST = 'elko.io' DEBUG = False SECURE_COOKIE_DURATION = 30 * 86400 SECURE_COOKIE_KEY = 'secret key for authenticating cookies' STATIC_HANDLER = 'sta...
with open("dane/liczby.txt") as f: nums = [int(l.strip(), 2) for l in f.readlines()] wynik43 = open("wynik43.txt", "w") smallest = nums.index(min(nums)) + 1 biggest = nums.index(max(nums)) + 1 wynik43.write(f"wiersz z najmniejsza liczba: {smallest}, najwieksza liczba: {biggest}") wynik43.close()
class Solution(object): def minimumTotal(self, triangle): """ :type triangle: List[List[int]] :rtype: int """ n = len(triangle) dp = [[0 for col in range(row+1)] for row in range(n)] for i in range(n): dp[n-1][i] = triangle[n-1][i] for i in...
n_pts = 500 np.random.seed(0) Xa = np.array([np.random.normal(13, 2, n_pts), np.random.normal(12, 2, n_pts)]).T Xb = np.array([np.random.normal(8, 2, n_pts), np.random.normal(6, 2, n_pts)]).T X = np.vstack((Xa, Xb)) y = np.matrix(np.append(np.zeros(n_pts), np.ones(n_pts))).T plt.scatter(...
''' Prompt: Write a function that, fiven a string, returns the length of the longest palindromic subsequence. Ex: input: "abaxyaba", output: 7. Because "abaxaba", or "abayaba" are the longest palindromic subsequence. ''' # Solution with no memoization. Time: O(2^n), Space: O(n) # We could use memoization and cache t...
def factorial_iterative(n: int) -> int: if n < 0: raise ValueError("factorial() not defined for negative values") value = 1 for i in range(1, n + 1): value *= i return value def factorial_recursive(n: int) -> int: if n < 0: raise ValueError("factorial() not defined for nega...
# encoding: utf-8 """ @author: lileilei @file: error_message.py @time: 2019/3/26 20:23 """ login_username_not_message=u"用户名没有输入" login_password_not_message=u'密码没有输入' login_user_free_message=u'用户冻结!' login_user_sucess_message=u'登录成功!' login_password_error_message=u'密码错误' login_user_not_exict_message=u'用户不存在' interface_a...
def solution(a): stack = [] valid = True for c in a: if c == "[" or c == "{" or c=="(": stack.append(c) print(stack) elif c == ")": valid = False if not stack or stack.pop() != "(" else valid #age stack khali bashe ya pop mokhalef ...
class Solution: def twoSum(self, nums, target): """ Approach #2 (Two-pass Hash Table) :type nums: List[int] :type target: int :rtype: List[int] """ lookup = {} for i, num in enumerate(nums): #print(i,num) #print(lookup) ...
""" -=-=- CONTINUAÇÃO: FUNÇÕES -=-=- """ def contador(i, f, p): # <- Função com docstring. """ -> Faz uma contagem e mostra na tela. :param i: início da contagem :param f: fim da contagem :param p: passo da contagem :return: sem retorno Função criada por David Ferreira. 08/06...
{ "targets" :[ { "target_name": "cryptopp", "sources": [ "main.cpp", "cryptopp/misc.cpp", "cryptopp/cryptlib.cpp", "cryptopp/modes.cpp", "cryptopp/rijndael.cpp", "cryptopp/filters.cpp", "cryptopp/strciphr.cpp", "cryptopp/fips140.cpp", "cryptopp/3way.cpp", "cryptopp/adler32.cpp", "cry...
#Faça agora o contrário, de Fahrenheit para Celsius. f=float(input('Coloque a temperatura em Fº')) c=(f-32)*5/9 print('A sua temperatura é %.2f:' %c,'Cº')
file_in = open("DomainMuteLists_V1.txt", "r") file_out = open("PowerActions.js", "w") line = file_in.readline() file_out.write("var defaultFilters = [\n") first = True while(line): if("[" not in line): if not first: file_out.write(",\n") first = False line = (line....
class MiddlewareInvalidArgumentError(Exception): """When middleware receives non keyword=arguments""" pass
def sitecode_pick(txt): stcnt = 0 numcnt = 0 lp = 1 prelp = 0 indx = 0 for i in txt: try: ix = int(i) except: ix = i if isinstance(ix,str): stcnt = stcnt + 1 elif isinstance(ix,int): numcnt = numcnt + 1 ...
# # @lc app=leetcode.cn id=403 lang=python3 # # [403] 青蛙过河 # # https://leetcode-cn.com/problems/frog-jump/description/ # # algorithms # Hard (40.07%) # Likes: 278 # Dislikes: 0 # Total Accepted: 29.9K # Total Submissions: 68.7K # Testcase Example: '[0,1,3,5,6,8,12,17]' # # 一只青蛙想要过河。 假定河流被等分为若干个单元格,并且在每一个单元格内都有可能...
default_app_config = "memberaudit.apps.MemberAuditConfig" __version__ = "1.4.0" __title__ = "Member Audit"
# minke.utils.statistics # Helper functions for statistical computations. # # Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Sat Aug 06 17:04:24 2016 -0400 # # Copyright (C) 2016 District Data Labs # For license information, see LICENSE.txt # # ID: statistics.py [3d75c52] benjamin@bengfort.com...
def gcd_two_num(a, b): if a == 0: return b return gcd_two_num(b % a, a) def gcd_list(arr): if len(arr) == 0: return 0 if (len(arr) == 1): return arr[0] t = arr[0] for i in range(len(arr)): t = gcd_two_num(t, arr[i]) return t
# need strings[i] = strings[j] for all patterns[i] = patterns[j] to be true - # give false if strings[i] != strings[j] and patterns[i] = patterns[j] or # strings[i] = strings[j] and patterns[j] != patterns[j] - this last condition # threw me for a bit as an edge case! Need to ensure that each string is unique # to each...
class FundRequestTransactionDAO: def __init__(self, repo): self.repo = repo def persist_transaction(self, stake_member, transaction_hash, created_at): query_response = self.repo.execute( "INSERT INTO fund_request_transaction (stake_member, transaction_hash, created_at, row_created, ...
"""__getitem__""" def f(): pass class G(object): def __init__(self): """XXX: Without __init__ the translation with javascript fail""" pass def main(): g = G() a = {'2': 22, 3:33} a[f] = 44 a[g] = 66 a[G] = 55 TestError(a['2'] == 22) TestError(a[3] == 33) TestError(a[f] == 44) TestError(...
def get_color_matrix(color): r = (color >> 16 & 255) / 255 g = (color >> 8 & 255) / 255 b = (color & 255) / 255 return "1 0 0 0 {} \ 0 1 0 0 {} \ 0 0 1 0 {} \ 0 0 0 1 0".format(r - 0.5, g - 0.5, b - 0.5) def get_color_filter(_id, color): return '<filter id="color_{}" \ x="-20%" y="-20%" width="140%...
class CamHolder: def __init__(self): self._cam1 = None self._cam2 = None def update_frame(self, frame, target_cam): if target_cam == 1: self._cam1 = frame else: self._cam2 = frame def get_frame(self, target_cam): if target_cam == 1: ...
class Solution: def minCameraCover(self, root: TreeNode) -> int: self.res = 0 def dfs(root): if not root: return 2 l, r = dfs(root.left), dfs(root.right) if l == 0 or r == 0: self.res += 1 return 1 return 2 if l == 1 or ...
def suma (n): s=0 for i in range (1,n+1): s+=i*(i+1) return s n=int(input("n=")) print(suma(n))
name0_1_1_0_0_3_0 = None name0_1_1_0_0_3_1 = None name0_1_1_0_0_3_2 = None name0_1_1_0_0_3_3 = None name0_1_1_0_0_3_4 = None
class Solution: def partitionLabels(self, S: str) -> List[int]: ans = [] indmap = {} leng = len(S) for i, l in enumerate(S): indmap[l] = i start, end = 0, 0 for idx in range(leng): end = max(end, indmap[S[idx]]) ...
n = int(input('digite um numero: ')) dobro = n * 2 triplo = n * 3 raizq = n ** (1 / 2) print('o dobro de {0} é {1}, o triplo de {0} é {2},'.format(n, dobro, triplo), end='') print('e sua raiz quadrada é {}'.format(raizq))
def quicksort(L): """ Developed in 1959 by Tony Hoare, quicksort is still a commonly used algorithm. Performance =========== Worst: O(n^2) Average: O(n log n) Best: O(n log n) Space ===== Worst: O(n) Average: O(n log n) """ if len(L) <= 1:...
class OK: def __eq__(self, other): return False class NotOK2: def __ne__(self, other): return True
DOC_HEADER = """ | Parameter | Value | | --------- | ----------- | | Author | TestEngine | | Version | %(version)s | | Status | Implemented | """ DOC_LEGEND = """ #### Legend ##### Paging | Param | Meaning | | ------ | ------------------ | | take | Rows per page | | skip | ...
HEADER_PROTEIN = 'Protein ID' HEADER_PROTEINS = 'Protein ID(s)' HEADER_GENEID = 'Gene ID' HEADER_GENENAME = 'Gene Name' HEADER_DESCRIPTION = 'Description' HEADER_COVERAGE = 'Coverage' HEADER_NO_PROTEIN = '# Proteins' HEADER_CONTENTPROT = 'Proteins in group' HEADER_NO_UNIPEP = '# Unique peptides' HEADER_NO_PEPTIDE = '# ...
lista=[] dado=[] maisdecem=[] menosdecem=[] cont=0 while True: dado.append(input('Nome: ')) dado.append(float(input('Peso: '))) lista.append(dado[:]) dado.clear() cont=cont+1 e=' ' while e not in 'SN': e=input('Deseja cadastrar mais pessoas? [S/N]: ').strip().upper()[0] if e == '...
def main() -> None: N = int(input()) S = input() T = input() assert 2 <= N <= 100 assert len(S) == len(T) == N assert all(S_i in ('0', '1') for S_i in S) assert all(T_i in ('0', '1') for T_i in T) if __name__ == '__main__': main()
def execute_resolveit_as_context_manager() -> None: a = "str" b = ["str"] a + b
#! /usr/bin/env python # -*- coding: utf-8 -*- class BitFlag(object): def __init__(self, *args): if len(args)==0: self.value = 0 else: self.value = 0 for val in args: SetFlag(self, val) def IsSet(self, flag): return (self.value & flag) != 0 def SetFlag(self, flag): self.value = self.value |...
#!/usr/bin/env python3 # -*- coding: utf8 -*- __author__ = 'wangqiang' """ dijkstra最短路径算法的另一种实现 """ def dijkstra(graph, start): """ 查找start到任意节点的最短路径 :param graph: :param start: 起始节点 :return: """ # 记录路径结果:"起点终点": ("路径", 路径权重) result = {start*2: (start, 0)} # 记录已经访问过的节点(途中如果没有遇到新的节...
a = [4,2,1,-3,5] b = [1,2,3,4,5] print(len(a)) sorted(a) print(a) for x in reversed(a): print(x,end=' ') print('\n====================') for x in range(1,5): print(x,end=' ') print('\n====================') print(list(zip(a,b)))
# Nguyen ly ke thua, reuse method, overriding method,... giong Java class Parent(): def __init__(self, last_name, eye_color): print("Parent constructor called") self.last_name = last_name self.eye_color = eye_color def show_info(self): print("Last name: " + self.last_name) print("Eye color: " + self.eye...
## 凯撒密码的破解演示 ## 假设已获得一段密文如下 ## GUVF VF ZL FRPERG ZRFFNTR ## 先讲密文赋值给变量 message = "COCBKPIOAGCTRJQPG" ## 采用A~Z大写字母进行破解 ## 将26个大写字母进行一次排列并赋值给‘生成密码本’:LETTERS LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ## 解决思路:把每个可能出现的密钥都循环生成一遍 ## 采用循环结构,迭代变量key代表每一种可能的密钥 for key in range(len(LETTERS)): # translated设为空字符串,每次循环后必须清空以接受下一个...
class Solution: def largestPalindrome(self, n): """ :type n: int :rtype: int """ upper = pow(10, n) - 1 for i in range(upper): i = upper - i if i <= upper / 10: break palindrome = int(str(i) + str(i)[::-1]) ...
for x in range(16): with open(f'..\\data\\cpu\\functions\\opcode_switch\\opcode_cxxx\\opcode_cxxx_{x}.mcfunction', 'w') as f: f.write(f'function cpu:bitwise_ops/and\n' f'scoreboard players operation Global result *= c16 Constant\n' f'scoreboard players operation G...
teste = [] teste.append('Gabriel') teste.append(19) print(teste) galera = [] galera.append(teste[:]) # para copiar os dados de uma lista precisa do [:] se nao vai criar uma ligacao e quando mudar a lista original print(galera) # tambem vai mudar a lista composta q pegou o link teste[0] = 'Pedro' teste[1] = '21' gal...
BORDER_STYLES = [ [" ", " "], ["─", "│"], ["━", "┃"], ["═", "║"], ["-", "|"], ["─", "│"], ["╌", "┆"], ["╍", "┇"], ["▀", "█"], ["═", "│"], ["─", "║"], ] CORNER_STYLES = [ [" ", " ", " ", " ", " ", " ", " ", " ", " "], ["┌", "┐", "└", "┘", "├", "┤", "┬", "┴", "┼"], ...
def perm(list): if len(list) != 1: pWord = perm(list[1:]) res = [] for i in pWord: for j in range(len(i) + 1): res.append(i[:j] + list[0] + i[j:]) return res elif(len(list) == 1): return [list] print(perm('abc'))
OUT = 'Out' CLOSE_DOOR = 'CloseDoor' OPEN_DOOR = 'OpenDoor' STAIRS = 'Stairs' MY_ROOM = 'MyRoom' E_TURNED_KNOB = 'turned_knob' E_PULLED_KNOB = 'pulled_knob' E_ENTER = 'enter' E_UP = 'up' E_SITTING_DOWN = 'sitting_down' E_FAILED = 'failed' MSG_TURN_KNOB = 'Turn knob' MSG_PULL_KNOB = 'Pull knob' MSG_ENTER = 'Enter' MSG_U...
menu = [ ["egg", "spam", "bacon"], ["egg", "sausage", "bacon"], ["egg", "spam"], ["egg", "bacon", "spam"], ["egg", "bacon", "sausage", "spam"], ["spam", "bacon", "sausage", "spam"], ["spam", "egg", "spam", "spam", "bacon", "spam"], ["spam", "egg", "sausage", "spam"], ["chicken", "chi...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Utility methods""" def print_error(error_msg): """Prints an error""" print('ERROR: {}'.format(error_msg)) def print_object(lobj): """ Print a message object """ if 'deleted' in lobj.keys() and lobj['deleted'] == '1': print('[deleted]') ...
##################PROCESS CLASS #As we well know, all processes have things in common, # that is why we decided to generalize these properties in a class class process(): def __init__(self, arriveT , workDuration , name): self.name = name self.dead = False self.working = False # It is n't t...
""" Funções sem o return são chamadas de funções void, ou procedures porque não retornam nada. Ex.: """ # void = função sem retorno def ola(): print("Olá") # A funcao acima executa o print e depois nao faz mais nada, nao tem um retorno. ola() # implicitamente retorna None # funcao com retorno e anotações opc...
shengmu = ['b' ,'p' ,'m' ,'f' ,'d' ,'t' ,'n' ,'l' ,'g' ,'k' ,'h' ,'j' ,'q' ,'x' ,'zh' ,'ch' ,'sh' ,'z' ,'c' ,'s' ,'y' ,'w' ,'r'] yunmu = ['a' ,'o' ,'e' ,'i' ,'u' ,'v' ,'ai' ,'ei' ,'ui' ,'ao' ,'ou' ,'iu' ,'ie' ,'ve' ,'er' ,'an' ,'en' ,'in' ,'un' ,'vn' ,'ang' ,'eng' ,'ing' ,'ong'] shengmu_metrix = { ...
### Solution 1 (The only solution I could think of) def find_sum(arr): if (len(arr) == 0): return 0 prevSum = arr[0] currSum = arr[0] for n in arr[1:]: prevSum = max(prevSum+n, n) currSum = max(prevSum, currSum) return currSum # arr1 = [1,2,3,4,5,6,-10] # Sum = 21 # arr1...
_FIELDS = ('spec', 'file', 'mntopts', 'freq', 'passno') class Fstab: def __init__(self, host): self._host = host def list(self, filepath='/etc/fstab'): with self.open(filepath) as fhandler: return [zip(_FIELDS, elts) for line in fhandler.read().splitlines() ...
# https://leetcode.com/problems/invalid-transactions/ # Easy (22.83%) # Total Accepted: 2,216 # Total Submissions: 9,708 # beats 100.0% of python submissions class Solution(object): def invalidTransactions(self, transactions): """ :type transactions: List[str] :rtype: List[str] ...
"""MySQL FIELD_TYPE Constants These constants represent the various column (field) types that are supported by MySQL. """ DECIMAL = 0 TINY = 1 SHORT = 2 LONG = 3 FLOAT = 4 DOUBLE = 5 NULL = 6 TIMESTAMP = 7 LONGLONG = 8 INT24 = 9 DATE = 10 TIME = 11 DATETIME = 12 YEAR = 13 NEWDATE = 14 VARCHAR =...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "GumGum Inc." __email__ = "machine-learning-engineering@gumgum.com" __version__ = "0.0.3"
#!/usr/bin/env python3 ''' This file is to learn about set type more detail. ''' # declare a set set1 = set([1,2,3]) print(set1)
{ 'targets': [{ 'target_name': 'faster-serial-port', 'win_delay_load_hook': 'true', 'sources': [ 'src/Drain.cpp', 'src/Flush.cpp', 'src/WriteBaton.cpp', 'src/UpdateBaton.cpp', 'src/ListBaton.cpp', 'src/BatonBase.cpp', 'src/V8ArgDecoder.cpp', ...
def sumTriangle(triangle): with open(triangle, 'r') as triangle: for triangleRow in triangle.readlines(): outRow = triangleRow.strip().split() yield [int(x) for x in outRow] # yield list(map(lambda x: int(x), outRow)) def triangleReduce(topRow,bottomRow): pas...
""" Collision handling using Chaining: Implementation of chaining using LinkedList and chain creation""" def display_hash(hash_table): # Function to display hashtable for i in range(len(hash_table)): print(i, end=" ") for j in hash_table[i]: print("-->", end=" ") print(j...
def func(kek: str): return "kek" # FIXME otherwise ebonite collects all the dependencies in file with `func` declaration
IP = 'localhost' PORT = 50500 SALT = 'SaltySaltySalt' # ur salt # leave blank for WS protocol SSL_CHAIN = "" SSL_KEY = ""
class EsperantoNumbers: def nameThisNumber(self, x): o, s = ["unu", "du", "tri", "kvar", "kvin", "ses", "sep", "ok", "nau", "dek"], '' if x/10 >= 2: s += o[x/10-1] if x >= 10: s += 'dek' if x%10: if s: s += ' ' s += o[x%...
""" ############### Pseudocode ############## split word on " " sort list return " ".join(list) """ def sort_string(words): list_word = words.split(" ") list_word.sort(key=lambda word: word.lower()) return " ".join(list_word) print(sort_string(input("Words: ")))
load( "@com_vistarmedia_rules_js//js/private:rules.bzl", "js_binary", "node_attr", ) def _browserify_impl(ctx): entry = ctx.attr.entrypoint.main.short_path.replace(".js", "") arguments = [ "--ignore-transform", "envify", "--outfile", ctx.outputs.js.path, "--...
# -*- coding: UTF-8 -*- numeros = [] parar = 'N' while True: numeros.append(int(input('Digite um número.'))) parar = input('Quer parar? Digite [S] para parar. ').strip().upper() if parar == 'S': break print(f'Os números foram: {numeros}.') print(f'O maior valor inserido foi {max(numeros)}, ...
n = int(input()) def cal( arr): sum1 = 0 n= len(arr) for k in range(n): sum1 += arr[k]*((4/5)**k) return sum1/5 arr=[] arr2=[] for i in range(n): x = int(input()) arr.append(x) arr2.append(x) sum1 = 0 for k in range(n): sum1 += arr[k]*((4/5)**k) s2=0 ans=[] for k1 in range(n): arr...
def load(h): return ({'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'}, {'abbr': 'msl', 'code': 2, 'title': 'MSL Pressure reduced to MSL Pa'}, {'abbr': 'ptend', 'code': 3, 'title': 'PTEND Pressure tendency Pa/s'}, {'abbr': 'pv', 'code': 4, 'title': 'PV Potential vorticity ...
class Cell: def __init__(self): self._status = False def set_alive(self): self._status = True def set_dead(self): self._status = False def check_status(self): return self._status def print_status(self): if self.check_status(): return "*" ...
CRAWLER_RESPONSE = { 'class': 'Apelação Cível', 'degree': 'Test', 'area': 'Cível', 'subject': 'Obrigação de Fazer / Não Fazer', 'distribution': None, 'judge': None, 'value': '10.000,00', 'parties_involved': [ { 'type': 'Apelante', 'name': 'Leidi Silva Ormond G...
# # Helper function to unpack a symbol # class SymbolUnpacker(object): """ Helper class to unpack a (set of) symbol(s) to find all instances of a class. Uses caching to speed up the process. Parameters ---------- classes_to_find : list of pybamm classes Classes to identify in the equa...
def ca(d): a = b = c = 0 e = f = d print(a) print(e)
print("hello world") d = {"a": 0, "b": 1, "c": 2} for i in d.values(): print(i)
# # PySNMP MIB module NETSCREEN-VR-RIPv2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-VR-RIPv2-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:20:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
#!/usr/bin/python # -*- coding: UTF-8 -*- """ @version: 0.0.0 @author: xiaoming @license: MIT Licence @contact: xiaominghe2014@gmail.com @site: @software: PyCharm @file: __version__.py @time: 2018/1/15 下午2:47 """ __version__ = '0.0.0'
""" Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [9,4] Note: Each element in the result must be unique. The result can be in any order.   """ class Solution:...
# BASE = "https://lingon.ladok.umu.se" BASEURL = "https://90.147.19.66" # If BASE is https these has to be specified SERVER_CERT = "certs/cert.pem" SERVER_KEY = "certs/key.pem" CA_BUNDLE = None VERIFY_SSL = False KEYDEFS = [ {"type": "RSA", "key": '', "use": ["sig"]}, {"type": "EC", "crv": "P-256", "use": ["...
class Solution(object): def findLUSlength(self, strs): """ :type strs: List[str] :rtype: int """ def findLUSlength(a, b): return max(len(a), len(b)) if a != b else -1 def isSubsequence(s, t): d = collections.defaultdict(l...
def load(): with open("inputs/17.txt") as f: xr, yr = f.read().split(", ") xl, xu = xr.split("=")[-1].split("..") yl, yu = yr.split("=")[-1].split("..") return ( (int(xl), int(xu)), (int(yl), int(yu)), ) def inside( me: tuple[int, int], target: tuple[tuple[int, int]...
# buildifier: disable=module-docstring load("//foreign_cc/private/shell_toolchain/toolchains:commands.bzl", "PLATFORM_COMMANDS") load(":function_and_call.bzl", "FunctionAndCall") _function_and_call_type = type(FunctionAndCall(text = "")) def create_context(ctx): return struct( shell = ctx.toolchains["@rul...
'''THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT...
#!/usr/bin/env python # encoding: utf-8 """ filter(function or None, iterable) --> filter object filter()也接收一个函数和一个序列。和map()不同的是,filter()把传入的函数依次作用于每个元素,然后根据返回值是True还是False决定保留还是丢弃该元素。 filter()的作用是从一个序列中筛出符合条件的元素。由于filter()使用了惰性计算,所以只有在取filter()结果的时候,才会真正筛选并每次返回下一个筛出的元素。 """ even_num = list(filter(lambda x: x % 2 == ...
""" Entradas examen matematicas-->float-->em calificacion 3 trabajos-->float-->c1, c2, c3 calificacion fisica--> float-->cf Salidas promedio matematicas-->rpromedio1= (em* 0.90)+(tarea* 0.10) promedio fisica-->promedio2= (cf*0.80)+(tarea1*0.20) promedio quimica-->promedio3= (cq*0.85)+(tarea2*0.15) promedio general-->pr...
# Local Scope # def my_func() -> None: # y: int = 5 # print(y) # Global Scope # y: int = 5 # def my_function() -> None: # print(y) # def my_another_functions() -> None: # print(y) # my_function() # my_another_functions() y: int = 5 def my_function() -> None: y: int = 3 def my_anoth...
num = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] for c in range(0,3): for i in range(0,3): num[c][i] = int(input(f'Digite um valor para a posição{c,i}: ')) print('--'*30) for c in range(0,3): for i in range(0,3): print(f'[ {num[c][i]:^5} ]',end=' ') print()