content stringlengths 7 1.05M |
|---|
def compose_maxmin(R, S):
"""
X = {1: 0, 2: 0.2, 3: 0.4}
Y = {1: 0, 2: 0.2}
Relation (X*Y) = {(1, 1): 0, (1, 2): 0, (2, 1): 0, (2, 2): 0.04, (3, 1): 0, (3, 2): 0.08}
:param R: a dictionary like above example that
:param S: a dictionary like above example
:return: RoS a composition of R to S
... |
class Solution:
def rangeSumBST(self, root, L, R):
def dfs(node):
if node:
if L <= node.val <= R:
self.ans = self.ans + node.val
if L < node.val:
dfs(node.left)
if R > node.val:
dfs(node.r... |
"""
This problem was asked by Google.
Given two rectangles on a 2D graph, return the area of their intersection. If the rectangles don't intersect, return 0.
For example, given the following rectangles:
{
"top_left": (1, 4),
"dimensions": (3, 3) # width, height
}
and
{
"top_left": (0, 5),
"dimension... |
class DataGridViewRowErrorTextNeededEventArgs(EventArgs):
""" Provides data for the System.Windows.Forms.DataGridView.RowErrorTextNeeded event of a System.Windows.Forms.DataGridView control. """
ErrorText=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the error text for the ... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @author jsbxyyx
# @since 1.0
class Types:
BIT = -7
TINYINT = -6
SMALLINT = 5
INTEGER = 4
BIGINT = -5
FLOAT = 6
REAL = 7
DOUBLE = 8
NUMERIC = 2
DECIMAL = 3
CHAR = 1
VARCHAR = 12
LONGVARCHAR = -1
DATE = 91
TIME =... |
class Count(object):
version=1.5
def add(self,x,y):
return x+y
def sub(self,x,y):
return x-y
if __name__ == '__main__':
c=Count()
print(c.add(1,2))
print(c.sub(10,5)) |
expected_output = {
"sensor_list": {
"Environmental Monitoring": {
"sensor": {
"PEM Iout": {"location": "P1", "reading": "0 A", "state": "Normal"},
"PEM Vin": {"location": "P1", "reading": "104 V AC", "state": "Normal"},
"PEM Vout": {"location": "P... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 模块作者
__author__ = "Kiana Kaslana"
# 导入所有模块时(from dapas.XXXX import *)的模块名
__all__ = ["basefunction", "statistics", "distribution"]
# 模块内测试代码
if __name__ == '__main__':
print("【模块内部测试】")
else:
print("【dapas包加载成功】") |
"""
Here we put all the device configuration that we emulate.
"""
# possible kik versions to emulate
kik_version_11_info = {"kik_version": "11.1.1.12218", "classes_dex_sha1_digest": "aCDhFLsmALSyhwi007tvowZkUd0="}
kik_version_13_info = {"kik_version": "13.4.0.9614", "classes_dex_sha1_digest": "ETo70PFW30/jeFMKKY+CNanX... |
"""Created by sgoswami on 8/8/17."""
"""Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the
nodes of the first two lists."""
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = No... |
class AST:
def __init__(self, **fields):
for k, v in fields.items():
setattr(self, k, v)
class mod(AST): pass
class Module(mod):
_fields = ('body',)
class Interactive(mod):
_fields = ('body',)
class Expression(mod):
_fields = ('body',)
class Suite(mod):
_fields = ('body',)
cla... |
# Approach 1 - Backtracking
class Solution:
def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:
def backtrack(remain, comb, next_start):
if remain == 0:
results.append(comb.copy())
return
elif remain < 0:
... |
#Find the Prime Numbers in a given range with total count.
#(so basically prime number is a number which is only divisible by '1' & itself)
#examples : 2, 3, 5, 7, 11, 13,...
def error():
try:
#Finds the Prime Numbers in a given range:
ip = int(input("Enter the range to find Prime Nu... |
# -*- coding:utf-8 -*-
# @Time:2020/6/21 17:13
# @Author:TimVan
# @File:21. Merge Two Sorted Lists.py
# @Software:PyCharm
# 21. Merge Two Sorted Lists
# Merge two sorted linked lists and return it as a new sorted list.
# The new list should be made by splicing together the nodes of the first two lists.
#
# Example 1:
... |
# encoding: utf-8
# module Revit.Filter calls itself Filter
# from RevitNodes,Version=1.2.1.3083,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class FilterRule(object):
""" Revit Filter Rule """
@staticmethod
def ByRuleType(type, v... |
class Solution:
def spiralMatrixIII(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:
res = [(r0, c0)]
step = 1
while len(res) < R * C:
# right
for j in range(step):
c0 += 1
if self._in_grid(c0, r0, C, R):
... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class PixelTestPage(object):
"""A wrapper class mimicking the functionality of the PixelTestsStorySet
from the old-style GPU tests.
"""
def __init__(... |
Diccionario = {}
Diccionario["Toddle"] = "niño pequeño, de entre 2 y 4 años aproximadamente"
Diccionario["list comprehension"] = "Lista con un ciclo dentro para generar los valores directamente en la lista"
Diccionario["Odd"] = "Pares"
Diccionario["Diccionarios"] = "Variable que se usa con distincion de claves en vez d... |
def get_sql():
limit = 6
sql = f"SELEct speed from world where animal='dolphin' limit {limit}"
return sql
def get_query_template():
limit = 6
query_template = (
f"SELEct speed from world where animal='dolphin' group by family limit {limit}"
)
return query_template
def get_query()... |
'''
Programming Language: Python 3.9.4
Developer: Daniel Nogueira
Program: List of lists
Based on: EIN420 Unity 3
'''
listax=[[1,2,3,4,],[5,6,7,8]]
print(listax) #lista toda
print(listax[0]) #lista na posição 0
listax[0][1]=1 #troca 2 por 1
print(listax[0])
listay=listax[0]
'''
lista y não recebe a lista x[0]
... |
postponed = 'POSTPONED'
scheduled = 'SCHEDULED'
awarded = 'AWARDED'
suspended = 'SUSPENDED'
inPlay = 'IN_PLAY'
canceled = 'CANCELED'
paused = 'PAUSED'
finished = 'FINISHED'
matchToBePlayedList = [scheduled, suspended, paused, inPlay] |
class ActionException(Exception):
pass
class PingTimeout(Exception):
pass
class MeruException(Exception):
pass
|
class Table(object):
def __init__(self, name, columns):
self.name = name
self.columns = columns
|
def test_add_group(app, xlsx_groups):
old_list = app.group.get_group_list()
app.group.add_new_group(xlsx_groups)
new_list = app.group.get_group_list()
old_list.append(xlsx_groups)
assert sorted(old_list) == sorted(new_list)
|
'''
Created on 18 Sep 2017
@author: ywz
'''
|
a = 3
b = 4.0
c = a + b
d = a - b
e = a / b
tup = (a, b, c, d, e)
tup
|
#!/usr/bin/env python
NAME = 'Newdefend (NewDefend)'
def is_waf(self):
# Newdefend reveals itself within the server headers without any mal requests
if self.matchheader(('Server', 'Newdefend')):
return True
for attack in self.attacks:
r = attack(self)
if r is None:
re... |
# -*- coding: utf-8 -*-
# author:lyh
# datetime:2020/5/13 8:29
"""
38. 外观数列
「外观数列」是一个整数序列,从数字 1 开始,序列中的每一项都是对前一项的描述。前五项如下:
1. 1
2. 11
3. 21
4. 1211
5. 111221
1 被读作 "one 1" ("一个一") , 即 11。
11 被读作 "two 1s" ("两个一"), 即 21。
21 被读作 "one 2", "one 1" ("一个二" , "一个一") , 即 1211。
给定一个正整数 n(1 ≤ n ≤ 30),输... |
# Example: Send Picture Message
id = api.send_message(
from_ = '+1234567980',
to = '+1234567981',
media = ['http://host/path/to/file']
)
|
def lps(string, result=[]):
if len(string) > 0:
end = 0
for i in range(1, len(string)):
if string[i] == string[0] and i > end:
end = i
if not result:
result.append(string[0: end + 1])
elif len(string[0: end+1]) > len(result[0]):
re... |
class ModesOfPaymentService(object):
"""
:class:`fortnox.ModesOfPaymentService` is used by :class:`fortnox.Client` to make
actions related to ModesOfPayment resource.
Normally you won't instantiate this class directly.
"""
"""
Allowed attributes for ModesOfPayment to send to Fortnox backen... |
# Exercise 66 - Translator
d = dict(weather = "clima", earth = "terra", rain = "chuva")
def vocabulary(word):
return d[word] if word in d else ''
word = input('Enter word: ')
print(vocabulary(word)) |
class BoardAlreadyExistsException(Exception):
"""
Exception used for when the Tensorboard class cannot delete a folder
that already exists. This exception should not be use for anything else.
"""
def __init__(self, name):
super().__init__(f'Tensorboard: {name} already exists') |
def bytes2human(n):
# http://code.activestate.com/recipes/578019
symbols = ("K", "M", "G", "T", "P", "E", "Z", "Y")
prefix = {}
for i, s in enumerate(symbols):
prefix[s] = 1 << (i + 1) * 10
for s in reversed(symbols):
if n >= prefix[s]:
value = float(n) / prefix[s]
... |
#!/usr/bin/env python
NAME = 'Radware AppWall'
def is_waf(self):
if self.matchheader(('X-SL-CompState', '.')):
return True
for attack in self.attacks:
r = attack(self)
if r is None:
return
_, responsebody = r
# Most reliable fingerprint is this on block page... |
class RoutingPath:
"""Holds a list of locations and optimizes for `in` comparisons
"""
def __init__(self, path):
self._values = tuple(path)
self._set = frozenset(path)
def __len__(self):
return len(self._values)
def __getitem__(self, key):
return self._values[key]
... |
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
if len(nums) == 1:
return 1
i = 1
l = len(nums)
cur = 0
while i < l:
if nums[c... |
def domainchanger(email,newdom,olddom = "1"):
email = email.split("@")
if newdom != email[1]:
newemail = email[0] + "@"+ newdom
return f"Changed: {newemail}"
else:
newemail = email[0] + "@"+ email[1]
return f"Unchanged: {newemail}"
email = input("Enter your email: ")
newdom... |
# -*- coding: utf-8 -*-
def extract_id(object_or_id):
"""Return an id given either an object with an id or an id."""
try:
id = object_or_id.id
except AttributeError:
id = object_or_id
return id
def extract_ids(objects_or_ids):
"""Return a list of ids given either objects with ids o... |
"""Params for ADDA."""
# params for dataset and data loader
data_root = "data"
usps_data = data_root + '/USPS'
mnistm_data = data_root + '/MNIST_M'
svhn_data = data_root + '/SVHN'
dataset_mean_value = 0.5
dataset_std_value = 0.5
dataset_mean = (dataset_mean_value, dataset_mean_value, dataset_mean_value)
dataset_std = ... |
class Ordenador:
def selecao_direta (self, lista):
fim = len(lista)
for i in range(fim - 1):
# Inicialmente, o menor elemento já visto é o i-ésimo
posicao_do_minimo = i
for j in range(i + 1, fim):
if lista[j] < lista[posicao_do_minimo]:
... |
#!/usr/bin/env python
""" This simple Python script can be run to generate
ztriangle_code_*.h, ztriangle_table.*, and ztriangle_*.cxx, which
are a poor man's form of generated code to cover the explosion of
different rendering options while scanning out triangles.
Each different combination of options is compiled to a... |
class Vector:
def __init__(self, length=3, vec=None):
self._vec = []
if isinstance(vec, list):
self._vec = vec.copy()
else:
if isinstance(length, (int, float)):
for i in range(int(length)):
self._vec.append(0)
self._length =... |
idade = int(input("Digite sua idade: "))
if(idade >= 18):
print("Você é maior de idade e já pode ser preso!")
else:
print("Você é menor de idade!") |
# -*- coding: utf-8 -*-
"""
pip_services3_mongodb.__init__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mongodb module initialization
:copyright: Conceptual Vision Consulting LLC 2015-2016, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
__all__ = [ ]
|
'''
This file contains config values (like the port numbers) used by our library
'''
#:port to use for socket communications
PORT = 1001
#:ip address of group to use for multicast communications
MULTICAST_GROUP_IP = '224.15.35.42'
#:port to use for multicast communications
MULTICAST_PORT = 10000
#:the default timeout f... |
food_items = [
"ham",
#"spam",
"eggs",
"nuts"
]
for food in food_items:
if food == "spam":
print ("No spam please")
break
print ("Great - ", food)
#else:
# print ("I am glad - There was no spam")
print ("Finally I have finished") |
# https://leetcode.com/problems/sum-of-two-integers/
class Solution:
def getSum(self, a: int, b: int) -> int:
result = sum([a, b])
return result
a = 1
b = 2
s = Solution()
result = s.getSum(a, b) |
class HttpHeaders:
X_CORRELATION_ID = "X-Correlation-ID"
CONTENT_TYPE = "Content-Type"
ACCEPT = 'Accept'
|
ES_HOST = 'localhost:9200'
ES_INDEX = 'pending-repodb'
ES_DOC_TYPE = 'chemical'
API_PREFIX = 'repodb'
API_VERSION = ''
|
def check_types(value, *types, var_name="value"):
"""
Check value by types compliance.
:param value: object.
Value to check.
:param types: tuple.
Types list to compare.
:param var_name: str, optional (default="value").
Name of the variable for exception message.
"""
... |
def match(text, pattern, base=10):
text_len = len(text)
pattern_len = len(pattern)
text_hash = _get_hash(text[:pattern_len], base)
pattern_hash = _get_hash(pattern, base)
matches = []
for i in xrange(text_len - pattern_len + 1):
if pattern_hash == text_hash:
# If the hashe... |
"""
A collection of useful classes and functions
"""
__all__ = ['add', 'MixedSpam']
def add(a, b):
"""
Add two numbers
"""
return a + b
class MixedSpam(object):
"""
Special spam
"""
def eat(self, time):
"""
Eat special spam in the required time.
"""
... |
#Calculator app
# read input
# figure out order of operations
# consider edge cases
#divide by zero
#formula : string => "1 + 2 + 3"
def Calculator(formula):
"""Calculator handler executes calculation and returns float result"""
ans = 0
#read input into a list
... |
# coding:utf-8
class config:
# 窗口的大小
wm_geometry = '1280x760'
# canvas大小
cnf = {
'height': 600,
'width': 1000
}
# 更新时间间隔
time_frame = 300
cell_size = (100, 60)
|
"""
Rearrange the Number
Given a number, return the difference between the maximum and minimum numbers that can be formed when the digits are rearranged.
Examples
rearranged_difference(972882) ➞ 760833
# 988722 - 227889 = 760833
rearranged_difference(3320707) ➞ 7709823
# 7733200 - 23377 = 7709823
rearranged_differen... |
class Form:
company: str
user: str
days: int
def __init__(self, company, user, days):
self.company = company
self.user = user
self.days = days
|
def large(arr):
if (len(arr)) < 0:
return 0
max_sum = current = arr[0]
for num in arr[1:]:
current = max(current + num, num)
max_sum = max(current, max_sum)
return max_sum
if __name__ == "__main__":
print(large([1, -1, 3, -4, 5, -3, 6, -3, 2, -1])) |
for i in range(int(input())):
n, k, s = list(map(int, input().split()))
total = k * s
count = 0
val = False
m = 0
for j in range(1, s + 1):
if (j % 7) != 0:
count += n
m += 1
else:
continue
if count >= total:
val = True
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 08:12:43 2020
@author: cis-user
"""
# score=['小徐',5,9,6,8,7,10,6]
# s=score[1:]
# a=max(s)
# print(a)
# score=['小徐',5,9,6,8,7,10,6]
# s=score[1:]
# a=min(s)
# print(a)
# score=['wang',5,9,6,8,7,10,6]
# s=score[1:]
# y= sorted(s,reverse=True)
# a,... |
# Python program to display astrological sign
# or Zodiac sign for given date of birth
def zodiac_sign(day, month):
# checks month and date within the valid range
# of a specified zodiac
if month == 'december':
astro_sign = 'Sagittarius' if (day < 22) else 'capricorn'
elif month == 'january'... |
class Redirect(Exception):
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
|
audio = [
"aif",
"cda",
"mid",
"midi",
"mp3",
"mpa",
"ogg",
"wav",
"wma",
"wpl"
]
compressed = [
"arj",
"deb",
"gz",
"pkg",
"rar",
"rpm",
"tar",
"z",
"zip"
]
image = [
"ai",
"bmp",
"gif",
"ico",
"jpeg",
"jpg",
"png",... |
print('Digite a nota do aluno abaixo Para ver a média')
nota1 = float(input('Primeira nota: '))
nota2 = float(input('Segunda nota: '))
média = (nota1 + nota2) / 2
print('Tirando {} e {}, a média é {}'.format(nota1, nota2, média))
if média <= 4:
print('Aluno Reprovado!')
elif média <= 6.9:
print('Aluno ficou de ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class UnknownSizeError(Exception):
def __init__(self, cls):
self.cls = cls
def __str__(self):
return f'The size of `{self.cls}` is unkown, the object could not be generated.'
class UnavalibleAttributeError(Exception):
def __init__(sel... |
# ------------------------------
# 166. Fraction to Recurring Decimal
#
# Description:
# Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.
# If the fractional part is repeating, enclose the repeating part in parentheses.
# Example 1:
# Input: numerator =... |
# test short circuit expressions outside if conditionals
print(() or 1)
print((1,) or 1)
print(() and 1)
print((1,) and 1)
print("PASS") |
TRAINING_DATA = [
(
"i went to amsterdem last year and the canals were beautiful",
{"entities": [(10, 19, "TOURIST_DESTINATION")]},
),
(
"You should visit Paris once in your life, but the Eiffel Tower is kinda boring",
{"entities": [(17, 22, "TOURIST_DESTINATION")]},
),
... |
class LoraCommands:
## Returns the firmware version and release date in format: "RN2903 X.Y.Z MMM DD YYYY HH:MM:SS"
GET_VERSION = 'sys get ver'
## Resets LoRa stack
RESET_STACK = 'mac reset'
## Sets the LoRA functionality to radio (needs to be done before anything else)
START_RADIO_O... |
"""
Integers in Python can be as big as the bytes in your machine's memory. There is no limit in size as there is: (c++ int) or
(C++ long long int).
As we know, the result of
grows really fast with increasing
.
Let's do some calculations on very large integers.
Task
Read four numbers,
, , , and , and print the res... |
name = "ege"
skins = [
("avadefault", 'AVA padrão'),
("avaalternative", 'AVA alternativo'),
("egedefault", 'EGE padrão'),
("egealternative", 'EGE alternativo'),
("highcontrast", 'Alto contraste'),
("dark", 'Dark'),
("contrast", 'Contraste'),
("golden", 'Dourado'),
("purple", 'Púrpur... |
# 挿入ソート
n = int(input())
n_lst = list(map(int, input().split()))
s_lst = [str(i) for i in n_lst]
print(' '.join(s_lst))
for i in range(1, n):
v = n_lst[i]
j = i - 1
while j >= 0 and n_lst[j] > v:
n_lst[j+1] = n_lst[j]
j -= 1
n_lst[j+1] = v
s_lst = [str(i) for i in n_lst]
print('... |
# DataBase Credentials
database="da665kfg2oc9og"
user = "aourrzrdjlrpjo"
password = "12359d0fa8d70aeea4d2ef3acd96eb794f178dee42887f7c350ad49a4d78e323"
host = "ec2-18-207-95-219.compute-1.amazonaws.com"
port = "5432" |
# http://codeforces.com/contest/268/problem/C
n, m = map(int, input().split())
d = min(n, m)
print(d + 1)
for i in range(d + 1): print("{} {}".format(d-i, i)) |
infile = "input_file.txt"
outfile = "output_file.txt"
delete_list = [
# Your words you want to fill to filter.
"Dog","Bird","Pig"
]
with open(infile) as fin, open(outfile, "w+") as fout:
for line in fin:
for word in delete_list:
line = line.replace(word, "")
fout.write(line)
|
answers =[
"Apple",
"Apricot",
"Avocado",
"Banana",
"Bilberry",
"Blackberry",
"Blackcurrant",
"Blueberry",
"Cherry",
"Coconut",
"Cranberry",
"Date",
"Dragonfruit",
"Durian",
"Grape",
"Grapefruit",
"Guava",
"Jackfruit",
"Jujube",
"Kiwifruit"... |
puzzle_input_list = []
with open("input.txt", "r") as puzzle_input:
for line in puzzle_input:
line = line.strip()
puzzle_input_list.append(line)
open_brackets = {"{", "(", "[", "<"}
bracket_mapping = {"}": "{", ")": "(", "]": "[", ">": "<",
"{": "}", "(": ")", "[": "]", "<": ">"... |
# 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 ... |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Average Scores
#Problem level: 7 kyu
def average(array):
return round(sum(array)/len(array))
|
# -*- coding: utf-8 -*-
{
'name': "Online Event Ticketing",
'category': 'Website/Website',
'summary': "Sell event tickets online",
'description': """
Sell event tickets through eCommerce app.
""",
'depends': ['website_event', 'event_sale', 'website_sale'],
'data': [
'data/event_data... |
class Allergies(object):
items = {
'eggs': 1,
'peanuts': 2,
'shellfish': 4,
'strawberries': 8,
'tomatoes': 16,
'chocolate': 32,
'pollen': 64,
'cats': 128,
}
def __init__(self, score):
self._score = score
def is_allergic_to(self, i... |
def main():
# Let's create a dictionary with student keys and GPA values
student_gpa = {"john": 3.5,
"jane": 4.0,
"bob": 2.8,
"mary": 3.2}
# There are four student records in this dictionary
assert len(student_gpa) == 4
# Each student has a ... |
# @Fábio C. Nunes
# Escreva um programa que pergunte a quantidade de quilometros percorridos por um carro alugado
# e a quantidade de dias pelos quais ele foi alugado. Calcule o preço a pagar sabendo que
# O carro custa R$60,00 por dia e R$0,15 por km rodado.
km = float(input('Quilometros percorridos pelo carro: '))
d... |
# DNA -> RNA Transcription
def transcribe(seq: str) -> str:
"""
transcribes DNA to RNA by generating
the complement sequence with T -> U replacement
"""
# rna dict
rna_dict = {'A': 'U', 'T': 'A',
'C': 'G', 'G': 'C'}
# seq to list
seq_list = list(seq)
# for each e... |
class VserverPeerState(basestring):
"""
peered|pending|initializing|initiated|rejected|suspended|deleted
Possible values:
<ul>
<li> "peered" - Vserver peer relationship is
established and the respective applications can use peer
relationship,
<li> "pending" - Vserver peer re... |
# The MIT License (MIT)
#
# Copyright (c) 2017-2018 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... |
# pylint: disable=missing-docstring
"""
# Stub file type annotations examples
## Links
[Stub files](https://mypy.readthedocs.io/en/latest/stubs.html)
"""
class MyValue:
pass
def func(_list, _my_value_cls=MyValue, **_kwargs):
pass
def func_any(_list, _my_value_cls=MyValue, **_kwargs):
pass
|
SPANISH_STOP_WORDS = ["hola", "chao", "a", "al", "algo", "algunas", "algunos", "ante", "antes", "como", "con", "contra", "cual", "cuando", "de"
, "del", "desde", "donde", "durante", "e", "ella", "ellas", "ellos", "en", "entre", "era", "erais", "eran", "eras", "eres",
"es", "esa", "esas", "ese", "eso", "esos", "esta", "... |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
url_slugs_string = u"""JohannesKarstensen
SvenVanPoucke
MuhammadYakutAli
PaulJohnson
KarinaTamashiro
S... |
class Heap:
def __init__(self,comp):
self.hp = []
self.size = 0
self.comp = comp
def push(self,value):
self.hp.append(value)
self.size += 1
self._heapifyForInsertion()
def pop(self):
if self.size == 0:
return None
value = self.hp[0]... |
names = []
for i in range(10):
X =str(input(''))
names.append(X)
print(names[2])
print(names[6])
print(names[8]) |
"""
# @Time : 2019/10/30 14:16
# @Author : jay
# @File : __init__.py.py
# @GitHub : https://github.com/Locusc
""" |
def addBinary(a: str, b: str) -> str:
n_a = len(a)
n_b = len(b)
max_n = max(n_a, n_b)
a = a.rjust(max_n, "0")
b = b.rjust(max_n, "0")
jin_bit = 0
result = ""
for i in range(max_n - 1, -1, -1):
tmp_a = int(a[i])
tmp_b = int(b[i])
tmp = tmp_a + tmp_b + jin_bit
... |
# Performance note: I benchmarked this code using a set instead of
# a list for the stopwords and was surprised to find that the list
# performed /better/ than the set - maybe because it's only a small
# list.
stopwords = '''
i
a
an
are
as
at
be
by
for
from
how
in
is
it
of
on
or
that
the
this
... |
"""
Escreva um programa que leia um número n inteiro qualquer e mostre
na tela os n primeiros elementos de uma Sequência de Fibonacci.
Ex: 0 → 1 → 1 → 2 → 3 → 5 → 8
"""
num = int(input('Digite quantos termos você quer ver da sequência de Fibonacci: '))
anterior = 0
proximo = 0
cont = 0
while cont < num:
print(pro... |
class Credentials(object):
def __init__(self, username, password):
"""
Credentials.
:param username: Username
:param password: Password
"""
self.username = username #: Username
self.password = password #: Password
|
# st2common
__all__ = ["MASKED_ATTRIBUTES_BLACKLIST", "MASKED_ATTRIBUTE_VALUE"]
# A blacklist of attributes which should be masked in the log messages by default.
# Note: If an attribute is an object or a dict, we try to recursively process it and mask the
# values.
MASKED_ATTRIBUTES_BLACKLIST = [
"password",
... |
combination = [(True,True,True),(True,True,False),(True,False,True),(True,False,False),(False,True,True),(False,True,False),(False,False,True),(False,False,False)]
variable = {'p':0,'q':1,'r':2}
kb = ''
q = ''
priority = {'~':3,'v':1,'^':2}
def input_rules():
global kb,q
kb = (input("Enter rule : ... |
# Numeric Pattern 7
"""
2 4 6 8 10
12 14 16 18 20
22 24 26 28 30
32 34 36 38 40
42 44 46 48 50
"""
i = 0
nums = list(range(2, 52, 2))
for _ in range(5):
j = i + 5
row = " ".join(map(str, nums[i:j]))
print(row)
i = j
|
{
'includes': [
'common.gypi',
],
'targets': [
{
'target_name': 'svg',
'type': 'static_library',
'include_dirs': [
'../include/config',
'../include/core',
'../include/xml',
'../include/utils',
'../include/svg',
],
'sources': [
'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.