content stringlengths 7 1.05M |
|---|
def rowsearch(q,p):
prow,qrow=[len(p),len(q)]# no. of rows
pcol,qcol=[len(p[0]),len(q[0])]# 0 only for reference, pcol= no. of columns in p
#print(prow, qrow, pcol, qcol)
for i in range(qrow-prow+1):# for checking every row of q
if(p[0] in q[i]):#if present in any row of q, then only bother to proceed fur... |
""" Unit tests for shell script conversion """
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
load(
"//tools/build_defs:shell_script_helper.bzl",
"convert_shell_script_by_context",
"do_function_call",
"replace_exports",
"replace_var_ref",
"split_arguments",
)
load("//tools/build... |
#!usr/bin/env python3
"""Example 6 from https://www.practicepython.org/exercise/2014/03/12/06-string-lists.html
==========================
- Prompt user for a string
- Print whether user's string is a palindrome or not
"""
def main():
maybePalindrome = input("Enter some string.\n" +
... |
age = 99
if age < 2:
print("This man is a baby.")
elif age < 4:
print("This man is child.")
elif age < 13:
print("This man is children.")
elif age < 20:
print("This man is teenagers.")
elif age < 65:
print("This man is adult.")
else:
print("This man is old man.")
|
"""
Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn.
Sample value of n is 5
Expected Result : 615
"""
n = int(input("Enter a positive integer:"))
if n<0:
print("Enter a positive integer")
else:
n1 = str(n)
n2 = n1+n1
n3 = n1+n1+n1
value = n + int(n2)+int(n3)
... |
"""
You are keeping score for a baseball game with strange rules. The game
consists of several rounds, where the scores of past rounds may affect
future rounds' scores.
At the beginning of the game, you start with an empty record. You are given
a list of strings ops, where ops[i] is the ith oper... |
#!/usr/bin/env python
imagedir = parent + "/oiio-images"
files = [ "dpx_nuke_10bits_rgb.dpx", "dpx_nuke_16bits_rgba.dpx" ]
for f in files:
command += rw_command (imagedir, f)
# Additionally, test for regressions for endian issues with 16 bit DPX output
# (related to issue #354)
command += oiio_app("oiiotool") + ... |
'''
Here, we assume that word1 and word2 are both in English.
You can use unidecode.unidecode() to remove the accents in European languages,
and use googletrans.Translator.translate() to translate other languages into English.
'''
def match_words(word1, word2):
if (len(word1) == 1 or len(word2) == 1) or (word1[1] ... |
class Solution:
def countBits(self, n: int) -> List[int]:
res = [0]*(n+1)
for i in range(1,n+1):
res[i] = res[i>>1] + (i&1)
return res
|
'''
Escreva um script para classificar um triângulo de acordo com o tamanho dos seus lados. Considere as seguintes informações:
Triângulo equilátero: todos os lados possuem o mesmo tamanho;
Triângulo escaleno: todos os lados possuem medidas diferentes;
Triângulo isósceles: caracterizado por ter dois lados com o mesm... |
c = 's'
contador = soma = maior = menor = 0
while c != 'n':
n = int(input('digite o numero que voce deseja aqui: '))
contador += 1
soma += n
if contador == 1:
maior = menor = n
else:
if n > maior:
maior = n
if n < menor:
menor = n
c = str(input('qu... |
def simple_reduce_function(results):
"""general purpose reduce function that sums up the results
of previous activations of map functions """
total = 0
for map_result in results:
total = total + map_result
return total
def my_reduce_function(results):
"""sums up the number of words by... |
"""
Utils is a subpackage designed to provide utility functions and classes to the rest of pyMez or store one-off
helper functions needed in daily development life. All other packages should if needed import this one.
Help
---------------
<a href="../index.html">`pyMez.Code`</a>
<div>
<a href="../../../pyMez_Document... |
def product(R1, R2):
"Compute the relational product of R1 and R2."
return { (x, z) for (x, y1) in R1 for (y2, z) in R2 if y1 == y2 }
def transClosure(R):
"Compute the transitive closure of the binary relation R."
T = R
while True:
oldT = T
T = product(R,T) | R
if T == ol... |
# Description: Three electron density as volumes.
# Source: placeHolder
"""
cmd.do('load ${1:4dgr}.pdb;')
cmd.do('# Make sure to rename map file so that ;')
cmd.do('# the root filename differs from pdb root filename;')
cmd.do('load ${1:4dgr}_2fofc.ccp4, 2fofc;')
cmd.do('load ${1:4dgr}_fofc.ccp4, fofc;')
cmd.do('sele... |
# GIS4WRF (https://doi.org/10.5281/zenodo.1288569)
# Copyright (c) 2018 D. Meyer and M. Riechert. Licensed under MIT.
# colors for categories defined directly in WPS Binary index file or WRF NetCDF global attributes
# (only used if existing category scheme does not contain the category)
darkblue = '#001DB1'
blue = '#0... |
# 这种表达的方式不是set,而使dict
# r0 = {}
# -----------------------------------------
def base():
r0 = set()
print("-> 空集", r0)
r1 = {1, 2, 3, 4}
r2 = {2, 3, 5, 6}
print("-> 集合r1 ", r1)
print("-> 集合r2 ", r2)
r = r1 & r2
print("交集 ", r)
r = r1 | r2
print("并集 ", r)
r = r1 - r2
p... |
DB_NAME = "postgres"
ARN = "arn:aws:rds:us-east-2:500514381816:cluster:postgres"
SECRET_ARN = "arn:aws:secretsmanager:us-east-2:500514381816:secret:rds-db-credentials/cluster-33FXTTBJUA6VTIJBXQWHEGXQRE/postgres-3QyWu7"
|
"""
Faça um programa que peça ao usuário para digitar 10 valores e some-os.
"""
print('-' * 40)
print('Soma de valores'.center(40))
soma = 0
for i in range(1, 11):
valores = int(input(f'Digite {i}° valor: '))
soma += valores
print(f'A soma dos valores é {soma}.')
print('-' * 40)
|
places = ['shiyan', 'shanghai', 'chicago', 'paris', 'berlin']
print('original list')
print(places)
print('alphabetical order')
print(sorted(places))
print('original list')
print(places)
print('reverse alphabetical order')
print(sorted(places, reverse=True))
print('original list')
print(places)
# reversed list
places... |
#!/usr/bin/env python3
"""
Advent of Code!
--- Day 1: Sonar Sweep ---
Looking forward to discovering more tricks within Python!
Although solving the puzzles in as few lines as possible might prove
too challenging...
I'll probably play with learning Python more deeply for real
after finals (if my interest still per... |
def SwapOddEvenBits(n):
even = n & 0xAAAAAAAA
odd = n & 0x55555555
even >>= 1
odd <<= 1
return (even | odd)
print(SwapOddEvenBits(30))
print(SwapOddEvenBits(20)) |
def format_starred(t):
return "%x %x %x" % (0, *t)
def ascii(a, b):
return "%a %x" % (a, b) |
#encoding: utf-8
userAgents=["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser)",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SE 2.X MetaSr 1.0; SE 2.X Meta... |
class TestGCL:
def testTest(self):
assert 1 == 1
|
"""
*************** RSA *****************
- Best known & widely used public-key encryption algorithm
- Uses large integers (e.g.. 1024 bits)
- Security due to cost of factoring large numbers
- Relies on the fact that Prime factorization is computationally very hard.
************* El-Gamal *************
- ElGamal cry... |
# https://docs.python.org/3/library/exceptions.html
"""
Raise serve para lançar e relançar uma exceção no python
"""
def divide(n1, n2):
try:
return n1/ n2
except ZeroDivisionError as error:
print('Log:', error) # Loguei o error
raise # reloga o erro (Retorna a descrição da exceção dis... |
#3.Dado o tamanho do raio de uma circunferência, calcular a área e o perímetro da mesma.
raio=(float(input('Digite o raio da circuferência: ')))
area=3.14*(raio*raio)
perimetro=2*3.14*raio
print(f'Sua área é: {area:,.2f} e o perimetro {perimetro:,.2f}') |
def on_button_pressed_a():
basic.show_number(randint(1, 6))
input.on_button_pressed(Button.A, on_button_pressed_a)
def on_button_pressed_b():
basic.show_number(randint(1, 4))
input.on_button_pressed(Button.B, on_button_pressed_b)
|
# while True:
# command = input()
# result = ""
#
# if "end" in command:
# break
#
# for i in range(len(command) - 1, -1, -1):
# result += command[i]
#
# print(f"{command} = {result}")
command = input()
while not command == "end":
print(f"{command} = {command[::-1]}")
comman... |
#Mock class for Adafruit Python DHT mock
def read_retry(a,b):
print ("read_retry DHT",a,b)
|
INITIAL_POSITION =\
{
"blue":
{
1: [-3.5, 0, 0],
2: [-1, 0, 0],
3: [-1.5, 1.75, 0]
},
"red":
{
1: [3.5, 0, -3.14],
2: [1, -2.5, -3.14],
3: [1.5, 1.75, -3.14]
}
}
START_POSITION =\
{
"blue":
{
1: [-4, -3.1, 1.57],
2: [-1, -... |
# pylint: disable=missing-docstring
# -1: [too-many-lines]
__revision__ = 0
... |
a = input()
if a == "A":
print("best!!!")
elif a == "B":
print("good!!")
elif a == "C":
print("run!")
elif a == "D":
print("slowly~")
else:
print("what?")
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-02-29
Last_modify: 2016-02-29
******************************************
'''
'''
Follow up for "Remove Duplicates":
What if... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
base_params = {
"sequence.max_length": 15,
"sequence.num_units": 128,
"random_seed": 0,
"use_horovod": False,
"num_gpus": 8,
"batch_size_per_gpu": [[300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400],
[120, 90, 72, 6... |
def remove_quotes(s: str) -> str:
if not isinstance(s, str):
return s
for q in '\'"':
if s.startswith(q):
s = s[1:]
if s.endswith(q):
s = s[0:-1]
return s
def get_bulks(items: list, bulk_size: int) -> list:
bulks = []
_items = items.copy()
while ... |
"""
Module imports for templates.python.business_logic.my_project
This file is automatically generated by ./scripts/empty_pyinit.sh
DO NOT EDIT IT MANUALLY
"""
|
class EngineBase:
def __init__(self, *args, **kwargs):
raise NotImplementedError()
def connection(self, *args, **kwargs):
raise NotImplementedError()
def execute(self, query, params):
raise NotImplementedError()
def fetchone(self, query, params):
raise NotImplementedEr... |
C = 0
X = str(input(''))
for i in X:
if i == ',':
C = X.index(i)
break
print(X[:C])
print(X[C+1 : len(X)]) |
soma = 0
for c in range(0,6):
n = int(input('Digite um número: '))
if n % 2 == 0:
soma += n
print('A soma dos números pares é {}'.format(soma)) |
RECIPE = \
{
"Registration_FakeAccountCreationByBots":
{
"data_path": "data/Registration_FakeAccountCreationByBots_100k.csv",
"variable_mappings": [
{
"variable_name": "first_name",
... |
height = float(input('Type your height, please: '))
wheight = float(input('Type your wheight, please: '))
bmi = wheight / height ** 2
print(f'Your Body Mass Index ─ BMI is {bmi}')
|
a=set((11,11,11,22,3,33,"hi",False))
print(a)
b = tuple((11,11,22,False,"hi"))
print(b)
c = {2:1,"b":3}
print(c["b"])
sequence= [1, 6, -1, 10]
q = set(sequence)
l = tuple(sequence)
w = tuple(q)
x =tuple(w)
print(sorted(q))
print(sorted(l))
print(w)
print(x)
if w == x:
print(True) |
print("Задача 1:")
numbers = [5, 7, 14, 22]
zero = 0
for number in numbers:
zero += number
print(f"Сумма чисел {numbers} =", zero)
print("\nЗадача 2:")
fruits = ['banana', 'apple', 'orange']
symbol = 'a'
for fruit in fruits:
print(f"Символ '{symbol}' встречается "
f"{fruit.count(symbol)} раз(а) в сло... |
#############################################################################
# Copyright (c) 2018 Eli Polonsky. 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... |
class Content(object):
"""Content to be included in your email.
You must specify at least one mime type in the Contents of your email.
"""
def __init__(self, type_=None, value=None):
"""Create a Content with the specified MIME type and value.
:param type_: MIME type of this Content (e... |
connections = {
"default": {
"engine": "tortoise.backends.sqlite",
"credentials": {
"file_path": "common.db"
}
}
}
apps = {
"default": {
"models": [
"model.visitor"
],
"default_connection": "default"
}
}
|
input = """
win( X ) :- move( X, Y ), not win( Y ).
move( a, d ).
move( b, c ).
move( c, b ).
"""
output = """
win( X ) :- move( X, Y ), not win( Y ).
move( a, d ).
move( b, c ).
move( c, b ).
"""
|
class Symbol(object):
def __init__(self, type, value):
self.type = type
self.value = value
def get_value(self):
return self.value
def set_value(self, value):
self.value = value
return self
class SymbolType(object):
INT = 0
FLOAT = 1
BOOL = 2
CHAR =... |
frase = str(input('Digite uma frase: ')).strip().upper()
print(f'A letra A aparece {frase.count("A")} vezes na frase')
print(f'A primeira letra A apareceu na posição {(frase.find("A")+1)}')
print(f'A Última letra A apareceu na posição {(frase.rfind("A")+1)}')
|
# -*- coding: utf-8 -*-
##########################################################################
# pySAP - Copyright (C) CEA, 2017 - 2018
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-e... |
class Solution:
def isMatch(self, s: str, p: str) -> bool:
"""
recurrence:
x. match -> move i, j
x. "." move forwards i, j
-. "d*" move forwards i as long as d is match, then move j once
x. "d*" move forwards j, backtrack move i if char1 == char2
x. ".*" move... |
HTML_WITH_EMPTY_BODY = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Just some page</title>
</head>
<body>
{}
</body>
</html>"""
|
text = """
//------------------------------------------------------------------------------
// Explicit instantiation.
//------------------------------------------------------------------------------
#include "ConnectivityMap.cc"
#include "Geometry/Dimension.hh"
template class Spheral::ConnectivityMap<Spheral::Dim< %(... |
def multiples(a, b, n):
total = []
for i in range(1, n + 1):
if i % a == 0 or i % b == 0:
total.append(i)
return total
print(multiples(7, 3, 30))
|
class Solution:
def oddEvenJumps(self, A) -> int:
largerIndex = [-1] * len(A)
smallerIndex = [-1] * len(A)
St = []
for _, i in sorted((a, i) for i, a in enumerate(A)):
while St and St[-1] < i:
largerIndex[St.pop()] = i
St.append(i)
St ... |
def reader():
a, b = map(int, input().split())
q, r = divmod(a, b)
print(f'{a + b}\n{a - b}\n{a * b}\n{q}\n{r}')
if __name__ == '__main__':
reader()
|
def left(A, k):
xt = A[k:] + A[:k]
return ''.join([str(ele) for ele in xt])
def right(A, k):
xt = A[-k:] + A[:-k]
return ''.join([str(ele) for ele in xt])
class Solution:
def stringShift(self, s: str, shift: List[List[int]]) -> str:
for i in shift:
if i[0] == 0:
... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
rd, rm, ry = [int(x) for x in input().split(' ')]
ed, em, ey = [int(x) for x in input().split(' ')]
if (ry, rm, rd) <= (ey, em, ed):
print(0)
elif (ry, rm) == (ey, em):
print(15 * (rd - ed))
elif ry == ey:
print(500 * (rm - em))
else:
... |
# passing a list
def greet_users(names):
for name in names:
msg = "Hello, " + name.title() + "!"
print(msg)
usernames = ['harry potter','ron weasly','harmoine granger']
greet_users(usernames)
unprinted_designs = ['iphone case', 'robot pendant', 'dodechedron']
completed_designs = []
while unprinted_... |
sexo = str(input('Informe seu sexo: [M/F] '))
while sexo != 'F' and sexo != 'M':
sexo = str(input('Dados inválidos. Por favor informe seu sexo: ')).upper().strip()
print(f'Sexo {sexo} registrado com sucesso!')
|
# Copyright 2021 The XLS 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 writ... |
TIMEOUT = 8 # s
CP = 1 # by default
ROWS = 6
COLUMNS = 7
CONNECT_X = 4 # value of X
|
name1_1_1_1_0_2_0 = None
name1_1_1_1_0_2_1 = None
name1_1_1_1_0_2_2 = None
name1_1_1_1_0_2_3 = None
name1_1_1_1_0_2_4 = None |
__author__ = 'florianseidl'
# Copyright (C) Schweizerische Bundesbahnen SBB, 2016
# Python 3.4
__author__ = '<your_userid_here>'
# Template for an output. For ampel type output with 3 or less lights or signals, use myampeloutput template instead.
# copy and add your functionality
def create(configuration, key=None):
... |
__all__ = ["Serializer"]
class Serializer(object):
def __call__(self, *args, **kwargs):
return self.serialize(*args, **kwargs)
def get_attrs(self, item_list):
return {}
def serialize(self, item, attrs):
return {}
def format_datetime(self, datetime):
if not datetime:
... |
# coding=UTF-8
# ex:ts=4:sw=4:et=on
# Copyright (c) 2013, Mathijs Dumon
# All rights reserved.
# Complete license can be found in the LICENSE file.
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
|
class DpiChangedEventArgs(CancelEventArgs):
# no doc
def ToString(self):
""" ToString(self: DpiChangedEventArgs) -> str """
pass
DeviceDpiNew = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: DeviceDpiNew(self: DpiChangedEventArgs)... |
#! /usr/bin/env python3
with open("test.pgm") as fp:
lineno = 0
for line in fp.readlines():
lineno+= 1
if lineno == 2:
break
lineno = 0
for line in fp.readlines():
lst = [int(v) for v in line.split()]
for i in range(len(lst)):
if (i + lineno) % 2 =... |
# coding=utf-8
n = int(input())
a = list(map(int, input().split()))
f = [0] * 1010
ans = []
for v in reversed(a):
if f[v] == 0:
ans.append(v)
f[v] += 1
print(len(ans))
ans = reversed(ans)
print(*ans)
|
"""
http://codekata.com/kata/kata01-supermarket-pricing/
"""
def run():
raise NotImplementedError("This function is not yet implemented.")
|
def build_table(text, style):
if not text:
return ""
lengths=[-float("inf") for i in range(len(text[0]))]
for i in text:
for j,k in enumerate(i):
lengths[j]=max(lengths[j], len(k)+style.off_min*2)
res=[style.sep_he*(sum(lengths)+len(style.sep_vi)*(len(lengths)-1)+len(style.se... |
# https://www.acmicpc.net/problem/10871
a, b = input().split()
c = list(input().split())
for i in range(len(c)):
if int(c[i]) < int(b):
print(int(c[i]), end = " ", flush = True) |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 26 15:22:21 2018
@author: chenxi11
"""
#665. Non-decreasing Array
class Solution:
def checkPossibility(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
lows = 0
point = 0
for i in range(len(nums) - 1):
... |
class DirectorException(Exception):
"""Basic exception for errors raised with director"""
def __init__(self, msg=None):
if msg is None:
msg = "Unexpected error occured in director subpackage"
super().__init__(msg)
class ServiceNotFoundError(DirectorException):
"""Service was n... |
'''For this problem, you will write a program that takes a string of characters, S,
and creates a new string of characters, T, with each character repeated R times.
That is, R copies of the first character of S, followed by R copies of the second character of S, and so on.
Valid characters for S are the QR Code "alpha... |
# -*- coding: utf-8 -*-
# Author: Tonio Teran
# Copyright: Stateoftheart AI PBC 2021.
'''Tensorflow Dataset's wrapper module.
Model information taken from:
Dataset information taken from:
'''
SOURCE_METADATA = {
'name': 'tensorflow',
'original_name': 'TensorFlow Datasets',
'url': 'https://www.tensorflow.o... |
#===- enumerations.py - Python Enumerations ------------------*- python -*--===#
#
# The LLVM37 Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------... |
#########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... |
'''
Variáveis
iniciar com letra, pode conter números, separar _, letras minusculas
'''
nome = 'Luis Gustavo Hauck'
idade = 18
altura = 1.87
e_maior = idade >18
print('Nome:', nome)
print('Idade:', idade)
print('Altura:', altura)
print('É maior de idade:', e_maior)
|
data = {'level_index': 10216, 'move_count': '24',
'board_info': {(-7, 14): {}, (-7, 13): {}, (-4, 13): {'next': (0, -1), 'prev': (1, 0)},
(-4, 12): {'next': (0, -1), 'prev': (0, 1)}, (-4, 11): {'next': (0, -1), 'prev': (0, 1)},
(-4, 10): {'next': (0, -1), 'prev': (0... |
'''
Defines the set of symbols used in text input to the model.
The default is a set of ASCII characters that works well for English or text that has been run
through Unidecode. For other data, you can modify _characters. See TRAINING_DATA.md for details.
'''
# from . import cmudict
_pad = '_'
_eos = '~... |
array = [6, 5, 12, 10, 9, 1]
|
RABBIT_HOST= 'localhost'
PORT=32784
QUEUE_TOPIC='boom'
USER='guest'
PASSWORD='guest' |
class Payload:
def __init__(self, website, username, password):
self.website = website
self.username = username
self.password = password
|
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
"""
Given an array nums of n integers, are there elements
a, b, c in nums such that a + b + c = 0? Find all unique
triplets in the array which gives the sum of zero.
Notice that the solution s... |
def test_create_user(client, user_data, users_api):
resp = client.post(users_api.url, json=user_data)
assert resp.status_code == 201
json_data = resp.get_json()
assert json_data['email'] == user_data['email']
assert json_data['first_name'] == user_data['first_name']
assert json_data['last_name'... |
def clr(colour):
if colour == "teal":
clr = 0x1abc9c
elif colour == "dark_teal":
clr = 0x11806a
elif colour == "green":
clr = 0x2ecc71
elif colour == "dark_green":
clr = 0x1f8b4c
elif colour == "blue":
clr = 0x3498db
elif colour == "dark_blue":
... |
# 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 isCousins(self, root: TreeNode, x: int, y: int) -> bool:
# store (parent, depth) tuple
res = ... |
# Programowanie I R
# Funkcja print()
# Dokumentacja:
# https://docs.python.org/3/library/functions.html#print
# Wartościowe informacje:
# https://realpython.com/python-print/
# Wypisanie pustej linii
print()
# Wypisanie łańcucha znaków
print("Dubito ergo sum.")
message = "Dubito ergo sum."
print(message)
# Wszel... |
"""Metadata and other parsers.
"""
class Parser:
def __init__(self):
pass
|
line = [int(i) for i in input().split()]
ans = True
for a in range(line[0]):
cur = input().split()
for b in cur:
if(b!='B' and b!='W' and b!='G'):
ans=False
if(ans):
print("#Black&White")
else:
print("#Color")
|
nome = str(input('Digite seu nome completo: '))
print('Muito prazer em te conhecer!')
partido = nome.split()
pnome = partido[0]
print('Seu primeiro nome é {}'.format(pnome))
npartes = len(partido)
unome = partido[npartes - 1]
print('Seu último nome é {}.'.format(unome))
|
def no_match(num):
mid_index = int(len(num) / 2)
left_side = num[:mid_index]
right_side = num[mid_index:]
item_to_append = f"-{moves}a"
left_side += [item_to_append] * 2
print("Invalid input! Adding additional elements to the board")
return left_side + right_side
def match(num):
print(... |
ODESK_REDIRECT_SESSION_KEY = '_odesk_redirect_url'
ODESK_TOKEN_SESSION_KEY = '_odesk_api_token'
ENCRYPTION_KEY_NAME = 'oekey'
|
class Solution:
def connectTwoGroups(self, cost: List[List[int]]) -> int:
g1Size, g2Size = len(cost), len(cost[0])
g2Mins = [min(cost[i][j] for i in range(g1Size)) for j in range(g2Size)]
@lru_cache(None)
def dfs(g1Index, group2):
sumCost = 0 if g1Index >= g1Size else flo... |
expected_output = {
"active": {
"boot_variable": "disk0:s72033-adventerprisek9-mz.122-33.SRE0a-ssr-nxos-76k-1,12;",
"configuration_register": "0x2012",
},
"next_reload_boot_variable": "disk0:s72033-adventerprisek9-mz.122-33.SRE0a-ssr-nxos-76k-1,12;",
}
|
# TODO Wrap coffeescad command line to build it
def build_with_coffeescad(state):
pass
|
A, B = map(int, input().split())
unused_socket = 1
plug_num = 0
while True:
if unused_socket >= B: break
unused_socket += A - 1
plug_num += 1
print(plug_num) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.