content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Copyright 2016 Savoir-faire Linux
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Web No Bubble",
"version": "14.0.1.0.0",
"author": "Savoir-faire Linux, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"category": ... | {'name': 'Web No Bubble', 'version': '14.0.1.0.0', 'author': 'Savoir-faire Linux, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/web', 'license': 'AGPL-3', 'category': 'Web', 'summary': 'Remove the bubbles from the web interface', 'depends': ['web'], 'data': ['views/web_no_bubble.xml'], 'installa... |
# https://adventofcode.com/2019/day/5
#
# --- Day 2: 1202 Program Alarm ---
#
# --- Day 5: Sunny with a Chance of Asteroids ---
#
def loadintCode(fname='input'):
with open(fname, 'r') as f:
l = list(f.read().split(','))
p = [int(x) for x in l]
return p
def printIndexValue(L, pos=0):
... | def loadint_code(fname='input'):
with open(fname, 'r') as f:
l = list(f.read().split(','))
p = [int(x) for x in l]
return p
def print_index_value(L, pos=0):
longest = len(str(max(L)))
print('[', end='')
for (idx, val) in enumerate(L):
print('{:{width}d},'.format(val, wid... |
class Phone(object):
def __init__(self, phone_number):
phone_number = [char for char in phone_number if char.isdigit()]
if phone_number[:1] == ['1']:
phone_number = phone_number[1:]
if len(phone_number) != 10:
raise ValueError("Insufficient Digits")
if (int(ph... | class Phone(object):
def __init__(self, phone_number):
phone_number = [char for char in phone_number if char.isdigit()]
if phone_number[:1] == ['1']:
phone_number = phone_number[1:]
if len(phone_number) != 10:
raise value_error('Insufficient Digits')
if int(p... |
# -*- coding: utf-8 -*-
__title__ = u'django-flexisettings'
# semantic versioning, check http://semver.org/
__version__ = u'0.3.1'
__author__ = u'Stefan Berder <stefan.berder@ledapei.com>'
__copyright__ = u'Copyright 2012-2013, Heatwave fashion Ltd., ' \
u'all rights reserved'
| __title__ = u'django-flexisettings'
__version__ = u'0.3.1'
__author__ = u'Stefan Berder <stefan.berder@ledapei.com>'
__copyright__ = u'Copyright 2012-2013, Heatwave fashion Ltd., all rights reserved' |
def solution(p):
answer = p + 1
while(not isBeautifulYear(answer)):
answer += 1
return answer
def isBeautifulYear(year):
years = list(map(int, str(year)))
return len(set([x for x in years])) == len(years)
print(solution(1987)) | def solution(p):
answer = p + 1
while not is_beautiful_year(answer):
answer += 1
return answer
def is_beautiful_year(year):
years = list(map(int, str(year)))
return len(set([x for x in years])) == len(years)
print(solution(1987)) |
def split_and_add(numbers, n):
temp=[]
count=0
while count<n:
for i in range(0,len(numbers)//2):
temp.append(numbers[0])
numbers.pop(0)
if not temp:
return numbers
if len(temp)<len(numbers):
for i in range(0,len(temp)):
... | def split_and_add(numbers, n):
temp = []
count = 0
while count < n:
for i in range(0, len(numbers) // 2):
temp.append(numbers[0])
numbers.pop(0)
if not temp:
return numbers
if len(temp) < len(numbers):
for i in range(0, len(temp)):
... |
if __name__ == "__main__":
with open("file.txt", "r", encoding="utf-8") as f:
a = f.readlines()
for i in a:
if "," in i:
print(i)
| if __name__ == '__main__':
with open('file.txt', 'r', encoding='utf-8') as f:
a = f.readlines()
for i in a:
if ',' in i:
print(i) |
description='HRPT Graphit Filter via SPS-S5'
devices = dict(
graphit=device('nicos_sinq.amor.devices.sps_switch.SpsSwitch',
description='Graphit filter controlled by SPS',
epicstimeout=3.0,
readpv='SQ:HRPT:SPS1:DigitalInput',
... | description = 'HRPT Graphit Filter via SPS-S5'
devices = dict(graphit=device('nicos_sinq.amor.devices.sps_switch.SpsSwitch', description='Graphit filter controlled by SPS', epicstimeout=3.0, readpv='SQ:HRPT:SPS1:DigitalInput', commandpv='SQ:HRPT:SPS1:Push', commandstr='S0001', byte=4, bit=4, mapping={'OFF': False, 'ON'... |
# BUILD FILE SYNTAX: SKYLARK
SE_VERSION = '3.11.0'
| se_version = '3.11.0' |
def main(filepath):
rows = []
#file load
with open(filepath) as file:
for line in file:
rows.append(line)
counter = 0
counter2 = 0
for entry in rows:
entry = entry.split(" ")
letter = entry[1][0]
entry[0] = entry[0].split("-")
low =... | def main(filepath):
rows = []
with open(filepath) as file:
for line in file:
rows.append(line)
counter = 0
counter2 = 0
for entry in rows:
entry = entry.split(' ')
letter = entry[1][0]
entry[0] = entry[0].split('-')
low = entry[0][0]
high =... |
x = range(1, 5, 9)
for n in x:
print(n)
| x = range(1, 5, 9)
for n in x:
print(n) |
class StudySeries(object):
def __init__(self, study_object, study_data=None):
'''
Takes study object
'''
assert hasattr(study_object, "__call__"), "invalid study object"
self.study = study_object
if study_data:
self.update(study... | class Studyseries(object):
def __init__(self, study_object, study_data=None):
"""
Takes study object
"""
assert hasattr(study_object, '__call__'), 'invalid study object'
self.study = study_object
if study_data:
self.update(study_data)
def up... |
TRPOconfig = {
'cg_damping': 1e-3,
'GAE_lambda': 0.,
'reward_decay': 0.98,
'max_kl_divergence': 2e-5,
'hidden_layers': [256, 256, 256],
'hidden_layers_v': [256, 256, 256],
'max_grad_norm': None,
'value_lr': 5e-4,
'train_v_iters': 20,
'lr_pi': 5e-4,
'steps_per_iter'... | trp_oconfig = {'cg_damping': 0.001, 'GAE_lambda': 0.0, 'reward_decay': 0.98, 'max_kl_divergence': 2e-05, 'hidden_layers': [256, 256, 256], 'hidden_layers_v': [256, 256, 256], 'max_grad_norm': None, 'value_lr': 0.0005, 'train_v_iters': 20, 'lr_pi': 0.0005, 'steps_per_iter': 3200, 'value_func_type': 'FC'}
TRPOconfig['mem... |
transverse_run5 = [
6165044,
6165046,
6165047,
6165055,
6165058,
6165059,
6165063,
6166051,
6166052,
6166054,
6166055,
6166056,
6166057,
6166059,
6166060,
6166061,
6166070,
6166071,
6166073,
6166074,
6166075,
6166076,
6166090,
6166091,
#6166101, ## no relative luminosities
6167079,
6167083,
6167088
]
## transverse run... | transverse_run5 = [6165044, 6165046, 6165047, 6165055, 6165058, 6165059, 6165063, 6166051, 6166052, 6166054, 6166055, 6166056, 6166057, 6166059, 6166060, 6166061, 6166070, 6166071, 6166073, 6166074, 6166075, 6166076, 6166090, 6166091, 6167079, 6167083, 6167088]
transverse_run6_iucf = [7098001, 7098002, 7098004, 7098006... |
class Details:
def __init__(self, details):
self.details = details
def __getattr__(self, attr):
if attr in self.details:
return self.details[attr]
else:
raise AttributeError('{attr} is not a valid attribute of Details'.format(attr))
@property
def all(se... | class Details:
def __init__(self, details):
self.details = details
def __getattr__(self, attr):
if attr in self.details:
return self.details[attr]
else:
raise attribute_error('{attr} is not a valid attribute of Details'.format(attr))
@property
def all(s... |
# Aula 18 - Listas (Parte 2)
teste = list()
teste.append('Marieliton')
teste.append(33)
galera = list()
#galera.append(teste) # fazer isso cria uma dependencia entre as listas
galera.append(teste[:]) # isso faz a copia da lista sem criar dependencia
print(galera)
teste[0] = 'Maria'
teste[1] = 22
print(teste)
galera.... | teste = list()
teste.append('Marieliton')
teste.append(33)
galera = list()
galera.append(teste[:])
print(galera)
teste[0] = 'Maria'
teste[1] = 22
print(teste)
galera.append(teste)
print(galera)
galera = [['Joao', 19], ['Ana', 31], ['Manoel', 42], ['Maria', 51]]
for pessoa in galera:
print(f'{pessoa[0]} tem {pessoa[... |
expected_output = {
"Ethernet1/1": {
"advertising_code": "Passive Cu",
"cable_attenuation": "0/0/0/0/0 dB for bands 5/7/12.9/25.8/56 " "GHz",
"cable_length": 2.0,
"cis_part_number": "37-1843-01",
"cis_product_id": "QDD-400-CU2M",
"cis_version_id": "V01",
"cisc... | expected_output = {'Ethernet1/1': {'advertising_code': 'Passive Cu', 'cable_attenuation': '0/0/0/0/0 dB for bands 5/7/12.9/25.8/56 GHz', 'cable_length': 2.0, 'cis_part_number': '37-1843-01', 'cis_product_id': 'QDD-400-CU2M', 'cis_version_id': 'V01', 'cisco_id': '0x18', 'clei': 'CMPQAGSCAA', 'cmis_ver': 4, 'date_code': ... |
a=input().split();r=5000
for i in a:
if i=='1':
r-=500
elif i=='2':
r-=800
else:
r-=1000
print(r)
| a = input().split()
r = 5000
for i in a:
if i == '1':
r -= 500
elif i == '2':
r -= 800
else:
r -= 1000
print(r) |
# https://leetcode.com/problems/clone-graph/description/
#
# algorithms
# Medium (25.08%)
# Total Accepted: 180.2K
# Total Submissions: 718.5K
# beats 50.23% of python submissions
# Definition for a undirected graph node
# class UndirectedGraphNode:
# def __init__(self, x):
# self.label = x
# se... | class Solution:
def __init__(self):
self.hash_map = {}
def clone_graph(self, node):
if not node:
return node
new_node = undirected_graph_node(node.label)
self.hash_map[node.label] = new_node
for neighbor in node.neighbors:
if neighbor.label in se... |
def preprocess_input(date, state_holiday):
day, month = (int(date.split(" ")[0]), int(date.split(" ")[1]))
if state_holiday == 'a':
state_holiday = 1
elif state_holiday == 'b':
state_holiday = 2
elif state_holiday == 'c':
state_holiday = 3
else:
state_holiday = 0
return day, month, state_holiday | def preprocess_input(date, state_holiday):
(day, month) = (int(date.split(' ')[0]), int(date.split(' ')[1]))
if state_holiday == 'a':
state_holiday = 1
elif state_holiday == 'b':
state_holiday = 2
elif state_holiday == 'c':
state_holiday = 3
else:
state_holiday = 0
... |
class dotDrawText_t(object):
# no doc
aText=None
Color=None
Location=None
| class Dotdrawtext_T(object):
a_text = None
color = None
location = None |
numeros = [-12, 84, 13, 20, -33, 101, 9]
def separar(lista):
pares = []
impares = []
for numero in lista:
if numero%2 == 0:
pares.append(numero)
else:
impares.append(numero)
return pares, impares
pares, impares = separar(numeros)
print(pares)
print(impares)
| numeros = [-12, 84, 13, 20, -33, 101, 9]
def separar(lista):
pares = []
impares = []
for numero in lista:
if numero % 2 == 0:
pares.append(numero)
else:
impares.append(numero)
return (pares, impares)
(pares, impares) = separar(numeros)
print(pares)
print(impares) |
# callback handlers: reloaded each time triggered
def message1(): # change me
print('spamSpamSPAM') # or could build a dialog...
def message2(self):
print('Ni! Ni!') # change me
self.method1() # access the 'Hello' instance...
| def message1():
print('spamSpamSPAM')
def message2(self):
print('Ni! Ni!')
self.method1() |
class DetailModel:
class Mesh:
def __init__(self):
self.vertices_count = None
self.indices_count = None
self.uv_map_name = 'Texture'
self.bpy_mesh = None
self.bpy_material = None
def __init__(self):
self.shader = None
self.tex... | class Detailmodel:
class Mesh:
def __init__(self):
self.vertices_count = None
self.indices_count = None
self.uv_map_name = 'Texture'
self.bpy_mesh = None
self.bpy_material = None
def __init__(self):
self.shader = None
self.te... |
def fibonacci_numbers(ul: int) -> int:
numbers: list = []
a: int = 0
b: int = 1
total: int = 0
while (total <= ul):
numbers.append(total)
a = b
b = total
total = a + b
return sum(filter(lambda x: not x % 2, numbers))
if __name__ == '__main__':
t: int = int(i... | def fibonacci_numbers(ul: int) -> int:
numbers: list = []
a: int = 0
b: int = 1
total: int = 0
while total <= ul:
numbers.append(total)
a = b
b = total
total = a + b
return sum(filter(lambda x: not x % 2, numbers))
if __name__ == '__main__':
t: int = int(input... |
nm = input().split()
n = int(nm[0])
m = int(nm[1])
mt = []
for _ in range(n):
matrix_item = input()
mt.append(matrix_item)
p=0
print(mt)
k = int(input())
for i in range(n):
for j in range(m):
if(mt[i][j]=="M"):
print(i,j)
for i in range(n):
for ... | nm = input().split()
n = int(nm[0])
m = int(nm[1])
mt = []
for _ in range(n):
matrix_item = input()
mt.append(matrix_item)
p = 0
print(mt)
k = int(input())
for i in range(n):
for j in range(m):
if mt[i][j] == 'M':
print(i, j)
for i in range(n):
for j in range(... |
class Formatter:
def __init__(self):
pass
def format(self, args, data):
if args.vba:
self.format_VBA(args,data)
elif args.csharp:
self.format_CSharp(args,data)
elif args.cpp:
self.format_CPP(args,data)
elif args.raw:
... | class Formatter:
def __init__(self):
pass
def format(self, args, data):
if args.vba:
self.format_VBA(args, data)
elif args.csharp:
self.format_CSharp(args, data)
elif args.cpp:
self.format_CPP(args, data)
elif args.raw:
pr... |
M = int(input())
N = int(input())+1
numbers = []
for i in range(M,N):
c = 0
for j in range(1,i+1):
if i%j == 0:
c += 1
if c > 2:
break
if c == 2:
numbers.append(i)
if sum(numbers) == 0:
print(-1)
else:
print(sum(numbers),min(numbers),sep='\n') | m = int(input())
n = int(input()) + 1
numbers = []
for i in range(M, N):
c = 0
for j in range(1, i + 1):
if i % j == 0:
c += 1
if c > 2:
break
if c == 2:
numbers.append(i)
if sum(numbers) == 0:
print(-1)
else:
print(sum(numbers), min(numbers), sep='\n'... |
_base_ = ["../../_base_/gdrn_base.py"]
OUTPUT_DIR = "output/gdrn_selfocc/lm/mm_r50v1d_a6_cPnP_GN_gelu_lm13"
INPUT = dict(
DZI_PAD_SCALE=1.5,
COLOR_AUG_PROB=0.0,
COLOR_AUG_TYPE="code",
COLOR_AUG_CODE=(
"Sequential(["
"Sometimes(0.4, CoarseDropout( p=0.1, size_percent=0.05) ),"
# ... | _base_ = ['../../_base_/gdrn_base.py']
output_dir = 'output/gdrn_selfocc/lm/mm_r50v1d_a6_cPnP_GN_gelu_lm13'
input = dict(DZI_PAD_SCALE=1.5, COLOR_AUG_PROB=0.0, COLOR_AUG_TYPE='code', COLOR_AUG_CODE='Sequential([Sometimes(0.4, CoarseDropout( p=0.1, size_percent=0.05) ),Sometimes(0.5, GaussianBlur(np.random.rand())),Some... |
N,K=map(int,input().split())
x=list(map(int,input().split()))
n=N-K+1
left=[0]*n
for i in range(n):left[i]=abs(x[i])+abs(x[i]-x[i+K-1])
x=x[::-1]
right=[0]*n
for i in range(n):right[i]=abs(x[i])+abs(x[i]-x[i+K-1])
print(min(min(left),min(right))) | (n, k) = map(int, input().split())
x = list(map(int, input().split()))
n = N - K + 1
left = [0] * n
for i in range(n):
left[i] = abs(x[i]) + abs(x[i] - x[i + K - 1])
x = x[::-1]
right = [0] * n
for i in range(n):
right[i] = abs(x[i]) + abs(x[i] - x[i + K - 1])
print(min(min(left), min(right))) |
'''
Created on Mar 13, 2021
@author: mballance
'''
print("SystemVerilog generator") | """
Created on Mar 13, 2021
@author: mballance
"""
print('SystemVerilog generator') |
def calc_combinations(names, n, combs=[]):
if len(combs) == n:
print(", ".join(combs))
for i in range(len(names)):
name = names[i]
combs.append(name)
calc_combinations(names[i+1:], n, combs)
combs.pop()
names = input().split(", ")
n = int(input())
calc_combinations(... | def calc_combinations(names, n, combs=[]):
if len(combs) == n:
print(', '.join(combs))
for i in range(len(names)):
name = names[i]
combs.append(name)
calc_combinations(names[i + 1:], n, combs)
combs.pop()
names = input().split(', ')
n = int(input())
calc_combinations(name... |
#! /usr/bin/python3
def partOne(arr):
timeStamp = int(arr[0])
busses = []
tmp = [x for x in arr[1].split(',')]
for x in tmp:
if x != 'x':
busses.append(int(x))
maxTime = max(busses)
calculateTimeStamp = timeStamp + maxTime
# shortest waittime ?
# find bus near timest... | def part_one(arr):
time_stamp = int(arr[0])
busses = []
tmp = [x for x in arr[1].split(',')]
for x in tmp:
if x != 'x':
busses.append(int(x))
max_time = max(busses)
calculate_time_stamp = timeStamp + maxTime
busses.sort()
sol = {}
keys = []
for y in busses:
... |
def main(request, response):
if b'mime' in request.GET:
return [(b'Content-Type', request.GET[b'mime'])], b""
return [], b""
| def main(request, response):
if b'mime' in request.GET:
return ([(b'Content-Type', request.GET[b'mime'])], b'')
return ([], b'') |
N = int(input())
if -(2 ** 31) <= N < 2 ** 31:
print("Yes")
else:
print("No") | n = int(input())
if -2 ** 31 <= N < 2 ** 31:
print('Yes')
else:
print('No') |
def motif_and_its_rev_comp_counter(motif, sample):
counter_of_motif = 0
counter_of_res_comp_motif = 0
for i in range(len(sample)):
if sample.startswith(motif, i):
counter_of_motif += 1
comp_pairs = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
rev_comp_of_motif = ''
for i in moti... | def motif_and_its_rev_comp_counter(motif, sample):
counter_of_motif = 0
counter_of_res_comp_motif = 0
for i in range(len(sample)):
if sample.startswith(motif, i):
counter_of_motif += 1
comp_pairs = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
rev_comp_of_motif = ''
for i in motif... |
#!/usr/bin/env python3
# coding: utf8
if __name__ == "__main__":
pass
| if __name__ == '__main__':
pass |
def piece_wise_linear_fn(x, y_0,y_1,x_0,x_1):
'''
This fn computes y_0 + (y_1 - y_0)/(x_1-x_0)*(x - x_0),
i.e. a fn with offset y_0 and slope (y_1 - y_0)/(x_1-x_0)
before x_0 the value is returned as y_0
after x_1 the value is returned as y_1
:param y_0:
:param y_1:
:param x_0:
:para... | def piece_wise_linear_fn(x, y_0, y_1, x_0, x_1):
"""
This fn computes y_0 + (y_1 - y_0)/(x_1-x_0)*(x - x_0),
i.e. a fn with offset y_0 and slope (y_1 - y_0)/(x_1-x_0)
before x_0 the value is returned as y_0
after x_1 the value is returned as y_1
:param y_0:
:param y_1:
:param x_0:
:p... |
#
# PySNMP MIB module Nortel-Magellan-Passport-VnsMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-VnsMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pytho... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
def selection_sort(ar):
n = len(ar)
for k in range(n):
minimal = k
for j in range(k + 1, n):
if ar[j] < ar[minimal]:
minimal = j
print(k, j, minimal, ar)
ar[k], ar[minimal] = ar[minimal], ar[k]
return ar
ar = [1, 5, 2, 7, 9, 6]
res = sele... | def selection_sort(ar):
n = len(ar)
for k in range(n):
minimal = k
for j in range(k + 1, n):
if ar[j] < ar[minimal]:
minimal = j
print(k, j, minimal, ar)
(ar[k], ar[minimal]) = (ar[minimal], ar[k])
return ar
ar = [1, 5, 2, 7, 9, 6]
res = se... |
# The Nexus software is licensed under the BSD 2-Clause license.
#
# You should have recieved a copy of this license with the software.
# If you did not, you can find one at the following link.
#
# http://opensource.org/licenses/bsd-license.php
(i,j,k) = (x,y,z)
entitylist.append(["fish",(x,y,z),7,7,(i,j,k),3,False])... | (i, j, k) = (x, y, z)
entitylist.append(['fish', (x, y, z), 7, 7, (i, j, k), 3, False])
self.client.sendServerMessage('A fish was created.') |
#
# PySNMP MIB module ONEACCESS-BRIDGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-BRIDGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:34:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, single_value_constraint, value_range_constraint) ... |
data = (
((-0.010000, -0.090000), (-0.010000, -0.040000)),
((0.589999, -0.040000), (0.730000, -0.040000)),
((0.990000, -0.980000), (0.990000, -0.840000)),
((0.630000, -0.490000), (0.630000, -0.480000)),
((-0.300000, 0.160000), (-0.250000, 0.160000)),
((0.440000, -0.190000), (0.440000, -0.240000)),
((0.150000, -0.630000... | data = (((-0.01, -0.09), (-0.01, -0.04)), ((0.589999, -0.04), (0.73, -0.04)), ((0.99, -0.98), (0.99, -0.84)), ((0.63, -0.49), (0.63, -0.48)), ((-0.3, 0.16), (-0.25, 0.16)), ((0.44, -0.19), (0.44, -0.24)), ((0.15, -0.63), (0.15, -0.68)), ((0.429999, -0.54), (0.29, -0.54)), ((-0.690001, 0.2), (-0.75, 0.2)), ((0.929999, -... |
name1 = "Atilla"
for ch in name1:
print(ch)
| name1 = 'Atilla'
for ch in name1:
print(ch) |
def add_feather_vertex(location=(0.0, 0.0)):
pass
def add_feather_vertex_slide(MASK_OT_add_feather_vertex=None, MASK_OT_slide_point=None):
pass
def add_vertex(location=(0.0, 0.0)):
pass
def add_vertex_slide(MASK_OT_add_vertex=None, MASK_OT_slide_point=None):
pass
def copy_splines():
pass
d... | def add_feather_vertex(location=(0.0, 0.0)):
pass
def add_feather_vertex_slide(MASK_OT_add_feather_vertex=None, MASK_OT_slide_point=None):
pass
def add_vertex(location=(0.0, 0.0)):
pass
def add_vertex_slide(MASK_OT_add_vertex=None, MASK_OT_slide_point=None):
pass
def copy_splines():
pass
def cy... |
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
r = len(numbers)
for ind in range(r):
goal = target - numbers[ind]
l = ind
while l < r:
m = l + (r - l) // 2
if numbers[m] == goal:
... | class Solution:
def two_sum(self, numbers: List[int], target: int) -> List[int]:
r = len(numbers)
for ind in range(r):
goal = target - numbers[ind]
l = ind
while l < r:
m = l + (r - l) // 2
if numbers[m] == goal:
... |
# Title : TODO
# Objective : TODO
# Created by: Wenzurk
# Created on: 2018/2/6
alien_color = 'green'
# if alien_color == 'green':
# print("You get 5 point.")
# if alien_color == 'yellow':
# print("You are a loser.")
# if alien_color == 'green':
# print("You got 5 point.")
# else:
# print("You got... | alien_color = 'green'
if alien_color == 'green':
print('You got 5 point.')
elif alien_color == 'yellow':
print('You got 10 point.')
elif alien_color == 'red':
print('You got 15 point.') |
expected_output = {
'dir': {
'total_free_bytes': '939092 kbytes',
'files':
{'pnet_cfg.log':
{'permission': '-rw-r--r--', 'date': 'May 10 2017', 'index': '14', 'size': '10429'},
'status_file':
{'permission': '-rw-r--r--', 'date': 'May 10 13:1... | expected_output = {'dir': {'total_free_bytes': '939092 kbytes', 'files': {'pnet_cfg.log': {'permission': '-rw-r--r--', 'date': 'May 10 2017', 'index': '14', 'size': '10429'}, 'status_file': {'permission': '-rw-r--r--', 'date': 'May 10 13:15', 'index': '18', 'size': '2458'}, 'nvgen_traces': {'permission': 'drwxr-xr-x', ... |
'''
Author: your name
Date: 2021-08-16 11:00:16
LastEditTime: 2021-08-16 11:00:17
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /lanenet-lane-detection-pytorch/local_utils/__init__.py
'''
| """
Author: your name
Date: 2021-08-16 11:00:16
LastEditTime: 2021-08-16 11:00:17
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /lanenet-lane-detection-pytorch/local_utils/__init__.py
""" |
arr = [1,2,3,4,6,7,8,9,12,4,2,5,7,2,5,2,1,4,6,3]
# arr = [21,31,43,57,97,89,63,61,51,75,2,4,6,8,0,12,22,24,12,68,62]
print(arr)
lst = list(sorted(arr, key=lambda x: [x % 2, x]))
print(lst)
# f_idx = 0
# b_idx = len(arr) - 1
# while f_idx < b_idx:
# if arr[f_idx] % 2 != 0:
# if arr[b_idx] % 2 != 0:
# ... | arr = [1, 2, 3, 4, 6, 7, 8, 9, 12, 4, 2, 5, 7, 2, 5, 2, 1, 4, 6, 3]
print(arr)
lst = list(sorted(arr, key=lambda x: [x % 2, x]))
print(lst) |
def test_str(RS, str_data):
assert RS(str_data, 0.8) != str_data
assert type(RS(str_data, 0.8)) is str
assert len(RS(str_data, 0.8, repetition=3)) == 3
def test_list(RS, list_data):
assert RS(list_data, 0.8) != list_data
assert type(RS(list_data, 0.8)) is list
assert len(RS(list_data, 0.8, rep... | def test_str(RS, str_data):
assert rs(str_data, 0.8) != str_data
assert type(rs(str_data, 0.8)) is str
assert len(rs(str_data, 0.8, repetition=3)) == 3
def test_list(RS, list_data):
assert rs(list_data, 0.8) != list_data
assert type(rs(list_data, 0.8)) is list
assert len(rs(list_data, 0.8, repe... |
class Solution:
def minArea(self, image: List[List[str]], x: int, y: int) -> int:
m = len(image)
n = len(image[0])
dirs = [0, 1, 0, -1, 0]
topLeft = [x, y]
bottomRight = [x, y]
q = deque([(x, y)])
image[x][y] = '2' # visited
while q:
i, j = q.popleft()
for k in range(4):
... | class Solution:
def min_area(self, image: List[List[str]], x: int, y: int) -> int:
m = len(image)
n = len(image[0])
dirs = [0, 1, 0, -1, 0]
top_left = [x, y]
bottom_right = [x, y]
q = deque([(x, y)])
image[x][y] = '2'
while q:
(i, j) = q.p... |
#@+leo-ver=5-thin
#@+node:ekr.20170428084207.353: * @file ../external/npyscreen/npysNPSFilteredData.py
#@+others
#@+node:ekr.20170428084207.354: ** class NPSFilteredDataBase
class NPSFilteredDataBase:
#@+others
#@+node:ekr.20170428084207.355: *3* __init__
def __init__(self, values=None):
self._value... | class Npsfiltereddatabase:
def __init__(self, values=None):
self._values = None
self._filter = None
self._filtered_values = None
self.set_values(values)
def set_values(self, value):
self._values = value
def get_all_values(self):
return self._values
def... |
my_dictionary = {'name': 'naeim', 'age': 33}
print(my_dictionary['name'])
print(my_dictionary['age'])
print(type(my_dictionary))
print(my_dictionary)
my_dictionary['family'] = 'nobahari'
print(my_dictionary)
for item in my_dictionary:
print(f"your {item} is {my_dictionary[item]}")
del my_dictionary['family']
pri... | my_dictionary = {'name': 'naeim', 'age': 33}
print(my_dictionary['name'])
print(my_dictionary['age'])
print(type(my_dictionary))
print(my_dictionary)
my_dictionary['family'] = 'nobahari'
print(my_dictionary)
for item in my_dictionary:
print(f'your {item} is {my_dictionary[item]}')
del my_dictionary['family']
pri... |
############################################################
# from django.urls import path, include
############################################################
app_name = "adventure"
urlpatterns = []
| app_name = 'adventure'
urlpatterns = [] |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def helper(self, node, cur_sum):
if not node.left and not node.right:
self.ans += cur_sum*2 + node.val
... | class Solution:
def helper(self, node, cur_sum):
if not node.left and (not node.right):
self.ans += cur_sum * 2 + node.val
if node.left:
self.helper(node.left, cur_sum * 2 + node.val)
if node.right:
self.helper(node.right, cur_sum * 2 + node.val)
def... |
#declaration of x
x = "There are %d types of people." % 10
#declaration of a variable
binary = "binary"
#here it is also a variable
do_not = "don't"
#declaretion of y
y = "Those who know %s and those who %s." % (binary,do_not)
# it prints x
print (x + y)
# it prints y
print ("hello '%s' hi" % y) | x = 'There are %d types of people.' % 10
binary = 'binary'
do_not = "don't"
y = 'Those who know %s and those who %s.' % (binary, do_not)
print(x + y)
print("hello '%s' hi" % y) |
class Bracket:
def __init__(self, round16):
self.round16 = round16
self.quarters = [None] * 8
self.semis = [None] * 4
self.finals = [None] * 2
self.thirdPlaceMatch = [None] * 2
# results
self.champion = [None] * 1
self.runnerUp = [None] * 1
sel... | class Bracket:
def __init__(self, round16):
self.round16 = round16
self.quarters = [None] * 8
self.semis = [None] * 4
self.finals = [None] * 2
self.thirdPlaceMatch = [None] * 2
self.champion = [None] * 1
self.runnerUp = [None] * 1
self.third = [None] ... |
#Python 3.X solution for Easy Challenge #0008
#GitHub: https://github.com/Ashkore
#https://www.reddit.com/user/Ashkoree/
string = " bottles of beer on the wall, take one down, pass it around."
bottles = 99
for x in range(bottles+1):
print (str(bottles-x)+string)
#Extra Credit ??
newstring = ""
for x in range(bott... | string = ' bottles of beer on the wall, take one down, pass it around.'
bottles = 99
for x in range(bottles + 1):
print(str(bottles - x) + string)
newstring = ''
for x in range(bottles + 1):
newstring += str(bottles - x) + string
print(newstring) |
# DO NOT SHARE YOUR CREDENTIALS
# Login into your Spotify developer account at https://developer.spotify.com.
# Create an app and visit the Dashboard, go to the app's overview to retrieve the 'Client ID' and 'Client Secret' values.
# Put these values into the variables below.
client_id = ''
client_secret = ''
usernam... | client_id = ''
client_secret = ''
username = ''
redirect_uri = 'http://localhost:8080/' |
# Python Variables
# Variables
# Variables are containers for storing data values.
# Creating Variables
# Python has no command for declaring a variable.
# A variable is created the moment you first assign a value to it.
# Example
x = 5
y = "John"
print(x)
print(y)
# Variables do not need to be declared with any par... | x = 5
y = 'John'
print(x)
print(y)
x = 4
x = 'Vera Kasela'
print(x)
x = str(3)
y = int(3)
z = float(3)
x = 5
y = 'John'
print(type(x))
print(type(y))
x = 'John'
x = 'John'
a = 4
a = 'Sally'
myvar = 'John'
my_var = 'John'
_my_var = 'John'
my_var = 'John'
myvar = 'John'
myvar2 = 'John'
my_variable_name = 'John'
my_variab... |
class Solver:
@staticmethod
def create(board):
return Solver(board)
def __init__(self, board):
self._board = board
def solve(self):
return self._tryToPlaceValidQueen(self._board)
def _tryToPlaceValidQueen(self, solution):
columns = self._getNonThreatenedList(solut... | class Solver:
@staticmethod
def create(board):
return solver(board)
def __init__(self, board):
self._board = board
def solve(self):
return self._tryToPlaceValidQueen(self._board)
def _try_to_place_valid_queen(self, solution):
columns = self._getNonThreatenedList(s... |
def export_tomo_scan_legacy(h, fpath=None):
if fpath is None:
fpath = './'
else:
if not fpath[-1] == '/':
fpath += '/'
scan_type = "tomo_scan"
scan_id = h.start["scan_id"]
try:
x_eng = h.start["XEng"]
except:
x_eng = h.start["x_ray_energy"]
bkg_i... | def export_tomo_scan_legacy(h, fpath=None):
if fpath is None:
fpath = './'
elif not fpath[-1] == '/':
fpath += '/'
scan_type = 'tomo_scan'
scan_id = h.start['scan_id']
try:
x_eng = h.start['XEng']
except:
x_eng = h.start['x_ray_energy']
bkg_img_num = h.start['... |
class Options:
def __init__(self, *, filename: str, collapse_single_pages: bool, strict: bool):
self.filename = filename
self.collapse_single_pages = collapse_single_pages
self.strict = strict
| class Options:
def __init__(self, *, filename: str, collapse_single_pages: bool, strict: bool):
self.filename = filename
self.collapse_single_pages = collapse_single_pages
self.strict = strict |
__all__ = [
'Mouse',
'Render'
]
| __all__ = ['Mouse', 'Render'] |
METRICS = ['cityblock', 'euclidean']
NORMALIZE = 'gaussian'
SUB_SAMPLE = 64_000 # for testing the implementation
MAX_DEPTH = 50 # even though no dataset reaches this far
| metrics = ['cityblock', 'euclidean']
normalize = 'gaussian'
sub_sample = 64000
max_depth = 50 |
# from ..package1 import module1a ValueError: attempted relative import beyond top-level package
def func2a():
print('2a')
| def func2a():
print('2a') |
configs = {
'camera_res': (320, 240),
'crop_top' : 2/6,
'crop_bot' : 5/6,
'exposure' : 3,
'CSIexposure' : 3000,
'CSIframerate': 90
}
cropped_vres = int(configs['camera_res'][1]*(configs['crop_bot'])) - int(configs['camera_res'][1]*(configs['crop_top']))
configs['output_res'] = (configs['ca... | configs = {'camera_res': (320, 240), 'crop_top': 2 / 6, 'crop_bot': 5 / 6, 'exposure': 3, 'CSIexposure': 3000, 'CSIframerate': 90}
cropped_vres = int(configs['camera_res'][1] * configs['crop_bot']) - int(configs['camera_res'][1] * configs['crop_top'])
configs['output_res'] = (configs['camera_res'][0], cropped_vres) |
headPort = "COM5"
i01 = Runtime.createAndStart("i01", "InMoov")
mouthControl=i01.startMouthControl("COM5")
head = i01.startHead(headPort)
leftArm = i01.startLeftArm(headPort)
leftHand = i01.startLeftHand(headPort)
headTracking = i01.startHeadTracking("COM5")
eyesTracking= i01.startEyesTracking("COM5")
i01.headTrac... | head_port = 'COM5'
i01 = Runtime.createAndStart('i01', 'InMoov')
mouth_control = i01.startMouthControl('COM5')
head = i01.startHead(headPort)
left_arm = i01.startLeftArm(headPort)
left_hand = i01.startLeftHand(headPort)
head_tracking = i01.startHeadTracking('COM5')
eyes_tracking = i01.startEyesTracking('COM5')
i01.head... |
class Solution:
def totalNQueens(self, n: int) -> int:
def backtrack(row, cols, diagonals, antiDiagonals):
if row == n:
return 1
solutions = 0
for col in range(n):
currentDiagonal = row - col
currentAntiDiagonal = row + col
... | class Solution:
def total_n_queens(self, n: int) -> int:
def backtrack(row, cols, diagonals, antiDiagonals):
if row == n:
return 1
solutions = 0
for col in range(n):
current_diagonal = row - col
current_anti_diagonal = row... |
s = '''en;q=0.8, de;q=0.7, fr-CH, fr;q=0.9, *;q=0.5'''
accept_language = AcceptLanguage(s)
pobj(accept_language.sarr)
pobj(accept_language.darr)
accept_language.header_type
accept_language.forbidden_header_name
accept_language.cros_safelisted_request_header
accept_language.qsort()
accept_language.rm_locale("CH")
acce... | s = 'en;q=0.8, de;q=0.7, fr-CH, fr;q=0.9, *;q=0.5'
accept_language = accept_language(s)
pobj(accept_language.sarr)
pobj(accept_language.darr)
accept_language.header_type
accept_language.forbidden_header_name
accept_language.cros_safelisted_request_header
accept_language.qsort()
accept_language.rm_locale('CH')
accept_la... |
# Python Program to Calculate Sum of Odd Numbers from 1 to 20
maxnum = 20
oddadd = 0
for num in range(1, maxnum + 1):
if num % 2 != 0:
#print("odd number :",num)
oddadd=oddadd+num
print("Sum of Odd Number from 1 to 20 is:",oddadd)
| maxnum = 20
oddadd = 0
for num in range(1, maxnum + 1):
if num % 2 != 0:
oddadd = oddadd + num
print('Sum of Odd Number from 1 to 20 is:', oddadd) |
#!/usr/bin/env python
NAME = 'Naxsi'
def is_waf(self):
return self.match_header(('X-Data-Origin', '^naxsi'))
| name = 'Naxsi'
def is_waf(self):
return self.match_header(('X-Data-Origin', '^naxsi')) |
#!/usr/bin/env python3
class FuseModel:
def fuse(self, first, second):
raise NotImplementedError()
| class Fusemodel:
def fuse(self, first, second):
raise not_implemented_error() |
table = {"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000}
roman = "MDCLXVI"
number = 0
for ch in roman:
number += table[ch]
print(number) | table = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
roman = 'MDCLXVI'
number = 0
for ch in roman:
number += table[ch]
print(number) |
# STATIC FILES
HOUSING_SECTOR_BILL_FILE = 'static_files/bill.pdf'
PRODUCTS_CSV_FILE = 'static_files/list.csv'
INDEX_CSV_FILE = 'static_files/index.csv'
# URLs
URL_TO_PARSE_FUEL = "https://auto.mail.ru/fuel/"
URL_TO_PARSE_MCD_TICKETS = "https://troikarta.ru/tarify/mcd/"
URL_TO_PARSE_ELECTRICITY_PRICE = "https://www.mo... | housing_sector_bill_file = 'static_files/bill.pdf'
products_csv_file = 'static_files/list.csv'
index_csv_file = 'static_files/index.csv'
url_to_parse_fuel = 'https://auto.mail.ru/fuel/'
url_to_parse_mcd_tickets = 'https://troikarta.ru/tarify/mcd/'
url_to_parse_electricity_price = 'https://www.mosenergosbyt.ru/individua... |
class Solution:
def twoSum(self, numbers, target):
i, j = 0, len(numbers) - 1
while i < j:
ts = numbers[i] + numbers[j]
if ts == target:
break
elif ts > target:
j = j - 1
else:
i = i + 1
return [i... | class Solution:
def two_sum(self, numbers, target):
(i, j) = (0, len(numbers) - 1)
while i < j:
ts = numbers[i] + numbers[j]
if ts == target:
break
elif ts > target:
j = j - 1
else:
i = i + 1
ret... |
'''
Find first missing positive integer (>0)
Given an array of integers, find the first missing positive integer in linear time and constant space.
In other words, find the lowest positive integer that does not exist in the array.
The array can contain duplicates and negative numbers as well.
Note: you can modify the ... | """
Find first missing positive integer (>0)
Given an array of integers, find the first missing positive integer in linear time and constant space.
In other words, find the lowest positive integer that does not exist in the array.
The array can contain duplicates and negative numbers as well.
Note: you can modify the ... |
BASKET_CREATED = 'basket_created'
ADD_ITEM = 'add_item'
ITEM_ADDED = 'item_added'
CHECKOUT = 'checkout'
CHECKOUT_STARTED = 'checkout_started'
PAY_ORDER = 'pay_order'
| basket_created = 'basket_created'
add_item = 'add_item'
item_added = 'item_added'
checkout = 'checkout'
checkout_started = 'checkout_started'
pay_order = 'pay_order' |
def check_scope(func):
def check(self, other):
if not isinstance(other, self.__class__) and type(other) != str:
raise TypeError(f"Cannot compare type Scope with type {type(other).__name__}")
if isinstance(other, self.__class__):
other = other.scope
if other not in sel... | def check_scope(func):
def check(self, other):
if not isinstance(other, self.__class__) and type(other) != str:
raise type_error(f'Cannot compare type Scope with type {type(other).__name__}')
if isinstance(other, self.__class__):
other = other.scope
if other not in s... |
expected_output = {
{
"object_manager_statistics": {
"batch_begin": {
"pending_acknowledgement": 0,
"pending_issue": 0
},
"batch_end": {
"pending_acknowledgement": 0,
"pending_issue": 0
},
"childless_delete_objects": "0",
... | expected_output = {{'object_manager_statistics': {'batch_begin': {'pending_acknowledgement': 0, 'pending_issue': 0}, 'batch_end': {'pending_acknowledgement': 0, 'pending_issue': 0}, 'childless_delete_objects': '0', 'command': '0', 'error_objects': '0', 'object_update': {'pending_acknowledgement': 0, 'pending_issue': 0}... |
# creating a Class of name Employee
class Employee:
# creating a Class Variable
increament = 1.5
# Creating a Constructor of the Class Employee
def __init__(self, fname, lname, salary):
# setting Values to the variables
self.fname = fname
# setting Values to the variables
... | class Employee:
increament = 1.5
def __init__(self, fname, lname, salary):
self.fname = fname
self.lname = lname
self.salary = salary
def increase(self):
self.salary = int(self.salary * Employee.increament)
@classmethod
def change_increament(cls, amount):
c... |
'''
Count sort.
Outperforms the default sorting routine when the range of values is reasonably bounded.
'''
def count_sort(a):
mn, mx = float('inf'), -float('inf')
for x in a:
if x < mn: mn = x
if x > mx: mx = x
counter = [0 for _ in range(mx - mn + 1)]
for x in a:
counter[x - ... | """
Count sort.
Outperforms the default sorting routine when the range of values is reasonably bounded.
"""
def count_sort(a):
(mn, mx) = (float('inf'), -float('inf'))
for x in a:
if x < mn:
mn = x
if x > mx:
mx = x
counter = [0 for _ in range(mx - mn + 1)]
for ... |
name = "alita"
version = "0.3.28"
build_command = "python -m rezutil build {root}"
private_build_requires = ["rezutil-1"]
# Variables unrelated to Rez are typically prefixed with `_`
_data = {
"label": "Alita - Battle Angel",
"icon": "{root}/resources/icon_{width}x{height}.png"
}
_requires = {
"any": [
... | name = 'alita'
version = '0.3.28'
build_command = 'python -m rezutil build {root}'
private_build_requires = ['rezutil-1']
_data = {'label': 'Alita - Battle Angel', 'icon': '{root}/resources/icon_{width}x{height}.png'}
_requires = {'any': ['welcome-1', 'base-1', '~blender==2.80.0', '~maya==2017.0.4|==2018.0.6', '~dev_ma... |
class Coins:
''' Coins class for monetization '''
def __init__(self):
self.quarter = True
| class Coins:
""" Coins class for monetization """
def __init__(self):
self.quarter = True |
firstname = input("Give me your firstname: ")
familyname = input("Give me your lastname: ")
age = int(input("Give me your age: "))
# print(type(age))
print(firstname + familyname + str(age) + "years old")
if age >= 18:
print("You are an adult")
elif age < 16:
print("F U FAGGOT!")
else:
print("Fokking bab... | firstname = input('Give me your firstname: ')
familyname = input('Give me your lastname: ')
age = int(input('Give me your age: '))
print(firstname + familyname + str(age) + 'years old')
if age >= 18:
print('You are an adult')
elif age < 16:
print('F U FAGGOT!')
else:
print('Fokking baby')
print('end program... |
class EmployeeModel:
def __init__(self, eid=0, did=0, name="", money=0):
self.eid = eid
self.did = did
self.name = name
self.money = money
| class Employeemodel:
def __init__(self, eid=0, did=0, name='', money=0):
self.eid = eid
self.did = did
self.name = name
self.money = money |
# cmd blacklist
__blacklist__ = {
"help": "crashes the app (requires unsupported external user input)",
"license": "crashes the app (requires unsupported external user input)"
}
| __blacklist__ = {'help': 'crashes the app (requires unsupported external user input)', 'license': 'crashes the app (requires unsupported external user input)'} |
def function1(x, n):
if n <= 0:
return x
else:
return 1 + function1(x, n - 1)
def function2(a, b):
if a <= 0:
return 1 + function1(a+1, b**a)
else:
return b
def function3(a, b):
if b <= 0:
return a
else:
return a + b + function3(a, b -1)
def fun... | def function1(x, n):
if n <= 0:
return x
else:
return 1 + function1(x, n - 1)
def function2(a, b):
if a <= 0:
return 1 + function1(a + 1, b ** a)
else:
return b
def function3(a, b):
if b <= 0:
return a
else:
return a + b + function3(a, b - 1)
de... |
#Passphrases
#Advent of Code 2017 Day 4
#deal with the file
file = open('input4.txt','r')
input = file.read()
file.close()
lines = input.split("\n")
validLines = 0
def isValid(line):
words = line.split(" ")
#print( str(len(words)))
for x in range( 0, len(words) ):
for y in range( x+1, len(words... | file = open('input4.txt', 'r')
input = file.read()
file.close()
lines = input.split('\n')
valid_lines = 0
def is_valid(line):
words = line.split(' ')
for x in range(0, len(words)):
for y in range(x + 1, len(words)):
if words[x] == words[y]:
return False
return True
for e... |
# 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.
#
# Input: 1->2->4, 1->3->4
# Output: 1->1->2->3->4->4
class ListNode:
def __init__(self, val):
self.val = val
self.next = None
class Solution:
... | class Listnode:
def __init__(self, val):
self.val = val
self.next = None
class Solution:
def merge(self, l1, l2):
newnode = list_node(-1)
node = newnode
while l1 is not None and l2 is not None:
if l1.val <= l2.val:
node.next = l1
... |
rows = [[1 if c == '#' else 0 for c in line[:-1]]
for line in open('input.txt')]
height, width, result = len(rows), len(rows[0]), 1
steps = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
for right, down in steps:
trees, row, col = 0, 0, 0
for row in range(0, height, down):
trees += rows[row][col]
... | rows = [[1 if c == '#' else 0 for c in line[:-1]] for line in open('input.txt')]
(height, width, result) = (len(rows), len(rows[0]), 1)
steps = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
for (right, down) in steps:
(trees, row, col) = (0, 0, 0)
for row in range(0, height, down):
trees += rows[row][col]
... |
def alternatingSort(a):
b = []
i = 0 ; j = len(a)-1
j_turn = True
while (i <= j):
if (j_turn):
b.append(a[i])
i += 1
j_turn = False
else:
b.append(a[j])
j -= 1
j_turn = True
print(b)
alter... | def alternating_sort(a):
b = []
i = 0
j = len(a) - 1
j_turn = True
while i <= j:
if j_turn:
b.append(a[i])
i += 1
j_turn = False
else:
b.append(a[j])
j -= 1
j_turn = True
print(b)
alternating_sort([1, 2, 3, 4... |
def writeuser_tex(text_tex,env):
if env == 1:
text_file = open("latex/user_eq.tex", "w")
text_file.write(r"\begin{align*}")
text_file.write("\n")
text_file.write(r"%s" % text_tex)
text_file.write("\n")
text_file.write(r"\end{align*}")
text_file.close()
e... | def writeuser_tex(text_tex, env):
if env == 1:
text_file = open('latex/user_eq.tex', 'w')
text_file.write('\\begin{align*}')
text_file.write('\n')
text_file.write('%s' % text_tex)
text_file.write('\n')
text_file.write('\\end{align*}')
text_file.close()
eli... |
def subset_sum(numbers, target, partial=[]):
s = sum(partial)
# check if the partial sum is equals to target
if s == target:
return True
elif s > target:
return False # if we reach the number why bother to continue
i=0
while i < len(numbers):
n = numbers[i]
rem... | def subset_sum(numbers, target, partial=[]):
s = sum(partial)
if s == target:
return True
elif s > target:
return False
i = 0
while i < len(numbers):
n = numbers[i]
remaining = numbers[i + 1:]
if subset_sum(remaining, target, partial + [n]) == True:
... |
LEN_TIME = 3
MAPPING_TEXT = {
"Train a l'approche": "APR",
"Train a quai": "QAI",
"Train retarde": "RET",
"A l'approche": "APR",
"A l'arret": "ARR",
"Train arrete": "TAR",
"": "NAV",
"NAV": "NAV",
"UNC": "UNC"
}
def get_timings(returned_page_data):
first_destination = returned... | len_time = 3
mapping_text = {"Train a l'approche": 'APR', 'Train a quai': 'QAI', 'Train retarde': 'RET', "A l'approche": 'APR', "A l'arret": 'ARR', 'Train arrete': 'TAR', '': 'NAV', 'NAV': 'NAV', 'UNC': 'UNC'}
def get_timings(returned_page_data):
first_destination = returned_page_data[0]
first_time = returned_... |
#Add prod locations and copy to file_locations_prod.py
LAST_ID = 'last_id.txt'
LOCK_FILE = 'locked.txt'
LOG_FILE = 'errors.txt'
| last_id = 'last_id.txt'
lock_file = 'locked.txt'
log_file = 'errors.txt' |
book = {"apple": 0.67,
"banana": 1.49,
"milk": 2.3
}
book["avocado"] = 1.5
print(book)
print(book["banana"])
print(book["avocado"]) | book = {'apple': 0.67, 'banana': 1.49, 'milk': 2.3}
book['avocado'] = 1.5
print(book)
print(book['banana'])
print(book['avocado']) |
print ("program mayor menor")
numero1= input ("INTRODUCE UN NUMERO:")
numero1= int (numero1)
numero2= input ("INTRODUCE UN NUMERO:")
numero2= int (numero2)
if numero1<numero2:
print ("Usted Escribio los nmeros %d " %numero1, end="")
print (" y %d" %numero2)
| print('program mayor menor')
numero1 = input('INTRODUCE UN NUMERO:')
numero1 = int(numero1)
numero2 = input('INTRODUCE UN NUMERO:')
numero2 = int(numero2)
if numero1 < numero2:
print('Usted Escribio los nmeros %d ' % numero1, end='')
print(' y %d' % numero2) |
'''
Problem statement: Create a function to find only the root value of x in any quadratic equation ax^2 + bx + c. The function will take three arguments:
- a as the coefficient of x^2
- b as the coefficient of x
- c as the constant term
Problem Link: https://edabit.com/challenge/MDWFcHCTiJfHmwTFx
'''
def quadratic_eq... | """
Problem statement: Create a function to find only the root value of x in any quadratic equation ax^2 + bx + c. The function will take three arguments:
- a as the coefficient of x^2
- b as the coefficient of x
- c as the constant term
Problem Link: https://edabit.com/challenge/MDWFcHCTiJfHmwTFx
"""
def quadratic_eq... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.