content stringlengths 7 1.05M |
|---|
# We can easily adjust the code from the most common character
# to the most common word by splitting the paragraph into a
# list of words instead of characters:
myParagraph = "In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescrib... |
# All endpoint constants for the User resource
USER_ADD_DEVICE_TOKEN = "/push/{token_type}"
USER_BAN_FROM_CHANNELS_WITH_CUSTOM_TYPES = "/banned_channel_custom_types"
USER_BLOCK = "/block"
USER_CHOOSE_PUSH_MESSAGE_TEMPLATE = "/push/template"
USER_LIST_BANNED_CHANNELS = "/ban"
USER_LIST_BLOCKED_USERS = "/block"
USER_LIST... |
def dict_equal(first, second):
"""
This is a utility function used in testing to determine if two dictionaries are, in a nested sense, equal (ie they have the same keys and values at all levels).
:param dict first: The first dictionary to compare.
:param dict second: The second dictionary to compare.
... |
def aumentar(n, taxa=0):
res = n + (n * taxa / 100)
return res # moeda(res)
# return res
def diminuir(n=0, taxa=0):
res = n - (n * taxa / 100)
return res # moeda(res)
def dobro(n=0):
res = n * 2
return res # moeda(res)
def metade(n):
res = n / 2
return res # moeda(res)
de... |
class Solution(object):
def sortedSquares(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
left, right = 0, len(A) - 1
result = []
while left <= right:
leftSqr = A[left] * A[left]
rightSqr = A[right] * A[right]
if left... |
class MyMath:
def __init__(self):
self.answer = 0
def Add(self, first_number, second_number):
self.answer = first_number + second_number
def Subtract(self, first_number, second_number):
self.answer = first_number - second_number
def __str__(self):
return str(se... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License,... |
rules = {
"username": {
"presence": True,
"unique_user": True,
"not_google_username": True,
"name": "usuario"
},
"last_name": {"presence": True, "name": "apellido"},
"first_name": {"presence": True, "name": "nombre"},
"email": {"presence": True, "email": True, "unique... |
"""Python replacement for overlapSelect.
For a chain and a set of genes returns:
gene: how many bases this chain overlap in exons.
"""
__author__ = "Bogdan Kirilenko, 2020."
__version__ = "1.0"
__email__ = "kirilenk@mpi-cbg.de"
__credits__ = ["Michael Hiller", "Virag Sharma", "David Jebb"]
def make_bed_ranges(bed_... |
COLUMN_VARIABLES = ['M_t', 'H_t', 'W_t']
RAW_DATA_DIRECTORY = './sample_data'
TRAIN_TEST_SPLIT_VALS = {'test_1':'2017-08-06', 'test_2':'2017-01-15',
'test_3':'2017-05-14', 'test_4':'2016-10-16'}
|
# URI Online Judge 2762
entrada = input().split('.')
saida = str(int(entrada[1])) + '.' + entrada[0]
print(saida) |
dinero=2000
preciodelhelado=100
incrementodelpreciodelhelado=1.20
edad=19
hambrequesatisfaceelhelado=edad
hambresatisfecho=edad
n=0
while (hambresatisfecho<85 and dinero>0):
dinero=dinero-(preciodelhelado)
hambresatisfecho=hambresatisfecho+hambrequesatisfaceelhelado
preciodelhelado=preciodelhelado*increment... |
class DisabledFormMixin():
def __init__(self):
for (_, field) in self.fields.items():
field.widget.attrs['disabled'] = True
field.widget.attrs['readonly'] = True
|
{
"targets": [
{
"target_name": "greet",
"cflags!": ["-fno-exceptions"],
"cflags_cc!": ["-fno-exceptions"],
"sources": [
"./src/cpp/greeting.cpp",
"./src/cpp/count.cpp",
"./src/cpp/custom_object.cpp",
"./src/cpp/index.cpp"
],
"include_dirs": [
... |
def get_register_info(registers, register_name):
return registers[register_name].bit_offset
def get_register_location_in_frame_data(registers, register_name, start_word_index=0):
bit_offset = get_register_info(registers, register_name)
word_index = (bit_offset >> 5) - start_word_index
bit_index = bit_offset % ... |
files = [
"midi.vhdl", "midi.ucf", "clock_divider.vhdl", "shift_out.vhdl",
]
|
#
# PySNMP MIB module ENDRUNTECHNOLOGIES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENDRUNTECHNOLOGIES-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:02:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
def max_pairwise_product(numbers):
n = len(numbers)
max_product = 0
for first in range(n):
for second in range(first + 1, n):
max_product = max(max_product,
numbers[first] * numbers[second])
return max_product
def max_pairwise_product_Fast(numbers):
n = len(numb... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage provides tools for reading and writing CRTF (CASA Region
Text Format) region files.
"""
|
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... |
## Find the prime numbers from 1 - 20
primeCheck = 0
for index in range(2,21):
# print("index values are",index)
for num in range(2,index):
# print("----> num is ",num)
if index%num == 0:
primeCheck = 0
print("Number ",index," not a prime")
break
else... |
class _AVLNode():
_BALANCE_FACTOR_LIMIT = 2;
def __init__(self, value):
self.value = value
self.left = None
self.right = None
self.size = 1
self._height = 0
self._balance_factor = 0
def search(self, key):
if key == self.value:
return self... |
#
# lithospheres
#
# =============================================================================
lith200 = {
"numlayers": 7,
"nature_layers": ['matUC','matMC','matLC','matLM1','matLM2','matLM3','matSLM'],
"thicknesses": [15e3,10e3,10e3,45e3,45e3,75e3,400e3],
"thermalBc": ['thermBcUC','thermBcMC','thermBcLC','therm... |
def solution(A):
refSum = len(A) + 1
curSum = 0
for i in range(0, len(A)):
refSum += i + 1
curSum += A[i]
return refSum - curSum
assert 1 == solution([])
assert 2 == solution([ 1 ])
assert 1 == solution([ 2 ])
assert 4 == solution([ 2, 3, 1, 5 ])
MaxArrSize = 100000 # by the task
str... |
class Punto2D():
def __init__(self, x, y) -> None:
self.x = x
self.y = y
def traslacion(self, a, b):
punto = [self.x + a, self.y + b]
print(punto)
|
# encoding: utf-8
SECRET_KEY='JACK_ZH' # session key
TITLE='zWiki' # wiki title
CONTENT_DIR="markdown" # wiki(blog) save file dir
USER_CONFIG_DIR="content" # ...
PRIVATE=False # logout edit del ... flag
SHOWPRIVATE=False # logout show flag
UPLOAD_DIR="./static... |
# class Tree:
# def __init__(self, val, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def solve(self, root):
ans = []
dfs = [[root,0]]
while dfs:
cur,i = dfs.pop()
if i >= len(ans): ans.... |
dataset_type = 'UnconditionalImageDataset'
train_pipeline = [
dict(
type='LoadImageFromFile',
key='real_img',
io_backend='disk',
),
dict(type='Resize', keys=['real_img'], scale=(512, 384)),
dict(
type='NumpyPad',
keys=['real_img'],
padding=((64, 64), (0, ... |
__all__ = ['FirankaError', 'NotInDomainError', 'DomainError']
class FirankaError(Exception):
"""
Base class for firanka's exceptions
"""
class DomainError(FirankaError, ValueError):
"""Has something to do with the domain :)"""
class NotInDomainError(DomainError):
"""
Requested index is bey... |
id_to_glfunc = {
160: "glAlphaFunc",
161: "GL_ALPHA_TEST",
162: "glBlendFunc",
163: "glBlendEquationSeparate",
164: "GL_BLEND",
165: "glCullFace",
166: "GL_CULL_FACE",
167: "glDepthFunc",
168: "glDepthMask",
169: "GL_DEPTH_TEST",
172: "glColorMask"
}
glBool_options = {
... |
"""Guarde en lista `naturales` los primeros 100 números naturales (desde el 1)
usando el bucle while
"""
i = 1
naturales = list()
while i <= 100:
naturales.append(i)
i = i+1
"""Guarde en `acumulado` una lista con el siguiente patrón:
['1','1 2','1 2 3','1 2 3 4','1 2 3 4 5',...,'...47 48 49 50']
Hasta el número... |
class Page:
def __init__(browser, fix, driver):
browser.fix = fix
browser.driver = driver
def find_element(browser, *locator):
return browser.fix.driver.find_element(*locator)
def find_elements(browser, *locator):
return browser.fix.driver.find_elements(*locator)
def ... |
'''
module for implementation
of Z algorithm for
pattern matching
'''
def z_arr(string: str, z: list):
'''
fills z array for given
string
'''
len_str = len(string)
l, r, k = 0, 0, 0
for i in range (1, len_str):
if (i > r):
l, r = i, i
while (r < len_str... |
class Solution:
def largestTimeFromDigits(self, A):
"""
:type A: List[int]
:rtype: str
"""
maxtime = ""
for i in range(4):
for j in range(4):
for k in range(4):
if i == j or i == k or k == j:
con... |
def isIn(char, aStr):
'''
char: a single character
aStr: an alphabetized string
returns: True if char is in aStr; False otherwise
'''
# Your code here
midIndex = round(len(aStr)/2)
if len(aStr) == 0 or len(aStr) == 1 and char != aStr[0]:
return False
# elif len(aStr) == 1 an... |
def tablero_a_cadena(tablero):
cadena = ""
for fila in tablero:
cadena += str(fila) + "\n"
return cadena
def obtener_nombre_pieza(simbolo):
"""
(str) -> str
>>> obtener_nombre_pieza('p')
'Peon blanco'
>>> obtener_nombre_pieza('R')
'Rey Negro'
Retorna el nombre de la p... |
INPUT = 314
pos = 0
l = [0]
for i in range(1,2018):
pos = (pos + INPUT) % len(l) + 1
l.insert(pos, i)
pos += 1
if pos == len(l):
pos = 0
print("Part 1", l[pos])
size = 1
pos = 0
val = 1
for i in range(1,50000001):
pos = (pos + INPUT) % size + 1
if pos == 1:
val = size
size += 1
print... |
counter = 0
def handler(event, context):
global counter
result = {"counter": counter}
counter += 1
return result
|
# Advent Of Code 2018, day 11, part 1
# http://adventofcode.com/2018/day/11
# solution by ByteCommander, 2018-12-11
with open("inputs/aoc2018_11.txt") as file:
serial = int(file.read())
def get_power(x_, y_):
rack_id = x_ + 10
power_lv = (rack_id * y_ + serial) * rack_id
return power_lv % 1000 // 100... |
class Contorno:
def __init__(self, x, altura):
self.x = x
self.altura = altura
def __str__(self):
return str([self.x, self.altura])
class Edificio:
def __init__(self, izquierda, altura, derecha):
self.izquierda = izquierda
self.altura = altura
self.derecha = derecha
def conquista(lista... |
#Famous Quote:
Famous_person = "M. S. Dhoni"
Quote = "Hardwork, dedication, persevrance, disipline, etc all is required. But what matters the most in life is HONESTY."
print(Famous_person+" once said, \"" + Quote + "\"")
|
EAST, NORTH, WEST, SOUTH = range(4)
def move(pos, dir):
x, y = pos
if dir == EAST:
return x + 1, y
if dir == WEST:
return x - 1, y
if dir == NORTH:
return x, y + 1
if dir == SOUTH:
return x, y - 1
def generate_spiral(n):
g = {}
x = 1
direction = EAST
... |
def insertionSort(listku):
for index in range(1,len(listku)):
current_element = listku[index]
i = index
while current_element < listku[i-1] and i > 0:
listku[i] = listku[i-1]
i = i-1
listku[i] = current_element
jumlah = int(input("Berapa banyak element yang ... |
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número: '))
n3 = int(input('Digite outro número: '))
print('')
if n1 > n2 and n1 > n3:
print('Maior: {}'.format(n1))
elif n2 > n1 and n2 > n3:
print('Maior: {}'.format(n2))
else:
print('Maior: {}'.format(n3))
if n1 < n2 and n1 < n3:
prin... |
"""Generic contsnts"""
# Byte order magic numbers
# ----------------------------------------
ORDER_MAGIC_LE = 0x1A2B3C4D
ORDER_MAGIC_BE = 0x4D3C2B1A
SIZE_NOTSET = 0xFFFFFFFFFFFFFFFF # 64bit "-1"
# Endianness constants
ENDIAN_NATIVE = 0 # '='
ENDIAN_LITTLE = 1 # '<'
ENDIAN_BIG = 2 # '>'
|
a = 2
b = 7
area = a * b
print(area)
c = 7
d = 8
area1 = c * d
print(area1)
e = 12
f = 5
area2 = e * f
print(area2)
side_g = int(input())
side_h = int(input())
print(side_g * side_h) |
#code
class Node:
def __init__(self,data):
self.data = data
self.next = None
self.prev = None
class DoublyLinkedList:
def __init__(self):
self.head = None
def Push(self,new_data):
temp = self.head
new_node = Node(new_data)
if self.head is None:
... |
class Model:
"""An object backed by a plain data structure.
For compatibility with JSON serialisation it's important that the inner
data structure not contain anything which cannot be serialised. This is
the responsibility of the implementer.
"""
# An optional schema to apply to the contents w... |
# -*- coding: utf-8 -*-
def test_add_contact(app, db, json_contacts, check_ui):
contact = json_contacts
old_contacts = db.get_contact_list()
app.contact.add_new(contact)
app.contact.check_add_new_success(db, contact, old_contacts, check_ui)
|
def get_greater(project_arr):
version0 = project_arr[0].split(',')[1].lower()
version1 = project_arr[1].split(',')[1].lower()
split_char = None
if '.' in version0:
split_char = '.'
elif '_' in version0:
split_char = '_'
if split_char == None:
if version0 < version1:... |
#Get states and coordinates and generates a csv file
lats = []
lons = []
states = []
lat = 0.0
lon = 0.0
infile = 'all_states.json'
with open(infile, 'r') as f:
for line in f:
if ('coordinates' in line):
lon = float(f.readline().strip().split(',')[0])
lat = float(f.readline().stri... |
# Allows us to read a espionage
def read_espionage(espionage, structures):
ans = {}
carefull = False
espionage = espionage.split('\n')
line = espionage[0].split(' ')
j = 4
while line[j][0] != '[':
j += 1
ans.update({'planet':' '.join(line[4:j])})
ans.update({'coordinate... |
# dataset settings
dataset_type = 'TianchiDataset' # 上一步中你定义的数据集的名字
data_root = 'data/tianchi_aug' # 数据集存储路径
iamge_scale_t = (768, 768)
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) # 数据集的均值和标准差,空引用默认的,也可以网上搜代码计算
crop_size = (512, 512) # 数据增强时裁剪的大小
train_pipeline... |
##########################
###### MINI-MAX ######
##########################
class MiniMax:
# print utility value of root node (assuming it is max)
# print names of all nodes visited during search
def __init__(self, root):
#self.game_tree = game_tree # GameTree
self.root = root # Game... |
# Creating a dictionary called 'birthdays' containing famous people's names as
# key and their birthday date as values.
birthdays = {
'Albert Einstein': '03/14/1879',
'Benjamin Franklin': '01/17/1706',
'Ada Lovelace': '12/10/1815',
'Donald Trump': '06/14/1946',
'Rowan Atkinson': '01/6/1955'}
... |
# See: https://docs.djangoproject.com/en/1.5/ref/settings/#authentication-backends
AUTH_USER_MODEL = 'auth.User'
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
)
|
# https://codeforces.com/problemset/problem/1519/B
t = int(input())
cases = [list(map(int, input().split())) for _ in range(t)]
for case in cases:
if (case[0]-1) + (case[0] * (case[1]-1)) == case[2]:
print('YES')
else:
print('NO') |
subt = ''
file = 'BookCorpus2'
groups = ['ArXiv', 'BookCorpus2', 'Books3', 'DM Mathematics', 'Enron Emails', 'EuroParl', 'FreeLaw', 'Github', 'Gutenberg (PG-19)', 'HackerNews', 'NIH ExPorter', 'OpenSubtitles', 'OpenWebText2', 'Pile-CC', 'PhilPapers', 'PubMed Central', 'PubMed Abstracts', 'StackExchange', 'Ubuntu IRC',... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( s , t ) :
count = 0
for i in range ( 0 , len ( t ) ) :
if ( count == len ( s ) ) :
brea... |
class No:
def __init__(self, valor):
self.valor = valor
self.proximo = None
self.anterior = None
def mostrar_no(self):
print(self.valor)
class FilaListaDuplamenteEncadeada:
def __init__(self):
self.primeiro = None
self.ultimo = None
def __fila_vazia(self):
return self.primeiro ... |
class SinglyLinkedList:
def __init__(self, single_link_node_factory, *args, **kwargs):
super().__init__(*args, **kwargs)
self._linked_node_factory = single_link_node_factory
self._header = self._linked_node_factory()
self._tail = None
def __iter__(self):
return iter(self... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def distribute_coins(self, root: TreeNode) -> int:
self.result = 0
self.post_order(root)
return self.result
def post_order(self, root) -> int:
if ... |
class Broker:
def purchase_shares():
raise NotImplementedError
def sell_shares():
raise NotImplementedError |
# https://leetcode.com/problems/delete-operation-for-two-strings/
class Solution:
def minDistance(self, word1: str, word2: str) -> int:
dp = [[0] * (len(word2) + 1) for _ in range(len(word1) + 1)]
for i in range(len(word1) + 1):
dp[i][0] = i
for i in range(len(word2) ... |
print("#===Welcome to DNA/mRNA/tRNA/Anino Acid (Protein) Sequence Converter===#")
start = input("Press Enter to continue...")
while True:
if start == "":
print("Check Available Options:")
print("1. DNA")
print("2. mRNA")
print("3. tRNA")
print("4. Amino Acid(Protein)"... |
# Recitation Lab 5 Question 1: Program to find smallest power of 2 greater than or equal to a number
# Author: Asmit De
# Date: 03/02/2017
# Input number
num = int(input('Enter a number: '))
# Initialize variable to the lowest power of 2
powervalue = 2
# Run loop until powervalue becomes greater than or eq... |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
Escribir un programa que solicite al usuario ingresar un número de
decimales y almacénelo en una variable. A continuación, el programa
debe solicitar al usuario que ingrese un número entero y guardarlo en
otra variable. En una tercera variable se deberá gua... |
tabela_brasileirao = ('Palmeiras', 'Bragantino', 'Atlético-PR', 'Atlético-MG', 'Fortaleza', 'Bahia', 'Santos',
'Atlético-GO', 'Ceará', 'Corinthians', 'Fluminense', 'Flamengo', 'Juventude', 'Internacional',
'América-MG', 'São Paulo', 'Sport', 'Cuiabá', 'Chapecoense', 'Grêmio')... |
class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
return ' '.join(s.split()[::-1])
def test_reverse_words():
s = Solution()
assert "blue is sky the" == s.reverseWords("the sky is blue")
assert "world! hello" == s.reverseWords(" ... |
players = { "name" : "Messi", "age" : 32, "goals": 800, "cap" : 700}
players.keys()
for k in players.keys():
print(k) |
#maximo
def maximo(a,b):
if a > b:
return a
else:
return b
|
n = int(input()) #lost fights
helmet_price = float(input())
sword_price = float(input())
shield_price = float(input())
armor_price = float(input())
lost_fights_count = 0
helmet_brakes = 0
sword_brakes = 0
shield_brakes = 0
armor_brakes = 0
total_shield_brakes = 0
for x in range(n):
lost_fights_count += 1
if ... |
#!/usr/bin/env python
# coding: utf-8
# In[5]:
def left(i):
return 2 * i
def right(i):
return 2 * i + 1
def parent(i):
return i // 2
def MaxHeapify(lis, heap_size, i):
l = left(i)
r = right(i)
largest = 0
temp = 0
if (l <= heap_size) and lis[l] > lis[i]:
largest = l
... |
"""ENum values dictionary for the Home Connect integration."""
enum_list = {
"BSH.Common.Status.OperationState" : "Operation State",
"BSH.Common.EnumType.OperationState.Inactive" : "Inactive",
"BSH.Common.EnumType.OperationState.Ready" : "Ready",
"BSH.Common.EnumType.OperationState.DelayedStart" : "De... |
lista = [];
lista.append(float(input("Digite o primeiro elemento")));
lista.append(float(input("Digite o segundo elemento")));
lista.append(float(input("Digite o terceiro elemento")));
lista.sort();
print(lista)
|
class HeapBinaryMin:
def __init__(self, data=[]):
self.data = data
self.build_max_heap()
def build_min_heap(self):
pass
def get_min(self):
return self.data[0]
def extract_min(self):
popped, self.data[0] = self.data[0], self.data[-1]
return popp... |
class ClassifierBase(object):
def getClassDistribution(self, instance):
raise NotImplementedError("This must be implemented by a concrete adapter.")
def classify(self, instance):
raise NotImplementedError("This must be implemented by a concrete adapter.")
|
i=int(input('enter a year'))
if (i%4)==0:
if (i%100)==0:
if (i%400)==0:
print('leap year')
else:
print('not a lep year')
else:
print('not a lep year')
else:
print('not a lep year')
|
# -- MocaMultiProcessLock --------------------------------------------------------------------------
class MocaMultiProcessLock:
__slots__ = ("_rlock", "_blocking", "_acquired")
def __init__(self, rlock, blocking):
self._rlock = rlock
self._blocking = blocking
self._acquired = False
... |
'''
Problem Statement : Single Number
Link : https://leetcode.com/explore/featured/card/30-day-leetcoding-challenge/528/week-1/3283/
score : accepted
'''
class Solution:
def singleNumber(self, nums: List[int]) -> int:
for i in nums:
if nums.count(i)==1:
return i
|
## PARAMETERS TO CALCULATE LEARNING TIME
"----------------------------------------------------------------------------------------------------------------------"
############################################# Imports ##################################################################
"-------------------------------... |
# Copyright 2019 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.
config_type='servod'
revs = [513]
inas = [('ina3221', '0x40:0', 'pp1000_a_pmic', 7.6, 0.010, 'rem', True), # PR127, ppvar_sys_pmic_v1
('ina... |
"""
Basic Variables
"""
# Create a variable that represents your favorite number, and add a note to remind yourself what this variable represents. Now print it out without re-typing the number.
fave_num = 12
print(fave_num)
# Create another variable that represents your favorite color, and do the same steps as abo... |
#!/usr/bin/env python3
with open("input.txt", "r") as f:
lines = [int(x) for x in f.read().splitlines()]
def part1(lines, preamble = 25):
for i, line in enumerate(lines[preamble:], preamble):
possible = lines[i - preamble : i]
for a in possible:
for b in possible:
if a + b == line:
break
else:
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name' : 'Invoicing',
'version' : '1.1',
'summary': 'Send Invoices and Track Payments',
'sequence': 30,
'description': """
Invoicing & Payments
====================
The specific and easy-to-use Invoi... |
class HTMLTable:
"""Class to easily generate a ranking table in HTML for WordPress"""
def __init__(self, columns: int):
self.columns = columns
self.header = str()
self.rows = list()
def add_header(self, *cells):
if len(cells) != self.columns:
return
self.... |
Cell = DT('Cell', ('vitality', int))
def main():
assert match(Cell(50), ("Cell(n)", lambda n: n + 1)) == 51, "Match"
m = match(Cell(20))
if m('Cell(21)'):
assert False, "Wrong block intlit match"
elif m('Cell(x)'):
assert m.x == 20, "Block intlit binding"
return 0
|
# Author: Ben Wichser
# Date: 12/13/2019
# Description: Play the breakout game. What's the score after winning? see www.adventofcode.com/2019 (day 13) for more information
class IntCode:
"""
IntCode Computer.
Public Data Members:
code_list -- intcode instruction set
Public Methods:
intcode_... |
#!/usr/bin/env python3
mat_mul = __import__('8-ridin_bareback').mat_mul
mat1 = [[1, 2],
[3, 4],
[5, 6]]
mat2 = [[1, 2, 3, 4],
[5, 6, 7, 8]]
print(mat_mul(mat1, mat2))
|
OK = 0
ERROR = 1
INVALID_ARGUMENT = 2
INTERNAL_ERROR = 3
REQUIRE_LANG = 4
REQUIRE_CAPTCHA = 5
CAPTCHA_ERROR = 6
VALIDATE_CODE_ERROR ... |
class Computer:
__IMAGES = [
r'''
.----.
.---------. | == |
|.-"""""-.| |----|
|| || | == |
|| || |----|
|'-.....-'| |::::|
`"")---(""` |___.|
/:::::::::::\" _ "
/:::=======:::\`\`\
`"""""""""""""` '-'
''',
... |
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
def my_startswith(haystack: str, needle: str, start: int):
if len(needle) + start > len(haystack):
return False
for i in range(len(needle)):
if haystack[start + i] != needle[i]:
... |
# -*- coding: utf-8 -*-
{
'name': "eJob Recruitment",
'sequence': 1,
'summary': """
A job recruitment module.""",
'description': """
A job recruitment module
""",
'author': "Kamrul",
'website': "http://www.yourcompany.com",
'category': 'Services',
'version': '0.1',
... |
"""
Finds the maximum path sum in a given triangle of numbers
"""
def max_path_sum_in_triangle(triangle):
"""
Finds the maximum sum path in a triangle(tree) and returns it
:param triangle:
:return: maximum sum path in the given tree
:rtype: int
"""
length = len(triangle)
for _ in rang... |
#
# PySNMP MIB module ELTEX-MES-COPY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-COPY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:01:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
#Input: length of the series N
n=int(input())
if n <=0 or n >100: #Check for boundary conditions
print("invalid")
else: # Check for in range conditions
for i in range(1,n+1):
if i%2==0: #For even positions
sum=0
for j in range(1, i+1):
sum=sum+(j*j)
p... |
#
# PySNMP MIB module RADLAN-rndMng (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-rndMng
# Produced by pysmi-0.3.4 at Wed May 1 14:51:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
s = '100'
print(s)
s = 'abc1234-09232<>?323'
print(s)
s = 'abc 123'
print(s)
s = ' '
print(s)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 8 17:29:02 2021
@author: dopiwoo
Given a binary tree and a number 'S', find if the tree has a path from root-to-leaf such that the sum of all the node
values of that path equals 'S'.
"""
class TreeNode:
def __init__(self, val: int = 0, left:... |
# 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.