content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# List Comprehension is sort of like Map + Filter
numbers_list = range(10)
# Basic list comprehension (map)
doubled = [x * 2 for x in numbers_list]
print(doubled)
# Basic list comprehension (filter)
evens = [x for x in numbers_list if x % 2 == 0]
print(evens)
# list comprehension (map + filter)
doubled_evens = [x *... | numbers_list = range(10)
doubled = [x * 2 for x in numbers_list]
print(doubled)
evens = [x for x in numbers_list if x % 2 == 0]
print(evens)
doubled_evens = [x * 2 for x in numbers_list if x % 2 == 0]
print(doubled_evens)
processed_data = [x * 2 if x % 2 == 0 else x * 10 for x in numbers_list]
print(processed_data) |
#looping in Tuples
#tuple with one element
#tuple unpacking
#list inside tuple
#some function that you can use with tuple
Mixed = (1,2,3,4.0)
#for loop and tuple
for i in Mixed:
print(i)
#you can use while loop too
#tuple with one element
num1 = (1) #that is the class of integer
num2 = (1,) #that is the class of ... | mixed = (1, 2, 3, 4.0)
for i in Mixed:
print(i)
num1 = 1
num2 = (1,)
words = ('word1',)
print(type(num1))
print(type(num2))
print(type(Mixed))
print(type(words))
furit = ('Apple', 'Grapes', 'Mango')
print(type(furit))
furits = ('Apple', 'Mango', 'Peach', 'Orange')
(furit1, furit2, furit3, furit4) = furits
print(fur... |
class classonlymethod(classmethod):
'''
Descriptor for making class only methods.
A `classonly` method is a class method, which can be called only from the
class itself and not from instances. If called from an instance will
raise ``AttributeError``.
'''
def __get__(self, instance, owner):... | class Classonlymethod(classmethod):
"""
Descriptor for making class only methods.
A `classonly` method is a class method, which can be called only from the
class itself and not from instances. If called from an instance will
raise ``AttributeError``.
"""
def __get__(self, instance, owner):... |
ACTIVATED_MSG = (200, "Successfully_activated")
DEACTIVATED_MSG = (200, "Successfully_deactivated")
DELETE_IMG = (204, "image_deleted")
SENT_SMS_MSG = (403, 'Message_Didnt_send')
NOT_SENT_SMS_MSG = (200, 'Message_sent')
NOT_VALID_CODE = (422, 'Code_is_not_valid')
STILL_HAS_VALID_CODE = (403, 'Phone_already_has_valid_co... | activated_msg = (200, 'Successfully_activated')
deactivated_msg = (200, 'Successfully_deactivated')
delete_img = (204, 'image_deleted')
sent_sms_msg = (403, 'Message_Didnt_send')
not_sent_sms_msg = (200, 'Message_sent')
not_valid_code = (422, 'Code_is_not_valid')
still_has_valid_code = (403, 'Phone_already_has_valid_co... |
inutil = input()
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
temp = True
temp2 = True
for index,i in enumerate(b):
if i not in a:
temp = False
for n in b[0:index]:
for m in b[0:index]:
if m+n == i:
temp = True
if not temp:
print(i)
temp2 = False
break
if temp2:
p... | inutil = input()
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
temp = True
temp2 = True
for (index, i) in enumerate(b):
if i not in a:
temp = False
for n in b[0:index]:
for m in b[0:index]:
if m + n == i:
temp = True
i... |
class RenderMethod:
def __init__(self, image):
self.image = image
def to_string(self):
raise NotImplementedError('Renderer::to_string() should be implemented!')
| class Rendermethod:
def __init__(self, image):
self.image = image
def to_string(self):
raise not_implemented_error('Renderer::to_string() should be implemented!') |
#Imprima o valor da soma dos quadrados de 3 numeros inteiras
a = int(input('Digite o valor de a: '))
b = int(input('Digite o valor de b: '))
c = int(input('Digite o valor de c: '))
d = (a**2) + (b**2) + (c**2)
print(f'Resultado: {d}') | a = int(input('Digite o valor de a: '))
b = int(input('Digite o valor de b: '))
c = int(input('Digite o valor de c: '))
d = a ** 2 + b ** 2 + c ** 2
print(f'Resultado: {d}') |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( S , n ) :
found = False
S.sort ( )
for i in range ( n - 1 , - 1 , - 1 ) :
for j in range ( 0 , ... | def f_gold(S, n):
found = False
S.sort()
for i in range(n - 1, -1, -1):
for j in range(0, n):
if i == j:
continue
for k in range(j + 1, n):
if i == k:
continue
for l in range(k + 1, n):
if... |
# Super Spooky Damage Skin
success = sm.addDamageSkin(2433183)
if success:
sm.chat("The Super Spooky Damage Skin has been added to your account's damage skin collection.")
| success = sm.addDamageSkin(2433183)
if success:
sm.chat("The Super Spooky Damage Skin has been added to your account's damage skin collection.") |
# 2 - Dimmensional array
# Is implemented as array of array or list of list in python
# initialize an 2D array
array_2D = [[1, 2, 3, 4],
["a", "b", "c", "d"]]
# or
array_2d = [[5,6,7,8],
[3,5,2,9]]
# print the second item in the first row
print(array_2d[0][1])
print(array_2D[0][1])
# print ... | array_2_d = [[1, 2, 3, 4], ['a', 'b', 'c', 'd']]
array_2d = [[5, 6, 7, 8], [3, 5, 2, 9]]
print(array_2d[0][1])
print(array_2D[0][1])
print(array_2D[1][2])
print(array_2d[1][2])
for row in array_2D:
for item in row:
print(item)
for i in range(len(array_2d)):
for j in range(len(array_2d[i])):
prin... |
#!/usr/bin/python3
#str = input("Please give me an integer: ")
#num = int(str)
num = 20
# I'm guessing we can optionally exception catch.
# Perhaps this alone makes people recommend Python over Java.
# Optional error handling was a feature of BASIC.
if num < 0:
#print(num = 0, "");
# Among other reasons, Python can... | num = 20
if num < 0:
print('Negative..')
elif num == 0:
print('Zero.')
elif num > 0:
print('Positive..')
if False:
pass
elif True:
print('Hmm')
words = ['my IME is not working', 'goodbye']
for w in words:
print(w, len(w))
room = {}
room['bear'] = 'inactive'
room['koala'] = 'active'
room['kangaro... |
STORAGE_ACCOUNT_NAME = " aibootcamp2019sa "
STORAGE_ACCOUNT_KEY = ""
BATCH_ACCOUNT_NAME = "aibootcamp2019ba"
BATCH_ACCOUNT_KEY = ""
BATCH_ACCOUNT_URL = "https://aibootcamp2019ba.westeurope.batch.azure.com"
ACR_LOGINSERVER = "athensaibootcampdemo.azurecr.io"
ACR_USERNAME = "athensaibootcampdemo"
ACR_PASSWORD = "" | storage_account_name = ' aibootcamp2019sa '
storage_account_key = ''
batch_account_name = 'aibootcamp2019ba'
batch_account_key = ''
batch_account_url = 'https://aibootcamp2019ba.westeurope.batch.azure.com'
acr_loginserver = 'athensaibootcampdemo.azurecr.io'
acr_username = 'athensaibootcampdemo'
acr_password = '' |
buf = b""
buf += b"\x48\x31\xc9\x48\x81\xe9\xb1\xff\xff\xff\x48\x8d\x05"
buf += b"\xef\xff\xff\xff\x48\xbb\xf8\x3d\x59\x54\x46\x6d\x59"
buf += b"\x99\x48\x31\x58\x27\x48\x2d\xf8\xff\xff\xff\xe2\xf4"
buf += b"\x04\x75\xda\xb0\xb6\x85\x95\x99\xf8\x3d\x18\x05\x07"
buf += b"\x3d\x0b\xc8\xae\x75\x68\x86\x23\x25\xd2\xcb\x98... | buf = b''
buf += b'H1\xc9H\x81\xe9\xb1\xff\xff\xffH\x8d\x05'
buf += b'\xef\xff\xff\xffH\xbb\xf8=YTFmY'
buf += b"\x99H1X'H-\xf8\xff\xff\xff\xe2\xf4"
buf += b'\x04u\xda\xb0\xb6\x85\x95\x99\xf8=\x18\x05\x07'
buf += b'=\x0b\xc8\xaeuh\x86#%\xd2\xcb\x98u'
buf += b'\xd2\x06^%\xd2\xcb\xd8u\xd2&\x16%V'
buf += b'.\xb2w\x14e\x8f%... |
def separate_speaker(speaker_npz_obj):
all_speaker = sorted(list(set(map(str, speaker_npz_obj.values()))))
all_keys = sorted(list(speaker_npz_obj.keys()))
speaker_individual_keys = [
[
key
for key in all_keys if speaker_npz_obj[key] == speaker
]
for speaker in all_sp... | def separate_speaker(speaker_npz_obj):
all_speaker = sorted(list(set(map(str, speaker_npz_obj.values()))))
all_keys = sorted(list(speaker_npz_obj.keys()))
speaker_individual_keys = [[key for key in all_keys if speaker_npz_obj[key] == speaker] for speaker in all_speaker]
return (all_speaker, speaker_indi... |
def main():
# input
H, W = map(int, input().split())
Ass = [[*map(int, input().split())] for _ in range(H)]
# compute
ansss = []
for i in range(H):
ansss.append([sum(Ass[i])] * W)
for j in range(W):
tmp_sum = 0
for i in range(H):
tmp_sum += Ass[i][j]
... | def main():
(h, w) = map(int, input().split())
ass = [[*map(int, input().split())] for _ in range(H)]
ansss = []
for i in range(H):
ansss.append([sum(Ass[i])] * W)
for j in range(W):
tmp_sum = 0
for i in range(H):
tmp_sum += Ass[i][j]
for i in range(H):
... |
class MonsterClassificationAgent:
def __init__(self):
#If you want to do any initial processing, add it here.
self.default_monster_attributes = {
'size': ['tiny', 'small', 'medium', 'large', 'huge'],
'color': ['black', 'white', 'brown', 'gray', 'red', 'yellow', 'blue', 'gree... | class Monsterclassificationagent:
def __init__(self):
self.default_monster_attributes = {'size': ['tiny', 'small', 'medium', 'large', 'huge'], 'color': ['black', 'white', 'brown', 'gray', 'red', 'yellow', 'blue', 'green', 'orange', 'purple'], 'covering': ['fur', 'feathers', 'scales', 'skin'], 'foot-type': ... |
with open('inputs/input11.txt') as fin:
raw = fin.read()
def parse(raw):
x = tuple(x for x in raw.split('\n'))
return x
a = parse(raw)
def part_1(data):
test = data[:]
test2 = []
while test != test2:
test = data[:]
for i, x in enumerate(data):
for a, b in enumera... | with open('inputs/input11.txt') as fin:
raw = fin.read()
def parse(raw):
x = tuple((x for x in raw.split('\n')))
return x
a = parse(raw)
def part_1(data):
test = data[:]
test2 = []
while test != test2:
test = data[:]
for (i, x) in enumerate(data):
for (a, b) in enum... |
#############################################
### web face setting
#############################################
pretrain_model_path = 'E:/git/project/facenet/model/20180402-114759'
train_mode = 'TRAIN'
classify_mode = 'CLASSIFY'
profile_data_root_path = 'E:/temp/flask-upload-test/'
image_upload_path = 'E:/temp... | pretrain_model_path = 'E:/git/project/facenet/model/20180402-114759'
train_mode = 'TRAIN'
classify_mode = 'CLASSIFY'
profile_data_root_path = 'E:/temp/flask-upload-test/'
image_upload_path = 'E:/temp/flask-upload-test/'
detect_dir = 'detect'
post_process_image_size = 160
gpu_memory_fraction = 0.25
minsize = 20
threshol... |
str1 = "abcdefghijklmnopqrstuvwxyz"
# 1. Create a slice that produces "qpo"
print(str1[16:13:-1])
# 2. Slice the string to produce "edcba"
print(str1[4::-1])
# 3. Slice the string to produce the last 8 characters, in reverse order
print(str1[:-9:-1])
print(str1[-4:])
print(str1[-1:])
print(str1[:1])
print(str1[0... | str1 = 'abcdefghijklmnopqrstuvwxyz'
print(str1[16:13:-1])
print(str1[4::-1])
print(str1[:-9:-1])
print(str1[-4:])
print(str1[-1:])
print(str1[:1])
print(str1[0]) |
expected_output = {
'instance': {
'test': {
'vrf': {
'default': {
'interfaces': {
'Ethernet1/1.115': {
'adjacencies': {
'R2_xr': {
... | expected_output = {'instance': {'test': {'vrf': {'default': {'interfaces': {'Ethernet1/1.115': {'adjacencies': {'R2_xr': {'neighbor_snpa': {'fa16.3eff.4abd': {'level': {'1': {'hold_time': '00:00:09', 'state': 'UP'}, '2': {'hold_time': '00:00:07', 'state': 'UP'}}}}}}}, 'Ethernet1/2.115': {'adjacencies': {'R1_ios': {'nei... |
skip_list = [
{'scheme': 'kyber1024', 'implementation': 'm3', 'estmemory': 12288},
{'scheme': 'kyber512', 'implementation': 'm3', 'estmemory': 7168},
{'scheme': 'kyber768', 'implementation': 'm3', 'estmemory': 9216},
{'scheme': 'saber', 'implementation': 'm3', 'estmemory': 22528},
{'scheme': 'sikep4... | skip_list = [{'scheme': 'kyber1024', 'implementation': 'm3', 'estmemory': 12288}, {'scheme': 'kyber512', 'implementation': 'm3', 'estmemory': 7168}, {'scheme': 'kyber768', 'implementation': 'm3', 'estmemory': 9216}, {'scheme': 'saber', 'implementation': 'm3', 'estmemory': 22528}, {'scheme': 'sikep434', 'implementation'... |
def add(a, b):
c = a + b
return c
c = add(1, 2)
print(c)
def subtraction(a, b):
return a - b
print(subtraction(b=5, a=10))
def division(a, b=1):
return a / b
print(division(5))
print(division(10, 5))
def print_a(a, *b):
print(a, b)
print_a(1, 2, 3, 4, 5, 6)
... | def add(a, b):
c = a + b
return c
c = add(1, 2)
print(c)
def subtraction(a, b):
return a - b
print(subtraction(b=5, a=10))
def division(a, b=1):
return a / b
print(division(5))
print(division(10, 5))
def print_a(a, *b):
print(a, b)
print_a(1, 2, 3, 4, 5, 6)
def print_b(a, **b):
print_a(a, b)... |
def problem_14():
"Which starting number, under one million, produces the longest [Collatz sequence] chain?"
longest_length = 0
longest_start = 0
# For each number between 1 and one million...
for i in range(1, 1000000):
# Take a copy of each number
n = i
# Set the length o... | def problem_14():
"""Which starting number, under one million, produces the longest [Collatz sequence] chain?"""
longest_length = 0
longest_start = 0
for i in range(1, 1000000):
n = i
length = 1
while n != 1:
if n % 2 == 0:
n /= 2
lengt... |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, "/WorldClient.dll?View=Main")
| def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, '/WorldClient.dll?View=Main') |
def update_fields_widget(form, fields, css_class):
for field in fields:
form.fields[field].widget.attrs.update({'class': css_class})
| def update_fields_widget(form, fields, css_class):
for field in fields:
form.fields[field].widget.attrs.update({'class': css_class}) |
# A base Class for the various kinds of 2d-rules used to update the playing field
class BaseRule:
def __init__(self, rule_str="", mode=None, num_states=0):
self.rule_str = rule_str
self.mode = mode
self.num_states = num_states
def apply(self, curr_state: int, num_neighbors: int) -> i... | class Baserule:
def __init__(self, rule_str='', mode=None, num_states=0):
self.rule_str = rule_str
self.mode = mode
self.num_states = num_states
def apply(self, curr_state: int, num_neighbors: int) -> int:
pass |
def resizeApp(app, dx, dy):
switchApp(app)
corner = find(Pattern("1273159241516.png").targetOffset(3,14))
dragDrop(corner, corner.getCenter().offset(dx, dy))
resizeApp("Safari", 50, 50)
# exists("1273159241516.png")
# click(Pattern("1273159241516.png").targetOffset(3,14).similar(0.7).firstN(2))
# with Region(10,100... | def resize_app(app, dx, dy):
switch_app(app)
corner = find(pattern('1273159241516.png').targetOffset(3, 14))
drag_drop(corner, corner.getCenter().offset(dx, dy))
resize_app('Safari', 50, 50) |
a = input("Immetti il coefficiente a ")
b = input("Immetti il coefficiente b ")
c = input("Immetti il coefficiente c ")
print ("Data l'equazione algebrica " + str(a) +
"*X^2+" + str(b) + "*X+" + str(c) + "=0 ")
delta = b * b - 4 * a * c
if delta >= 0:
rad_delta = delta**0.5
x1 = -(b - rad_delta) / (2 * ... | a = input('Immetti il coefficiente a ')
b = input('Immetti il coefficiente b ')
c = input('Immetti il coefficiente c ')
print("Data l'equazione algebrica " + str(a) + '*X^2+' + str(b) + '*X+' + str(c) + '=0 ')
delta = b * b - 4 * a * c
if delta >= 0:
rad_delta = delta ** 0.5
x1 = -(b - rad_delta) / (2 * a)
... |
'''
PROBLEM STATEMENT:
Given an array of integers of size n, where n denotes number of books and each element of an array denotes the number of pages in the ith book, also given another integer
denoting number of students. The task is to allocate books to the given number of students so that maximum number of pag... | """
PROBLEM STATEMENT:
Given an array of integers of size n, where n denotes number of books and each element of an array denotes the number of pages in the ith book, also given another integer
denoting number of students. The task is to allocate books to the given number of students so that maximum number of pages a... |
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"feature",
"flag_group",
"flag_set",
"tool_path",
)
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
# This file has been written based off the variable definitions in the following
# files:
# - https://github.c... | load('@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl', 'feature', 'flag_group', 'flag_set', 'tool_path')
load('@bazel_tools//tools/build_defs/cc:action_names.bzl', 'ACTION_NAMES')
build_f_cpu = '240000000L'
runtime_ide_version = '10607'
build_board = 'ESP32_DEV'
build_arch = 'ESP32'
build_variant = 'esp32'
build_e... |
sum_ = 0
for n in range(1, 1000):
if n % 3 == 0 or n % 5 == 0:
print(n, end=", ")
sum_ += n
print("sum =", sum_) | sum_ = 0
for n in range(1, 1000):
if n % 3 == 0 or n % 5 == 0:
print(n, end=', ')
sum_ += n
print('sum =', sum_) |
'''
Print the following pattern for the given N number of rows.
Pattern for N = 4
1234
123
12
1
'''
rows=int(input())
n=rows
for i in range(rows):
value=1
for j in range(n,0,-1):
print(value,end="")
value=value+1
n=n-1
print()
| """
Print the following pattern for the given N number of rows.
Pattern for N = 4
1234
123
12
1
"""
rows = int(input())
n = rows
for i in range(rows):
value = 1
for j in range(n, 0, -1):
print(value, end='')
value = value + 1
n = n - 1
print() |
# URL: https://www.geeksforgeeks.org/python-list/
myList = []
print("Intial List : ")
print(myList)
# Addition of Elements in the list
myList.append(1)
myList.append(2)
myList.append(4)
print("\nList after addition of three elements : ")
print(myList)
# Adding elements to the list using Iterator
for i in range(1, 4)... | my_list = []
print('Intial List : ')
print(myList)
myList.append(1)
myList.append(2)
myList.append(4)
print('\nList after addition of three elements : ')
print(myList)
for i in range(1, 4):
myList.append(i)
print('\nList after adding the element 1 to 3 : ')
print(myList)
length = len(myList)
print(f'\nTotal number ... |
n = int(input())
for i in range(0, n):
line = input()
total = 0
k = int(line.split()[0])
for j in range(0, k):
o = int(line.split()[j+1])
total += o
total -= k - 1
print(total)
| n = int(input())
for i in range(0, n):
line = input()
total = 0
k = int(line.split()[0])
for j in range(0, k):
o = int(line.split()[j + 1])
total += o
total -= k - 1
print(total) |
#
# Solution to Project Euler Problem 8
# by Lucas Chen
#
# Answer: 23514624000
#
DIGITS = 13
NUM = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445... | digits = 13
num = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493... |
units = 'nm'
vdw ={
"H" : 0.11000,
"He" : 0.14000,
"Li" : 0.18200,
"Be" : 0.15300,
"B" : 0.19200,
"C" : 0.17000,
"N" : 0.15500,
"O" : 0.15200,
"F" : 0.14700,
"Ne" : 0.15400,
"Na" : 0.22700,
"Mg" : 0.17300,
"Al" : 0.18400,
"Si" : 0.21000,
"P" : 0.18000,
"S" : 0.18000,
"Cl" : 0.17500,
"Ar" : 0.18800,
... | units = 'nm'
vdw = {'H': 0.11, 'He': 0.14, 'Li': 0.182, 'Be': 0.153, 'B': 0.192, 'C': 0.17, 'N': 0.155, 'O': 0.152, 'F': 0.147, 'Ne': 0.154, 'Na': 0.227, 'Mg': 0.173, 'Al': 0.184, 'Si': 0.21, 'P': 0.18, 'S': 0.18, 'Cl': 0.175, 'Ar': 0.188, 'K': 0.275, 'Ca': 0.231, 'Sc': 0.215, 'Ti': 0.211, 'V': 0.207, 'Cr': 0.206, 'Mn'... |
s1=str(input())
s2=str(input())
n=len(s1)
m=len(s2)
a=[0]*n
b=[0]*m
for i in range(0,n-2):
if s1[i]=='1':
a[i]=a[i]+1
a[i+1]+=a[i]
a[i+2]+=a[i];
if(s1[n-2]=='1'):
a[n-2]+=1
if(s1[n-1]=='1'):
a[n-1]+=1
for i in range(0,m-2):
if s2[i]=='1':
++b[i];
b[i+1]+=b[i]
b[i+2]+=b[i]... | s1 = str(input())
s2 = str(input())
n = len(s1)
m = len(s2)
a = [0] * n
b = [0] * m
for i in range(0, n - 2):
if s1[i] == '1':
a[i] = a[i] + 1
a[i + 1] += a[i]
a[i + 2] += a[i]
if s1[n - 2] == '1':
a[n - 2] += 1
if s1[n - 1] == '1':
a[n - 1] += 1
for i in range(0, m - 2):
if s2[i] == '1'... |
def new_queue():
return []
def enqueue(a, element):
a.append(element);
def dequeue(a):
if (len(a)):
return a.pop(0)
def is_empty(a):
return True if len(a) == 0 else False | def new_queue():
return []
def enqueue(a, element):
a.append(element)
def dequeue(a):
if len(a):
return a.pop(0)
def is_empty(a):
return True if len(a) == 0 else False |
#
# PySNMP MIB module GAMATRONIC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GAMATRONIC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:04:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
# Generated with generatedevices.py
class Device:
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])
devices = [
Device(devid="at90can128", name="AT90CAN128", signature=0x978103f, flash_size=0x20000, flash_pagesize=0x100, reg_dwdr=None, reg_spmcsr=0x37),
D... | class Device:
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])
devices = [device(devid='at90can128', name='AT90CAN128', signature=158863423, flash_size=131072, flash_pagesize=256, reg_dwdr=None, reg_spmcsr=55), device(devid='at90can32', name='AT90CAN32', signatur... |
#Embedded file name: ACEStream\Core\dispersy\encoding.pyo
def _a_encode_int(value, mapping):
value = str(value).encode('UTF-8')
return (str(len(value)).encode('UTF-8'), 'i', value)
def _a_encode_float(value, mapping):
value = str(value).encode('UTF-8')
return (str(len(value)).encode('UTF-8'), 'f', v... | def _a_encode_int(value, mapping):
value = str(value).encode('UTF-8')
return (str(len(value)).encode('UTF-8'), 'i', value)
def _a_encode_float(value, mapping):
value = str(value).encode('UTF-8')
return (str(len(value)).encode('UTF-8'), 'f', value)
def _a_encode_unicode(value, mapping):
value = val... |
n = int(input())
value = 0
max_value = 0
max_quality = 0
max_weight = 0
max_time = 0
for x in range(n):
weight = int(input())
time_needed = int(input())
quality = int(input())
value = (weight / time_needed) ** quality
if value > max_value:
max_value = value
max_quality = quality
... | n = int(input())
value = 0
max_value = 0
max_quality = 0
max_weight = 0
max_time = 0
for x in range(n):
weight = int(input())
time_needed = int(input())
quality = int(input())
value = (weight / time_needed) ** quality
if value > max_value:
max_value = value
max_quality = quality
... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def findBottomLeftValue(self, root: TreeNode) -> int:
stack = [root]
res = stack[0].val
while stack:
newstack =... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def find_bottom_left_value(self, root: TreeNode) -> int:
stack = [root]
res = stack[0].val
while stack:
newstack = []
for node in stac... |
night = 20
transport = 1.60
museum = 6
number_of_people = int(input())
number_of_nights = int(input())
number_of_cards = int(input())
number_of_tickets = int(input())
all_nights = night * number_of_nights
all_cards = transport * number_of_cards
all_museum = museum * number_of_tickets
total_per_person = all_nights + ... | night = 20
transport = 1.6
museum = 6
number_of_people = int(input())
number_of_nights = int(input())
number_of_cards = int(input())
number_of_tickets = int(input())
all_nights = night * number_of_nights
all_cards = transport * number_of_cards
all_museum = museum * number_of_tickets
total_per_person = all_nights + all_... |
into = [13,56,34,58,52,93,35,24]
print(into)
print("\sorted is =",
sorted(into))
print("\maximum is = ",
max(into))
print("\minimum is =",
min(into))
print("\length is = ",
len(into))
| into = [13, 56, 34, 58, 52, 93, 35, 24]
print(into)
print('\\sorted is =', sorted(into))
print('\\maximum is = ', max(into))
print('\\minimum is =', min(into))
print('\\length is = ', len(into)) |
# https://www.codechef.com/problems/CHOPRT
for T in range(int(input())):
a,b = map(int,input().split())
if(a>b): print(">")
if(a<b): print("<")
if(a==b): print("=") | for t in range(int(input())):
(a, b) = map(int, input().split())
if a > b:
print('>')
if a < b:
print('<')
if a == b:
print('=') |
###############################################################################
# Function: Sequence1Frames_set_timeslider
#
# Purpose:
# This is a callback function for sequence 1's IterateCallbackAndSaveFrames
# function. This function sets the time and updates the time slider so
# it has the right time value.
... | def sequence1_frames_set_timeslider(i, cbdata):
ts = cbdata
ret = set_time_slider_state(i)
query('Time')
time = get_query_output_value()
ts.text = 'Time = %1.5f' % time
return ret
def sequence2_frames_clip_cb(i, cbdata):
nts = cbdata[0]
clip = cbdata[1]
xmin = cbdata[2]
xmax = c... |
def printb(block):
print(bstr(block))
def bstr(block):
strs = []
types = ['res', 'com', 'ind']
for t in types:
bldg_strs = []
bldgs = list(block['buildings'][t].values())
bldgs = sorted(bldgs, key=lambda b: b['weight'])
for build in bldgs:
s = f" {build[... | def printb(block):
print(bstr(block))
def bstr(block):
strs = []
types = ['res', 'com', 'ind']
for t in types:
bldg_strs = []
bldgs = list(block['buildings'][t].values())
bldgs = sorted(bldgs, key=lambda b: b['weight'])
for build in bldgs:
s = f" {build['n... |
#/usr/bin/env python
'''
Classical algorithm
Hanoi Towel
'''
# No Import needed.
# No Global Variable.
# No Class definition.
def Hanoi( a , b , c , n ):
'''
a -- position for the plate need to move
b -- destination for the plate need to reach
c -- assistant plate
n -- count of p... | """
Classical algorithm
Hanoi Towel
"""
def hanoi(a, b, c, n):
"""
a -- position for the plate need to move
b -- destination for the plate need to reach
c -- assistant plate
n -- count of plate in a
"""
if n >= 1:
hanoi(a, c, b, n - 1)
move(a, b)
hanoi(c, b, a, n - ... |
NAME_FILE = "name.mp3"
TMP_DATA_DIR = "data/engagement"
TMP_RAW_NAME_FILE = f"{TMP_DATA_DIR}/raw-name.wav"
TMP_NAME_FILE = f"{TMP_DATA_DIR}/{NAME_FILE}"
FACES_DATA_DIR = "data/faces"
ENCODINGS_FILE_PATH = "data/encodings.pickle"
TRAINER_PROCESSED_FILE_PATH = "data/faces_processed.txt"
| name_file = 'name.mp3'
tmp_data_dir = 'data/engagement'
tmp_raw_name_file = f'{TMP_DATA_DIR}/raw-name.wav'
tmp_name_file = f'{TMP_DATA_DIR}/{NAME_FILE}'
faces_data_dir = 'data/faces'
encodings_file_path = 'data/encodings.pickle'
trainer_processed_file_path = 'data/faces_processed.txt' |
#!/usr/bin/env python3
txt = "w1{1wq87g_9654g"
flag = ""
for i in range(len(txt)):
if i % 2 == 0:
flag += chr(ord(txt[i])-5)
else:
flag += chr(ord(txt[i])+2)
print("picoCTF{%s}"%flag) | txt = 'w1{1wq87g_9654g'
flag = ''
for i in range(len(txt)):
if i % 2 == 0:
flag += chr(ord(txt[i]) - 5)
else:
flag += chr(ord(txt[i]) + 2)
print('picoCTF{%s}' % flag) |
# Write your code here
test = int(input())
while test > 0 :
n = input()
count = 0
l = ['a','e','i','o','u','A','E','I','O','U']
for i in n :
if i in l :
count += 1
print(count)
test -= 1
| test = int(input())
while test > 0:
n = input()
count = 0
l = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
for i in n:
if i in l:
count += 1
print(count)
test -= 1 |
def condition_check(string: str, condition: str) -> bool:
condition = chop_redundant_bracket(condition.strip()).strip()
level_dict = get_level_dict(condition)
if level_dict == {}:
return has_sub_string(string, condition)
else:
min_level = min(level_dict.keys())
min_level_dict = l... | def condition_check(string: str, condition: str) -> bool:
condition = chop_redundant_bracket(condition.strip()).strip()
level_dict = get_level_dict(condition)
if level_dict == {}:
return has_sub_string(string, condition)
else:
min_level = min(level_dict.keys())
min_level_dict = l... |
for i in range (10,20):#imprime do ao 19, pois sao 10 numeros
print(i)
for i in range (10,20,2):#agora com numero 2 determino o salto de numeros
print(i) | for i in range(10, 20):
print(i)
for i in range(10, 20, 2):
print(i) |
def make_collector(cls, methodname):
storage = []
method = getattr(cls, methodname)
method = getattr(method, "__func__", method)
def collect(self, ctx):
storage.append(ctx)
return method(self, ctx)
class Collector(cls):
pass
collect.__name__ = methodname
Collector... | def make_collector(cls, methodname):
storage = []
method = getattr(cls, methodname)
method = getattr(method, '__func__', method)
def collect(self, ctx):
storage.append(ctx)
return method(self, ctx)
class Collector(cls):
pass
collect.__name__ = methodname
Collector._... |
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:
if obstacleGrid[0][0] == 1:
return 0
else:
obstacleGrid[0][0] = 1
numberOfRows = len(obstacleGrid)
numberOfColumns = len(obstacleGrid[0])
for col in range(1, numb... | class Solution:
def unique_paths_with_obstacles(self, obstacleGrid: List[List[int]]) -> int:
if obstacleGrid[0][0] == 1:
return 0
else:
obstacleGrid[0][0] = 1
number_of_rows = len(obstacleGrid)
number_of_columns = len(obstacleGrid[0])
for col in range... |
#
# PySNMP MIB module TRANGOP5830S-RU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRANGOP5830S-RU-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint, constraints_union) ... |
test = { 'name': 'q2_1_2',
'points': 1,
'suites': [ { 'cases': [ { 'code': '>>> # Make sure you can use any two movies;\n'
'>>> correct_dis = 0.000541242;\n'
'>>> dis = distance_two_features("clerks.", "the a... | test = {'name': 'q2_1_2', 'points': 1, 'suites': [{'cases': [{'code': '>>> # Make sure you can use any two movies;\n>>> correct_dis = 0.000541242;\n>>> dis = distance_two_features("clerks.", "the avengers", "water", "feel");\n>>> np.isclose(np.round(dis, 9), correct_dis)\nTrue', 'hidden': False, 'locked': False}, {'cod... |
# TC:O(N^N)
def queens_helper(n, row, col, asc_des, desc_des, possibilities):
curr_row = len(possibilities)
for curr_col in range(n):
if col[curr_col] and row[curr_row] and asc_des[curr_col+curr_row] and desc_des[curr_row-curr_col]:
row[curr_row] = False
col[curr_col] = False
... | def queens_helper(n, row, col, asc_des, desc_des, possibilities):
curr_row = len(possibilities)
for curr_col in range(n):
if col[curr_col] and row[curr_row] and asc_des[curr_col + curr_row] and desc_des[curr_row - curr_col]:
row[curr_row] = False
col[curr_col] = False
... |
SITE_NAME='Bitsbox'
SQLALCHEMY_TRACK_MODIFICATIONS=False
DEBUG=False
USER_CREATION_ALLOWED=False
GOOGLE_CLIENT_ID='YOUR_CLIENT_ID.apps.googleusercontent.com'
| site_name = 'Bitsbox'
sqlalchemy_track_modifications = False
debug = False
user_creation_allowed = False
google_client_id = 'YOUR_CLIENT_ID.apps.googleusercontent.com' |
option_spec = {
"OIDCProvider": {
"REQUIRE_CONSENT": {
"type": "boolean",
"default": True,
"envvars": ("KOLIBRI_OIDC_PROVIDER_REQUEST_CONSENT",),
}
}
}
| option_spec = {'OIDCProvider': {'REQUIRE_CONSENT': {'type': 'boolean', 'default': True, 'envvars': ('KOLIBRI_OIDC_PROVIDER_REQUEST_CONSENT',)}}} |
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
s_dict = {}
t_dict = {}
if len(s) != len(t):
return False
for idx in range(len(s)):
s_char = s[idx]
t_char = t[idx]
if s_char not in s_dict:
... | class Solution:
def is_isomorphic(self, s: str, t: str) -> bool:
s_dict = {}
t_dict = {}
if len(s) != len(t):
return False
for idx in range(len(s)):
s_char = s[idx]
t_char = t[idx]
if s_char not in s_dict:
s_dict[s_char... |
base_dir = os.path.split(os.path.dirname(__file__))[0]
data_dir = os.path.join(
base_dir,
"data",
)
resource_dir = os.path.join(
base_dir,
"resources",
)
| base_dir = os.path.split(os.path.dirname(__file__))[0]
data_dir = os.path.join(base_dir, 'data')
resource_dir = os.path.join(base_dir, 'resources') |
# -*- coding: utf-8 -*-
#
#
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General infor... | source_suffix = '.rst'
master_doc = 'index'
project = u'Unreal Engine 4 Steamworks Callback Plugin'
copyright = u'2018, Daniel Nahle'
author = u'Daniel Nahle'
version = u'1.0'
release = u'1.0'
language = 'en'
pygments_style = 'sphinx'
html_scaled_image_link = False
html_theme = 'sphinx_rtd_theme'
html_theme_options = {... |
VALIDATION_EXCEPTION_MESSAGE = "Validation error has occurred : {0}"
WRONG_ID_FORMAT_MESSAGE = "Wrong {0} id format : {1}"
OBJECT_ALREADY_PROCESSING_MESSAGE = "object {0} is already processing. request cannot be completed."
# validation error messages
INVALID_SECRET_CONFIG_MESSAGE = "got an invalid secret config"
IN... | validation_exception_message = 'Validation error has occurred : {0}'
wrong_id_format_message = 'Wrong {0} id format : {1}'
object_already_processing_message = 'object {0} is already processing. request cannot be completed.'
invalid_secret_config_message = 'got an invalid secret config'
insufficient_data_to_choose_a_sto... |
stop_codon = ["UAA", "UAG", "UGA"]
amino_acid = ["Ala", "Arg", "Asn", "Asp", "Cys", "Glu", "Gln", "Gly", "His", "Ile", "Leu", "Lys",
"Met", "Phe", "Pro", "Ser", "Thr", "Trp", "Tyr", "Val"]
codon_U = ["UUU", "UUC", "UUA", "UUG",
"UCU", "UCC", "UCA", "UCG",
"UAU", "UAC", "UAA", "U... | stop_codon = ['UAA', 'UAG', 'UGA']
amino_acid = ['Ala', 'Arg', 'Asn', 'Asp', 'Cys', 'Glu', 'Gln', 'Gly', 'His', 'Ile', 'Leu', 'Lys', 'Met', 'Phe', 'Pro', 'Ser', 'Thr', 'Trp', 'Tyr', 'Val']
codon_u = ['UUU', 'UUC', 'UUA', 'UUG', 'UCU', 'UCC', 'UCA', 'UCG', 'UAU', 'UAC', 'UAA', 'UAG', 'UGU', 'UGC', 'UGA', 'UGG']
codon_c ... |
def isMAC48Address(inputString):
str_split = inputString.split("-")
count = 0
if len(inputString) != 17:
return False
if len(str_split) != 6:
return False
for i in range(0, 6):
if str_split[i] == "":
return False
if re.search("[a-zG-Z]", str_split[i]):
... | def is_mac48_address(inputString):
str_split = inputString.split('-')
count = 0
if len(inputString) != 17:
return False
if len(str_split) != 6:
return False
for i in range(0, 6):
if str_split[i] == '':
return False
if re.search('[a-zG-Z]', str_split[i]):
... |
class Account:
def __init__(self, client):
self._client = client
def get_balance(self):
return self._client.get(self._client.host(), "/account/get-balance")
def topup(self, params=None, **kwargs):
return self._client.post(self._client.host(), "/account/top-up", params or kwargs)
... | class Account:
def __init__(self, client):
self._client = client
def get_balance(self):
return self._client.get(self._client.host(), '/account/get-balance')
def topup(self, params=None, **kwargs):
return self._client.post(self._client.host(), '/account/top-up', params or kwargs)
... |
# Base architecture
alexnet = {}
alexnet['conv1'] = [64,3,11,11]
alexnet['conv2'] = [192,64,5,5]
alexnet['conv3'] = [384,192,3,3]
alexnet['conv4'] = [256,384,3,3]
alexnet['conv5'] = [256,256,3,3]
alexnet['fc'] = [100,256]
vgg8 = {}
vgg8['conv1'] = [64,3,3,3]
vgg8['conv2'] = [128,64,3,3]
vgg8['conv3'] = [256,128,3,... | alexnet = {}
alexnet['conv1'] = [64, 3, 11, 11]
alexnet['conv2'] = [192, 64, 5, 5]
alexnet['conv3'] = [384, 192, 3, 3]
alexnet['conv4'] = [256, 384, 3, 3]
alexnet['conv5'] = [256, 256, 3, 3]
alexnet['fc'] = [100, 256]
vgg8 = {}
vgg8['conv1'] = [64, 3, 3, 3]
vgg8['conv2'] = [128, 64, 3, 3]
vgg8['conv3'] = [256, 128, 3, ... |
strN = input("Please enter a number:")
N = int(strN)
#N = 10
total = 0
for current in range(N+1):
if current % 2 == 1:
total = total + current
print("summation 1..",N," for odd numbers is",total)
| str_n = input('Please enter a number:')
n = int(strN)
total = 0
for current in range(N + 1):
if current % 2 == 1:
total = total + current
print('summation 1..', N, ' for odd numbers is', total) |
#!/usr/bin/env python3
d = ['Sunny', 'Cloudy', 'Rainy']
N = input()
i = d.index(N)
print(d[(i + 1) % 3])
| d = ['Sunny', 'Cloudy', 'Rainy']
n = input()
i = d.index(N)
print(d[(i + 1) % 3]) |
version = '2.4.0'
author = 'maximilionus'
# Variables below was deprecated in 2.2.0
# and will be removed in 3.0.0 release
__version__ = version
__author__ = author
| version = '2.4.0'
author = 'maximilionus'
__version__ = version
__author__ = author |
class bank:
def __init__(self,d,w):
self.deposit = d
self.withdrawl = w
def amount(self):
if self.withdrawl<=self.deposit:
print("remaining balance: %d " %(self.deposit - self.withdrawl))
else:
print("insufficient balance:")
d = int(input("... | class Bank:
def __init__(self, d, w):
self.deposit = d
self.withdrawl = w
def amount(self):
if self.withdrawl <= self.deposit:
print('remaining balance: %d ' % (self.deposit - self.withdrawl))
else:
print('insufficient balance:')
d = int(input('enter the... |
class Config:
framesPerExample = 512
exampleLength = 120
batch_size = 98 | class Config:
frames_per_example = 512
example_length = 120
batch_size = 98 |
__author__ = 'sarangis'
class ModulePass:
def __init__(self):
pass
def run_on_module(self, node):
raise NotImplementedError("Derived passes class should implement run_on_module")
class FunctionPass:
def __init__(self):
pass
def run_on_function(self, node):
raise NotIm... | __author__ = 'sarangis'
class Modulepass:
def __init__(self):
pass
def run_on_module(self, node):
raise not_implemented_error('Derived passes class should implement run_on_module')
class Functionpass:
def __init__(self):
pass
def run_on_function(self, node):
raise n... |
github_config = {
"base_url": "",
"org": "",
"access_token": ""
} | github_config = {'base_url': '', 'org': '', 'access_token': ''} |
class Solution:
def arrangeCoins(self, n: int) -> int:
l, r = 1, 2 ** 16
while l <= r:
m = (l + r) // 2
c = self._count(m)
if c <= n and self._count(m + 1) > n:
return m
elif c > n:
r = m - 1
else:
... | class Solution:
def arrange_coins(self, n: int) -> int:
(l, r) = (1, 2 ** 16)
while l <= r:
m = (l + r) // 2
c = self._count(m)
if c <= n and self._count(m + 1) > n:
return m
elif c > n:
r = m - 1
else:
... |
class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
class LinkedList:
def __init__(self, head=None) -> None:
self.head = Node(head)
def pushTop(self, val):
newNode = Node(val)
current = self.head
if not current.data:
... | class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
class Linkedlist:
def __init__(self, head=None) -> None:
self.head = node(head)
def push_top(self, val):
new_node = node(val)
current = self.head
if not current.data:
... |
# noinspection PyShadowingBuiltins,PyUnusedLocal
def compute(x, y):
return x+y
a = 2
b = 3
print(compute(a,b)) | def compute(x, y):
return x + y
a = 2
b = 3
print(compute(a, b)) |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
L = list(map(lambda x: 2 **x, range(7)))
X = 5
obj = 2 ** X
if obj in L:
print('at index', L.index(obj))
else:
print(X, 'not found')
| l = list(map(lambda x: 2 ** x, range(7)))
x = 5
obj = 2 ** X
if obj in L:
print('at index', L.index(obj))
else:
print(X, 'not found') |
'''
Created on Dec 12, 2014
@author: MP
'''
| """
Created on Dec 12, 2014
@author: MP
""" |
def get_data(fold=0):
return (MImageItemList.from_df(df, path=TRAIN+"/train", cols='image_id')
.split_by_idx(df.index[df.split == fold].tolist())
.label_from_df(cols=['prim_gleason','secon_gleason'])
.transform(get_transforms(flip_vert=True,max_rotate=15),size=sz,padding_mode='zeros')
.datab... | def get_data(fold=0):
return MImageItemList.from_df(df, path=TRAIN + '/train', cols='image_id').split_by_idx(df.index[df.split == fold].tolist()).label_from_df(cols=['prim_gleason', 'secon_gleason']).transform(get_transforms(flip_vert=True, max_rotate=15), size=sz, padding_mode='zeros').databunch(bs=bs, num_workers... |
# Ctrl+K+C to comment a line, Ctrl+K+U to uncomment a line
first_name = input("What is your first name? ")
last_name = input("What is your last name? ")
print(first_name + last_name)
print("Hello " + first_name.capitalize() + " " + last_name.capitalize())
print()
sentence = "The dog is named Daisy"
print(sentence.uppe... | first_name = input('What is your first name? ')
last_name = input('What is your last name? ')
print(first_name + last_name)
print('Hello ' + first_name.capitalize() + ' ' + last_name.capitalize())
print()
sentence = 'The dog is named Daisy'
print(sentence.upper())
print(sentence.lower())
print(sentence.capitalize())
pr... |
class BingoBoardPlace:
def __init__(self, number: int):
self.number = number
self.selected: bool = False
class BingoBoard:
# 5x5 grid
# data must include rows and columns -> [ [0, 0, 0], [0, 0, 0], [0, 0, 0] ]
def __init__(self, data: []):
self.data = []
self.chosen_num... | class Bingoboardplace:
def __init__(self, number: int):
self.number = number
self.selected: bool = False
class Bingoboard:
def __init__(self, data: []):
self.data = []
self.chosen_numbers = []
self.result = -1
self.bingo_width = 0
for row in data:
... |
velocidadkms = 0
velocidadms = 0
distancia = float(input("ingrese la distancia recorrida en km"))
tiempo = float(input("ingrese el tiempo transcurrido en h"))
velocidadkms= distancia/tiempo
print("La velocidad en km/h es: ", velocidadkms)
velocidadms = (velocidadkms)*10/36
print("La velocidad en m/s es: ", velocidadms)... | velocidadkms = 0
velocidadms = 0
distancia = float(input('ingrese la distancia recorrida en km'))
tiempo = float(input('ingrese el tiempo transcurrido en h'))
velocidadkms = distancia / tiempo
print('La velocidad en km/h es: ', velocidadkms)
velocidadms = velocidadkms * 10 / 36
print('La velocidad en m/s es: ', velocid... |
def decode(cipher, rails):
cipher_len = len(cipher)
rail = [['\n' for i in range(len(cipher)) ] for j in range(rails)]
is_going_down = False
row, col = 0,0
for i in range(len(cipher)):
if row == 0:
is_going_down = True
elif row == rails -1:
is_going_d... | def decode(cipher, rails):
cipher_len = len(cipher)
rail = [['\n' for i in range(len(cipher))] for j in range(rails)]
is_going_down = False
(row, col) = (0, 0)
for i in range(len(cipher)):
if row == 0:
is_going_down = True
elif row == rails - 1:
is_going_down ... |
#!/usr/bin/env python3
class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
a = list(ransomNote)
b = list(magazine)
try:
for i in a:
b.remove(i)
return True
except:
return False | class Solution:
def can_construct(self, ransomNote: str, magazine: str) -> bool:
a = list(ransomNote)
b = list(magazine)
try:
for i in a:
b.remove(i)
return True
except:
return False |
__author__ = 'raymond'
class TradingDataRowParser:
def __init__(self, spacing):
self.spacing = spacing
def split_by_ticker_symbol(self, row):
for ticker_start_index in range(0, len(row), self.spacing):
yield row[ticker_start_index:ticker_start_index + self.spacing], ticker_start_index
| __author__ = 'raymond'
class Tradingdatarowparser:
def __init__(self, spacing):
self.spacing = spacing
def split_by_ticker_symbol(self, row):
for ticker_start_index in range(0, len(row), self.spacing):
yield (row[ticker_start_index:ticker_start_index + self.spacing], ticker_start_... |
def check(num1, num2, num3):
total = num1 + num2 + num3
for i in range(2, total):
if total % i == 0 : return False
return True
def solution(nums):
answer = 0
for i in range(0, len(nums) - 2):
for j in range(i+1, len(nums) - 1):
for k in range(j+1, len(nums)):
... | def check(num1, num2, num3):
total = num1 + num2 + num3
for i in range(2, total):
if total % i == 0:
return False
return True
def solution(nums):
answer = 0
for i in range(0, len(nums) - 2):
for j in range(i + 1, len(nums) - 1):
for k in range(j + 1, len(nums... |
# -*- coding: utf-8 -*-
__version__ = '0.5.3'
__project__ = 'diamond-patterns'
__author__ = 'Ian Dennis Miller'
__email__ = 'iandennismiller@gmail.com'
__url__ = 'https://diamond-patterns.readthedocs.io/'
__repo__ = 'https://github.com/iandennismiller/diamond-patterns/'
__copyright__ = '2019 Ian Dennis Miller'
| __version__ = '0.5.3'
__project__ = 'diamond-patterns'
__author__ = 'Ian Dennis Miller'
__email__ = 'iandennismiller@gmail.com'
__url__ = 'https://diamond-patterns.readthedocs.io/'
__repo__ = 'https://github.com/iandennismiller/diamond-patterns/'
__copyright__ = '2019 Ian Dennis Miller' |
class AisiklError(Exception):
'''The base class for AIS, REST-related exceptions.'''
def __init__(self, *args, **kwargs):
super().__init__(*args)
for key, value in kwargs.items():
setattr(self, key, value)
class AISParseError(AisiklError):
'''We couldn't parse or properly pro... | class Aisiklerror(Exception):
"""The base class for AIS, REST-related exceptions."""
def __init__(self, *args, **kwargs):
super().__init__(*args)
for (key, value) in kwargs.items():
setattr(self, key, value)
class Aisparseerror(AisiklError):
"""We couldn't parse or properly pro... |
class factorial:
def find_fact(self,n):
res = 1
if n < 0:
return -1
elif n == 0:
return 1
else:
for i in range(1,n+1):
res = res*i
return res
| class Factorial:
def find_fact(self, n):
res = 1
if n < 0:
return -1
elif n == 0:
return 1
else:
for i in range(1, n + 1):
res = res * i
return res |
def Gray2Binary(n):
m = 0
while n:
m ^= n
n >>= 1
return m
print(Gray2Binary(4)) | def gray2_binary(n):
m = 0
while n:
m ^= n
n >>= 1
return m
print(gray2_binary(4)) |
class Entitlement_Manager:
@staticmethod
def fetch_entitlements(client,entitlement_type):
conversions = {
"skin_level": "e7c63390-eda7-46e0-bb7a-a6abdacd2433",
"skin_chroma": "3ad1b2b2-acdb-4524-852f-954a76ddae0a",
"agent": "01bb38e1-da47-4e6a-9b3d-945fe4655707",
... | class Entitlement_Manager:
@staticmethod
def fetch_entitlements(client, entitlement_type):
conversions = {'skin_level': 'e7c63390-eda7-46e0-bb7a-a6abdacd2433', 'skin_chroma': '3ad1b2b2-acdb-4524-852f-954a76ddae0a', 'agent': '01bb38e1-da47-4e6a-9b3d-945fe4655707', 'contract_definition': 'f85cb6f7-33e5-4... |
# Flask settings
DEBUG = False
# Flask-restplus settings
RESTPLUS_MASK_SWAGGER = False
# Application settings
# API metadata
API_TITLE = 'Model Asset Exchange Server'
API_DESC = 'An API for serving models'
API_VERSION = '0.1'
# default model
MODELNAME = 'ssrnet_3_3_3_64_1.0_1.0.h5'
DEFAULT_MODEL_PATH = 'assets/{}'.... | debug = False
restplus_mask_swagger = False
api_title = 'Model Asset Exchange Server'
api_desc = 'An API for serving models'
api_version = '0.1'
modelname = 'ssrnet_3_3_3_64_1.0_1.0.h5'
default_model_path = 'assets/{}'.format(MODELNAME)
model_license = 'MIT'
model_meta_data = {'id': 'ssrnet', 'name': 'SSR-Net Facial Ag... |
# find the ceil and floor value of a no. in a sorted array
n = int(input())
a = []
for i in range(n):
a.append(int(input()))
d = int(input())
l = 0
h = n-1
ceil = 0
floor = 0
while(l<=h):
mid = (l+h)//2
if a[mid]<d:
l = mid+1
ceil=a[mid]
elif a[mid]>d:
h = mid-1
floor=a[... | n = int(input())
a = []
for i in range(n):
a.append(int(input()))
d = int(input())
l = 0
h = n - 1
ceil = 0
floor = 0
while l <= h:
mid = (l + h) // 2
if a[mid] < d:
l = mid + 1
ceil = a[mid]
elif a[mid] > d:
h = mid - 1
floor = a[mid]
else:
ceil = floor = a[m... |
_base_ = ['./masktrack_rcnn_r50_fpn_12e_youtubevis2019.py']
model = dict(
detector=dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://r... | _base_ = ['./masktrack_rcnn_r50_fpn_12e_youtubevis2019.py']
model = dict(detector=dict(backbone=dict(type='ResNeXt', depth=101, groups=64, base_width=4, init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d')), init_cfg=dict(type='Pretrained', checkpoint='https://download.openmmlab.com/mmdetection/... |
LOG_FILE = '/var/lib/pgadmin/pgadmin.log'
SQLITE_PATH = '/var/lib/pgadmin/pgadmin.db'
SESSION_DB_PATH = '/var/lib/pgadmin/sessions'
STORAGE_DIR = '/var/lib/pgadmin/storage'
SERVER_MODE = True
ALLOW_SAVE_PASSWORD = True | log_file = '/var/lib/pgadmin/pgadmin.log'
sqlite_path = '/var/lib/pgadmin/pgadmin.db'
session_db_path = '/var/lib/pgadmin/sessions'
storage_dir = '/var/lib/pgadmin/storage'
server_mode = True
allow_save_password = True |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
# This turns on e.g. the filename-based detection of which
# platforms to include source files on (e.g. files ending in
# _mac... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'user_service_lib', 'type': 'static_library', 'include_dirs': ['../..'], 'sources': ['user_id_map.cc', 'user_id_map.h', 'user_service.cc', 'user_service.h', 'user_shell_client.cc', 'user_shell_client.h'], 'dependencies': ['user_app_manifest', 'user_service... |
# Converts an RGB color value to HSL. Conversion formula
# adapted from http://en.wikipedia.org/wiki/HSL_color_space.
# Assumes r, g, and b are contained in the set [0, 255] and
# returns h, s, and l in the set [0.0, 1.0].
#
# @param {number} r The red color value
# @param {number} g The green color v... | def rgb_to_hsl(r, g, b):
r = r / 255.0
g = g / 255.0
b = b / 255.0
_max = max(r, g, b)
_min = min(r, g, b)
h = 0
s = 0
l = (_max + _min) / 2
if _max == _min:
h = s = 0
else:
d = _max - _min
s = d / (2 - _max - _min) if l > 0.5 else d / (_max + _min)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.