content stringlengths 7 1.05M |
|---|
# encoding: utf-8
# module cv2.ogl
# from /home/davtoh/anaconda3/envs/rrtools/lib/python3.5/site-packages/cv2.cpython-35m-x86_64-linux-gnu.so
# by generator 1.144
# no doc
# no imports
# Variables with simple values
BUFFER_ARRAY_BUFFER = 34962
Buffer_ARRAY_BUFFER = 34962
Buffer_ELEMENT_ARRAY_BUFFER = 34963
BUFFER_... |
# 2. Data of XYZ company is stored in sorted list. Write a program for searching specific data from that list.
# Hint: Use if/elif to deal with conditions.
string = input("Enter list of items (comma seperated)>>> ")
find_ele = input("Enter the elements which needs to find>>> ")
list_eles = str(string).split(",")
if ... |
class Iterator:
def set_client_response(self, client_response: dict):
self.client_response = client_response
return self
def count(self):
return len(self.client_response['Environments'])
|
#Desenvolver um algoritmo que leia o preço base de um determinado produto e
#calcule o seu preço de venda ao público (ou seja, preço base acrescido da taxa de
#IVA a 23%).
#Altere o algoritmo anterior para que o valor da taxa de IVA seja também um valor
#fornecido pelo utilizador.
def IVA():
try:
i... |
class Solution:
def canTransform(self, start: str, end: str) -> bool:
n = len(start)
L = R = 0
for i in range(n):
s, e = start[i], end[i]
if s == 'R':
if L != 0:
return False
else:
R += 1
... |
values = [int(i) for i in open('input','r').readline().split(",")]
data = [0,1,2,3,4,5,6,7,8,9]
steps = 256
for i in range(10):
data[i] = values.count(i)
for i in range(steps):
item = data.pop(0)
data[6] += item
data[8] = item
data.append(0)
print(sum(data))
|
# Null Object Sentinel
class NullObject:
def __repr__(self):
return '< Null object >'
|
############################################################################
# Copyright (C) 2008 - 2015 Bosch Sensortec GmbH
#
# File : bmp180.h
#
# Date : 20150327
#
# Revision : 2.2.2
#
# Usage: Sensor Driver for BMP180 sensor
#
############################################################################
#file bmp... |
class Solution:
def diagonalSort(self, mat: List[List[int]]) -> List[List[int]]:
m, n = len(mat), len(mat[0])
q = [[] for i in range(m + n)]
for i in range(m):
for j in range(n):
q[i - j + n].append(mat[i][j])
q = list(map(lambda x: sorted(x, reverse=True)... |
class OpcodeError(Exception):
'''
opcodeが指定されたものではありません
'''
pass
class TooLongMessageError(Exception):
'''
メッセージは125バイト以下です
'''
pass
class FirstFrameBitError(Exception):
'''
fin,rsv1,2,3の数値が0,1ではありません
'''
pass
class UnavailableToSendError(Exception):
'''
データが送信できなかった。
'''
pass
class UnavailableToSen... |
print('===== DESAFIO 079 =====')
lista = []
while True:
i = int(input('digite um numero: '))
if i not in lista:
lista.append(i)
print('valor adicionado com sucesso')
else:
print('valor duplicado, não vou adicionar')
f = str(input('vc deseja continuar: [S/N] '))
if f in 'Nn'... |
#
# PySNMP MIB module ATTO-PRODUCTS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ATTO-PRODUCTS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:31:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
def cCollateralBugHandler_fbPoisonRegister(
oSelf,
oProcess,
oThread,
sInstruction,
duPoisonedRegisterValue_by_sbName,
u0PointerSizedOriginalValue,
sbRegisterName,
uSizeInBits,
):
uPoisonValue = oSelf.fuGetPoisonedValue(
oProcess = oProcess,
oWindowsAPIThread = oProcess.foGetWindowsAPIThreadFo... |
#!/usr/local/bin/python
#-*- coding: utf-8 -*-
__author__ = "Miracle Wong"
class Fibonacci(object):
"""返回一个Fibonacci数列"""
def __init__(self):
self.fList = [0,1] #设置初始数列
self.main()
def main(self):
listLen = raw_input('请输入Fibonacci数列的长度(3-50):')
self.checkLen(listLen)
... |
class Settings():
def __init__(self, screenSize):
# Configurações da tela
self.screen_width = screenSize[0]
self.screen_height = screenSize[1]
self.bg_color = (100, 100, 100)
# Configurações do retangulo
self.rect_color = (150, 150, 150)
self.rect_width = 3... |
''' Challenge
Suppose the following input is supplied to the program:
without,hello,bag,world
Then, the output should be:
bag,hello,without,world
'''
items = [x for x in input('Enter words separated with comma: ').split(',')]
items.sort()
print(','.join(items))
|
"""
Space : O(n)
Time : O(n)
"""
class Solution:
def fib(self, n: int) -> int:
mem = [0, 1]
if n <= 1:
return mem[n]
for i in range(2, n+1):
mem.append(mem[i-1] + mem[i-2])
return mem[-1]
|
def left_join(phrases):
if(len(phrases) < 1 or len(phrases) > 41):
return "Error"
mytext = ','.join(phrases);
mytext = mytext.replace("right", "left");
return mytext
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
a... |
class ONE(object):
symbol = 'I'
value = 1
class FIVE(object):
symbol = 'V'
value = 5
class TEN(object):
symbol = 'X'
value = 10
class FIFTY(object):
symbol = 'L'
value = 50
class HUNDRED(object):
symbol = 'C'
value = 100
class FOUR(object):
symbol = ONE.symbol + FIVE.sym... |
def inf_cad_cliente():
nome = input('Digite o nome do cliente: ')
sobrenome = input('Digite o sobrenome do cliente: ')
cpf = input('Digite o cpf: ')
idade = int(input('Digite a idade: '))
dic_cliente = {'nome':nome,'sobrenome':sobrenome,'cpf':cpf, 'idade':idade}
print('''########################... |
# python3
def naive_fibonacci_partial_sum(m: int, n: int) -> int:
total = 0
previous, current = 0, 1
for i in range(n + 1):
if i >= m:
total += previous
previous, current = current, previous + current
return total % 10
def fast_fibonacci_huge(n: int, m: int) -> int:
p... |
class atom_type:
"""
Class that describes the atomtype representation in the GROMACS topology file
Args:
----
line(str): A string which is the line in the GROMACS topology file that holds information about an atom
"""
def __init__(self,line):
# name at.num mass charge ptype sigma... |
def longest_palindrome(s: str) -> str:
def expand(left: int, right: int) -> str:
while left >= 0 and right < len(s) and s[left] == s[right]:
left -= 1
right += 1
return s[left + 1:right]
if len(s) < 2 or s == s[::-1]:
return s
result = ''
for i in rang... |
#!/bin/python
# Specified for different system
partition = "engi"
totres = 2616
# Do a batch for every 5 residues as 'residue I'
# for 'residue J': loop it through the whole I+1 to the end of tetramer
#for i in range(int(totres/5)):
# beg = i*5 + 1
# end = (i+1)*5
# print(f"sbatch --export=batchid={i+1},batc... |
"""Alunos
Escreva um programa que lê duas notas de vários alunos e armazena tais
notas em um dicionário, onde a chave é o nome do aluno. A entrada de
dados deve terminar quando for lida uma string vazia como nome.
De seguida o programa deverá perguntar um nome ao utilizador e imprimir
as notas e a média do aluno.
"""
... |
class Solution:
def fourSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
size = len(nums)
if size < 4:
return []
nums.sort()
ret = []
nums_set = set()
for i in range(si... |
"""
Check if a triangle of positive area is possible with the given angles
Given three angles. The task is to check if it is possible to have a triangle of positive area with these angles. If it is possible print “YES” else print “NO”.
Examples:
Input : ang1 = 50, ang2 = 60, ang3 = 70
Output : YES
Input : ang1 =... |
# ------------------------------
# 310. Minimum Height Trees
#
# Description:
# For an undirected graph with tree characteristics, we can choose any node as the root. The result graph is
# then a rooted tree. Among all possible rooted trees, those with minimum height are called minimum height trees
# (MHTs). Given s... |
#
# PySNMP MIB module ASCEND-MIBREDHM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBREDHM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:12:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
"""Role testing files using testinfra."""
def test_service(host):
"""assert service enabled and started"""
squid = host.service('squid')
assert squid.is_enabled
assert squid.is_running
def test_port(host):
"""assert port is listening"""
assert host.socket('tcp://0.0.0.0:3128').is_listening
|
def get_id_from_urn(urn):
"""
Return the ID of a given Linkedin URN.
Example: urn:li:fs_miniProfile:<id>
"""
return urn.split(":")[3]
|
work = True
while(work):
t = 2
t = t+1
work = False
print(t) |
class Solution(object):
def countNumbersWithUniqueDigits(self, n):
return self.fn(n)
def fn(self,n):
if n==0:
return 1
if n==1:
return 10
if n>10:
return 0
f = 9
i = 1
while i<n and i<=10:
f *= 10-i
... |
def file_to_id(outfile: str) -> str:
fn = outfile.split('.')[0]
assert(fn.startswith('blk'))
return fn[3:]
def id_int_to_outfile(fid_int: int, fid_len: int) -> str:
fid_s = str(fid_int)
prefix = (fid_len - len(fid_s)) * '0'
return f'blk{prefix+fid_s}.out'
def id_int_to_chunk_id(cid_int: int) -> ... |
# problem statement: Given an array, find the total number of inversions of it. If (i < j) and (A[i] > A[j]), then pair (i, j) is called an inversion of an array A. We need to count all such pairs in the array.
# Function to find inversion count of a given list
def findInversionCount(A):
inversionCount = 0
f... |
#
# PySNMP MIB module BLUECOAT-SG-PROXY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BLUECOAT-SG-PROXY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:22:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
a = (42, 1)
print(f"First value of a: {a[0]}.")
# Set first value of a to 23:
a[0] = 23
print(f"First value of a: {a[0]}.")
|
INSTAGRAM_FEED = """
[
{
"comments": 2,
"likes": 1,
"id": "363839373298",
"created": "2010-07-17 01:29:43",
"caption": "",
"type": "video",
"tags": [
],
"user": {
"username": "kevin",
"full_name": "Kevin S",
... |
# coding=utf-8
class RpcRequest(object):
def __init__(self, method, params):
self._method = method
self._params = params
@property
def method(self):
return self._method
@property
def params(self):
return self._params
@property
def to_json(self):
r... |
# original data
data = "75\n\
95 64\n\
17 47 82\n\
18 35 87 10\n\
20 04 82 47 65\n\
19 01 23 75 03 34\n\
88 02 77 73 07 63 67\n\
99 65 04 28 06 16 70 92\n\
41 41 26 56 83 40 80 70 33\n\
41 48 72 33 47 32 37 16 94 29\n\
53 71 44 65 25 43 91 52 97 51 14\n\
70 11 33 28 77 73 17 78 39 68 17 57\n\
91 71 52 38 17 14 91 43 58... |
def encontra_impares(lista):
if len(lista) == 0:
return lista
if lista[0] % 2 == 0:
return encontra_impares(lista[1:])
return [lista[0]] + encontra_impares(lista[1:])
|
# Kth smallest element
# Input:
# N = 6
# arr[] = 7 10 4 3 20 15
# K = 3
# Output : 7
# Explanation :
# 3rd smallest element in the given
# array is 7.
k = int(input())
arr = list(map(int,input().split()))
arr.sort()
print("\n")
print("{k}th min element is : ",arr[k-1])
print("{k}th max element is : ",arr[-k])
|
#Class for scrapers table
class Scrapers:
def __init__(self, cursor):
self.cursor = cursor
#read from db
#read all scaping jobs by progress
def getScrapingJobsByProgress(cursor, progress):
sql= "SELECT * from scrapers WHERE scrapers_progress=%s ORDER BY RANDOM()"
data = (progress)
... |
"""
@name: PyHouse_Install/src/Update/update_pyhouse.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2015-2016 by D. Brian Kimmel
@license: MIT License
@note: Created on Oct 20, 2015
@Summary:
"""
__updated__ = '2016-08-26'
# Import system type stuff
# Import PyHouse... |
#
# PySNMP MIB module TIMETRA-IF-GROUP-HANDLER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-IF-GROUP-HANDLER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:17:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... |
async def create_table(database):
conn = await database.get_connection()
await conn.execute(
"""
CREATE TABLE IF NOT EXISTS users(
id serial PRIMARY KEY,
name text,
dob date
)
"""
)
await conn.close()
return True
async def drop_ta... |
class JobResult():
def __init__(self, job, build_number, status):
self.job = job
self.build_number = int(build_number)
self.status = status
def __repr__(self):
return "job: %s, build number: %s, status: %s" % (self.job, self.build_number, self.status)
|
# Please refer to sanitizers.gni for detail.
load("@cc//:compiler.bzl", "is_linux", "is_x64")
load("//third_party/chromium/build/config:buildconfig.bzl", "IS_OFFICIAL_BUILD")
IS_HWASAN = False
IS_CFI = is_linux() and is_x64()
USE_CFI_CAST = False
USE_CFI_ICALL = is_linux() and is_x64() and IS_OFFICIAL_BUILD
USE_CFI_... |
#3,用户任意输入他的生日,判断他输入00后,90后,还是80后
data = input("请输入你的生日:")
year = int(data[0:4])
if year >= 2000 :
print("你是00后阿!")
elif 1990 <= year < 2000:
print("你是90后阿!")
elif 1980 <= year < 1990:
print("你是80后阿!")
else:
print("你啥都不是!")
|
class Character:
def __init__(self, health, power):
self.health=health
self.power=power
class Hero(Character):
def __init__(self):
super(Hero, self).__init__(10,5)
class Goblin(Character):
def __init__(self):
super(Goblin, self).__init__(6,2) |
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation
# {"feature": "Coupon", "instances": 8148, "metric_value": 0.4751, "depth": 1}
if obj[0]>1:
# {"feature": "Education", "instances": 5867, "metric_value": 0.4695, "depth": 2}
if obj[1]>0:
# {"feature": "Occupation", "instances": 3831,... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 01:14:44 2020
@author: Dilay Ercelik
"""
# Practice
# You are driving a little too fast, and a police officer stops you.
# Write code to compute the result, encoded as an int value: 0=no ticket, 1=small ticket, 2=big ticket.
# If speed is 60 or less, t... |
class Progress:
prg = '|/-\\'
prg_len = len(prg)
def __init__(self, total=0):
self.i = 0
self.total = total
self.val = ''
self.update = self._progress if total else self._spin
def _spin(self):
self.i %= self.prg_len
self.val = self.prg[self.i]
def _... |
#!/usr/bin/env python3
class Code:
"""
The Code class contains static attributes of the (Comp)utation, (Dest)ination, and Jump codes of the Hack language.
More can be found under 'assets/'.
"""
# Static class attributes
_jump_codes = ["null", "JGT", "JEQ", "JGE", "JLT", "JNE", "JLE", "JMP"]
... |
n = int(input())
def encontrarCamino(viajes,temp,camino,CaminoActual,llaves):
if temp == "C-137" and CaminoActual!=0:
camino.append(CaminoActual)
return camino
else:
if temp in llaves:
for i in viajes[temp]:
caminos=encontrarCamino(viajes,i,camino,CaminoActua... |
#Find a Motif in DNA:
string = "AACTATGCAACTATGAAACTATGAACTATGATTCCAACTATGTAACTATGATGCATTAAACTATGAAACTATGAACTATGAACTATGAACTATGAAACTATGCGGAACTATGAACTATGGGGACAACTATGGAACTATGAGAACTATGTCAATTAACTATGCGTAACTATGGTCGAAACTATGAACTATGGAACTATGGCAACTATGCAAACTATGAAACTATGTAACTATGTGAAGGACGCACTAACTATGAGAAACTATGAACTATGAACTATGAACTATGCACG... |
def single_number(numbers):
single = 0
for number in numbers:
single ^= number
return single
if __name__ == "__main__":
numbers = [3, 4, 2, 1, 3, 1, 4]
assert single_number(numbers) == 2
numbers = input("Enter list of repeated numbers: ")
numbers = map(int, numbers.split())
p... |
# Name - Thilakarathna W M D U
# Email - dtdinidu7@gmail.com
# Date - 08/04/2020
tm = int(input()) # number of test cases
for t in range(1, tm+1):
lis = [int(i) for i in list(input())] # taking the input as list
strg = '('*lis[0] + str(lis[0]) # final string to be displayed
prev = lis[0] ... |
#!/usr/bin/env python3
class TokenBase():
""" Base class of all tokens """
def get_possible_words(self) -> list:
""" Gets all possible words that can be made out of this token """
raise NotImplemented
|
# Sample untracked-keys file
# If you get errors trying to 'import apikeys', do the following:
# 1) Copy this file to apikeys.py (keeping it in the package directory)
# 2) Replace all of the example values with real ones
# 3) Generate your own cookie key, possibly using urandom as per below
# You should then be able to... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def subtreeWithAllDeepest(self, root: TreeNode) -> TreeNode:
depths = [collections.defaultdict(list) for _ in range(500)]
... |
"""
реализация Объектов типа Tree
"""
class TreeObject:
pass |
#
# PySNMP MIB module S5-CHASSIS-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/S5-CHASSIS-TRAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:59:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
class Ssl(object):
FIELD_MAP = {
"domain": "domain",
"expires": "expires",
"issuer": "issuer",
"org": "org",
"subject": "subject",
"valid": "valid",
"version": "version"
}
def __init__(self):
self.domain = ""
self.expires = ""
... |
cuenta = []
for i in range(0,20):
cuenta.append(i+1)
print("Primeros 3 elementos en la lista")
print(cuenta[slice(3)])
print()
print("3 elementos del medio")
print(cuenta[slice(7,10)])
print()
print("ultimos 3 elementos de la lista")
print(cuenta[slice(len(cuenta)-3,len(cuenta))]) |
# -*- coding: utf-8 -*-
inputCoordInicialFinalFazenda = list(map(int, input().split()))
countTest = 1
while sum(inputCoordInicialFinalFazenda) != 0:
qntOcorrenciaMeteoro = int(input())
qntOcorrenciaMeteoroDentroFazenda = 0
tamanhoFazendaCoordX = abs(inputCoordInicialFinalFazenda[0] - inputCoordInicialFin... |
def binary_search(items, target):
"""O(log n)."""
low = 0
high = len(items) - 1
while low <= high:
mid = (low + high) // 2
if items[mid] == target:
return mid
elif items[mid] < target:
low = mid + 1
elif items[mid] > target:
high = mi... |
endPoints={
"register" : "/register",
"checkKyc" : "/check_kyc",
"checkHandle" : "/check_handle",
"requestKyc" : "/request_kyc",
"issueSila" : "/issue_sila",
"redeemSila" : "/redeem_sila",
"transferSila" : "/transfer_sil... |
id_to_channel = {}
# Official Studio Channels
id_to_channel['UC2-BeLxzUBSs0uSrmzWhJuQ'] = "20th Century Fox"
id_to_channel['UCor9rW6PgxSQ9vUPWQdnaYQ'] = "FoxSearchlight"
id_to_channel['UCz97F7dMxBNOfGYu3rx8aCw'] = "Sony Pictues"
id_to_channel['UCFqyJFbsV-uEcosvNhg0PaQ'] = "Sony Pictures India"
id_to_channel['UCjmJD... |
N=int(input())
v=[*map(int,input().split())]
ba=ba2=-1
last=-1
dec_start=False
for n,i in enumerate(v):
if i>=last:
if i>last:
if not dec_start:
ba=n
else:
ba2=n-1
break
else:
dec_start=True
last=i
if not dec_start:
... |
class ModelManager:
models = [
{
'modelPath': 'core/models/mobilenet_ssd_v1_coco/frozen_inference_graph.pb',
'configPath': 'core/models/mobilenet_ssd_v1_coco/ssd_mobilenet_v1_coco_2017_11_17.pbtxt',
'classNames': {
0: 'background', 1: 'person', 2: 'bicy... |
# Space: O(n)
# Time: O(n)
# Solution without collections library
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution():
def zigzagLevelOrder(self,... |
# adds a and b
def addNumbers(a, b):
return a+b
# subtracts a and b
def subNumbers(a, b):
return a-b |
#!/usr/bin/python
"""
Amicable numbers
https://projecteuler.net/problem=21
"""
def d(n):
q = []
for i in range(1, n / 2 + 1, 1):
if n % i == 0:
q.append(i)
return sum(q)
def main():
w = []
for i in range(1, 10000, 1):
if i == d(d(i)) and i != d(i):
print(i... |
# Evaluation function
CAPACITY_SCALAR = 0.25
TARGET_SCORE = 1e4
# Bed update generation
TIMESTEP = 50
UPDATE_CASES = ["normal_to_corona", "corona_leaves_hosp"]
BED_UPDATE_PROB = 10
# Hospitals initialization
NUMBER_FREE_BEDS = 25
NUMBER_CORONA_BEDS = 5
NUMBER_FREE_CORONA_BEDS = 3
NUMBER_CORONA_PAT_IN_NORMAL_BED =... |
class HttpResponseException(Exception):
def __init__(self, http_response):
super(HttpResponseException, self).__init__(http_response)
self.http_response = http_response
|
User_Name=input('What is your name? ')
User_Age=input('How old are you? ')
User_Home=input('Where do you live? ')
print('Hello, ',User_Name)
print('Your age is ',User_Age)
print('You live in ',User_Home) |
#Valor na faixa
numero = int(input('Digite um número: '))
if numero in range(1, 10):
print("O valor está na faixa permitida!")
else:
print("O valor informado está fora da faixa!") |
def funA(fn):
print('A')
fn()
return "success"
@funA
def funB():
print('B')
print(funB)
a = funB
print(a)
class Category:
cake=lambda p: print(p)
c=Category()
c.cake() |
#!/usr/bin/env python
#pylint: skip-file
# This source code is licensed under the Apache license found in the
# LICENSE file in the root directory of this project.
class CertificateInfo(object):
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and the ... |
'''
Faça um pprograma que leia 5 valoes numericos e guarde-os em uma lista. No final, mostre
qual foi o maior e o menor valor difitado e as suas respectrivas posiçoes na lista
'''
lista = []
for i in range(5):
lista.append(int(input("Diga um valor")))
if i == 0:
maior = menor = lista[i]
else:
... |
expected_output = {
'topo_id': {
'0': {
'topo_name': {
'EVPN-Multicast-BTV': {
'topo_type': 'L2VRF'}}},
'4294967294': {
'topo_name': {
'GLOBAL': {
'topo_type': 'N/A'}}},
'4294967295': {
... |
num1 = int(input("Enter the first number"))
num2 = int(input("Enter second number"))
op = input("Enter operator")
if op == " + ":
print(num1+num2)
elif op == "-":
print("The subraction is", num1-num2)
elif op == "*":
print("The multiplication is ",num1*num2)
elif op == "/":
print("The divisi... |
def add_common_params(parser):
parser.add_argument(
'--batch-size',
type=int,
default=64,
help='input batch size for training (default: 64)')
parser.add_argument(
'--test-batch-size',
type=int,
default=1000,
help='input batch size for testing ... |
def div(a, b):
if b==0:
return "error"
else:
return a/b
def add(a,b):
return a+b
|
class Fibonacci:
def __init__(self):
self.memo = dict()
self.memo[1] = 1
self.memo[2] = 1
def __call__(self, N):
if N <= 0 or type(N) != int:
raise ValueError('Invalid argument: %s' % str(N) )
if N in self.memo:
return self.memo[N]
els... |
o = input()
e = input()
ans = ''
for i in range(min(len(o), len(e))):
ans += o[i]
ans += e[i]
if len(o) > len(e):
ans += o[len(o) - 1]
if len(o) < len(e):
ans += o[len(e) - 1]
print(ans)
|
# FOR LOOP
print('This program prints all the even number upto n')
n=int(input('Enter the value of n '))
for i in range(0,n):
if(not i%2):
print(i) |
# Topics
topics = {
# Letter A
"Amor post mortem" : ["Amor más allá de la muerte.", "Carácter eterno del amor, sentimiento que perdura después de la muerte física."]
, "Amor bonus" : ["Amor bueno.", "Carácter positivo del amor espiritual."]
, "Amor ferus" : ["Amor salvaje.", "Carácter negativo del amor físico, de la... |
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "org_joda_joda_convert",
artifact = "org.joda:joda-convert:2.1.1",
artifact_sha256 = "9b5ec53c4974be36fdf97ba026f3cec4106b8109bb9b484883c8d81c433991fb",
srcjar... |
sample_rate = 32000
window_size = 1024
hop_size = 500 # So that there are 64 frames per second
mel_bins = 64
fmin = 50 # Hz
fmax = 14000 # Hz
frames_per_second = sample_rate // hop_size
logmel_eps = -100 # This value indicates silence used for padding
labels = ['Accelerating_and_revving_and_vroom', 'A... |
def get_customized_mapping(cls):
mapping = {
"fda_orphan_drug": {
"properties": {
"designated_date": {
"type": "date"
},
"designation_status": {
"normalizer": "keyword_lowercase_normalizer",
... |
#! python3
def mapear(funcao, lista):
return (funcao(elemento) for elemento in lista)
if __name__ =='__main__':
print(list(mapear(lambda x: x ** 2, [2, 3, 4]))) |
class Hand:
def __init__(self, cards):
self.__cards = cards
self.__total = self.sum_cards(cards)
def __str__(self):
string = 'total: ' + str(self.total()) + ' '
for card in self.cards():
string += str(card)
string += ' '
return string
def add_card(self, card):
self.__cards.... |
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/17/A
def f(l):
n,k = l
pl = [True]*(n+1) # TRUE=prime or not?
for i in range(2):
pl[i] = False
ll = n+1
i = 2
while i<ll:
if pl[i]: #only for prime
j = (i<<1)
while j<... |
"""Global shared constants for dart rules."""
dart_filetypes = [".dart"]
api_summary_extension = "api.ds"
analysis_extension = "analysis"
codegen_outline_extension = "outline"
WEB_PLATFORM = "web"
VM_PLATFORM = "vm"
FLUTTER_PLATFORM = "flutter"
ALL_PLATFORMS = [WEB_PLATFORM, VM_PLATFORM, FLUTTER_PLATFORM]
|
# Первая строка входа содержит число операций 1≤n≤105.
# Каждая из последующих n строк задают операцию одного из следующих двух типов:
#
# Insert x, где 0≤x≤109 — целое число;
# ExtractMax.
#
# Первая операция добавляет число x в очередь с приоритетами,
# Вторая — извлекает максимальное число и выводит его.
# Sample In... |
def luck_check(s):
if len(s) % 2 == 1:
s = s[:len(s)//2] + s[len(s)//2 + 1:]
return (sum(int(i) for i in s[:len(s)//2]) == sum(int(i)
for i in s[len(s)//2:]))
|
# This is the solution to the problem if the lines would "partition"
# the containers, as physics works in real life.
# This particular problem doesn't care about partitioning the water, though.
HEIGHT = 0
INDEX = 1
BOUNDING_HEIGHT = 2
class Solution:
'''
Given n non-negative integers a1, a2, ..., an, where ea... |
def open_door():
# TODO: This needs to be in the stdlib.
Driftwood.area.tilemap.layers[2].tile(4, 0).nowalk = None
Driftwood.area.tilemap.layers[2].tile(4, 0).setgid(27)
def open_door2():
Driftwood.area.tilemap.layers[2].tile(2, 0).nowalk = None
Driftwood.area.tilemap.layers[2].tile(2, 0).setgid(2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.