content
stringlengths
7
1.05M
# Faça um programa que tenha uma função chamada area(), # que receba as dimenções de um terreno retangular (Largura e comprimento) # e mostre a area do terrreno. def moldura(txt): print(f'{txt:^30}') print('-' * 30) def area(l, c): a = l * c print(f'A área do terreno de {l:.1f}mx{c:.1f}m é de {a:.1f}...
class Expr: def evaluate(self) -> str: raise NotImplementedError() def __str__(self) -> str: return self.evaluate() def __repr__(self) -> str: return self.evaluate()
def getCellTypeCombinations(): return [ ("C2-L2PY","C2-L2PY","C2-L2PY"), ("C2-L3PY","C2-L2PY","C2-L2PY"), ("C2-L3PY","C2-L3PY","C2-L2PY"), ("C2-L3PY","C2-L3PY","C2-L3PY"), ("C2-L4PY","C2-L2PY","C2-L2PY"), ("C2-L4PY","C2-L3PY","C2-L2PY"), ("C2-L4PY","C2-L3PY","...
# Link to flowcharts: # https://drive.google.com/file/d/12xTQSyUeeSIWUDkwn3nWW-KHMmj31Rxy/view?usp=sharing # Find the sum of n elements of the following series of numbers: 1 -0.5 0.25 -0.125 ... # The number of items (n) is entered from the keyboard. print( "Find the sum of a certain number of elements in a series of...
def math(): number = int(input()) if number <= 1: print('Top 1') elif number <= 3: print('Top 3') elif number <= 5: print('Top 5') elif number <= 10: print('Top 10') elif number <= 25: print('Top 25') elif number <= 50: print('Top 50') eli...
# this program reads an integer from input representing someone's age and prints the votabillity of the user. try: a = int(input("enter age")) if a >= 18:#caters for age from 18 and above. print("you can vote") elif 0 <= a <= 17: print("too young to vote") elif a < 0: print("you ...
# Copyright (c) 2018 Daniel Mark Gass # Licensed under the MIT License # http://opensource.org/licenses/MIT __all__ = ('__title__', '__summary__', '__uri__', '__version_info__', '__version__', '__author__', '__maintainer__', '__email__', '__copyright__', '__license__') __title__ = "baseli...
#Day 2: #Python program to find Fibonacci series up to n #Step 1. Start #Step 2. Take a user input and store into int type num variable. #Step 3. Initialize n1, n2 variable to 0, 1. #Step 4. Run a for loop starts from 2 to num value. #Step 5. Inside for loop, using arithmetic addition method, and calculate the n3, whe...
file = open("example.txt", 'w') lines = ["Custom Line 1", "Custom Line 2", "Custom Line 3"] for line in lines: file.write(line + "\n") file.close()
# -*- coding: utf-8 -*- """ Created on Sun Jul 25 11:11:55 2021 @author: alber """ PATH_AFF_LEXICON = "datasets/affective-lexicons" PATH_POEMS = "datasets/per-sonnet" PATH_POEMS_SXX = "datasets/per-sonnets-xx" PATH_GROUND_TRUTH = "datasets/ground-truth" PATH_RESULTS = "results"
BALANCED_CLASS_DISTRIBUTION = { 'INDUSTRIAL': 0.25, 'PUBLIC': 0.16, 'RETAIL': 0.11, 'OFFICE': 0.1, 'OTHER': 0.07, 'AGRICULTURE': 0.02, 'RESIDENTIAL': 0.29 } BALANCED = 'balanced' IMBALANCED = 'imbalanced' ALL = 'all' DATA_SET_TYPES = [BALANCED, IMBALANCED, ALL] MODELATE_RAW_DATA_SET = 'Mo...
def twoNumberSum(array, targetSum): # Write your code here. for i in range (len(array)-1): firstNum = array[i] for j in range (i+1,len(array)): secondNum =array[j] if firstNum +secondNum ==targetSum: return [firstNum,secondNum] return []
# a = 32 # # if a % 2 == 0: # print("THE NUMBER IS EVEN") # else: # print("THE NUMBER IS ODD") counter = 0 while counter < 100: counter += 1 if counter % 9 == 0: print(str(counter) + "!!!!") elif counter % 5 == 0: print(str(counter) + "!!!") elif counter % 3 == 0: p...
class Person: def __init__(self, name): self.name = name class Email: def __init__(self, sender, recipient, content): self.sender = sender self.recipient = recipient self.content = content self.is_sent = False def send(self): self.is_sent = True def ge...
"""List of parameters for the simulation. """ NUM_VALIDATORS = 100 # number of validators at each checkpoint VALIDATOR_IDS = list(range(0, NUM_VALIDATORS * 2)) # set of validators INITIAL_VALIDATORS = list(range(0, NUM_VALIDATORS)) # set of validators for root BLOCK_PROPOSAL_TIME = 100 # adds a block every 100 tic...
EMOJIS = { "+1": "\ud83d\udc4d", "-1": "\ud83d\udc4e", "100": "\ud83d\udcaf", "1234": "\ud83d\udd22", "8ball": "\ud83c\udfb1", "a": "\ud83c\udd70\ufe0f", "ab": "\ud83c\udd8e", "abc": "\ud83d\udd24", "abcd": "\ud83d\udd21", "accept": "\ud83c\ude51", "admission_tickets": "\ud83...
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A, K): # write your code in Python 3.6 if len(A) == 0: return A K = K % len(A) def rotate_one(): tmp = A[-1] for i in range(len(A) - 1, 0, -1): A[i] = A[i - 1] ...
class AverageMeter(object): def __init__(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 def __repr__(self): return f'{self.avg:.2e}' def update(self, val, n=1): self.val = val self.sum += val * n self.count += n self.av...
""" Power Set: Write a method to return all subsets of a set. is the input set() or list? I assumed it is a list. Set contains unique values input: [1,2,3,4] output: [1,2,3,4] """ def power_set(A): # initializations subset, powerset, index = [], [], -1 power_set_helper(A, index, powerset, subset) ...
subBloco = [[],[],[],[],[],[],[],[],[]] for l in range(9): for c in range(9): n = int(input(f"Digite o valor [{l}][{c}] ")) if n >= 0 and n < 10: if l <= 2: if c >= 0 and c <= 2: subBloco[0].append(n) if c >= 3 and c <= 5: ...
__version_tuple__ = (0, 2, 0) __version_tuple_js__ = (0, 2, 0) __version__ = '0.2.0' __version_js__ = '0.2.0' version_info = __version_tuple__ # kept for backward compatibility
def get_filter_wordlist(): f = open('transskribilo/data/filter_wordlist.txt', 'r') s = set() for line in f: line = line.strip() s.add(line) return s
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"convert_str": "01_Regression.ipynb", "scaler": "01_Regression.ipynb", "comb": "01_Regression.ipynb", "rf_colselector": "01_Regression.ipynb", "corr_colselector": "01_Regre...
# 8958 OX퀴즈 line = int(input()) for _ in range(line): oxstring = input().split("X") oxlist = [[o for o in ox] for ox in oxstring] answer = sum([i + 1 for ox in oxlist for i, o in enumerate(ox)]) print(answer)
""" mutli comment lines """ x, y, z = 'x', 'y', 'z' print('x: ', x) print('y: ', y) print('z: ', z) print('=== Data Types ===') # str print('* str') x = 'hello world' print('type: ', type(x)) print('str: ', x) # int print('* int') x = 100 print('int: ', x) # float print('* float') x = 10.10 print('float: ', x) # c...
############################################################################# # The contents of this file are subject to the Interbase Public # License Version 1.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.Inprise.com/IPL.htm...
'''Constant values needed for unpacking''' EVB_PACK_HEADER = [ ('4s', 'signature'), # Would always be ('EVB\x00') if valaid 64 ] EVB_NODE_MAIN = [ ('I', 'size'), ('8s', ''), # don't know what this is for ('I', 'objects_count'), 16 ] EVB_NODE_NAMED = [ ('H','objects_count'), # for non-fol...
PARTICLE_IDS = { 1: 'gamma', 2: 'electron', 3: 'positron', 5: 'mu_plus', 6: 'mu_minus', 13: 'neutron', 14: 'proton', 302: 'helium3', 402: 'helium4', 5626: 'iron', } def primary_id_to_name(primary_id): ''' if unknown just return the primary_id as string''' return PARTICL...
mag45 = """* alf CMa,SB*,-1.46,101.28715533333335,-16.71611586111111 * alf Car,*,-0.74,95.98795782918306,-52.69566138386201 * alf Cen,**,-0.1,219.87383306,-60.83222194 NAME CMa Dwarf Galaxy,G,-0.1,108.15,-27.666666666666668 * alf Boo,RG*,-0.05,213.915300294925,19.1824091615312 * alf Cen A,SB*,0.01,219.90205833170774,-6...
a = int(input()) b = int(input()) c = float(input()) rst = b * c print('NUMBER = '+str(a)) print('SALARY = U$ {:.2f}'.format(rst)) print('NUMBER = %d\nSALARY = U$ %.2f' % (a, rst))
def fib(n): if n>0: if n ==1 or n==2: return 1 if n>2: return fib(n-1) + fib(n-2) # print(Fri(10))
class Solution: """ @param: A: An integer array @param: B: An integer array @return: a double whose format is *.5 or *.0 """ def findMedianSortedArrays(self, A, B): n = len(A) + len(B) k = int(n / 2) + 1 if n % 2 == 1: return self.findK(A, B, 0, 0, k) ...
# # PySNMP MIB module IBM-FEATURE-ACTIVATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBM-FEATURE-ACTIVATION-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:50:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
# creating a function to calculate the speed of the wave given the temperature. def calcWaveSpeed(temperature): # arithmetic calculation to determine the speed of the wave. speed = 331.4 + (0.606 * temperature) speed = round(speed, 2) # returning the value for the speed of the wave. return...
SQLALCHEMY_ECHO = False SQLALCHEMY_ENCODING = 'utf-8' # 连接数据库 SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://zouzh:zouzihan0706@127.0.0.1:3306/class' SQLALCHEMY_TRACK_MODIFICATIONS = False DEBUG = False
class Solution: def trimMean(self, arr): trim = int(len(arr) * 0.05); return sum(sorted(arr)[trim:-trim]) / (len(arr) - 2 * trim)
def accum(s): out = "" for x in range(len(s)): out += s[x].upper() + (s[x].lower() * x) + "-" return out[:-1]
def rule(event): # check risk associated with this event if event.get("risk_score", 0) > 50: # a failed authentication attempt with high risk return event.get("event_type_id") == 6 return False def title(event): return f"A user [{event.get('user_name', '<UNKNOWN_USER>')}] failed a hig...
class Map(object): scenes={ 'central_corridor':CentralCorridor(), 'laser_weapon_armory':LaserWeaponArmory(), 'the_brideg':TheBridge(), 'escape_pod':EscapePod(), 'death':Death() } def __init__(self,start_scene): self.start_scene=start_scene ...
"""Write work lists.""" __all__ = ["write_gwl"] def write_gwl(path, gwl): """Write a gwl file.""" with open(path, "wb") as file_descriptor: file_descriptor.write(b"C;INIT - gwl created by pypetting\n") file_descriptor.write(b"\n".join(gwl))
#peça ao usuario para digitar 3 valores inteiros e imprima a soma deles valores=[] for c in range(0,3): num=int(input("Informe um numero inteiro: ")) valores.append(num) print(sum(valores))
class MinStack: def __init__(self): self.stack = [] self.min = [] def push(self, x): self.stack.append(x) if self.min: if x <= self.min[-1]: self.min.append(x) else: self.min.append(x) def pop(sel...
CHARACTER_LIMIT_MESSAGE = ( "{field} is longer than {maxsize} characters, " "it will be truncated when displayed." )
def cos(l): tak = [] l.sort() min = l[0] l.reverse() max = l[0] tak.append(min) tak.append(max) print(tak) l = [2,3,56,-33,3,42,66,43,52,53,454142,1,5] cos(l)
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 # # 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 ...
#encoding:utf-8 subreddit = '2meirl4meirl' t_channel = '@r_2meirl4meirl' def send_post(submission, r2t): return r2t.send_simple(submission)
""" PASSENGERS """ numPassengers = 15240 passenger_arriving = ( (0, 2, 3, 6, 2, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 7, 0, 3, 2, 1, 1, 3, 1, 2, 1, 0), # 0 (2, 1, 1, 10, 0, 3, 3, 0, 1, 1, 1, 0, 0, 2, 6, 5, 3, 3, 3, 2, 4, 3, 0, 2, 0, 0), # 1 (5, 6, 1, 2, 5, 0, 2, 3, 2, 0, 1, 0, 0, 1, 5, 4, 2, 4, 3, 0, 3, 1, 5, 1, 0, 0),...
class solve_day(object): with open('inputs/day13.txt', 'r') as f: data = f.readlines() data = [d.strip() for d in data] def part1(self): earliest_departure = int(self.data[0]) buses = [int(x) for x in self.data[1].split(',') if x.isdigit()] bus_routes = {} ...
email_id = "mailaddress@gmail.com" # Your Username password = "password@123" # Your Password def get_email(): return email_id def get_password(): return password contact_list = { # Your contacts(Use the correct format i.e dictionary) "name1": "mail1@gmail.com", "name2": "mail2@gma...
class License: def __init__(self, key: str, spdx_id: str, name: str, notes: str): self.key = key self.spdx_id = spdx_id self.name = name self.notes = notes licenses = [ License( "NONE", "UNLICENSED", "None", "This work will not be explicitly lice...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. __path__ = __import__('pkgutil').extend_path(__path__, __name__)
# # Copyright 2018 Asylo authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
class identity: def __repr__(self): return 'identity()' def forward(self, input): return input def backward(self, input): return 1
def to_Fahrenheit(c): FH = (c*9)/5+32 return round(FH,2) def to_Celcius(f): C = (f-32)*5/9 return round(C,2) print(to_Fahrenheit(21)) print(to_Celcius(60))
#Creating empty set b = set() print(type(b)) #Adding values to an empty set b.add(4) b.add(5) b.add(5) #Set is a collection of non repatative items so it will print 5 only once b.add(5) b.add(5) b.add((4,5,6)) #You can add touple in set #b.add({4:5}) # Cannot add list or dictionary to sets print(b) #Length of set pri...
#!/usr/bin/env python NAME = 'BitNinja (BitNinja)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return _, page = r # Both signatures are contained within response, so checking for any one of them if any(i in page for i in (b'Sec...
# # PySNMP MIB module SNMP-PROXY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMP-PROXY-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:08:15 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 w1(func): # def inner(): # print("---正在验证权限---") # func() # return inner # # # # # #f1 = w1(f1) # @w1 # def f1(): # print("---f1---") # # @w1 # def f2(): # print("---f2---") # # f1() # f2() # # def makebold(fn): # def wrapped(): # print('--1--') # return "<b>" + fn...
num1 = 10 num2 = 20 num3 = 33 num4 = 40
entries = [ { 'env-title': 'classic-acrobot', 'score': -88.103, 'stddev': 33.037, }, { 'env-title': 'atari-beam-rider', 'score': 888.741, 'stddev': 248.487, }, { 'env-title': 'atari-breakout', 'score': 191.165, 'stddev': 97.795,...
wheel cython opencv-python numpy torch torchvision pytorch_clip_bbox
#!/pxrpythonsubst # # Copyright 2020 Pixar # # Licensed under the Apache License, Version 2.0 (the "Apache License") # with the following modification; you may not use this file except in # compliance with the Apache License and the following modification to it: # Section 6. Trademarks. is deleted and replaced with: # ...
#! Классы для book9. class Dog: """A simple attempt to model a dog.""" def __init__(self, name, age): """Initialize name and age attributes.""" self.name = name self.age = age def sit(self): """Simulate a dog sitting in response to a command.""" print...
def get_digit(number, digit): """ Given a number, returns the digit in the specified position, for an out of range digit returns 0 """ digit_sum = 0 for i in range(digit): # Accumulate all the other digits and subtract from the original number digit_sum += number - ((number // 10**(i+1)) * 10**(i...
''' 2014314433 lee young suk ''' x = input("Input a value for x : ") #Ask user input x value y = input("Input a value for y : ") #Ask user input y value while x.isdigit() !=True or y.isdigit() !=True: if x.isdigit() !=True and y.isdigit() !=True: print("ERROR; Both of them is non-numerical ") x = i...
def sumar(x = 0,y = 0): sum = x + y return sum a = 12 b = 8 print("LA SUMA ES: ",sumar(a,b))
T = int(input()) while T > 0: a, b = map(int, input().split()) print(a * b) T -= 1
GRADLE_BUILD_FILE = """ java_import( name = "launcher", jars = ["lib/gradle-launcher.jar"], ) """ def gradle_repositories(): if not native.existing_rule("gradle"): native.new_http_archive( name = "gradle", url = "https://services.gradle.org/distributions/gradle-3.2.1-bin.zip", ...
""" Crie um programa que gerencie o aproveitamento de um jogador de futebol. O programa vai ler o nome do jogador e quantas partidas ele jogou. Depois vai ler a quantidade de gols feitos em cada partida. No final, tudo isso será guardado em um dicionário, incluindo o total de gols feitos durante o campeonato. """ joga...
class Animation: def getName(self): raise NotImplementedError def getBrightness(self): return 100 def getSetupCommand(self): return None def getAnimationCommand(self): raise NotImplementedError def getRepeatCount(self): return 1
# -*- coding: utf-8 -*- """ The `Node` Class ---------------- The basic building block for the linked list implementation is the **node**. Each node object must hold at least two pieces of information. First, the node must contain the list item itself. We will call this the **data field** of the node. In addition, eac...
# Este algoritmo retorna el mayor número de un arreglo # Fue implemetando para que sea O(n) def greatestNumber(array): greatestNumber = array[0] for i in array[1:]: if(i > greatestNumber): greatestNumber = i return greatestNumber # Test a = [43, 81, 21, 42, 13, 25] print(greatestNumber(a)) a = [24, 6,...
class StatsDict: def __init__(self, hp: int = 0, atk: int = 0, phys_def: int = 0, spe_atk: int = 0, spe_def: int = 0, spd: int = 0): self.hp = int(hp) self.atk = int(atk) self.phys_def = int(phys_def) self.spe_atk = int(spe_atk) self.spe_def = int(spe_def) self.spd...
class SVal: """This class represents a square in Sudoku. It either has 1 assigned value, or a set of possible values.""" def __init__(self): """Start with no set value and all possible values.""" self.possible_vals = [x for x in range(1, 10)] self.value = None def deep_copy(self): ...
class PrimaryReplicaRouter(object): def db_for_read(self, model, **hints): """ Reads go to a replica, load balanced my some proxy/middleware. """ return 'replica' def db_for_write(self, model, **hints): """ Writes always go to primary. """ return ...
#!/usr/bin/env python # -*- coding:utf-8 -*- # @FileName :__init__.py # @Time :2021/8/19 19:48 # @Author :Amundsen Severus Rubeus Bjaaland if __name__ == "__main__": run_code = 0
c.JupyterHub.tornado_settings = { 'headers': { 'Content-Security-Policy': "frame-ancestors '127.0.0.1:80'", } }
''' 10 best are: th1 transverse tree_next_vtx_z_min th2 opang nhits_other_pfps trkshw_score1 slice_ntrk tree_next_vtx_y_max sum_nhits_1 ''' def getit_df(df): df['sum_nhits_1'] = df.loc[:, ['nhits1_p0','nhits1_p1','nhits1_p2']].sum(axis=1) df.drop(columns=['nhits1_p0','nhits1_p1','nhits1_p2'],inplace=True) ...
# _*_ code:utf-8 _*_ #!/usr/local/bin/python buckets = [0 for i in range(11)] print (buckets) for i in range(5): score = int(input("请输入成绩:")) buckets[score] +=1 for i in range(10,-1,-1): if buckets[i]>0: for j in range(buckets[i]): print(i)
#Ask the user for quantity of name he has and save it in a variable number_of_names = int (input ("How many names do you have?: ")) full_name = "" #Print many times as the name of the user for i in range (number_of_names): f_name = str(input("Write your names: ")) #Save each name and write a space between them...
"""Define HeteroCL default tool settings""" #pylint: disable=too-few-public-methods, too-many-return-statements model_table = { "xilinx" : ["fpga_xc7z045", "fpga_xcvu19p"], "intel" : ["cpu_e5", "cpu_i7", "fpga_stratix10_gx", "fpga_stratix10_dx", "fpga_stratix10_mx", "fpga_arria10"], "arm" : ["...
def _run_pbjs(actions, executable, proto_file, es6): suffix = ".js" wrap = "amd" if es6: suffix = ".closure.js" wrap = "es6" proto_name = proto_file.basename[:-len(".proto")] js_tmpl_file = actions.declare_file(proto_name + suffix + ".tmpl") js_file = actions.declare_file(proto_name + suffix) arg...
''' The first idea I came up is to use O(n^2) by checking every single possible combination and see if they are covered with each other. The function I wrote is by comparing the maximum value of the beginning of the two intervals and minimum value of the ending of the two intervals I used the method that I previous us...
def solve(start, dest): answer = 0 dist = dest - start index = 0 while True: if answer >= dist: return index else: index += 1 answer += ((index - 1) // 2 + 1) def main(): start, dest = input().split(' ') start = int(start) dest = int(des...
#!/usr/bin/env python with open('net.vh', 'w') as f: num_col = 9 num_row = 12 f.write('module net(y, a);\n') f.write(' output [{0}:0] y;\n'.format(num_row - 1)) f.write(' input [{0}:0] a;\n\n'.format(num_col * 4 + num_row - 1)) for i in range(1, num_col): for j in range(0, num_ro...
# Copyright 2021 Edoardo Riggio # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
def digitDegree(n): ''' Let's define digit degree of some positive integer as the number of times we need to replace this number with the sum of its digits until we get to a one digit number. Given an integer, find its digit degree. ''' count = 0 while n // 10 > 0: n = sumDigit...
class Matrix: def __init__(self, elements): self.a11, self.a12, self.a21, self.a22 = elements @property def elements(self): return [self.a11, self.a12, self.a21, self.a22] def __add__(self, other): elements = [x + y for x, y in zip(self.elements, other.elements)] ...
segundos = int(input("Por favor, entre com o número de segundos que deseja converter: ")) dias = segundos//(3600*24) resto_de_dias = segundos%(3600*24) horas = resto_de_dias//3600 resto_de_horas = resto_de_dias%3600 minutos = resto_de_horas//60 segundos = resto_de_horas%60 print(dias,"dias,",horas,"horas,",minutos,"mi...
galleryinfo = { "status": 200, "language_localname": "한국어", "language": "korean", "date": "2020-02-14 07:57:00-06", "japanese_title": None, "title": "Sekigahara-san wa Tasshitai | 세키가하라는 닿고싶어", "id": "1570712", "type": "manga", "tags": [ { "male": "", ...
def getSubList(): l = [1, 4, 9, 10, 23] l1 = l[0:3] # sublist from index 0 to 3 l2 = l[3:] # sublist from 3 uptil end return [l1, l2] [l1, l2] = getSubList() print(l1) print(l2)
# # @lc app=leetcode id=120 lang=python3 # # [120] Triangle # # @lc code=start class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: if not triangle: return # O(n*n/2) space, top-down res = [[0 for i in range(len(row))] for row in triangle] res[0][...
# -*- coding: UTF-8 -*- """ Meieraha 2: PyTest tests As most of the complexity of the code is in Javascript, we do not have any real Python tests so far. Copyright 2015, Konstantin Tretyakov License: MIT """
__author__ = 'shikun' class Constants(object): TEST_ID = "test_id" TEST_DESC = "test_desc" FIND_TYPE = "find_type" SWIPE_DIRECTION = "direction" SWIPE_TIMES = "times" WAITE_TIMEOUT = "timeout" TAP_POINT = "point" OPERATION_TYPE = "operate_type" ELEMENT_INFO = "element_info" FI...
def test_search_shape(vidispine, cassette, item): result = vidispine.search.shape() assert 'id' in result['shape'][0] assert result['shape'][0]['item'][0]['id'] == item assert cassette.all_played def test_search_shape_with_params(vidispine, cassette, item): result = vidispine.search.shape(params=...
# -*- coding:utf-8 -*- # {crawler_name: crawler_module: class_name} CRAWLERS = { 'test':'crawlers.test:class' } # [requirements] # redis : host, port, db[default = 0], password[default None] # mongodb: host, port, db, collection # [type options] # redis, mongodb DATABASES = { 'database_name': { ...
class Logger: def __init__ (self) -> None: self._verbose:int = 0 def set_log_level (self, verbose:int) -> None: self._verbose:int = verbose def error (self, t:str) -> None: '''Errors are always printed''' print(f'Error: {t}') def warn (self, t:str) -> None: '''Warnings are the minimum level of logging...
def foo(): print(__file__ + ": parsed and executed.") foo()
n = int(input('Digite o primeiro termo de uma PA: ')) r = int(input('Digite a razão dessa PA: ')) termo = mais = 1 print(n, end=' ') while termo < 10: n += r termo += 1 print(n, end=' ') while mais != 0: mais = int(input('\nDeseja mostrar mais quantos termos? (Digite 0 para sair): ')) ate = mais + t...
for i in range(32, 128): print(chr(i), end =' ') if (i - 1) % 10 == 0: print() print()