content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
###exercicio 76
produtos = ('lapis', 1.5, 'borracha', 2.00, 'caderno', 15.00, 'livro', 50.00, 'mochila', 75.00)
print ('='*60)
print ('{:^60}'.format('Lista de produtos'))
print ('='*60)
for c in range (0, len(produtos), 2):
print ('{:<50}R$ {:>7}'.format(produtos[c], produtos[c+1]))
print ('-'*60) | produtos = ('lapis', 1.5, 'borracha', 2.0, 'caderno', 15.0, 'livro', 50.0, 'mochila', 75.0)
print('=' * 60)
print('{:^60}'.format('Lista de produtos'))
print('=' * 60)
for c in range(0, len(produtos), 2):
print('{:<50}R$ {:>7}'.format(produtos[c], produtos[c + 1]))
print('-' * 60) |
# Programacion orientada a objetos (POO o OOP)
# Definir una clase (molde para crear mas objetos de ese tipo)
# (Coche) con caracteristicas similares
class Coche:
# Atributos o propiedades (variables)
# caracteristicas del coche
color = "Rojo"
marca = "Ferrari"
modelo = "Aventador"
velocidad... | class Coche:
color = 'Rojo'
marca = 'Ferrari'
modelo = 'Aventador'
velocidad = 300
caballaje = 500
plazas = 2
def set_color(self, color):
self.color = color
def get_color(self):
return self.color
def set_modelo(self, modelo):
self.modelo = modelo
def g... |
class Solution:
def calculate(self, s: str) -> int:
stacks = [[0, 1]]
val = ""
sign = 1
for i, ch in enumerate(s):
if ch == ' ':
continue
if ch == '(':
stacks[-1][-1] = sign
stacks.append([0, 1])
... | class Solution:
def calculate(self, s: str) -> int:
stacks = [[0, 1]]
val = ''
sign = 1
for (i, ch) in enumerate(s):
if ch == ' ':
continue
if ch == '(':
stacks[-1][-1] = sign
stacks.append([0, 1])
... |
class Solution(object):
def frequencySort(self, s):
"""
:type s: str
:rtype: str
"""
freq = dict()
for char in s:
if char in freq:
freq[char] += 1
else:
freq[char] = 1
... | class Solution(object):
def frequency_sort(self, s):
"""
:type s: str
:rtype: str
"""
freq = dict()
for char in s:
if char in freq:
freq[char] += 1
else:
freq[char] = 1
sorted_list = sorted(freq.items(),... |
# -*- coding: utf-8 -*-
urls = (
"/", "Home",
)
| urls = ('/', 'Home') |
#!/usr/bin/env python3
BUS = 'http://m.bus.go.kr/mBus/bus/'
SUBWAY = 'http://m.bus.go.kr/mBus/subway/'
PATH = 'http://m.bus.go.kr/mBus/path/'
all_bus_routes = BUS + 'getBusRouteList.bms'
bus_route_search = all_bus_routes + '?strSrch={0}'
bus_route_by_id = BUS + 'getRouteInfo.bms?busRouteId={0}'
all_low_bus_routes = B... | bus = 'http://m.bus.go.kr/mBus/bus/'
subway = 'http://m.bus.go.kr/mBus/subway/'
path = 'http://m.bus.go.kr/mBus/path/'
all_bus_routes = BUS + 'getBusRouteList.bms'
bus_route_search = all_bus_routes + '?strSrch={0}'
bus_route_by_id = BUS + 'getRouteInfo.bms?busRouteId={0}'
all_low_bus_routes = BUS + 'getLowBusRoute.bms'... |
def config_record_on_account(request,account_id):
pass
def config_record_on_channel(request, channel_id):
pass
| def config_record_on_account(request, account_id):
pass
def config_record_on_channel(request, channel_id):
pass |
def gen_primes():
current_number = 2
primes = []
while True:
is_prime = True
for prime in primes:
if prime*prime > current_number: ## This is saying it's a prime if prime * prime > current_testing_number
# print("Caught here")
break # I'd love to s... | def gen_primes():
current_number = 2
primes = []
while True:
is_prime = True
for prime in primes:
if prime * prime > current_number:
break
if current_number % prime == 0:
is_prime = False
break
if is_prime:
... |
def isPrime(x):
for i in range(2,x):
if x%i == 0:
return False
return True
def findPrime(beginning, finish):
for j in range(beginning,finish):
if isPrime(j):
return j
def encrypt():
print("Provide two integers")
x = int(input())
y = int(input())
prime1 = findPrime(x,y)
print("Provi... | def is_prime(x):
for i in range(2, x):
if x % i == 0:
return False
return True
def find_prime(beginning, finish):
for j in range(beginning, finish):
if is_prime(j):
return j
def encrypt():
print('Provide two integers')
x = int(input())
y = int(input())
... |
# Gegeven zijn twee lijsten: lijst1 en lijst2
# Zoek alle elementen die beide lijsten gemeenschappelijk hebben
# Stop deze elementen in een nieuwe lijst
# Print de lijst met gemeenschappelijke elementen
lijst1 = [1, 45, 65, 24, 87, 45, 23, 24, 56]
lijst2 = [10, 76, 34, 1, 56, 22, 33, 77, 1]
| lijst1 = [1, 45, 65, 24, 87, 45, 23, 24, 56]
lijst2 = [10, 76, 34, 1, 56, 22, 33, 77, 1] |
class iterator:
def __init__(self,data):
self.data=data
self.index=-2
def __iter__(self):
return self
def __next__(self):
if self.index>=len(self.data):
raise StopIteration
self.index+=2
return self.data[self.index]
liczby=iterator([0,1,... | class Iterator:
def __init__(self, data):
self.data = data
self.index = -2
def __iter__(self):
return self
def __next__(self):
if self.index >= len(self.data):
raise StopIteration
self.index += 2
return self.data[self.index]
liczby = iterator([0... |
class RemovedInWagtail21Warning(DeprecationWarning):
pass
removed_in_next_version_warning = RemovedInWagtail21Warning
class RemovedInWagtail22Warning(PendingDeprecationWarning):
pass
| class Removedinwagtail21Warning(DeprecationWarning):
pass
removed_in_next_version_warning = RemovedInWagtail21Warning
class Removedinwagtail22Warning(PendingDeprecationWarning):
pass |
class ListNode(object):
"""
Definition fro singly-linked list.
"""
def __init__(self, val=0, next=None) -> None:
self.val = val
self.next = next | class Listnode(object):
"""
Definition fro singly-linked list.
"""
def __init__(self, val=0, next=None) -> None:
self.val = val
self.next = next |
"""
# Definition for a Node.
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
"""
class Solution:
def postorder(self, root: 'Node') -> List[int]:
if root == None:
return []
res = []
for index in range(len(root.ch... | """
# Definition for a Node.
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
"""
class Solution:
def postorder(self, root: 'Node') -> List[int]:
if root == None:
return []
res = []
for index in range(len(root.... |
arr = list(map(int, input().split()))
n = int(input())
for i in range(len(arr)):
one = arr[i]
for j in range(i+1,len(arr)):
two = arr[j]
s = one + two
if s == n:
print(f'{one} {two}') | arr = list(map(int, input().split()))
n = int(input())
for i in range(len(arr)):
one = arr[i]
for j in range(i + 1, len(arr)):
two = arr[j]
s = one + two
if s == n:
print(f'{one} {two}') |
"""
Error Message for REST API
"""
CUSTOM_VISION_ACCESS_ERROR = \
('Training key or Endpoint is invalid. Please change the settings')
CUSTOM_VISION_MISSING_FIELD = \
('Either Namespace or Key is missing or incorrect. Please check again')
| """
Error Message for REST API
"""
custom_vision_access_error = 'Training key or Endpoint is invalid. Please change the settings'
custom_vision_missing_field = 'Either Namespace or Key is missing or incorrect. Please check again' |
def format(string):
''' Formats the docstring. '''
# reStructuredText formatting?
# Remove all \n and replace all spaces with a single space
string = ' '.join(list(filter(None, string.replace('\n', ' ').split(' '))))
return string
class DocString:
def __init__(self, strin... | def format(string):
""" Formats the docstring. """
string = ' '.join(list(filter(None, string.replace('\n', ' ').split(' '))))
return string
class Docstring:
def __init__(self, string):
self.string = format(string)
def __str__(self):
return self.string
def __add__(self, other... |
class Solution:
def longestCommonPrefix(self, strs):
if strs == []:
return ""
ans = ""
for i, ch in enumerate(strs[0]): # iterate over the characters of first word
for j, s in enumerate(strs): # iterate over the list of words
if i >= len(strs[j]) or ch != s[i]: # IF the first word is longer
re... | class Solution:
def longest_common_prefix(self, strs):
if strs == []:
return ''
ans = ''
for (i, ch) in enumerate(strs[0]):
for (j, s) in enumerate(strs):
if i >= len(strs[j]) or ch != s[i]:
return ans
ans += ch
... |
# ---------------- User Configuration Settings for speed-cam.py ---------------------------------
# Ver 8.4 speed-cam.py webcam720 Stream Variable Configuration Settings
#######################################
# speed-cam.py plugin settings
#######################################
# Calibration Settings
# =... | cal_obj_px = 310
cal_obj_mm = 4330.0
min_area = 100
x_diff_max = 200
x_diff_min = 1
track_timeout = 0.0
event_timeout = 0.4
log_data_to_csv = True
webcam = True
webcam_src = 0
webcam_width = 1280
webcam_height = 720
image_font_size = 20
image_bigger = 1 |
def busca(lista, elemento):
for i in range(len(lista)):
if lista[i] == elemento:
return i
return False
o = busca([0,7,8,5,10], 10)
print(o) | def busca(lista, elemento):
for i in range(len(lista)):
if lista[i] == elemento:
return i
return False
o = busca([0, 7, 8, 5, 10], 10)
print(o) |
gem3 = (
(79, ("ING")),
)
gem2 = (
(5, ("TH")),
(41, ("EO")),
(79, ("NG")),
(83, ("OE")),
(101, ("AE")),
(107, ("IA", "IO")),
(109, ("EA")),
)
gem = (
(2, ("F")),
(3, ("U", "V")),
(7, ("O")),
(11, ("R")),
(13, ("C", "K")),
(17, ("G")),
(19, ("W")),
(23, ("H")),
(29, ("N")),
(... | gem3 = ((79, 'ING'),)
gem2 = ((5, 'TH'), (41, 'EO'), (79, 'NG'), (83, 'OE'), (101, 'AE'), (107, ('IA', 'IO')), (109, 'EA'))
gem = ((2, 'F'), (3, ('U', 'V')), (7, 'O'), (11, 'R'), (13, ('C', 'K')), (17, 'G'), (19, 'W'), (23, 'H'), (29, 'N'), (31, 'I'), (37, 'J'), (43, 'P'), (47, 'X'), (53, ('S', 'Z')), (59, 'T'), (61, '... |
def part_1(data):
blah = {'n': (0, 1), 'ne': (1, 0), 'se': (1, -1),
's': (0, -1), 'sw': (-1, 0), 'nw': (-1, 1)}
x, y = 0, 0
for step in data.split(","):
x, y = x + blah[step][0], y + blah[step][1]
distance = (abs(x) + abs(y) + abs(-x-y)) // 2
return distance
def part_2(... | def part_1(data):
blah = {'n': (0, 1), 'ne': (1, 0), 'se': (1, -1), 's': (0, -1), 'sw': (-1, 0), 'nw': (-1, 1)}
(x, y) = (0, 0)
for step in data.split(','):
(x, y) = (x + blah[step][0], y + blah[step][1])
distance = (abs(x) + abs(y) + abs(-x - y)) // 2
return distance
def part_2(data):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 18 12:00:00 2020
@author: divyanshvinayak
"""
for _ in range(int(input())):
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(sum(A) % K) | """
Created on Tue Feb 18 12:00:00 2020
@author: divyanshvinayak
"""
for _ in range(int(input())):
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
print(sum(A) % K) |
# -*- coding: utf-8 -*-
"""
Global tables and re-usable fields
"""
# =============================================================================
# Representations for Auth Users & Groups
def shn_user_represent(id):
table = db.auth_user
user = db(table.id == id).select(table.email, limitby=(0, 1), cache=(ca... | """
Global tables and re-usable fields
"""
def shn_user_represent(id):
table = db.auth_user
user = db(table.id == id).select(table.email, limitby=(0, 1), cache=(cache.ram, 10)).first()
if user:
return user.email
return None
def shn_role_represent(id):
table = db.auth_group
role = db(t... |
#!/bin/zsh
class Person:
def __init__(self, name, age):
mysillyobject.name = name
mysillyobject.age = age
def myfunc(abc):
print("Hello my name is " + abc.name)
p1 = Person("John", 36)
p1.myfunc() | class Person:
def __init__(self, name, age):
mysillyobject.name = name
mysillyobject.age = age
def myfunc(abc):
print('Hello my name is ' + abc.name)
p1 = person('John', 36)
p1.myfunc() |
class SmRestartEnum(basestring):
"""
always|never|default
Possible values:
<ul>
<li> "always" ,
<li> "never" ,
<li> "default"
</ul>
"""
@staticmethod
def get_api_name():
return "sm-restart-enum"
| class Smrestartenum(basestring):
"""
always|never|default
Possible values:
<ul>
<li> "always" ,
<li> "never" ,
<li> "default"
</ul>
"""
@staticmethod
def get_api_name():
return 'sm-restart-enum' |
def TrimmedMean(UpCoverage):
nonzero_count = 0
for i in range(1,50):
if (UpCoverage[-i]>0):
nonzero_count += 1
total = 0
count=0
for cov in UpCoverage:
if(cov>0):
total += cov
count += 1
trimMean = 0
if nonzero_count > 0 and count >20:
#if count >20:
trimMean = total/count;
return trimMean
| def trimmed_mean(UpCoverage):
nonzero_count = 0
for i in range(1, 50):
if UpCoverage[-i] > 0:
nonzero_count += 1
total = 0
count = 0
for cov in UpCoverage:
if cov > 0:
total += cov
count += 1
trim_mean = 0
if nonzero_count > 0 and count > 2... |
N = int(input())
gradeReal = list(map(int, input().split()))
M = max(gradeReal)
gradeNew = 0
for i in gradeReal:
gradeNew += (i / M * 100)
print(gradeNew / N) | n = int(input())
grade_real = list(map(int, input().split()))
m = max(gradeReal)
grade_new = 0
for i in gradeReal:
grade_new += i / M * 100
print(gradeNew / N) |
# -*- coding: utf-8 -*-
"""Entry point for the Nessie Airflow provider.
Contains important descriptions for registering to Airflow
"""
__version__ = "0.1.2"
def get_provider_info() -> dict:
"""Hook for Airflow."""
return {
"package-name": "airflow-provider-nessie",
"name": "Nessie Airflow Pr... | """Entry point for the Nessie Airflow provider.
Contains important descriptions for registering to Airflow
"""
__version__ = '0.1.2'
def get_provider_info() -> dict:
"""Hook for Airflow."""
return {'package-name': 'airflow-provider-nessie', 'name': 'Nessie Airflow Provider', 'description': 'An Airflow provide... |
universalSet={23,32,12,45,56,67,7,89,80,96}
subSetList=[{23,32,12,45},{32,12,45,56},{56,67,7,89},{80,96},{12,45,56,67,7,89},{7,89,80,96},{89,80,96}]
def getMinSubSetList(universalSet,subSetList):
SetDs=[[i,len(i)] for i in subSetList]
tempSet=set()
setList=[]
while(len(universalSet)!=0):
print("... | universal_set = {23, 32, 12, 45, 56, 67, 7, 89, 80, 96}
sub_set_list = [{23, 32, 12, 45}, {32, 12, 45, 56}, {56, 67, 7, 89}, {80, 96}, {12, 45, 56, 67, 7, 89}, {7, 89, 80, 96}, {89, 80, 96}]
def get_min_sub_set_list(universalSet, subSetList):
set_ds = [[i, len(i)] for i in subSetList]
temp_set = set()
set_... |
class RMCError(Exception):
def __init__(self, message):
Exception.__init__(self, message)
self.__line_number=None
def set_line_number(self, new_line_number):
self.__line_number=new_line_number
def get_line_number(self):
return self.__line_number
... | class Rmcerror(Exception):
def __init__(self, message):
Exception.__init__(self, message)
self.__line_number = None
def set_line_number(self, new_line_number):
self.__line_number = new_line_number
def get_line_number(self):
return self.__line_number
def as_nonneg_int(lite... |
TO_BIN = {'0': '0000', '1': '0001', '2': '0010', '3': '0011',
'4': '0100', '5': '0101', '6': '0110', '7': '0111',
'8': '1000', '9': '1001', 'a': '1010', 'b': '1011',
'c': '1100', 'd': '1101', 'e': '1110', 'f': '1111'}
TO_HEX = {v: k for k, v in TO_BIN.iteritems()}
def hex_to_bin(hex_stri... | to_bin = {'0': '0000', '1': '0001', '2': '0010', '3': '0011', '4': '0100', '5': '0101', '6': '0110', '7': '0111', '8': '1000', '9': '1001', 'a': '1010', 'b': '1011', 'c': '1100', 'd': '1101', 'e': '1110', 'f': '1111'}
to_hex = {v: k for (k, v) in TO_BIN.iteritems()}
def hex_to_bin(hex_string):
return ''.join((TO_B... |
def table(positionsList):
print("\n\t Tic-Tac-Toe")
print("\t~~~~~~~~~~~~~~~~~")
print("\t|| {} || {} || {} ||".format(positionsList[0], positionsList[1], positionsList[2]))
print("\t|| {} || {} || {} ||".format(positionsList[3], positionsList[4], positionsList[5]))
print("\t|| {} || {} || {} ||".... | def table(positionsList):
print('\n\t Tic-Tac-Toe')
print('\t~~~~~~~~~~~~~~~~~')
print('\t|| {} || {} || {} ||'.format(positionsList[0], positionsList[1], positionsList[2]))
print('\t|| {} || {} || {} ||'.format(positionsList[3], positionsList[4], positionsList[5]))
print('\t|| {} || {} || {} ||'.... |
def Spline(*points):
assert len(points) >= 2
return _SplineEval(points, _SplineNormal(points))
def Spline1(points, s0, sn):
assert len(points) >= 2
points = tuple(points)
s0 = float(s0)
sn = float(sn)
return _SplineEval(points, _SplineFirstDeriv(points, s0, sn))
def _IPolyMult(prod, poly):
if not pr... | def spline(*points):
assert len(points) >= 2
return __spline_eval(points, __spline_normal(points))
def spline1(points, s0, sn):
assert len(points) >= 2
points = tuple(points)
s0 = float(s0)
sn = float(sn)
return __spline_eval(points, __spline_first_deriv(points, s0, sn))
def _i_poly_mult(p... |
def find_missing_number(c):
b = max(c)
d = min(c + [0]) if min(c) == 1 else min(c)
v = set(range(d, b)) - set(c)
return list(v)[0] if v != set() else None
print(find_missing_number([1, 3, 2, 4]))
print(find_missing_number([0, 2, 3, 4, 5]))
print(find_missing_number([9, 7, 5, 8]))
| def find_missing_number(c):
b = max(c)
d = min(c + [0]) if min(c) == 1 else min(c)
v = set(range(d, b)) - set(c)
return list(v)[0] if v != set() else None
print(find_missing_number([1, 3, 2, 4]))
print(find_missing_number([0, 2, 3, 4, 5]))
print(find_missing_number([9, 7, 5, 8])) |
load("@bazel_skylib//lib:dicts.bzl", "dicts")
# load("//ocaml:providers.bzl", "CcDepsProvider")
load("//ocaml/_functions:module_naming.bzl", "file_to_lib_name")
## see: https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/common/cc/cc_import.bzl
## does this still apply?
# "Library outputs ... | load('@bazel_skylib//lib:dicts.bzl', 'dicts')
load('//ocaml/_functions:module_naming.bzl', 'file_to_lib_name')
def dump_library_to_link(ctx, idx, lib):
print(' alwayslink[{i}]: {al}'.format(i=idx, al=lib.alwayslink))
flds = ['static_library', 'pic_static_library', 'interface_library', 'dynamic_library']
f... |
'''
Created on Jan 22, 2013
@author: sesuskic
'''
__all__ = ["ch_flt"]
def ch_flt(filter_k):
chflt_coe_list = {
1 : [-3, -4, 1, 15, 30, 27, -4, -55, -87, -49, 81, 271, 442, 511], # 305k BW (decim-8*3) original PRO2
# 1: [13 17 -8 -15 14 20 -27 -23... | """
Created on Jan 22, 2013
@author: sesuskic
"""
__all__ = ['ch_flt']
def ch_flt(filter_k):
chflt_coe_list = {1: [-3, -4, 1, 15, 30, 27, -4, -55, -87, -49, 81, 271, 442, 511], 2: [0, 3, 12, 22, 23, 5, -34, -72, -75, -11, 127, 304, 452, 511], 3: [4, 10, 17, 18, 5, -22, -55, -71, -47, 33, 160, 304, 417, 460], 4: [... |
N = int(input())
A = [0] + [int(a) for a in input().split()]
B = [0] + [int(a) for a in input().split()]
C = [0] + [int(a) for a in input().split()]
previous = -1
satisfaction = 0
for a in A[1:]:
satisfaction += B[a]
if previous == a-1:
satisfaction += C[a-1]
previous = a
print(satisfaction)
| n = int(input())
a = [0] + [int(a) for a in input().split()]
b = [0] + [int(a) for a in input().split()]
c = [0] + [int(a) for a in input().split()]
previous = -1
satisfaction = 0
for a in A[1:]:
satisfaction += B[a]
if previous == a - 1:
satisfaction += C[a - 1]
previous = a
print(satisfaction) |
#!/usr/bin/python
# Filename: ex_for_before.py
print('Hello')
print('Hello')
print('Hello')
print('Hello')
print('Hello')
| print('Hello')
print('Hello')
print('Hello')
print('Hello')
print('Hello') |
class InvalidDataDirectory(Exception):
"""
Error raised when the chosen intput directory for the dataset is not valid.
"""
| class Invaliddatadirectory(Exception):
"""
Error raised when the chosen intput directory for the dataset is not valid.
""" |
"""
0340. Longest Substring with At Most K Distinct Characters
Medium
Given a string s and an integer k, return the length of the longest substring of s that contains at most k distinct characters.
Example 1:
Input: s = "eceba", k = 2
Output: 3
Explanation: The substring is "ece" with length 3.
Example 2:
Input... | """
0340. Longest Substring with At Most K Distinct Characters
Medium
Given a string s and an integer k, return the length of the longest substring of s that contains at most k distinct characters.
Example 1:
Input: s = "eceba", k = 2
Output: 3
Explanation: The substring is "ece" with length 3.
Example 2:
Input... |
class Solution:
def smallestRange(self, nums: List[List[int]]) -> List[int]:
lo, hi = -100000, 100000
pq = [(lst[0], i, 1) for i, lst in enumerate(nums)]
heapq.heapify(pq)
right = max(lst[0] for lst in nums)
while len(pq) == len(nums):
mn, idx, nxt = heapq.heappop... | class Solution:
def smallest_range(self, nums: List[List[int]]) -> List[int]:
(lo, hi) = (-100000, 100000)
pq = [(lst[0], i, 1) for (i, lst) in enumerate(nums)]
heapq.heapify(pq)
right = max((lst[0] for lst in nums))
while len(pq) == len(nums):
(mn, idx, nxt) = h... |
def snail(arr):
""" Inspired by a solution on Codewars by MMMAAANNN """
matrix = list(arr)
result = []
while matrix:
result.extend(matrix.pop(0))
matrix = zip(*matrix)
matrix.reverse()
return result
| def snail(arr):
""" Inspired by a solution on Codewars by MMMAAANNN """
matrix = list(arr)
result = []
while matrix:
result.extend(matrix.pop(0))
matrix = zip(*matrix)
matrix.reverse()
return result |
# Copyright (C) 2021 Anthony Harrison
# SPDX-License-Identifier: MIT
VERSION: str = "0.1"
| version: str = '0.1' |
'''
File: structures.py
Description: Defines the structures used by socket handler
Date: 26/09/2017
Author: Saurabh Badhwar <sbadhwar@redhat.com>
'''
class ClientList(object):
"""ClientList structure. Used for holding the connected clients list
The general structure looks like:
client_list: {'topic': [cli... | """
File: structures.py
Description: Defines the structures used by socket handler
Date: 26/09/2017
Author: Saurabh Badhwar <sbadhwar@redhat.com>
"""
class Clientlist(object):
"""ClientList structure. Used for holding the connected clients list
The general structure looks like:
client_list: {'topic': [cli... |
# coding: utf-8
"""
Created on 30.07.2018
:author: Polianok Bogdan
"""
class Item:
"""
Class represented Item object in skyskanner website response
"""
def __init__(self, jsonItem):
self.agent_id = jsonItem['agent_id']
self.url = jsonItem['url']
self.transfer_protection = js... | """
Created on 30.07.2018
:author: Polianok Bogdan
"""
class Item:
"""
Class represented Item object in skyskanner website response
"""
def __init__(self, jsonItem):
self.agent_id = jsonItem['agent_id']
self.url = jsonItem['url']
self.transfer_protection = jsonItem['transfer_... |
NEGATIVE_CONSTRUCTS = set([
"ain't",
"can't",
"cannot"
"don't"
"isn't"
"mustn't",
"needn't",
"neither",
"never",
"no",
"nobody",
"none",
"nothing",
"nowhere"
"shan't",
"shouldn't",
"wasn't"
"weren't",
"won't"
])
URLS = r'(https?:\/\/(?:www\.|(... | negative_constructs = set(["ain't", "can't", "cannotdon'tisn'tmustn't", "needn't", 'neither', 'never', 'no', 'nobody', 'none', 'nothing', "nowhereshan't", "shouldn't", "wasn'tweren't", "won't"])
urls = '(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-... |
class Configuration:
port = 5672
security_mechanisms = 'PLAIN'
version_major = 0
version_minor = 9
amqp_version = (0, 0, 9, 1)
secure_response = ''
client_properties = {'client': 'amqpsfw:0.1'}
server_properties = {'server': 'amqpsfw:0.1'}
secure_challenge = 'tratata'
| class Configuration:
port = 5672
security_mechanisms = 'PLAIN'
version_major = 0
version_minor = 9
amqp_version = (0, 0, 9, 1)
secure_response = ''
client_properties = {'client': 'amqpsfw:0.1'}
server_properties = {'server': 'amqpsfw:0.1'}
secure_challenge = 'tratata' |
class TrieNode:
def __init__(self):
self.flag = False
self.children = {}
class Trie(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = TrieNode()
def insert(self, word):
"""
Inserts a word into the trie.... | class Trienode:
def __init__(self):
self.flag = False
self.children = {}
class Trie(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = trie_node()
def insert(self, word):
"""
Inserts a word into the trie.
... |
class Solution(object):
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
pascal_triangle = [None] * 2
for i in range(rowIndex + 1):
row = [0] * (i + 1)
row[0] = 1
row[-1] = 1
for j in range(1, ... | class Solution(object):
def get_row(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
pascal_triangle = [None] * 2
for i in range(rowIndex + 1):
row = [0] * (i + 1)
row[0] = 1
row[-1] = 1
for j in range(1, ... |
# -*- coding: utf-8 -*-
class MissingSender(Exception):
pass
class WrongSenderSecret(Exception):
pass
class NotAllowed(Exception):
pass
class MissingProject(Exception):
pass
class MissingAction(Exception):
pass
| class Missingsender(Exception):
pass
class Wrongsendersecret(Exception):
pass
class Notallowed(Exception):
pass
class Missingproject(Exception):
pass
class Missingaction(Exception):
pass |
# O(j +d) Time and space
def topologicalSort(jobs, deps):
# We will use a class to define the graph:
jobGraph = createJobGraph(jobs, deps)
# Helper function:
return getOrderedJobs(jobGraph)
def getOrderedJobs(jobGraph):
orderedJobs = []
# In this case, we need to take the nodes with NO prereqs
nodesWithNoP... | def topological_sort(jobs, deps):
job_graph = create_job_graph(jobs, deps)
return get_ordered_jobs(jobGraph)
def get_ordered_jobs(jobGraph):
ordered_jobs = []
nodes_with_no_prereqs = list(filter(lambda node: node.numbOfPrereqs == 0, jobGraph.nodes))
while len(nodesWithNoPrereqs):
node = nod... |
mystr = "Anupam"
newstr = ""
# Iterating the loop in backward direction.
# for char in mystr[::-1]:
for char in reversed(mystr):
newstr = newstr + char
print(newstr)
| mystr = 'Anupam'
newstr = ''
for char in reversed(mystr):
newstr = newstr + char
print(newstr) |
#
# PySNMP MIB module F3-TIMEZONE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/F3-TIMEZONE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:11:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (fsp150cm,) = mibBuilder.importSymbols('ADVA-MIB', 'fsp150cm')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_size... |
class EmptyContextManager:
"""
A context manager that does nothing. Only to support conditional change of context managers,
eg in such a way:
>>> if tx_enabled:
>>> ctxt = transaction.atomic
>>> else:
>>> ctxt = EmptyContextManager()
>>> with ctxt:
>>> ...
"""
de... | class Emptycontextmanager:
"""
A context manager that does nothing. Only to support conditional change of context managers,
eg in such a way:
>>> if tx_enabled:
>>> ctxt = transaction.atomic
>>> else:
>>> ctxt = EmptyContextManager()
>>> with ctxt:
>>> ...
"""
d... |
def setup ():
size (500, 500)
smooth ()
background(255)
strokeWeight(30)
noLoop ()
def draw ():
stroke(20)
line(50*1,200,150+50*0,300)
line(50*2,200,150+50*1,300)
line(50*3,200,150+50*2,300)
| def setup():
size(500, 500)
smooth()
background(255)
stroke_weight(30)
no_loop()
def draw():
stroke(20)
line(50 * 1, 200, 150 + 50 * 0, 300)
line(50 * 2, 200, 150 + 50 * 1, 300)
line(50 * 3, 200, 150 + 50 * 2, 300) |
def number_indice_to_string(index)->str:
"""
Convert a number to a string.
"""
indicename = ["x", "y", "z"]
return "".join([indicename[i] for i in index]) | def number_indice_to_string(index) -> str:
"""
Convert a number to a string.
"""
indicename = ['x', 'y', 'z']
return ''.join([indicename[i] for i in index]) |
def validate_pin(pin):
if (len(pin) == 4 or len(pin) == 6) and pin.isdigit():
return True
else:
return False | def validate_pin(pin):
if (len(pin) == 4 or len(pin) == 6) and pin.isdigit():
return True
else:
return False |
"""solved with help, hard """
class Solution:
def convertToTitle(self, n):
"""
:type n: int
:rtype: str
"""
result = []
while n > 0:
n -= 1
result.append(chr(n % 26 + 65))
n = n // 26
return ''.join(result[::-1])
if __nam... | """solved with help, hard """
class Solution:
def convert_to_title(self, n):
"""
:type n: int
:rtype: str
"""
result = []
while n > 0:
n -= 1
result.append(chr(n % 26 + 65))
n = n // 26
return ''.join(result[::-1])
if __na... |
"""Membership operators
@see: https://www.w3schools.com/python/python_operators.asp
Membership operators are used to test if a sequence is presented in an object.
"""
def test_membership_operators():
"""Membership operators"""
# Let's use the following fruit list to illustrate membership concept.
fruit... | """Membership operators
@see: https://www.w3schools.com/python/python_operators.asp
Membership operators are used to test if a sequence is presented in an object.
"""
def test_membership_operators():
"""Membership operators"""
fruit_list = ['apple', 'banana']
assert 'banana' in fruit_list
assert 'pin... |
def moveElementToEnd(array, toMove):
# Write your code here.
left = 0
right = len(array) - 1
while left < right:
if array[right] == toMove:
right -= 1
elif array[left] != toMove:
left += 1
elif array[left] == toMove:
array[left], array[right] ... | def move_element_to_end(array, toMove):
left = 0
right = len(array) - 1
while left < right:
if array[right] == toMove:
right -= 1
elif array[left] != toMove:
left += 1
elif array[left] == toMove:
(array[left], array[right]) = (array[right], array[l... |
people = [
{"name": "Harry", "house":"Gryffibdor"},
{"name": "Ron", "house":"Ravenclaw"},
{"name": "Hermione", "house":"Gryffibdor"}
]
# def f(person):
# return person["house"]
people.sort(key=lambda person: person["house"])
print(people) | people = [{'name': 'Harry', 'house': 'Gryffibdor'}, {'name': 'Ron', 'house': 'Ravenclaw'}, {'name': 'Hermione', 'house': 'Gryffibdor'}]
people.sort(key=lambda person: person['house'])
print(people) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
PIXEL_ON = '#'
PIXEL_OFF = '.'
GROWTH_PER_ITERATION = 3
ITERATIONS_PART_ONE = 2
ITERATIONS_PART_TWO = 50
def filter_to_integer(image, x, y, default_value):
# The image enhancement algorithm describes how to enhance an image by simultaneously
# converting all pixels i... | pixel_on = '#'
pixel_off = '.'
growth_per_iteration = 3
iterations_part_one = 2
iterations_part_two = 50
def filter_to_integer(image, x, y, default_value):
integer = 0
for y_local in range(y - 1, y + 2):
for x_local in range(x - 1, x + 2):
integer <<= 1
if image.get((x_local, y_... |
# FIBONACCI PROBLEM
# Write a function 'fib(N)' that takes in a number as an argument.
# The function should return the nth number of the Fibonnaci sequence.
#
# The 0th number of sequence is 0.
# The 1st number of sequence is 1.
#
# To generate the next number of the sequence,we sum the previous two.
#
# N ... | def fib_brute(N):
if N == 0:
return 0
elif N == 1:
return 1
return fib_brute(N - 1) + fib_brute(N - 2)
def fib_dp(N, cache={}):
if N in cache:
return cache[N]
if N == 0:
return 0
elif N == 1:
return 1
cache[N] = fib_dp(N - 1, cache) + fib_dp(N - 2, ca... |
#lg1009
def exp(n):
ans = 1
for i in range(2, n + 1):
ans *= i
pass
return ans
pass
n = int(input())
tot = 0
for i in range(1, n + 1):
tot += exp(i)
pass
print(tot)
| def exp(n):
ans = 1
for i in range(2, n + 1):
ans *= i
pass
return ans
pass
n = int(input())
tot = 0
for i in range(1, n + 1):
tot += exp(i)
pass
print(tot) |
'''
Problem Description:
------------------
The program takes a file name from the user and
reads the contents of the file in reverse order.
'''
print(__doc__,end="")
print('-'*25)
fileName=input('Enter file name: ')
print('-'*40)
print('Contents of text in reversed order are: ')
for line in reversed(list(o... | """
Problem Description:
------------------
The program takes a file name from the user and
reads the contents of the file in reverse order.
"""
print(__doc__, end='')
print('-' * 25)
file_name = input('Enter file name: ')
print('-' * 40)
print('Contents of text in reversed order are: ')
for line in reversed(list(open... |
class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
if not list1 or not list2:
return list1 if list1 else list2
if list1.val > list2.val:
list1, list2 = list2, list1
list1.next = self.mergeTwoLists(lis... | class Solution:
def merge_two_lists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
if not list1 or not list2:
return list1 if list1 else list2
if list1.val > list2.val:
(list1, list2) = (list2, list1)
list1.next = self.mergeTwoList... |
#exercicio 97
def escreva(txt):
c = len(txt)
print ('-'*c)
print (txt)
print ('-'*c)
escreva (' Exercicio97 ')
escreva (' resolvido ') | def escreva(txt):
c = len(txt)
print('-' * c)
print(txt)
print('-' * c)
escreva(' Exercicio97 ')
escreva(' resolvido ') |
# 74. Search a 2D Matrix
class Solution:
def searchMatrix(self, matrix: [[int]], target: int) -> bool:
"""
Efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
- Integers in each row are sorted from left to right.
- The ... | class Solution:
def search_matrix(self, matrix: [[int]], target: int) -> bool:
"""
Efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
- Integers in each row are sorted from left to right.
- The first integer of each ro... |
class Elemento:
dado = None
anterior = None
proximo = None
def __init__(self, dado, anterior=None, proximo=None):
self.dado = dado
self.anterior = anterior
self.proximo = proximo
class Lista:
cabeca = None
cauda = None
def __init__(self, elemento):
self.ca... | class Elemento:
dado = None
anterior = None
proximo = None
def __init__(self, dado, anterior=None, proximo=None):
self.dado = dado
self.anterior = anterior
self.proximo = proximo
class Lista:
cabeca = None
cauda = None
def __init__(self, elemento):
self.cab... |
"""Storage module for static ids of DataProviders for consistent access.
IDs stored in this module should not be modified programmatically for any reason. Don't do it.
"""
INDICATOR_BLOCK_PROVIDER_ID = "IndicatorBlockProvider"
CLUSTERED_BLOCK_PROVIDER_ID = "ClusteredBlockProvider"
SPLIT_BLOCK_PROVIDER_ID = "Sp... | """Storage module for static ids of DataProviders for consistent access.
IDs stored in this module should not be modified programmatically for any reason. Don't do it.
"""
indicator_block_provider_id = 'IndicatorBlockProvider'
clustered_block_provider_id = 'ClusteredBlockProvider'
split_block_provider_id = 'SplitBlock... |
hexN = '0x41ba0320'
print(hexN)
hexP = hexN[2:]
print (hexP[0:2])
print (hexP[2:4])
print (hexP[4:6])
print (hexP[6:8])
print(hexP)
print("{}.{}.{}.{}".format(hexP[0:2],hexP[2:4],hexP[4:6],hexP[6:8])) | hex_n = '0x41ba0320'
print(hexN)
hex_p = hexN[2:]
print(hexP[0:2])
print(hexP[2:4])
print(hexP[4:6])
print(hexP[6:8])
print(hexP)
print('{}.{}.{}.{}'.format(hexP[0:2], hexP[2:4], hexP[4:6], hexP[6:8])) |
# print('Hello, what is your name?') will type out the text in the ()
print('Hello, what is your name?')
# name = input() means that the name you typed is the answer to the question.
name = input()
# print('your name is '+name) will print the sentence plus the name you put in at name = input().
print('Your name is... | print('Hello, what is your name?')
name = input()
print('Your name is ' + name) |
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.append("fake")
idx=0
ans=[l[0]]
s=set(l)
for i in range(1,n*k+1):
if i not in s:
ans.append(i)
if len(ans)==n:
print(*ans)
idx+=1
ans=[l[idx]] | (n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.append('fake')
idx = 0
ans = [l[0]]
s = set(l)
for i in range(1, n * k + 1):
if i not in s:
ans.append(i)
if len(ans) == n:
print(*ans)
idx += 1
ans = [l[idx]] |
class Solution:
def maxValue(self, grid: List[List[int]]) -> int:
if not grid:
return 0
m, n = len(grid), len(grid[0])
dp = [0] * n
for idx, _ in enumerate(grid[0]):
if idx == 0:
dp[idx] = _
else:
dp[idx] = _ + dp[id... | class Solution:
def max_value(self, grid: List[List[int]]) -> int:
if not grid:
return 0
(m, n) = (len(grid), len(grid[0]))
dp = [0] * n
for (idx, _) in enumerate(grid[0]):
if idx == 0:
dp[idx] = _
else:
dp[idx] = _... |
NON_EMPTY_FILEKEYS = """
.Contents[]
| select(.Size > 0)
| .Key
| select(endswith(".jsonl"))
"""
EMPTY_FILEKEYS = """
.Contents[]
| select(.Size == 0)
| .Key
| select(endswith(".jsonl"))
"""
DELETE_FILTER = """
.ResponseMetadata | {HTTPStatusCode, RetryAtte... | non_empty_filekeys = '\n .Contents[]\n | select(.Size > 0)\n | .Key\n | select(endswith(".jsonl"))\n'
empty_filekeys = '\n .Contents[]\n | select(.Size == 0)\n | .Key\n | select(endswith(".jsonl"))\n'
delete_filter = '\n .ResponseMetadata | {HTTPStatusCode, RetryAttem... |
def yes_no_query():
result = input("[y/n | yes/no]")
result = result.lower()
if result == 'y' or result == 'yes':
return True
elif result == 'n' or result == 'no':
return False
else:
print("[Please Enter yes or no]")
return yes_no_query()
def do_discussion():
# ... | def yes_no_query():
result = input('[y/n | yes/no]')
result = result.lower()
if result == 'y' or result == 'yes':
return True
elif result == 'n' or result == 'no':
return False
else:
print('[Please Enter yes or no]')
return yes_no_query()
def do_discussion():
pas... |
load(
"//rules/common:private/utils.bzl",
_action_singlejar = "action_singlejar",
)
#
# PHASE: binary_deployjar
#
# Writes the optional deploy jar that includes all of the dependencies
#
def phase_binary_deployjar(ctx, g):
main_class = None
if getattr(ctx.attr, "main_class", ""):
main_class = ... | load('//rules/common:private/utils.bzl', _action_singlejar='action_singlejar')
def phase_binary_deployjar(ctx, g):
main_class = None
if getattr(ctx.attr, 'main_class', ''):
main_class = ctx.attr.main_class
_action_singlejar(ctx, inputs=depset([ctx.outputs.jar], transitive=[g.javainfo.java_info.tran... |
"""
Discounts are determined by a combination of user and course, and have a one to one relationship with the enrollment
(if already enrolled) or a join table of user and course. They are determined in LMS, because all of the data for
the business rules exists here. Discount rules are meant to be permanent.
"""
| """
Discounts are determined by a combination of user and course, and have a one to one relationship with the enrollment
(if already enrolled) or a join table of user and course. They are determined in LMS, because all of the data for
the business rules exists here. Discount rules are meant to be permanent.
""" |
def find_pattern(given):
total = len(given)
pattern = given[0]
to_compare = len(pattern)
for i in range(1, total):
for j in range(to_compare):
if given[i][j] != pattern[j]:
pattern = pattern[:j] + '?' + pattern[j + 1:]
return pattern
if __name__ == '__main__':
... | def find_pattern(given):
total = len(given)
pattern = given[0]
to_compare = len(pattern)
for i in range(1, total):
for j in range(to_compare):
if given[i][j] != pattern[j]:
pattern = pattern[:j] + '?' + pattern[j + 1:]
return pattern
if __name__ == '__main__':
... |
"""Some utils to make parsing easier."""
def _string_to_db(stream: str) -> list:
db_values = []
if stream == '':
return db_values
escaped_actual = (
(r'\n', ord('\n')),
(r'\t', ord('\t'))
)
for c, val in escaped_actual:
if c in stream:
a, b = stream.spl... | """Some utils to make parsing easier."""
def _string_to_db(stream: str) -> list:
db_values = []
if stream == '':
return db_values
escaped_actual = (('\\n', ord('\n')), ('\\t', ord('\t')))
for (c, val) in escaped_actual:
if c in stream:
(a, b) = stream.split(c, maxsplit=1)
... |
x = float(input())
n = int(input())
def expo(x, n):
num = 1
den = 1
sumi = 1
if n == 1:
return 1
for cnt in range(1, n):
num *= x
den *= cnt
sumi += num / den
return sumi
print("{:.3f}".format(expo(x, n) ))
| x = float(input())
n = int(input())
def expo(x, n):
num = 1
den = 1
sumi = 1
if n == 1:
return 1
for cnt in range(1, n):
num *= x
den *= cnt
sumi += num / den
return sumi
print('{:.3f}'.format(expo(x, n))) |
# fo =open("/disk/lulu/TCGA11.txt","w")
with open(r"/disk/lulu/TCGA1.txt","r") as TCGA:
temp=[]
cancerlist=[]
cancer =[]
for line in TCGA:
list = line.strip().split("\t")
temp = list[0]
cancerlist.append(temp)
cancer = sorted(set(cancerlist))
print (cancer)
... | with open('/disk/lulu/TCGA1.txt', 'r') as tcga:
temp = []
cancerlist = []
cancer = []
for line in TCGA:
list = line.strip().split('\t')
temp = list[0]
cancerlist.append(temp)
cancer = sorted(set(cancerlist))
print(cancer)
tcg_alist = []
for item in cancer:
... |
# https://www.hackerrank.com/challenges/strange-code/problem?utm_campaign=challenge-recommendation&utm_medium=email&utm_source=24-hour-campaign
starting = 3
index = 1
# time and value seperated by 2 min
time,value = [],[]
for i in range(1,40+1):
time.append(index) # time
value.append(starting) # value
inde... | starting = 3
index = 1
(time, value) = ([], [])
for i in range(1, 40 + 1):
time.append(index)
value.append(starting)
index = starting + index
starting *= 2
cycle = list(zip(time, value))
t = 213921847123
f = 0
for i in range(len(time)):
if (t < time[i]) is True and (t > time[i]) is False:
f ... |
#
# PySNMP MIB module HPN-ICF-EPON-DEVICE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-EPON-DEVICE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:38:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ... |
# Question Link : https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/552/week-4-august-22nd-august-28th/3436/
# Level : Hard
# Solution right below :-
class Solution(object):
def mincostTickets(self, days, costs):
"""
:type days: List[int]
:type costs: List[int]
... | class Solution(object):
def mincost_tickets(self, days, costs):
"""
:type days: List[int]
:type costs: List[int]
:rtype: int
"""
def dp(day):
if day > days[-1]:
return 0
if memo[day]:
return memo[day]
... |
# comprehensive solution
class Solution:
def numJewelsInStones(self, J: str, S: str) -> int:
# https://leetcode.com/problems/jewels-and-stones/discuss/527360/Several-Python-solution.-w-Explanation
jewel = set(J)
return sum( 1 for item in S if item in jewel )
def numJewelsInStones(s... | class Solution:
def num_jewels_in_stones(self, J: str, S: str) -> int:
jewel = set(J)
return sum((1 for item in S if item in jewel))
def num_jewels_in_stones(self, J: str, S: str) -> int:
return sum((S.count(jewel) for jewel in J))
def num_jewels_in_stones(self, J: str, S: str) ->... |
TIEMPO_POR_INSTRUCCION = 15
TIEMPO_AVISO_NO_MOVIMIENTO = 10
constante_cambio_area = 1000 # constante de cambio de area, entre mayor sea el numero, mayor es el area a detectar para cambio, es decir el equivalente a la velocidad de movimiento
valor_cambio = 200 # Constante incremental para cambio de estado [Lavandose_... | tiempo_por_instruccion = 15
tiempo_aviso_no_movimiento = 10
constante_cambio_area = 1000
valor_cambio = 200
status_movimiento = ('MOVE', 'NO_MOVE')
tiempo_volver_lavar_manos = 60 |
# -*- coding=utf-8 -*-
# library: jionlp
# author: dongrixinyu
# license: Apache License 2.0
# Email: dongrixinyu.89@163.com
# github: https://github.com/dongrixinyu/JioNLP
# description: Preprocessing tool for Chinese NLP
def bracket(regular_expression):
return ''.join([r'(', regular_expression, r')'])
def bra... | def bracket(regular_expression):
return ''.join(['(', regular_expression, ')'])
def bracket_absence(regular_expression):
return ''.join(['(', regular_expression, ')?'])
def absence(regular_expression):
return ''.join([regular_expression, '?'])
def start_end(regular_expression):
return ''.join(['^', r... |
t = int(input())
s = "abcdefghijklmnopqrstuvwxyz"
for _ in range(t):
total = 0
l = list(map(int, input().split()))
string = input()
lst = list(set(s) - set(string))
for i in lst:
total += l[ord(i) - ord('a')]
print(total) | t = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(t):
total = 0
l = list(map(int, input().split()))
string = input()
lst = list(set(s) - set(string))
for i in lst:
total += l[ord(i) - ord('a')]
print(total) |
#
# License: BSD
# https://raw.githubusercontent.com/stonier/groot_tools/devel/LICENSE
#
##############################################################################
# Documentation
##############################################################################
"""
Groot tools and utilities
"""
##################... | """
Groot tools and utilities
"""
__version__ = '0.3.2' |
# Fury Incarnate
medal = 1142554
if sm.canHold(medal):
sm.chatScript("You obtained the <Fury Incarnate> medal.")
sm.startQuest(parentID)
sm.completeQuest(parentID) | medal = 1142554
if sm.canHold(medal):
sm.chatScript('You obtained the <Fury Incarnate> medal.')
sm.startQuest(parentID)
sm.completeQuest(parentID) |
#
# PySNMP MIB module WHISP-SM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WHISP-SM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:36:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ... |
"""Class to store customized UI parameters."""
class UIConfig():
"""Stores customized UI parameters."""
def __init__(self, description='Description',
button_text='Submit',
placeholder='Default placeholder',
show_example_form=False):
self.description ... | """Class to store customized UI parameters."""
class Uiconfig:
"""Stores customized UI parameters."""
def __init__(self, description='Description', button_text='Submit', placeholder='Default placeholder', show_example_form=False):
self.description = description
self.button_text = button_text
... |
#
# PySNMP MIB module NETSCREEN-SERVICE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-SERVICE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:20:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ... |
#
# PySNMP MIB module DT1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DT1-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:39:59 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ... |
# Copyright (c) 2006-2010 Tampere University of Technology
#
# 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, copy, modi... | """
This module implements the basis for logging system where many logger
objects may share the same targets and any logger object may have many
targets.
LoggerBase class shows the interface which every logger should
implement. When inherited, you should implement log,
_really_open_target and _really_close_target meth... |
print(''' _____
.-" .-. "-.
_/ '=(0.0)=' \_
/` .='|m|'=. `\
\________________ /
.--.__///`'-,__~\\\\~`
/ /6|__\// a (__)-\\\\
\ \/--`(( ._\ ,)))
/ \\ ))\ -==- (O)(
/ )\((((\ . /)))))
/ _.' / __(`~~~~`)__
//"\... | print(' _____\n .-" .-. "-.\n _/ \'=(0.0)=\' \\_\n /` .=\'|m|\'=. ` \\________________ /\n .--.__///`\'-,__~\\\\~`\n / /6|__\\// a (__)-\\\\\n \\ \\/--`(( ._\\ ,)))\n / \\ ))\\ -==- (O)(\n / )\\((((\\ . /)))))\n / _.\' / ... |
'''
Created on Dec 20, 2016
@author: bardya
'''
# HOG_herit = [0,1,2]
#
# hogset = set()
#
# for i in HOG_herit:
# fh = open("/share/project/bardya/Enterobacteriaceae/OMA_prot/HOGLevel_Gains/{}".format(i), 'r')
# hogset |= set([line.strip() for line in fh if line.strip()])
# fh.close()
#
# fh2 = ... | """
Created on Dec 20, 2016
@author: bardya
"""
hog_herit = [0]
hogset = set()
fh = open('/share/project/bardya/Enterobacteriaceae/OMA_prot/HOGLevel_Gains/{}'.format(HOG_herit[0]), 'r')
hogset |= set([line.strip() for line in fh if line.strip()])
fh.close()
lca_set = []
for i in hogset:
i_sample = i.replace('.fa',... |
class FModifierEnvelopeControlPoint:
frame = None
max = None
min = None
| class Fmodifierenvelopecontrolpoint:
frame = None
max = None
min = None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.