content
stringlengths
7
1.05M
""" This module implements the helm toolchain rule. """ HelmInfo = provider( doc = "Information on Helm command line tool", fields = { "tool": "Target pointing to Helm executable", "cmd": "File pointing to Helm executable" } ) def _helm_toolchain_impl(ctx): toolchain_info = platform_co...
# On est sur la première case. # On a un grain de blé sur la première case. # On a un grain de blé sur l'échéquier. # Nombre de grain de blé par case. # case est un nombre entier. case = 1 # Nombre de grain blé au total sur l'échiquier. # blé est un nombre entier. ble = 1 # Coefficient d'augmentation du nombre de gr...
class ChocolateBoiler: unique_instance = None def __new__(cls, *args, **kwargs): if not cls.unique_instance: cls.unique_instance = super().__new__(cls, *args, **kwargs) return cls.unique_instance def __init__(self): self.empty = True self.boiled = False def...
class Solution: def numRescueBoats(self, people, limit): """ :type people: List[int] :type limit: int :rtype: int """ people.sort() l, r, cnt = 0, len(people) - 1, 0 saved = 0 while saved < len(people): if people[r] + people[l] <= l...
inpu = """4 aba baba aba xzxb 3 aba xzxb ab """ inp = """100 lekgdisnsbfdzpqlkg eagemhdygyv jwvwwnrhuai urcadmrwlqe mpgqsvxrijpombyv mpgqsvxrijpombyv urcadmrwlqe mpgqsvxrijpombyv eagemhdygyv eagemhdygyv jwvwwnrhuai urcadmrwlqe jwvwwnrhuai kvugevicpsdf kvugevicpsdf mpgqsvxrijpombyv urcadmrwlqe mpgqsvxrijpombyv exdafbno...
class StartUploadEvent(object): """Event dispatched when an upload starts""" def __init__(self, filepath, upload_file_rank, files_to_upload): """ Constructor :param str filepath: file which starts to be uploaded :param int upload_file_rank: rank of the file in upload queue ...
class Solution: def minAvailableDuration(self, slots1: List[List[int]], slots2: List[List[int]], duration: int) -> List[int]: timeslots = list(filter(lambda x: x[1] - x[0] >= duration, slots1 + slots2)) heapq.heapify(timeslots) while len(timeslots) > 1: start1, end1 = heapq.heapp...
someParameters = input("Please Enter some parameters: ") def createList(*someParameters): paramList = [] for add in someParameters: paramList.append(add) print(paramList) return paramList createList(someParameters)
""" Write a program that first takes the year, month (as integer), and day of the user's birth date from console. Then, calculate and print on which day of the year the user has been born. You can assume user will enter a valid value for all inputs. Example: Enter your birth year: 1998 Enter your birth month as integer...
def first_repeating(n,arr): #initialize with the minimum index possible Min = -1 #create a empty dictionary newSet = dict() # tranversing the array elments from end for x in range(n - 1, -1, -1): #check if the element is already present in the dictionary #then up...
SECRET_KEY = 'testing' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } INSTALLED_APPS = [ 'django.contrib.contenttypes', 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.staticfiles', 'django.contrib.sessions', 'c...
class Drawable(): def draw(self, screen): pass def blit(self, screen): pass
# Arke # User-configurable settings. # Dirty little seeekrits... SECRET_KEY='much_sekrit_such_secure_wow' # Database # See http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls # With DEBUG defined, this is ignored and a SQLite DB in the root folder is used instead. # SQLite is probably not the best f...
#crie um programa que leia o preço de um #produto e mostre seu novo preço com 5% #de desconto p=float(input('Digite o preço do produto:R$ ')) pn=p-(p*5/100) print ('O novo preço com desconto de 5% é:R$ {:.2f}'.format (pn))
class TrieNode: def __init__(self, c=None, end=False): self.c = c self.children = {} self.end = end class Trie: def __init__(self): """ Initialize your data structure here. """ self.root = TrieNode('') def insert(self, word: str) -> None: ...
def n_choose_m_iterator(N, M, startpoint=None): if startpoint is None: subscripts = list(range(M)) else: subscripts = copy.deepcopy(startpoint) while True: yield subscripts off = M - 1 while off > -1: rev_off = M - off if subscripts[off] < N ...
#Author wangheng class Solution: def isNStraightHand(self, hand, W): c = collections.Counter(hand) for i in sorted(c): if c[i] > 0: for j in range(W)[::-1]: c[i + j] -= c[i] if c[i + j] < 0: return False ...
class EnumMeta(type): base = False def __new__(cls, name, bases, kw): klass = type.__new__(cls, name, bases, kw) if not EnumMeta.base: EnumMeta.base = True return klass return klass() class Enum(metaclass=EnumMeta): def __getitem__(self, key): if isinstance(key, int): for k in dir(self): if len...
# #.. create syth_test.geo file form this file # # python3 mkSyntheticGeoData2D.py test # #.. create 3D mesh syth_testmesh.msh # # gmsh -3 -format msh2 -o syth_testmesh.msh syth_test.geo # #.. run for synthetic data # # python3 mkSyntheticData2D.py -s synth -g -m test # # creating test_grav.nc and test_mag....
class Item: def __init__(self, id, quantity, price): self.__product_id = id self.__quantity = quantity self.__price = price def update_quantity(self, quantity): None class ShoppingCart: def __init__(self): self.__items = [] def add_item(self, item): None def remove_item(self, item...
class Solution(object): def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if not nums: return -1 lo = 0 hi = len(nums)-1 old_size = len(nums) # if not rotated if nums[lo] <= nums[hi]: return self.binary_search(nums,lo,hi+1,target) else: # ext...
a = [1,2,3] print(a) a.append(5) print(a) list1=[1,2,3,4,5] list2=['rambutan','langsa','salak','durian','apel'] list1.extend(list2) c = [1,2,3] print(c) c.insert(0,12) print(c) ### Perbedaan antara fungsi Append,extend,dan insert # append berfungsi untuk menambahkan elemen ke daftar # extend berfungsi untuk memp...
# 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 ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def averageOfLevels(self, root: TreeNode) -> List[float]: queue, levelsData, result = deque([(root, ...
af = list(b"\x13\x13\x11\x17\x12\x1d\x48\x45\x45\x41\x0b\x26\x2c\x42\x5f\x09\x0b\x5f\x6c\x3d\x56\x56\x1b\x54\x5f\x41\x45\x29\x3c\x0b\x5c\x58\x00\x5f\x5d\x09\x54\x6c\x2a\x40\x06\x06\x6a\x27\x48\x42\x5f\x4b\x56\x42\x2d\x2c\x43\x5d\x5e\x6c\x2d\x41\x07\x47\x43\x5e\x31\x6b\x5a\x0a\x3b\x6e\x1c\x49\x54\x5e\x1a\x2b\x34\x05\x5e...
I = input("Enter the string: ") S = I.upper() freq = {} for i in I: if i != " ": if i in freq: freq[i] += 1 else: freq[i] = 1 print(freq)
# Desenvolva um algoritmo que receba um valor inteiro e que exiba os números de 0 até ele. # OBS: Obrigatório o uso do while valor_digitado = int(input("Digite um valor maior que 0: ")) numero = 0 while numero <= valor_digitado: print(numero) numero = numero + 1 print("Valor final do numero: " + str(numero))...
class Solution(object): def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ nums.sort() res = [] for i,a in enumerate(nums): # If same as the previous value just continue, already checked if i>0 and a == nu...
# -*- coding: utf-8 -*- """ Created on Wed Mar 24 22:12:02 2021 @author: Abeg """ #all symmetric pair of an array def symmetricpair(pairs): s=set() for (x,y) in pairs: s.add((x,y)) if (y,x) in s: print((x,y),"|",((y,x))) pairs=[(11,20),(30,40),(5,10),(40,30),(10,5)] print(symmetricpai...
nome = str(input('Digite seu nome completo ')).strip() maisculas = nome.upper() minusculas = nome.lower() letras = len(nome) - nome.count(' ') primeiro = nome.find(' ') print(f'Seu nome em maiusculas é {maisculas}') print(f'Seu nome em minusculas é {minusculas}') print(f'Seu nome tem ao todo {letras} letras') print(f'S...
# exc. 7.2.4 def seven_boom(end_number): my_list = [] for i in range(0, end_number + 1): s = str(i) if '7' in s or i % 7 == 0: my_list += ['BOOM'] else: my_list += [i] print(my_list) def main(): end_number = 17 seven_bo...
"""Format a number with grouped thousands. Number will be formatted with a comma separator between every group of thousands. Source: cup """ # Implementation author: cup # Created on 2018-09-17T20:09:08.888749Z # Last modified on 2018-09-17T20:09:08.888749Z # Version 1 print("f'{1000:,}'")
def main(): # input N, K = map(int, input().split()) # compute def twoN(a: int): if a%200 == 0: a = int(a/200) else: a = int(str(a) + "200") return a for i in range(K): N = twoN(N) # output print(N) if __name__ == '__main_...
def increment_by_one(x): return x + 1 def test_increment_by_one(): assert increment_by_one(3) == 4
class CTDConfig(object): def __init__(self, createStationPlot, createTSPlot, createContourPlot, createTimeseriesPlot, binDataWriteToNetCDF, describeStation, createHistoricalTimeseries, showSta...
class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ i, j = 0, 0 for i, n in enumerate(nums): a = target - n # print('i = ',i,'n = ',n) # print('a = ',a) ...
##Generalize orienteering contours=name ##maximumdistancebetweentheoriginalandthesimplifiedcurvedouglaspeuckeralgorithm=number4 ##contours=vector ##min=string37 ##generalizecontours=output vector outputs_QGISFIELDCALCULATOR_1=processing.runalg('qgis:fieldcalculator', contours,'length',0,10.0,2.0,True,'round($length,2)'...
L=[1,2,3] it=iter(L) print("The Iteration:{}".format(it)) print("item is:{}".format(it.__next__())) print("item is:{}".format(next(it))) print("item is:{}".format(next(it))) print("item is:{}".format(next(it))) # 在代码段 for X in Y 中,Y必须是个迭代器或者可以通过使用 iter() 创建迭代器的一些对象 obj=(12,34) for i in iter(obj): print(i) fo...
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) # norm_cfg = dict(type='BN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet18_v1c', backbone=dict( type='BiseNetV1', base_model='ResNetV1c', depth=18, out_indices=(0,...
#For packaging ''' Users api handles JWT auth for users '''
def run(params={}): return { 'project_name': 'Core', 'bitcode': True, 'min_version': '9.0', 'enable_arc': True, 'enable_visibility': True, 'conan_profile': 'ezored_ios_framework_profile', 'archs': [ {'arch': 'armv7', 'conan_arch': 'armv7', 'platfor...
#!/usr/bin/python # encoding: utf-8 """ custom_stopwords Purpose: Collect custom stopwords lists Author: datadonk23 (datadonk23@gmail.com) Date: 2018-05-01 """ arxiv_stopwords = ["arxiv", "astro-ph", "astro-ph.co", "astro-ph.ep", "astro-ph.ga", "astro-ph.he", "astro-ph.im", "astro-ph.sr", ...
# Copyright 2020 Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.apac...
''' Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Examp...
class Tile(): """ The smallest building block in a map """ def __init__(self): self.tile = '.' def get(self): return self.tile def set(self, item): self.tile = item
def longestDigitsPrefix(inputString): # iterate through the string arr = '' for i in inputString: if i.isdigit(): arr += i else: break return arr
# Copyright 2017 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...
"""Debug functions for notebooks. """ def count(df, name=None): """Print the count of dataframe with title.""" if name: print("Dataset: %s" % (name)) print("Count: %d" % (df.count())) def show(df, name=None, num_rows=1): """Print title and show a dataframe""" if name: print("Data...
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # --------------------------------------------------------- class LCS: """ Compute the Longest Common Subsequence (LCS) of two given string.""" def __init__...
class Error: none_or_invalid_attribute = "main attributes should have value." unacceptable_json = "json input has unacceptable format." unacceptable_object_type = "object has unacceptable type"
def decimalni_zapis(deljenec, delitelj): memo = set() decimalni_zapis = '' while (deljenec, delitelj) not in memo: if deljenec % delitelj == 0: decimalni_zapis += str(deljenec // delitelj) return decimalni_zapis, deljenec, delitelj elif deljenec < delitelj: ...
class Solution: """ @param grids: a maxtrix with alphabet @return: return sorted lists """ def CounterDiagonalSort(self, grids): # write your code here m = len(grids) n = len(grids[0]) table = [] for i in range(m): temp = [] row = i ...
#!/usr/bin/python3 bridgera = ['Arijit','Soumya','Gunjan','Arptia','Bishwa','Rintu','Satya','Lelin'] # Generator Function iterarates through all items of array def gen_func(data): for i in range(len(data)): yield data[i] data_gen = list(gen_func(bridgera)) print (data_gen) # Normal Functio...
class Node: def __init__(self, value): self.value = value self.next = None class LinkedList: """ Class to create a linked list and perform some basic operations such as: append, display, prepend, convert, insert, remove, search, pop """ def __init__(self, value=None): s...
def data_for_fitting(*, building_id, date): """ Retrieves data for fitting from the previous business day taking into account holidays """ lease_start = None while lease_start is None: # Previous business day according to Pandas (might be a holiday) previous_bday = pd.to_datetim...
"""Top-level package for leimpy.""" __author__ = """Marco Berzborn""" __email__ = 'marco.berzborn@akustik.rwth-aachen.de' __version__ = '0.0.0'
class Node: """ A node in a graph """ def __init__(self, identifier): """ :param identifier: Identifier is hash of given Shape Object """ self.identifier = identifier self.outgoing_pointers = [] self.incoming_pointers = [] def get_identifier(self): ...
#implicit type conversion num1 = 12 num2= 13.5 num3 = num1 + num2 print(type(num1)) print(type(num2)) print(num3) print(type(num3))
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def findTarget(self, root, k): """ :type root: TreeNode :type k: int :rtype: bool ...
load("@rules_cuda//cuda:defs.bzl", "cuda_library") NVCC_COPTS = ["--expt-relaxed-constexpr", "--expt-extended-lambda"] def cu_library(name, srcs, copts = [], **kwargs): cuda_library(name, srcs = srcs, copts = NVCC_COPTS + copts, **kwargs)
''' Author: jianzhnie Date: 2022-03-04 17:13:55 LastEditTime: 2022-03-04 17:13:55 LastEditors: jianzhnie Description: '''
#!/usr/bin/env python3 #: Program Purpose: #: Read an integer N. For all non-negative integers i < N #: print i * i. #: #: Program Author: Happi Yvan <ivensteinpoker@gmail.com #: Program Date : 11/04/2019 (mm/dd/yyyy) def process(int_val): for x in range(int_val): print(x * x) def main...
def names(name_list): with open('textfile3.txt', 'w') as myfile: myfile.writelines(name_list) myfile.close() print(name_list) menu() def display_name(n): with open('textfile3.txt', 'r') as myfile: name_list = myfile.readlines() print(name_list[n-1]) retu...
test = { 'name': 'Problem 7', 'points': 1, 'suites': [ { 'cases': [ { 'answer': '103495fc3358e1b6354d1d4a277039e6', 'choices': [ r""" Pair('quote', Pair(A, nil)), where: A is the quoted expression """, r""" ...
n = int(input()) even_numbers_set = set() odd_numbers_set = set() for current_iteration_count in range(1, n+1): name = input() current_sum = sum([ord(el) for el in name]) // current_iteration_count if current_sum % 2 == 0: even_numbers_set.add(current_sum) else: odd_numbers_set.add(cu...
# -*- coding: utf-8 -*- r"""Testing code for the (Python) bandit library. Testing is done via the Testify package: https://github.com/Yelp/Testify This package includes: * Test cases/test setup files * Tests for bandit/epsilon: :mod:`moe.tests.bandit.epsilon` * Tests for bandit/ucb: :mod:`moe.tests.bandit.ucb` * Tes...
num = int(input("Numero: ")) for i in range(1,13): m = num * i print(num,"X",i,"=",m)
class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ if not matrix: return # use first row as "cols" array, use first column as "rows" array # to do that, first store what ne...
class Solution(object): def leastBricks(self, wall): """ :type wall: List[List[int]] :rtype: int """ hash_map = {} for row in wall: sum = 0 for brick in row[:-1]: sum += brick hash_map[str(sum)]...
# function type class function(object): def __get__(self, obj, objtype): # when used as attribute a function returns a bound method or the function itself object = ___id("%object") method = ___id("%method") NoneType = ___id("%NoneType") if obj is None and objtype is not NoneType: # no obj...
class GenerationTemplate: def __init__( self, source_path: str, template: str, group_template: str, unit_template: str ): self.source_path: str = source_path self.template: str = template self.group_template: str = group_temp...
#Son directorios donde se almacenan módulos ''' 1) Crear una carpeta con un archivo __init__.py <- constructor '''
""" Exercícios 2 - FizzBuzz parcial, parte 1 Receba um número inteiro na entrada e imprima Fizz se o número for divisível por 3. Caso contrário, imprima o mesmo número que foi dado na entrada. """ numero = int(input("Digite um número inteiro: ")) if(numero % 3 == 0): print("Fizz") else: print(numero)
#!/usr/bin/env python3 # # eask: # The initialization program (your puzzle input) can either update the bitmask # or write a value to memory. Values and memory addresses are both 36-bit # unsigned integers. For example, ignoring bitmasks for a moment, a line # like mem[8] = 11 would write the value 11 to memory address...
class Email: client = None optional_arguments = [ "antispamlevel", "antivirus", "autorespond", "autorespondsaveemail", "autorespondmessage", "password", "quota" ] def __init__(self, client): self.client = client def overview(self): return self.client.get("/email/overview") def globalquota(se...
class MyArray: def __init__(self, *args): self.elems = list(args) def __repr__(self): return str(self.elems) def __getitem__(self, index): return self.elems[index] def __setitem__(self, index, value): self.elems[index] = value def __delitem__(self, index): ...
# getTotalPage.py # 06-3 게시판 페이징하기 (나의 풀이_한 번에 성공!) # divmod를 사용해서 몫과 나머지를 한 번에 구했다는 점, # 그리고 그 결과는 튜플이라 리스트처럼 인덱싱했다는 점! result = 0 # 총 페이지 (output) m = 0 # 게시물의 총 건수 (input) n = 0 # 한 페이지에 보여줄 게시물 수 (input) def getTotalPage(m, n): page = divmod(m, n) if not page[1]==0: result = page[0]+1 else: ...
n = input() def odd_even(a): odd = 0 even = 0 for i in range(len(a)): if int(a[i]) % 2 == 0: even += int(a[i]) else: odd += int(a[i]) return (f'Odd sum = {odd}, Even sum = {even}') print(odd_even(n))
# Suponho que a população de um país A seja da ordem de 80000 habiteantes com uma taxa anual de crescimento de 3% e que # a população B seja 200000 habitantes com uma taxa de crescimento de 1.5%. Faça um programa que calcule e escreva o numero # de anos necessarios para que a população do Pais A ultrapasse ou i...
""" Entradas numero_hombres-->int-->p_h numero_mujeres-->int-->p_m salidas Porcentaje de hombres-->float-->p_h Porcentaje de mujeres-->float-->p_m """ numero_hombres=int(input("digite total de hombres: ")) numero_mujeres=int(input("digite total de mujeres: ")) #caja negra p_h=numero_hombres*100/(numero_hombres+numero_...
load("//internal/jsweet_transpile:jsweet_transpile.bzl", "jsweet_transpile","TRANSPILE_ATTRS") load("@npm_bazel_typescript//:index.bzl", "ts_library") JWSEET_TRANSPILE_KEYS = TRANSPILE_ATTRS.keys() def jsweet_ts_lib(name, **kwargs): transpile_args = dict() for transpile_key in JWSEET_TRANSPILE_KEYS: i...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: dummy = ListNode() output = dummy # l1_eol...
text = """first row second row third row""" print(text)
# WSADMIN SCRIPT TO SHOW USEFUL ADMINTASK COMMANDS AND HELP TOWARDS THEM # Santiago Garcia Arango # Command: # wsadmin.sh -lang jython -f /tmp/test.py print("***** Showing AdminTask help *****") print(AdminTask.help()) print("***** Showing AdminTask commands *****") print(AdminTask.help("-commands")) print("***** Sh...
def dummy_function(a): return a DUMMY_GLOBAL_CONSTANT_0 = 'FOO'; DUMMY_GLOBAL_CONSTANT_1 = 'BAR';
''' Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: - The length of num is less than 10002 and will be ≥ k. - The given num does not contain any leading zero. Example: ...
# Matrix solver (TDMA) # parameters required: # n: number of unknowns (length of x) # a: coefficient matrix # b: RHS/constant array # return output: # b: solution array def solve_TDMA(n, a, b): # forward substitution a[0][2] = -a[0][2] / a[0][1] b[0] = b[0] / a[0][1] for i in range(1, n): a[...
n = int(input('Quantos termos [FIBONACCI], você quer mostrar? ')) ant = 0 post = 1 cont = 0 print('{} -> {}'.format(ant, post),end='') while cont <= n: atual = ant + post print( '-> {}'.format(atual),end='') ant = post post = atual cont += 1 print('-> FIM!')
default_response = { "features":[ { "geometry":{ "coordinates":[ -43.21986610772104, -22.8049732 ], "type":"Point" }, "type":"Feature", "properties":{ "osm_id":5519132, "osm_type":"R", ...
allowed_request_categories = [ 'stock', 'mutual_fund', 'intraday', 'history', 'history_multi_single_day', 'forex', 'forex_history', 'forex_single_day', 'stock_search' ]
""" Constant values used all over the place. Fare data is stored in fares/data.py. """ # Directories DIR_DOWNLOAD = "data_src" DIR_CONVERTED = "data_feeds" DIR_SINGLE_FEED = "data_gtfs" DIR_SHAPE_ERR = "err_shapes" DIR_SHAPE_CACHE = "data_shapes" # How long to keep Overpass data cached (in minutes) SHAPE_CACHE_TTL =...
#Encontrar el menor valor en un array #con busqueda binaria def menor (array): l=0 r=len(array)-1 while l<=r: mid = l+(r-l)//2 if array[mid] > array[r]: l=mid+1 if array[mid]< array[r]: r=mid if r==l or mid==0: return array[r] n...
def fun(s): ans = 0 o = 0 c = 0 for i in s: if(i=="("): o+=1 elif(i==")"): c+=1 if(c>o): c-=1 o+=1 ans+=1 return ans t = int(input()) for _ in range(t): n = int(input()) s = input() ans = 0 N = 10**9+7 value = ((n+1)*n)//2 value = pow(value,N-2,N) prin...
for _ in range(int(input())): s = set() n = input().split() while True: m = input().split() if m[-1] == "say?": break s.add(m[-1]) for i in n: if i not in s: print(i, end=' ') print()
# -*- coding: utf-8 -*- BOT_TOKEN = "b73225fbdf517ed6cbc842b4c2c9b0d19422071825c18a4efc62c52a5b0bf89d270434602d03c729d7fa3" # Задержка перед ответом бота в секундах. RESPONSE_DELAY = 3 # Шанс ответа в процентах (от 1 до 100). RESPONSE_CHANCE = 25
# Copyright (c) 2018 Stephen Bunn <stephen@bunn.io> # MIT License <https://opensource.org/licenses/MIT> __name__ = "standardfile" __repo__ = "https://github.com/stephen-bunn/standardfile" __description__ = "A library for accessing and interacting with a Standard File server." __version__ = "0.0.0" __author__ = "Stephe...
""" 10. Faça um Programa que pergunte em que turno você estuda. Peça para digitar M-Matutino ou V-Vespertino ou N-Noturno. Imprima a mensagem "Bom Dia!", "Boa Tarde!" ou "Boa Noite!" ou "Valor Inválido!", conforme o caso. """ turno = input("Qual o turno que você estuda: ") if turno == 'M' or turno == "Matutino": ...
""" LIST: CHUNKING """ __author__ = 'Sol Amour - amoursol@gmail.com' __twitter__ = '@solamour' __version__ = '1.0.0' # Example of Chunking (Grouping an item with its next) def chunks(list, number): # Requires a list and a number for index in range(0, len(list), number): # For every # index inside of a n...
class Dataset(object): def __init__(self, env_spec): self._env_spec = env_spec def get_batch(self, batch_size, horizon): raise NotImplementedError def get_batch_iterator(self, batch_size, horizon, randomize_order=False, is_tf=True): raise NotImplementedError
# -------------- ##File path for the file file_path def read_file(path): f=open(path,'r') sentence=f.readline() f.close() return sentence sample_message=read_file(file_path) #Code starts here # -------------- #Code starts here file_path_1 file_path_2 message_1=read_file(file_pa...