content
stringlengths
7
1.05M
# Simple Math Libraries def add(*nums): number = 0 for num in nums: number += num return number def sub(*nums): number = 0 for num in nums: number -= num return number def multiply(*nums): number = 1 for num in nums: number *= num retu...
""" Faca um programa que receba 6 numeros inteiros e mostre: - Os numeros pares digitados; -A soma dos numeros pares digitados; -Os numeros impares digitados; -A quantidade de numeros impares digitados; """ x = [] soma = 0 quant = 0 for z in range(6): x.append(int(input('Digite um numero: '))) print('Numeros pa...
#!/usr/bin/env python # coding: utf-8 def countAnswers(__values): batchComplete = False answerCount = 0 answerDict = {} for answers in __values: for answer in answers: answerDict[answer] = 1 if answers == '': batchComplete = True if batchComplete: ...
# -*- coding: utf-8 -*- # Copyright 2020 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Templates for generating event classes for structured metrics.""" HEADER_FILE_TEMPLATE = """\ // Generated from gen_events.py...
{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "from matplotlib import style\n", "style.use('fivethirtyeight')\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count":...
#!/usr/bin/env python3 class ObjInfo(dict): def __init__(self): #, pre_id, name, letter, expire_state, id): self.side_id_name = ['front', 'back', 'left_side', 'right_side', 'bottom', 'side_id5', 'side_id6', 'side_id7', 'side_id8', 'side_id9'] self.obj = { # predefined merchandise infor...
# Version number as Major.Minor.Patch # The version modification must respect the following rules: # Major should be incremented in case there is a breaking change. (eg: 2.5.8 -> 3.0.0) # Minor should be incremented in case there is an enhancement. (eg: 2.5.8 -> 2.6.0) # Patch should be incremented in case there is a b...
# https://codeforces.com/problemset/problem/427/A n = int(input()) events = [int(x) for x in input().split()] counter = 0 free_officer = 0 for event in events: free_officer += event if free_officer < 0: counter += 1 free_officer = 0 print(counter)
# coding=utf-8 class ResultBean(dict): def __init__(self): dict.__init__(self) # 继承pyton字典类的方法和属性 def seet(self): self['abc'] = 'asss' return self
class Menu: def __init__(self, options: list): self.options = options def printMenu(self): print(' [ Main Menu ] ') for i in range(len(self.options)): print((i + 1), '::', self.options[i]) def getMenuInput(self, waitValidated: bool): returnValue = -2 ...
# TASK """Given names and phone numbers, assemble a phone book that maps friends' names to their respective phone numbers. You will then be given an unknown number of names to query your phone book for. For each queried, print the associated entry from your phone book on a new line in the form name=phoneNumber; if...
# python DDP_moco_ccrop.py path/to/this/config # model dim = 128 model = dict(type='ResNet', depth=18, num_classes=dim, maxpool=False) moco = dict(dim=dim, K=65536, m=0.999, T=0.20, mlp=True) loss = dict(type='CrossEntropyLoss') # data root = '/path/to/your/dataset' mean = (0.4914, 0.4822, 0.4465) std = (0.2023, 0.19...
#@liveupdate("globalClassMethod", "svc.debug::debugSvc", "OnRemoteExec") def OnRemoteExec(self, signedCode): eve.Message("CustomNotify", {"notify": "OnRemoteExec called"}) # No need to check if we're a client! code = marshal.loads(signedCode) self._Exec(code, {})
#frase = 'Curso em video python' #print(frase[:13]) #frase = ' Curso em video python ' #print(len(frase.strip())) #frase = 'Curso em Video Python' #print(frase.replace('Python', 'Android')) #frase ='Curso em Video Python' #print('Curso' in frase) frase = 'Curso em Vidio Python' dividido = frase.split() print(di...
# # PySNMP MIB module CISCO-GPRS-L2RLY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-GPRS-L2RLY-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:42:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
host = '127.0.0.1' port = 833 server_processes = 3 # 服务器多进程处理 error_info = 'XML' # error_code = 'JSON' logger_config={ 'format': '%(levelname)s ==> ::: %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S' }
""" This is the Scratchpad! This file is not graded, but you can use it to test your code. You can write and test your function in the Scratchpad, but make sure to copy and paste it into the Unit Test file before checking your answer. Remember to only copy and paste the function you want to submit, not all of your tes...
DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = () MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': '/tmp/locality.db' } } TIME_ZONE = "UTC" LANGUAGE_CODE = "en-us" SITE_ID = 1 USE_I18N = True USE_L10N = True MEDIA_ROOT = '' MEDIA_URL = '' STATIC_ROOT = '' STATIC_URL = '...
"""pynter - Minimal utility for generating images with textual caption""" __version__ = '0.1.0' __author__ = 'Gabriele Picco <piccogabriele@gmail.com>' __all__ = []
#program to convert a list of tuples into a dictionary. #create a list l = [("x", 1), ("x", 2), ("x", 3), ("y", 1), ("y", 2), ("z", 1)] d = {} for a, b in l: d.setdefault(a, []).append(b) print (d)
floor_number = int(input()) room_number = int(input()) for floor in range(floor_number, 0, -1): if floor == floor_number: result = [f'L{floor}{room}' for room in range(room_number)] print(' '.join(result)) continue if floor % 2 == 0: result = [f'O{floor}{room}' for ...
class User: last_name = '' first_name = '' email = '' def authenticate(self): # some logic to authenticate should be added here, currently it does nothing # e.g. we can access the attributes of the object to authenticate via email # address. Here, we just print it out instead ...
def esPrimo(numero, a=2): #Caso base if numero <= 2: return True if (numero == 2) else False if numero%a==0: return False if a*a> numero: return True #Para al siguiente divisor return esPrimo(numero,a+1) def verificarLista(lista: list, contador=0, listaaux=None): ...
grid = [ [ 8, 2,22,97,38,15, 0,40, 0,75, 4, 5, 7,78,52,12,50,77,91, 8], [49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48, 4,56,62, 0], [81,49,31,73,55,79,14,29,93,71,40,67,53,88,30, 3,49,13,36,65], [52,70,95,23, 4,60,11,42,69,24,68,56, 1,32,56,71,37, 2,36,91], [22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33...
# The MIT License (MIT) # # Copyright (c) 2007-2017 Einar Lielmanis, Liam Newman, and contributors. # # 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 ...
class Aluno(): def __init__(self): self.nome = "Pinguim" self.rg = 1234567891011 self.curso = "missanga" def printa(self): print("nome = ",self.nome) print("rg = ",self.rg) print("curso = ",self.curso) Aluno = Aluno() Aluno.printa()
class RedisList: def __init__(self, redis, key, converter, content=None): self.key_ = key self.redis_ = redis self.converter_ = converter if content: self.reset(content) def __len__(self): return self.redis_.llen(self.key_) def __getitem__(self, index):...
# # PySNMP MIB module NTPv4-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTPv4-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:15:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23...
def average_discount(list_of_changes): total = 0 count = 0 for change in list_of_changes: if change < 0: total += (- change) count += 1 return round((total / count), 2) def calculate_discount_averages(x): result=[] for i in x: try: ...
n = int(input()) even_ones = set() odd_ones = set() index = 0 sum_of_chars = 0 for _ in range(n): name = input() index += 1 for char in name: sum_of_chars += int(ord(char)) sum_of_chars //= index if sum_of_chars % 2 == 0: even_ones.add(sum_of_chars) else: odd_ones.add(s...
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. class Action(object): """ A build step """ def is_main(self): """ Returns True if this action needs no external tasks run to set it up """ return False def run(self, env): ...
# configs config_path = './config/config.yaml' # urls base_url = 'https://www.finanzen.net/index/' ext_urls = { 'DAX' : 'dax/30-werte', 'TECDAX' : 'tecdax/werte', 'DOW JONES' : 'dow_jones/werte', 'MDAX' : 'mdax/werte', 'SDAX' : 'sdax/werte', 'S&P...
n = int(input("Enter Number:")) sum = 0 while(n != 0): sum += n % 10 n //= 10 #floor division print(sum)
# Interactive Coding Exercise 2 # Solution - Wrapped the input on line 4 in an int(). year = int(input("Which year do you want to check?")) if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: print("Leap year.") else: print("Not leap year.") else: print("Leap year.") else: print("N...
def find_empty_space(board): """ find an empty space in the board param board: partially complete board return: (int, int) the row and the column """ for i in range(9): for j in range(9): if board[i][j] == 0: return (i,j) return None def valid_number(boar...
class CPP: @staticmethod def __protection_exception(prop): raise Exception(f'Can not modify constant property: {prop}') @staticmethod def protect(obj, prop): setattr(obj.__class__, prop, property( lambda self: getattr(self, '_'+prop), lambda self, value: CPP.__pr...
class User: def __init__(self, username, password): self.name = username self.password = password def login(self): return def logout(self): return
def is_valid(s): stack = [] for i in range(len(s)): if s[i] == "(" or s[i] == "[" or s[i] == "{": stack.append(s[i]) else: if len(stack) == 0: return False if s[i] == ")" and stack[-1] != "(": return False if s[i] =...
#W.A.P TO TAKE INPUT FROM USER (empid,name,salary) AND PRINT EMPLOYEE DETAILS emp=int(input('Enter employee ID:')) name=input('Enter your name:') sal=int(input('Enter your annual salary:')) print('Employee Details --> \n Employee ID:',emp,'\n Name:',name,'\n Annual Salary:',sal)
def main(): def findMin(x): minNum = x[0] for i in x: if minNum > i: minNum = i return minNum print(findMin([0,1,2,3,4,5,-3,24,-56])) # = -56 if __name__ == '__main__': main()
a = 'some_string' b = 'some' + '_' + 'string' c = 'somestring' print(id(a)) print(id(b)) print(id(c))
__all__ = ['split_and_load'] def split_and_load(data, ctx_list, batch_axis=0, even_split=True): """Splits an NDArray into `len(ctx_list)` slices along `batch_axis` and loads each slice to one context in `ctx_list`. Parameters ---------- data : NDArray A batch of data. ctx_list : list ...
# Copyright 2019, A10 Networks # # 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 a...
lots_of_numbers = range(-1000, 1000) the_same_numbers = range(-1000, 1000) same_numbers = ( i for i, j in zip(lots_of_numbers, the_same_numbers) if i is j ) print(*same_numbers, sep=", ")
def rotate(string, n): """Rotate characters in a string. Expects string and n (int) for number of characters to move. """ return string[n:] + string[:n] print (rotate('pybites loves julian and bob!',-15))
class Config: BOT_TOKEN = '' # from @botfather APP_ID = '' # from https://my.telegram.org/apps API_HASH = '' # from https://my.telegram.org/apps API_KEY = '' # from https://mixdrop.co API_EMA...
""" https://leetcode.com/problems/counting-bits/ Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. Example 1: Input: 2 Output: [0,1,1] Example 2: Input: 5 Output: [0,1,1,2,1,2] Follow up: It ...
debug = True run = { "echo": True }
age = float(input()) gender = input() if gender =="m": if age >= 16: print("Mr.") else: print("Master") if gender == "f": if age >= 16: print("Ms.") else: print("Miss")
""" Asked by: Snapchat [Easy]. Given an array of time intervals (start, end) for classroom lectures (possibly overlapping), find the minimum number of rooms required. For example, given [(30, 75), (0, 50), (60, 150)], you should return 2. """
T = int(input()) if 1 <= T <= 100: for i in range(T): N = int(input()) a = [] for j in range(N - 1): l = int(input()) if l <= N: a.append(l) for k in range(1, N + 1): if k not in a: print(k)
# # PySNMP MIB module ALCATEL-IND1-IGMP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-IGMP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:17:51 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
def vector_bits2int(arr): n = arr.shape[0] # number of columns a = arr[0] << n - 1 for j in range(1, n): # "overlay" with the shifted bits of the next column a |= arr[j] << n - 1 - j return a
#! /usr/bin/env python3 def func1(): x = set([1,2,3,4]) y = set([3,4,5,6,7]) z = frozenset([4,5]) print(x) print(y) x.add(5) x.remove(3) print(x) print("x|y=", x | y) # x U y print("x.union(y)=", x.union(y)) print("x&y=", x & y) # x ~U y print("x.intersection(y)=", x.intersection(y)) prin...
size = 21 array = [[0 for i in range(size)] for j in range(size)] for i in range(size): array[0][i] = 1 array[i][0] = 1 for i in range(1,size): for j in range(1,size): array[i][j] = array[i-1][j] + array[i][j-1] print(array[size-1][size-1])
""" File that contains configurations used by the model """ GRID_WIDTH = 10 GRID_HEIGHT = 40 SPAWN_LINE = 19
def peak(arr, low, high): n = len(arr) while low <= high: mid = low + (high - low) / 2 mid = int(mid) if (mid == 0 or arr[mid-1] <= arr[mid]) and (mid == n-1 or arr[mid+1] <= arr[mid]): return(arr[mid]) elif mid > 0 and arr[mid-1] > arr[mid]: ...
# -*- coding: utf-8 -*- # @Author: 何睿 # @Create Date: 2018-12-23 21:18:30 # @Last Modified by: 何睿 # @Last Modified time: 2018-12-23 21:19:39 class Solution: def deleteDuplicates(self, head): if head == None or head.next == None: return head p = head while p....
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
def vsota(mat1, mat2): vsota = [] for i in range(len(mat1)): nova_vrsta = [] for j in range(len(mat1[0])): nova_vrsta.append((mat1[i][j] + mat2[i][j])) vsota.append(nova_vrsta) return vsota def razlika(mat1, mat2): razlika = [] for i in range(len(mat1)): ...
class CaseInsensitiveDict(dict): """ A dictionary in which the keys are case-insensitive. It is initialized the same way as a typical dict, but the values can be accessed without regard to key case. The value associated with key "Key" can also be accessed with "key" or "KEY" or "kEy". Paramete...
# Testing configurations config = {} training_opt = {} training_opt['dataset'] = 'iNaturalist18' training_opt['log_dir'] = './logs/iNaturalist18' training_opt['num_classes'] = 8142 training_opt['batch_size'] = 64 training_opt['num_workers'] = 8 training_opt['num_epochs'] = 90 training_opt['display_step'] = 10 training...
#!/usr/bin/env python3 # This file is part of the kambpf project (https://github.com/zdule/part_ii_project). # It is file is offered under two licenses GPLv2 and Apache License Version 2. # For more information see the LICENSE file at the root of the project. # # Copyright 2020 Dusan Zivanovic first_dummy = "...
# -*- coding: utf-8 -*- # # Copyright 2019-2021 BigML # # 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 ...
TESTING = True POSTGRESQL_DATABASE_URI = "" URLS = 'app.urls'
""" * Assignment: Type Float Distance * Required: yes * Complexity: easy * Lines of code: 4 lines * Time: 5 min English: 1. Convert units 2. Instead `...` substitute calculated and converted values 3. Note the number of decimal places 4. Run doctests - all must succeed Polish: 1. Przekonwertuj jed...
text = input() cipher = [] for char in text: new_char = chr(ord(char) + 3) cipher.append(new_char) print(''.join(cipher))
a, b, c = map(int, input().split()) if c - b <= 0: result = -1 else: result = a // (c - b) result += 1 print(result)
JAZZMIN_SETTINGS = { # title of the window (Will default to current_admin_site.site_title if absent or None) 'site_title': 'Администрирование УМНОЦ', # Title on the login screen (19 chars max) (defaults to current_admin_site.site_header if absent or None) 'site_header': 'Платформа УМНОЦ', # Title ...
class ListControls: def com(self, comment="", **kwargs): """Places a comment in the output. APDL Command: /COM Parameters ---------- comment Comment string, up to 75 characters. Notes ----- The output from this command consists of the co...
def checkPassword(data): return (data["password"][data["pos1"] - 1] == data["char"]) != (data["password"][data["pos2"] -1 ] == data["char"]) passwords = [] with open("./2/input.txt") as inputFile: for line in inputFile: tokens = line.split(" ") minMax = tokens[0].split("-") data = { "pos1": int(minMax[0]), ...
# Difficulty: Easy # Problem Statement: https://leetcode.com/problems/add-binary/ class Solution: def addBinary(self, a: str, b: str) -> str: return bin(int(a, 2) + int(b, 2))[2:]
# -*- coding: utf-8 -*- """ Top-level package for Variational GCN """ __author__ = """anonymous due to blind submission to ICML 2020""" __email__ = '' __version__ = '0.1.0'
# Het is so simpel als het toevoegen van een save commando aan het stuk # code die de chart daadwerkelijk genereert. In bovenstand voorbeeld dus: alt.vconcat(points, bars, data=data.seattle_weather.url, title="Seattle Weather: 2012-2015" ).save('Seattle.html') # De interactiviteit zit in je html file besloten...
class Logedit: """ This object handles writing text outputs into a log file and to the screen as well. Class methods: -------------- init(logname, read=None): Creates a log instance into file logname. If read specified copies it's content into log. writelog(message): ...
test = { 'name': 'q5_3', 'points': 1, 'suites': [ { 'cases': [ { 'code': '>>> # The statistic should be between 0 and 13 face cards for a sample size of 13;\n' '>>> num_face = deck_simulation_and_statistic(13, deck_model_probabilities);\n' ...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
pkg_dnf = { 'collectd': {}, } svc_systemd = { 'collectd': { 'needs': ['pkg_dnf:collectd'], }, } files = { '/etc/collectd.conf': { 'mode': '0600', 'content_type': 'mako', 'context': { 'collectd': node.metadata.get('collectd', {}), }, 'needs': ...
class Aggrhapolicy(basestring): """ sfo|cfo Possible values: <ul> <li> "cfo" , <li> "sfo" </ul> """ @staticmethod def get_api_name(): return "aggrhapolicy"
"""3. Extracting video features from pre-trained models ======================================================= Feature extraction is a very useful tool when you don't have large annotated dataset or don't have the computing resources to train a model from scratch for your use case. It's also useful to visualize what ...
#Fibonacci Fibonacci.py # Fibonacci numbers module #n = int(input('Please enter a number: ')) def fib(n): a, b = 0, 1 while a < n: print(a, end=' ') a, b = b, a+b print() # Go to fibonacci Powerpoint def fib2(n): # return Fibonacci series result = [] a, b = 0, 1 while a < n: result.append(a) a, b = b...
#Parameters given at the beginning of the APP zid_min = 1E06 #1Mohm zic_min = 10E06 #10Mohm GM_min = 10 #dB PM_min = 30 #deg CL_min = 0 #0uF CL_max = 1E-06 #1uF Rl = 10 #10ohm Fc_low = 0 #DC Fc_high = 100E03 #100kHz CMRR_min = 100 ...
# # PySNMP MIB module IPFIX-SELECTOR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPFIX-SELECTOR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:44:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
grid_view_field_options_schema = { 'type': 'object', 'description': 'An object containing the field id as key and the ' 'properties related to view as value.', 'properties': { '1': { 'type': 'object', 'description': 'Properties of field with id 1 of the rel...
classmates = {'Петя': 9, 'Вася': 7, 'Ваня': 5, 'Толя': 3, 'Маша': 1, 'Саша': -1, 'Учитель': 11} names = ['Петя', 'Вася', 'Ваня', 'Толя', 'Маша', 'Саша', 'Учитель'] for name in names: print(name, ': ', classmates[name])
#!/usr/bin/env python3 # vim: set ai et ts=4 sw=4: def gen(arg, begin, pixels, arr): for i in range(0, int(2**len(arr))): if i > 0: print("else"); if i != int(2**len(arr)) - 1: print("if({} < ({} + ({}/{})*{}))".format( arg, begin, pixels, int(2**len(arr)), ...
# Time: O(m * nlogn) # Space: O(n) class Solution(object): def longestCommonSubpath(self, n, paths): """ :type n: int :type paths: List[List[int]] :rtype: int """ def RabinKarp(arr, x): # double hashing hashes = tuple([reduce(lambda h,x: (h*p+x)%MOD, (a...
class Song: def __init__(self, json): # playlist tracks not queryable over API if not json: raise LookupError self.name = json['name'] self.artists = list(map(lambda artist: artist['name'], json['artists'])) self.album = json['album']['name'] def __str__(se...
# test with with open("test.txt") as f: f.write("hello worlds") f.read()
class Solution: """ @param numbers : An array of Integer @param target : target = numbers[index1] + numbers[index2] @return : [index1 + 1, index2 + 1] (index1 < index2) """ def twoSum(self, numbers, target): # Hash map # map = {} # for i, n in enumerate(numbers): ...
class File(object): def __init__(self): self.filename = '' self.server_filename = '' self.rotate = 0 self.password = None # file_encryption_key TBD self.file_encryption_key = None self.metas = {} @property def metas_values(self): return "...
windowWidth = 500 windowHeight = 500 ellipseSize = 200 def setup(): size(windowWidth , windowHeight) smooth() background(255) fill(50, 80) stroke(100) strokeWeight(3) noLoop() def draw(): ellipse(windowWidth/2, windowHeight/2 - ellipseSize/2, ellipseSize , ellipseSize); ellipse(windowWidth/2 - ellipseSize/2, ...
# Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n. # Example 1: # Input: n = 3 # Output: 5 #FORMULA is 2nCn/ n+1 catelon number class Solution: def numTrees(self, n: int) -> int: res = 1 ...
'''Constants used by TRender. :copyright: 2015, Jeroen van der Heijden (Cesbit) ''' LINE_IF = 1 LINE_ELSE = 2 LINE_ELIF = 4 LINE_END = 8 LINE_MACRO = 16 LINE_COMMENT = 32 LINE_BLOCK = 64 LINE_FOR = 128 LINE_PASTE = 256 LINE_TEXT = 512 LINE_INCLUDE = 1024 LINE_EXTEND = 2048 LINE_EMPTY = 4096 EOF_TEXT = 8192 ALWAYS_A...
test_cases = int(input()) sol = [] for test in range(test_cases): budget = int(input()) useless = input() prices = list(map(int,input().split())) for i in range(len(prices)): for j in range(i+1,len(prices)): if prices[i]+prices[j] == budget: sol.append(str(i+1)+' '+st...
def pytest_assertrepr_compare(config, op, left, right): """Hook for PyCharm full diff References: https://stackoverflow.com/a/50625086/4249707""" if op in ("==", "!="): return ["{0} {1} {2}".format(left, op, right)]
its = [] for re in range(1, 6): peso = float(input(f'peso da {re}º pessoa: ')) its += [peso] print(f'maior peso lido {max(its)}kilos.') print(f'menor peso lido {min(its)}kilos.')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # def power(x, n=2): # s = 1 # while n > 0: # n = n - 1 # s = s * x # return s # # print(power(5)) # def add_end(L=[]): # L.append('END') # return L # # print(add_end([1, 2, 3])) # print(add_end(['x', 'y', 'z'])) # # print(add_end()) #...
n = int(input()) t = 0 a = 0 for _ in range(n): s = input() t += s.count('R') a += s.count('B') if t > a: print('TAKAHASHI') elif a > t: print('AOKI') else: print('DRAW')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 20 14:55:39 2017 @author: ishxiao ~Email~: me@ishxiao.com """