content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#
# PySNMP MIB module RBTWS-RF-DETECT-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBTWS-RF-DETECT-TC
# Produced by pysmi-0.3.4 at Mon Apr 29 20:45:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, value_range_constraint, constraints_union, single_value_constraint) ... |
# Collaborators (including web sites where you got help: (enter none if you didn't need help)
# none
# A note on style: Dictionaries can be defined before or after functions.
board = {'1': ' ' , '2': ' ' , '3': ' ' ,'4': ' ' , '5': ' ' , '6': ' ' ,'7': ' ' , '8': ' ' , '9': ' ' }
def gameboard(board):
print(board... | board = {'1': ' ', '2': ' ', '3': ' ', '4': ' ', '5': ' ', '6': ' ', '7': ' ', '8': ' ', '9': ' '}
def gameboard(board):
print(board['1'] + '|' + board['2'] + '|' + board['3'])
print('-+-+-')
print(board['4'] + '|' + board['5'] + '|' + board['6'])
print('-+-+-')
print(board['7'] + '|' + board['8'] ... |
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Financial Analysis\n",
"Total Months:86\n",
"Total Amount:38382578\n",
"-2315.1176470588234\n",
"Feb-2012 1926159... | {'cells': [{'cell_type': 'code', 'execution_count': 4, 'metadata': {}, 'outputs': [{'name': 'stdout', 'output_type': 'stream', 'text': ['Financial Analysis\n', 'Total Months:86\n', 'Total Amount:38382578\n', '-2315.1176470588234\n', 'Feb-2012 1926159\n', 'Sep-2013 -2196167\n']}], 'source': ['#import file\n', 'import os... |
# Puzzle Input
with open('Day13_Input.txt') as puzzle_input:
bus_info = puzzle_input.read().split('\n')
# Get the departure time and the IDs
departure = int(bus_info[0])
bus_id = bus_info[1].split(',')
# Remove the x's
while 'x' in bus_id:
bus_id.remove('x')
# Convert the IDs to integers
bus_id = list(map(in... | with open('Day13_Input.txt') as puzzle_input:
bus_info = puzzle_input.read().split('\n')
departure = int(bus_info[0])
bus_id = bus_info[1].split(',')
while 'x' in bus_id:
bus_id.remove('x')
bus_id = list(map(int, bus_id))
waiting_times = []
for id in bus_id:
waiting_times += [-(departure % ID) + ID]
min_ind... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"PseudoData": "00_pseudodata.ipynb",
"paper_sig": "00_pseudodata.ipynb",
"paper_bkg": "00_pseudodata.ipynb",
"ModelWrapper": "01_model_wrapper.ipynb",
"DataSet": "02_data.i... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'PseudoData': '00_pseudodata.ipynb', 'paper_sig': '00_pseudodata.ipynb', 'paper_bkg': '00_pseudodata.ipynb', 'ModelWrapper': '01_model_wrapper.ipynb', 'DataSet': '02_data.ipynb', 'WeightedDataLoader': '02_data.ipynb', 'DataPair': '02_data.ipynb', 'g... |
def min(x, y):
return x > y and x or y
def gcd(x, y):
res = -1
for i in range(1, min(x, y) + 1):
if x % i == 0 and y % i == 0:
if res < i: res = i
return res
N, M = map(int, input().split())
print(gcd(N, M))
print(gcd(N, M) * (N // gcd(N, M)) * (M // gcd(N, M)))
| def min(x, y):
return x > y and x or y
def gcd(x, y):
res = -1
for i in range(1, min(x, y) + 1):
if x % i == 0 and y % i == 0:
if res < i:
res = i
return res
(n, m) = map(int, input().split())
print(gcd(N, M))
print(gcd(N, M) * (N // gcd(N, M)) * (M // gcd(N, M))) |
# Python - 3.6.0
fruitList = {
1: 'kiwi',
2: 'pear',
3: 'kiwi',
4: 'banana',
5: 'melon',
6: 'banana',
7: 'melon',
8: 'pineapple',
9: 'apple',
10: 'pineapple',
11: 'cucumber',
12: 'pineapple',
13: 'cucumber',
14: 'orange',
15: 'grape',
16: 'orange',
17... | fruit_list = {1: 'kiwi', 2: 'pear', 3: 'kiwi', 4: 'banana', 5: 'melon', 6: 'banana', 7: 'melon', 8: 'pineapple', 9: 'apple', 10: 'pineapple', 11: 'cucumber', 12: 'pineapple', 13: 'cucumber', 14: 'orange', 15: 'grape', 16: 'orange', 17: 'grape', 18: 'apple', 19: 'grape', 20: 'cherry', 21: 'pear', 22: 'cherry', 23: 'pear... |
__all__ = [
'base_controller',
'imaging',
'telephony',
'data_tools',
'security_and_networking',
'geolocation',
'e_commerce',
'www',
] | __all__ = ['base_controller', 'imaging', 'telephony', 'data_tools', 'security_and_networking', 'geolocation', 'e_commerce', 'www'] |
f = open('test16.txt', 'rt')
rows = f.readlines()
for row in rows:
print(row)
f.close()
# while True:
# row = f.readline()
# print(row)
# if not row:
# break
# f.close() | f = open('test16.txt', 'rt')
rows = f.readlines()
for row in rows:
print(row)
f.close() |
flagArray = [0 for i in range(32)]
flag = ""
flagArray[0] = 'd'
flagArray[29] = '9'
flagArray[4] = 'r'
flagArray[2] = '5'
flagArray[23] = 'r'
flagArray[3] = 'c'
flagArray[17] = '4'
flagArray[1] = '3'
flagArray[7] = 'b'
flagArray[10] = '_'
flagArray[5] = '4'
flagArray[9] = '3'
flagArray[11] = 't'
flagArray[15... | flag_array = [0 for i in range(32)]
flag = ''
flagArray[0] = 'd'
flagArray[29] = '9'
flagArray[4] = 'r'
flagArray[2] = '5'
flagArray[23] = 'r'
flagArray[3] = 'c'
flagArray[17] = '4'
flagArray[1] = '3'
flagArray[7] = 'b'
flagArray[10] = '_'
flagArray[5] = '4'
flagArray[9] = '3'
flagArray[11] = 't'
flagArray[15] = 'c'
fl... |
print("Enter a selection from the below menu. Press '0' to exit.")
menu_items = ["Bake a loaf of bread", "Bake a pound cake", "Prepare Roast Chicken", "Make Curry", \
"Put a rack of ribs in the smoker", "Buy dinner out", "Have ice cream", "Sandwiches - again"]
select = None
while True:
for i in range(len(menu... | print("Enter a selection from the below menu. Press '0' to exit.")
menu_items = ['Bake a loaf of bread', 'Bake a pound cake', 'Prepare Roast Chicken', 'Make Curry', 'Put a rack of ribs in the smoker', 'Buy dinner out', 'Have ice cream', 'Sandwiches - again']
select = None
while True:
for i in range(len(menu_items)... |
def primes(n):
out = list()
sieve = [True] * (n+1)
for p in range(2, n+1):
if sieve[p]:
out.append(p)
for i in range(p, n+1, p):
sieve[i] = False
return out
def is_prime(n):
if n <= 1:
return False
if n <= 3:
return True
if n ... | def primes(n):
out = list()
sieve = [True] * (n + 1)
for p in range(2, n + 1):
if sieve[p]:
out.append(p)
for i in range(p, n + 1, p):
sieve[i] = False
return out
def is_prime(n):
if n <= 1:
return False
if n <= 3:
return True
... |
class Solution:
def maxArea(self, height: List[int]) -> int:
area = 0
left_pivot = 0
right_pivot = len(height)-1
while left_pivot != right_pivot:
current_area = abs(right_pivot-left_pivot) * min(height[left_pivot], height[right_pivot])
# ... | class Solution:
def max_area(self, height: List[int]) -> int:
area = 0
left_pivot = 0
right_pivot = len(height) - 1
while left_pivot != right_pivot:
current_area = abs(right_pivot - left_pivot) * min(height[left_pivot], height[right_pivot])
if current_area > ... |
print("------------------")
print("------------------")
print("------------------")
print("------------------")
print("------------------")
num1 = 10
num2 = 20
| print('------------------')
print('------------------')
print('------------------')
print('------------------')
print('------------------')
num1 = 10
num2 = 20 |
#exceptions
def spam(divided_by):
try:
return 42 / divided_by
except:
print('Invalid argument.')
print(spam(2))
print(spam(0))
print(spam(1))
| def spam(divided_by):
try:
return 42 / divided_by
except:
print('Invalid argument.')
print(spam(2))
print(spam(0))
print(spam(1)) |
# Slackbot API Information
slack_bot_token = "xoxb-2650828670406-2670419769553-qxTzP6Sbh9tlqfYIA52wh1bZ"
bot_id = "xoxb-2650828670406-2670419769553-qxTzP6Sbh9tlqfYIA52wh1bZ"
# AIML FIles
directory = "/aiml"
learn_file = "std-startup.xml"
respond = "load aiml b" | slack_bot_token = 'xoxb-2650828670406-2670419769553-qxTzP6Sbh9tlqfYIA52wh1bZ'
bot_id = 'xoxb-2650828670406-2670419769553-qxTzP6Sbh9tlqfYIA52wh1bZ'
directory = '/aiml'
learn_file = 'std-startup.xml'
respond = 'load aiml b' |
#-*- coding: UTF-8 -*-
def log_info(msg):
print ('bn info:'+msg);
return;
def log_error(msg):
print ('bn error:'+msg);
return;
def log_debug(msg):
print ('bn debug:'+msg);
return; | def log_info(msg):
print('bn info:' + msg)
return
def log_error(msg):
print('bn error:' + msg)
return
def log_debug(msg):
print('bn debug:' + msg)
return |
def fighter():
i01.moveHead(160,87)
i01.moveArm("left",31,75,152,10)
i01.moveArm("right",3,94,33,16)
i01.moveHand("left",161,151,133,127,107,83)
i01.moveHand("right",99,130,152,154,145,180)
i01.moveTorso(90,90,90) | def fighter():
i01.moveHead(160, 87)
i01.moveArm('left', 31, 75, 152, 10)
i01.moveArm('right', 3, 94, 33, 16)
i01.moveHand('left', 161, 151, 133, 127, 107, 83)
i01.moveHand('right', 99, 130, 152, 154, 145, 180)
i01.moveTorso(90, 90, 90) |
# -*- coding: utf-8 -*-
__name__ = "bayrell-common"
__version__ = "0.0.2"
__description__ = "Bayrell Common Library"
__license__ = "Apache License Version 2.0"
__author__ = "Ildar Bikmamatov"
__email__ = "support@bayrell.org"
__copyright__ = "Copyright 2016-2018"
__url__ = "https://github.com/bayrell/common_py3"
| __name__ = 'bayrell-common'
__version__ = '0.0.2'
__description__ = 'Bayrell Common Library'
__license__ = 'Apache License Version 2.0'
__author__ = 'Ildar Bikmamatov'
__email__ = 'support@bayrell.org'
__copyright__ = 'Copyright 2016-2018'
__url__ = 'https://github.com/bayrell/common_py3' |
description = 'Verify the application shows the correct error message when creating a project without name'
pages = ['common',
'index']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
def test(data):
click(index.create_project_button)
click(index.create_button)
index.veri... | description = 'Verify the application shows the correct error message when creating a project without name'
pages = ['common', 'index']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
def test(data):
click(index.create_project_button)
click(index.create_button)
index.verify_error_me... |
expected_output = {
'group':{
1:{
'state':'Ready',
'core_interfaces':{
'Bundle-Ether2':{
'state':'up'
},
'TenGigE0/1/0/6/1':{
'state':'up'
}
},
'access_in... | expected_output = {'group': {1: {'state': 'Ready', 'core_interfaces': {'Bundle-Ether2': {'state': 'up'}, 'TenGigE0/1/0/6/1': {'state': 'up'}}, 'access_interfaces': {'Bundle-Ether1': {'state': 'up'}}}}} |
class Band:
def __init__(self, musicians={}):
self._musicians = musicians
def add_musician(self, musician):
if musician is None:
raise ValueError("Missing required musician instance!")
if musician.get_email() in self._musicians.keys():
raise ValueError("Email a... | class Band:
def __init__(self, musicians={}):
self._musicians = musicians
def add_musician(self, musician):
if musician is None:
raise value_error('Missing required musician instance!')
if musician.get_email() in self._musicians.keys():
raise value_error('Email ... |
class TestStackiPalletInfo:
def test_no_pallet_name(self, run_ansible_module):
result = run_ansible_module("stacki_pallet_info")
assert result.status == "SUCCESS"
assert result.data["changed"] is False
def test_pallet_name(self, run_ansible_module):
pallet_name = "stacki"
... | class Teststackipalletinfo:
def test_no_pallet_name(self, run_ansible_module):
result = run_ansible_module('stacki_pallet_info')
assert result.status == 'SUCCESS'
assert result.data['changed'] is False
def test_pallet_name(self, run_ansible_module):
pallet_name = 'stacki'
... |
'''(Record and Move on Technique [E]): Given a sorted array A and a target T,
find the target. If the target is not in the array, find the number closest to the target.
For example, if A = [2,3,5,8,9,11] and T = 7, return 8.'''
def record(arr, mid, res, T):
if res == -1 or abs(arr[mid] - T) < abs(arr[res] - T... | """(Record and Move on Technique [E]): Given a sorted array A and a target T,
find the target. If the target is not in the array, find the number closest to the target.
For example, if A = [2,3,5,8,9,11] and T = 7, return 8."""
def record(arr, mid, res, T):
if res == -1 or abs(arr[mid] - T) < abs(arr[res] - T):
... |
f1 = open("../train_pre_1")
f2 = open("../test_pre_1")
out1 = open("../train_pre_1b","w")
out2 = open("../test_pre_1b","w")
t = open("../train_gbdt_out")
v = open("../test_gbdt_out")
add = []
for i in xrange(30,49):
add.append("C" + str(i))
line = f1.readline()
print >> out1, line[:-1] + "," + ",".join(add)
line = f2... | f1 = open('../train_pre_1')
f2 = open('../test_pre_1')
out1 = open('../train_pre_1b', 'w')
out2 = open('../test_pre_1b', 'w')
t = open('../train_gbdt_out')
v = open('../test_gbdt_out')
add = []
for i in xrange(30, 49):
add.append('C' + str(i))
line = f1.readline()
(print >> out1, line[:-1] + ',' + ','.join(add))
li... |
class Solution:
def readBinaryWatch(self, num: int) -> List[str]:
return [str(h)+':'+'0'*(m<10)+str(m) for h in range(12) for m in range(60) if (bin(m)+bin(h)).count('1') ==
num]
| class Solution:
def read_binary_watch(self, num: int) -> List[str]:
return [str(h) + ':' + '0' * (m < 10) + str(m) for h in range(12) for m in range(60) if (bin(m) + bin(h)).count('1') == num] |
# 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 ( a ) :
return ( 4 * a )
#TOFILL
if __name__ == '__main__':
param = [
(98,),
(9,),
(18,),
... | def f_gold(a):
return 4 * a
if __name__ == '__main__':
param = [(98,), (9,), (18,), (38,), (84,), (8,), (39,), (6,), (60,), (47,)]
n_success = 0
for (i, parameters_set) in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success += 1
print('#Results: %... |
selRoi = 0
top_left= [20,40]
bottom_right = [60,120]
#For cars2.avi
top_left= [40,50]
bottom_right = [60,80]
top_left2= [110,40]
bottom_right2 = [150,120]
first_time = 1
video_path = 'cars2.avi' | sel_roi = 0
top_left = [20, 40]
bottom_right = [60, 120]
top_left = [40, 50]
bottom_right = [60, 80]
top_left2 = [110, 40]
bottom_right2 = [150, 120]
first_time = 1
video_path = 'cars2.avi' |
class Animal:
def __init__(self):
self.age = 1
def eat(self):
print("eat")
class Mammal(Animal):
def walk(self):
print("walk")
m = Mammal()
print(isinstance(m, Mammal))
print(isinstance(m, Animal))
print(isinstance(Mammal, object))
o = object()
print(issubclass(Mammal, Animal))... | class Animal:
def __init__(self):
self.age = 1
def eat(self):
print('eat')
class Mammal(Animal):
def walk(self):
print('walk')
m = mammal()
print(isinstance(m, Mammal))
print(isinstance(m, Animal))
print(isinstance(Mammal, object))
o = object()
print(issubclass(Mammal, Animal))
p... |
inventory_dict = {
"core": [
"PrettyName",
"Present",
"Functional"
],
"fan": [
"PrettyName",
"Present",
"MeetsMinimumShipLevel",
"Functional"
],
"fan_wc": [
"PrettyName",
"Present",
"MeetsMinimumShipLevel"
],
"fr... | inventory_dict = {'core': ['PrettyName', 'Present', 'Functional'], 'fan': ['PrettyName', 'Present', 'MeetsMinimumShipLevel', 'Functional'], 'fan_wc': ['PrettyName', 'Present', 'MeetsMinimumShipLevel'], 'fru': ['PrettyName', 'Present', 'PartNumber', 'SerialNumber', 'Manufacturer', 'BuildDate', 'Model', 'Version', 'Field... |
SEAL_CHECKER = 9300535
SEAL_OF_TIME = 2159367
if not sm.hasQuest(25672):
sm.createQuestWithQRValue(25672, "1")
sm.showFieldEffect("lightning/screenMsg/6", 0) | seal_checker = 9300535
seal_of_time = 2159367
if not sm.hasQuest(25672):
sm.createQuestWithQRValue(25672, '1')
sm.showFieldEffect('lightning/screenMsg/6', 0) |
class Solution:
def minJumps(self, arr: List[int]) -> int:
if len(arr) == 1:
return 0
d = collections.defaultdict(list)
for index, element in enumerate(arr):
d[element].append(index)
queue = collections.deque([(0, 0)])
s = set()
s.add... | class Solution:
def min_jumps(self, arr: List[int]) -> int:
if len(arr) == 1:
return 0
d = collections.defaultdict(list)
for (index, element) in enumerate(arr):
d[element].append(index)
queue = collections.deque([(0, 0)])
s = set()
s.add(0)
... |
_base_ = './model_r3d18.py'
model = dict(
backbone=dict(type='R2Plus1D'),
)
| _base_ = './model_r3d18.py'
model = dict(backbone=dict(type='R2Plus1D')) |
'''input
ABCD
No
BACD
Yes
'''
# -*- coding: utf-8 -*-
# CODE FESTIVAL 2017 qual C
# Problem A
if __name__ == '__main__':
s = input()
if 'AC' in s:
print('Yes')
else:
print('No')
| """input
ABCD
No
BACD
Yes
"""
if __name__ == '__main__':
s = input()
if 'AC' in s:
print('Yes')
else:
print('No') |
ss = input()
out = ss[0]
for i in range(1, len(ss)):
if ss[i] != ss[i-1]: out += ss[i]
print(out)
| ss = input()
out = ss[0]
for i in range(1, len(ss)):
if ss[i] != ss[i - 1]:
out += ss[i]
print(out) |
def onStart():
parent().par.Showshortcut = True
def onCreate():
onStart()
| def on_start():
parent().par.Showshortcut = True
def on_create():
on_start() |
#Edited by Joseph Hutchens
def test():
print("Sucessfully Complete")
return 1
test()
| def test():
print('Sucessfully Complete')
return 1
test() |
__all__ = [
'ValidationError',
'MethodMissingError',
]
class ValidationError(Exception):
pass
class MethodMissingError(Exception):
pass
| __all__ = ['ValidationError', 'MethodMissingError']
class Validationerror(Exception):
pass
class Methodmissingerror(Exception):
pass |
def main():
while True:
text = input("Enter a number: ")
if not text:
print("Later...")
break
num = int(text)
num_class = "small" if num < 100 else "huge!"
print(f"The number is {num_class}")
| def main():
while True:
text = input('Enter a number: ')
if not text:
print('Later...')
break
num = int(text)
num_class = 'small' if num < 100 else 'huge!'
print(f'The number is {num_class}') |
def main():
# problem1()
# problem2()
# problem3()
problem4()
# Create a function that has two variables.
# One called greeting and another called myName.
# Print out greeting and myName two different ways without using the following examples
def problem1():
greeting = "Hello world"
myNam... | def main():
problem4()
def problem1():
greeting = 'Hello world'
my_name = 'Chey'
print('%s my name is %s.' % (greeting, myName))
def problem2():
secret_password = input('Enter secret password ')
while True:
password = input('Enter password ')
if password == secretPassword:
... |
# 037
# Ask the user to enter their name and display each letter in
# their name on a separate line
name = input('Enter ya name: ')
for i in range(len(name)):
print(name[i])
| name = input('Enter ya name: ')
for i in range(len(name)):
print(name[i]) |
# Dictionary Keys, Items and Values
mice = {'harold': 'tiny mouse', 'rose': 'nipple mouse', 'willy wonka': 'dead mouse'}
# Looping over a dictionary
for m in mice.values(): # All values of the dictionary
print(m)
print()
for m in mice.keys(): # All keys of the dictionary
print(m)
print()
... | mice = {'harold': 'tiny mouse', 'rose': 'nipple mouse', 'willy wonka': 'dead mouse'}
for m in mice.values():
print(m)
print()
for m in mice.keys():
print(m)
print()
for m in mice.items():
print(m)
print()
for (key, value) in mice.items():
print(value + ' ' + key + ' represent!')
print()
print('harold' i... |
def make_greeting(name, formality):
return (
"Greetings and felicitations, {}!".format(name)
if formality
else "Hello, {}!".format(name)
)
| def make_greeting(name, formality):
return 'Greetings and felicitations, {}!'.format(name) if formality else 'Hello, {}!'.format(name) |
class MockMetaMachine(object):
def __init__(self, meta_business_unit_id_set, tag_id_set, platform, type, serial_number="YO"):
self.meta_business_unit_id_set = set(meta_business_unit_id_set)
self._tag_id_set = set(tag_id_set)
self.platform = platform
self.type = type
self.seri... | class Mockmetamachine(object):
def __init__(self, meta_business_unit_id_set, tag_id_set, platform, type, serial_number='YO'):
self.meta_business_unit_id_set = set(meta_business_unit_id_set)
self._tag_id_set = set(tag_id_set)
self.platform = platform
self.type = type
self.ser... |
__all__ = ('CMD_STATUS', 'CMD_STATUS_NAME', 'CMD_BLOCKED', 'CMD_READY',
'CMD_ASSIGNED', 'CMD_RUNNING', 'CMD_FINISHING', 'CMD_DONE',
'CMD_ERROR', 'CMD_CANCELED', 'CMD_TIMEOUT',
'isFinalStatus', 'isRunningStatus')
CMD_STATUS = (CMD_BLOCKED,
CMD_READY,
C... | __all__ = ('CMD_STATUS', 'CMD_STATUS_NAME', 'CMD_BLOCKED', 'CMD_READY', 'CMD_ASSIGNED', 'CMD_RUNNING', 'CMD_FINISHING', 'CMD_DONE', 'CMD_ERROR', 'CMD_CANCELED', 'CMD_TIMEOUT', 'isFinalStatus', 'isRunningStatus')
cmd_status = (cmd_blocked, cmd_ready, cmd_assigned, cmd_running, cmd_finishing, cmd_done, cmd_timeout, cmd_e... |
uri = "postgres://user:password@host/database" # Postgresql url connection string
token = "" # Discord bot token
POLL_ROLE_PING = None # Role ID to ping for polls, leave as None to not ping
THREAD_INACTIVE_HOURS = 12 # How many hours of inactivity are required for a
ADD_USERS_IDS = [] # List of user ids to add to... | uri = 'postgres://user:password@host/database'
token = ''
poll_role_ping = None
thread_inactive_hours = 12
add_users_ids = [] |
# copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License Version 2.0 = uthe "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http //www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | class Keys(object):
null = u'\ue000'
cancel = u'\ue001'
help = u'\ue002'
back_space = u'\ue003'
tab = u'\ue004'
clear = u'\ue005'
return = u'\ue006'
enter = u'\ue007'
shift = u'\ue008'
left_shift = u'\ue008'
control = u'\ue009'
left_control = u'\ue009'
alt = u'\ue00a'... |
def my_cleaner(dryrun):
if dryrun:
print('dryrun, dont really execute')
return
print('execute cleaner...')
def task_sample():
return {
"actions" : None,
"clean" : [my_cleaner],
}
| def my_cleaner(dryrun):
if dryrun:
print('dryrun, dont really execute')
return
print('execute cleaner...')
def task_sample():
return {'actions': None, 'clean': [my_cleaner]} |
def NumFunc(myList1=[],myList2=[],*args):
list3 = list(set(myList1).intersection(myList2))
return list3
myList1 = [1,2,3,4,5,6]
myList2 = [3, 5, 7, 9]
NumFunc(myList1,myList2) | def num_func(myList1=[], myList2=[], *args):
list3 = list(set(myList1).intersection(myList2))
return list3
my_list1 = [1, 2, 3, 4, 5, 6]
my_list2 = [3, 5, 7, 9]
num_func(myList1, myList2) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
ans = list()
for node in lists:
val = node
while (v... | class Solution:
def merge_k_lists(self, lists: List[ListNode]) -> ListNode:
ans = list()
for node in lists:
val = node
while val != None:
ans.append(val.val)
val = val.next
ans = sorted(ans)
sub = None
point = None
... |
# Copyright (C) 2021 <FacuFalcone - CaidevOficial>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | def bag(sizeBag: int, kilos: list, values: list, index: int):
if index == 0 or sizeBag == 0:
return 0
elif kilos[index - 1] > sizeBag:
return bag(sizeBag, kilos, values, index - 1)
return max(values[index - 1] + bag(sizeBag - kilos[index - 1], kilos, values, index - 1), bag(sizeBag, kilos, v... |
#Replace all ______ with rjust, ljust or center.
THICKNESS = int(input()) #This must be an odd number
c = 'H'
# Top Cone
for i in range(THICKNESS):
print((c*i).rjust(THICKNESS-1)+c+(c*i).ljust(THICKNESS-1))
# Top Pillars
for i in range(THICKNESS+1):
print((c*THICKNESS).center(THICKNESS*2)+(c*THICK... | thickness = int(input())
c = 'H'
for i in range(THICKNESS):
print((c * i).rjust(THICKNESS - 1) + c + (c * i).ljust(THICKNESS - 1))
for i in range(THICKNESS + 1):
print((c * THICKNESS).center(THICKNESS * 2) + (c * THICKNESS).center(THICKNESS * 6))
for i in range((THICKNESS + 1) // 2):
print((c * THICKNESS * ... |
cellsize = 200
cells = {}
recording = False
class Cell:
def __init__(self, x, y, ix, iy):
self.x, self.y = x, y
self.ix, self.iy = ix, iy # positional indices
self.xdiv = 1.0
self.ydiv = 1.0
self.left = None
self.up = None
def left_inter(self):
if s... | cellsize = 200
cells = {}
recording = False
class Cell:
def __init__(self, x, y, ix, iy):
(self.x, self.y) = (x, y)
(self.ix, self.iy) = (ix, iy)
self.xdiv = 1.0
self.ydiv = 1.0
self.left = None
self.up = None
def left_inter(self):
if self.left:
... |
HUOBI_URL_PRO = "https://api.huobi.sg"
HUOBI_URL_VN = "https://api.huobi.sg"
HUOBI_URL_SO = "https://api.huobi.sg"
HUOBI_WEBSOCKET_URI_PRO = "wss://api.huobi.sg"
HUOBI_WEBSOCKET_URI_VN = "wss://api.huobi.sg"
HUOBI_WEBSOCKET_URI_SO = "wss://api.huobi.sg"
class WebSocketDefine:
Uri = HUOBI_WEBSOCKET_URI_PRO
clas... | huobi_url_pro = 'https://api.huobi.sg'
huobi_url_vn = 'https://api.huobi.sg'
huobi_url_so = 'https://api.huobi.sg'
huobi_websocket_uri_pro = 'wss://api.huobi.sg'
huobi_websocket_uri_vn = 'wss://api.huobi.sg'
huobi_websocket_uri_so = 'wss://api.huobi.sg'
class Websocketdefine:
uri = HUOBI_WEBSOCKET_URI_PRO
class R... |
def index(array,index):
try:
return array[index]
except:
return array
def append(array,value):
try:
array.append(value)
except:
pass
return array
def remove(array,index):
try:
del array[index]
except:
pass
return array
def dedupe(array):... | def index(array, index):
try:
return array[index]
except:
return array
def append(array, value):
try:
array.append(value)
except:
pass
return array
def remove(array, index):
try:
del array[index]
except:
pass
return array
def dedupe(arra... |
class Entity():
def __init__(self, entityID, type, attributeMap):
self.__entityID = entityID
self.__type = type
self.__attributeMap = attributeMap
@property
def entityID(self):
return self.__entityID
@entityID.setter
def entityID(self, entityID):
self.__enti... | class Entity:
def __init__(self, entityID, type, attributeMap):
self.__entityID = entityID
self.__type = type
self.__attributeMap = attributeMap
@property
def entity_id(self):
return self.__entityID
@entityID.setter
def entity_id(self, entityID):
self.__ent... |
#
# from src/3dgraph.c
#
# a part of main to tdGraph
#
_MAX_VALUE = float("inf")
class parametersTDGraph:
def __init__(self, m, n, t, u, minX, minY, minZ, maxX, maxY, maxZ):
self.m = m
self.n = n
self.t = t
self.u = u
self.minX = minX
self.minY = minY
self.... | _max_value = float('inf')
class Parameterstdgraph:
def __init__(self, m, n, t, u, minX, minY, minZ, maxX, maxY, maxZ):
self.m = m
self.n = n
self.t = t
self.u = u
self.minX = minX
self.minY = minY
self.minZ = minZ
self.maxX = maxX
self.maxY =... |
class CreateSingleEventRequest:
def __init__(self, chart_key, event_key=None, table_booking_config=None, social_distancing_ruleset_key=None):
if chart_key:
self.chartKey = chart_key
if event_key:
self.eventKey = event_key
if table_booking_config is not None:
... | class Createsingleeventrequest:
def __init__(self, chart_key, event_key=None, table_booking_config=None, social_distancing_ruleset_key=None):
if chart_key:
self.chartKey = chart_key
if event_key:
self.eventKey = event_key
if table_booking_config is not None:
... |
#
# PySNMP MIB module PYSNMP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PYSNMP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:43:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
def uniform_cost_search(graph, start, goal):
path = []
explored_nodes = list()
if start == goal:
return path, explored_nodes
path.append(start)
path_cost = 0
frontier = [(path_cost, path)]
while len(frontier) > 0:
path_cost_t... | def uniform_cost_search(graph, start, goal):
path = []
explored_nodes = list()
if start == goal:
return (path, explored_nodes)
path.append(start)
path_cost = 0
frontier = [(path_cost, path)]
while len(frontier) > 0:
(path_cost_till_now, path_till_now) = pop_frontier(frontier)... |
def fibonacci(n):
seznam = []
(a, b) = (0, 1)
for i in range(n):
(a, b) = (b, a+b)
seznam.append(a)
return [a, seznam]
def stevke(stevilo):
n = 1
while n > 0: #nevem kako naj bolje napisem
if fibonacci(n)[0] > 10 ** (stevilo -1):
return fibonacci(n)[1].index(... | def fibonacci(n):
seznam = []
(a, b) = (0, 1)
for i in range(n):
(a, b) = (b, a + b)
seznam.append(a)
return [a, seznam]
def stevke(stevilo):
n = 1
while n > 0:
if fibonacci(n)[0] > 10 ** (stevilo - 1):
return fibonacci(n)[1].index(fibonacci(n)[0]) + 1
... |
spam = 42 # global variable
def printSpam():
print('Spam = ' + str(spam))
def eggs():
spam = 42 # local variable
return spam
print('example xyz')
def Spam():
eggs = 99
bacon()
print(eggs)
def bacon():
ham = 101
eggs = 0
def assignSpam(var):
global spam
spam = var
Spam()
printSpam()
assignSp... | spam = 42
def print_spam():
print('Spam = ' + str(spam))
def eggs():
spam = 42
return spam
print('example xyz')
def spam():
eggs = 99
bacon()
print(eggs)
def bacon():
ham = 101
eggs = 0
def assign_spam(var):
global spam
spam = var
spam()
print_spam()
assign_spam(25)
print_sp... |
n = int(input().strip())
ar = list(map(int, input().strip().split(' ')))
print (ar.count(max(ar)))
#https://www.hackerrank.com/challenges/birthday-cake-candles/problem | n = int(input().strip())
ar = list(map(int, input().strip().split(' ')))
print(ar.count(max(ar))) |
class Project:
def __init__(self, id=None, name=None, description=None):
self.id = id
self.name = name
self.description = description
def __repr__(self):
return "%s: %s, %s" % (self.id, self.name, self.description)
def __eq__(self, other):
return self.id == other.id... | class Project:
def __init__(self, id=None, name=None, description=None):
self.id = id
self.name = name
self.description = description
def __repr__(self):
return '%s: %s, %s' % (self.id, self.name, self.description)
def __eq__(self, other):
return self.id == other.i... |
class Service:
def __init__(self, name):
self.name = name
self.methods = {}
def rpc(self, func_name):
def decorator(func):
self._save_method(func_name, func)
return func
if isinstance(func_name, str):
return decorator
func = func_nam... | class Service:
def __init__(self, name):
self.name = name
self.methods = {}
def rpc(self, func_name):
def decorator(func):
self._save_method(func_name, func)
return func
if isinstance(func_name, str):
return decorator
func = func_nam... |
def prime_factors(strs):
result = []
float=2
while float:
if strs%float==0:
strs = strs / float
result.append(float)
else:
float = float+1
if float>strs:
break
return result
| def prime_factors(strs):
result = []
float = 2
while float:
if strs % float == 0:
strs = strs / float
result.append(float)
else:
float = float + 1
if float > strs:
break
return result |
'''
Steven Kyritsis CS100
2021F Section 031 HW 10,
November 12, 2021
'''
#3
def shareoneletter(wordlist):
d={}
for w in wordlist:
d[w]=[]
for i in wordlist:
match=False
for c in w:
if c in i:
match=True
i... | """
Steven Kyritsis CS100
2021F Section 031 HW 10,
November 12, 2021
"""
def shareoneletter(wordlist):
d = {}
for w in wordlist:
d[w] = []
for i in wordlist:
match = False
for c in w:
if c in i:
match = True
if match and i... |
# A server used to store and retrieve arbitrary data.
# This is used by: ./dispatcher.js
def main(request, response):
response.headers.set(b'Access-Control-Allow-Origin', b'*')
response.headers.set(b'Access-Control-Allow-Methods', b'OPTIONS, GET, POST')
response.headers.set(b'Access-Control-Allow-Headers', ... | def main(request, response):
response.headers.set(b'Access-Control-Allow-Origin', b'*')
response.headers.set(b'Access-Control-Allow-Methods', b'OPTIONS, GET, POST')
response.headers.set(b'Access-Control-Allow-Headers', b'Content-Type')
response.headers.set(b'Cache-Control', b'no-cache, no-store, must-re... |
clarify_boosted = {
'abita cove': ["cooked cod"],
'the red city': ["baked potatoes", "carrots", "iron ingot"],
'claybound': ["cooked salmon"]
}
aliases = {
'Quartz': 'Quartz Crystal',
'Potatoes': 'Baked Potatoes',
'Nether Wart': 'Nether Wart Block'
}
| clarify_boosted = {'abita cove': ['cooked cod'], 'the red city': ['baked potatoes', 'carrots', 'iron ingot'], 'claybound': ['cooked salmon']}
aliases = {'Quartz': 'Quartz Crystal', 'Potatoes': 'Baked Potatoes', 'Nether Wart': 'Nether Wart Block'} |
while True:
linha = input("Digite qualquer coisa ou \"fim\" para terminar: ")
if linha == "fim":
break
print(linha)
print("Fim!")
| while True:
linha = input('Digite qualquer coisa ou "fim" para terminar: ')
if linha == 'fim':
break
print(linha)
print('Fim!') |
phrase = input('Enter a phrase: ')
for c in phrase:
if c in 'aeoiuAEOIU':
print(c) | phrase = input('Enter a phrase: ')
for c in phrase:
if c in 'aeoiuAEOIU':
print(c) |
# author Mahmud Ahsan
# --------------------
# msmath module under mspack package
# --------------------
def sum(x, y):
return x + y
def subtract(x, y):
return x - y
def multiplication(x, y):
return x * y
def division(x, y):
return x / y | def sum(x, y):
return x + y
def subtract(x, y):
return x - y
def multiplication(x, y):
return x * y
def division(x, y):
return x / y |
rows=input()
rows=int(rows)
k=0
matrixList=[]; evenMatrix=[]
while rows!=0:
matrix=input()
matrix=matrix.split(", "); matrix=[int(e) for e in matrix]
e=0; elements=len(matrix)
matrixList.append([])
while e < elements:
matrixList[k].append(matrix[0])
del matrix[0]
... | rows = input()
rows = int(rows)
k = 0
matrix_list = []
even_matrix = []
while rows != 0:
matrix = input()
matrix = matrix.split(', ')
matrix = [int(e) for e in matrix]
e = 0
elements = len(matrix)
matrixList.append([])
while e < elements:
matrixList[k].append(matrix[0])
del m... |
def profitable_gamble(prob, prize, pay):
if prob * prize > pay:
return True
return False
print(profitable_gamble(4,8,12)) | def profitable_gamble(prob, prize, pay):
if prob * prize > pay:
return True
return False
print(profitable_gamble(4, 8, 12)) |
#addition.py
def add(a,b):
return a+b
a=int(input("Enter the a value"))
b= int(input("Enter the b value"))
c=add(a,b)
print(c) | def add(a, b):
return a + b
a = int(input('Enter the a value'))
b = int(input('Enter the b value'))
c = add(a, b)
print(c) |
class Block:
def __init__(self):
self.statements = []
def add_statement(self, statement):
self.statements.append(statement)
| class Block:
def __init__(self):
self.statements = []
def add_statement(self, statement):
self.statements.append(statement) |
# TODO: Just change this to CSS
colors = {
"text" : "#aaaaaa",
"background" : "#222221",
"plot_background" : "#222221",
"plot_gridlines" : "#777776",
"page_background" : "#222221"
} | colors = {'text': '#aaaaaa', 'background': '#222221', 'plot_background': '#222221', 'plot_gridlines': '#777776', 'page_background': '#222221'} |
clang_env = {
"ASAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
"CC": "/usr/local/bin/clang",
"GCOV": "/dev/null",
"LD_LIBRARY_PATH": "/usr/local/lib",
"MSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
"TSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
"UBSAN_SYMBOLIZE... | clang_env = {'ASAN_SYMBOLIZER_PATH': '/usr/local/bin/llvm-symbolizer', 'CC': '/usr/local/bin/clang', 'GCOV': '/dev/null', 'LD_LIBRARY_PATH': '/usr/local/lib', 'MSAN_SYMBOLIZER_PATH': '/usr/local/bin/llvm-symbolizer', 'TSAN_SYMBOLIZER_PATH': '/usr/local/bin/llvm-symbolizer', 'UBSAN_SYMBOLIZER_PATH': '/usr/local/bin/llvm... |
# Task 03. Special Numbers
num = int(input())
digits = [x for x in range(1,num+1)]
is_special = False
for digit in digits:
digit_iter = [int(x) for x in str(digit)]
if sum(digit_iter) == 5 or sum(digit_iter) == 7 or sum(digit_iter) == 11:
is_special = True
else:
is_special = False
pri... | num = int(input())
digits = [x for x in range(1, num + 1)]
is_special = False
for digit in digits:
digit_iter = [int(x) for x in str(digit)]
if sum(digit_iter) == 5 or sum(digit_iter) == 7 or sum(digit_iter) == 11:
is_special = True
else:
is_special = False
print(f'{digit} -> {is_special... |
__version__ = '0.11.2'
# import importlib
# import logging
# from pathlib import Path
# importlib.reload(logging)
# logpath = Path.home() / 'p4reduction.log'
# logging.basicConfig(filename=str(logpath), filemode='w',
# format='%(asctime)s %(levelname)s: %(message)s',
# datefmt='... | __version__ = '0.11.2' |
def binario(n):
num = []
while(n>1):
if(n==2 or n==3):
resto = n % 2
n //= 2
num.append(resto)
num.append(n)
else:
resto = n % 2
n //= 2
num.append(resto)
return num
n = int(input('digite um numero: '))
n... | def binario(n):
num = []
while n > 1:
if n == 2 or n == 3:
resto = n % 2
n //= 2
num.append(resto)
num.append(n)
else:
resto = n % 2
n //= 2
num.append(resto)
return num
n = int(input('digite um numero: '))
n... |
#
#
# Package libApp in directory source
#
#
print("Loaded libApp")
#
# This file can be left empty, but its presence informs the import mechanism
#
| print('Loaded libApp') |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Corwin Brown <corwin@corwinbrown.com>
# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}
documentation = '\n---\nmodule: win_uri\nversion_added: \'2.1\'\nshort_description: Interacts with webservices\ndescription:\n- Interacts with FTP, HTTP and HTTPS web services.\n- Supports Digest, Basic and WSSE HTTP auth... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if... | debug = True
template_debug = DEBUG
admins = ()
managers = ADMINS
databases = {'default': {'ENGINE': 'django.db.backends.', 'NAME': '', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': ''}}
time_zone = 'America/Detroit'
media_root = ''
media_url = ''
static_root = ''
static_url = '/static/'
secret_key = 't76+zh&*@(p... |
VERSION = "3.6.dev1"
SERIES = '.'.join(VERSION.split('.')[:2])
| version = '3.6.dev1'
series = '.'.join(VERSION.split('.')[:2]) |
cookie = {
'ipb_member_id': '',
'ipb_pass_hash': '',
'igneous': '',
} | cookie = {'ipb_member_id': '', 'ipb_pass_hash': '', 'igneous': ''} |
class UserTarget:
@staticmethod
def get_response():
return "Response by UserTarget"
| class Usertarget:
@staticmethod
def get_response():
return 'Response by UserTarget' |
class ATM:
def __init__(self, balance, bank_name):
self.balance = balance
self.bank_name = bank_name
self.withdrawals_list = []
def calcul(self,request):
self.withdrawals_list.append(request)
self.balance -= request
notes =[100,50,10,5]
for note in notes :... | class Atm:
def __init__(self, balance, bank_name):
self.balance = balance
self.bank_name = bank_name
self.withdrawals_list = []
def calcul(self, request):
self.withdrawals_list.append(request)
self.balance -= request
notes = [100, 50, 10, 5]
for note in ... |
#
# @lc app=leetcode id=53 lang=python3
#
# [53] Maximum Subarray
#
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
if all([x < 0 for x in nums]):
return max(nums)
running_sum = 0
ans = 0
for x in nums:
running_sum += x
... | class Solution:
def max_sub_array(self, nums: List[int]) -> int:
if all([x < 0 for x in nums]):
return max(nums)
running_sum = 0
ans = 0
for x in nums:
running_sum += x
if running_sum < 0:
running_sum = 0
continue
... |
# flake8: NOQA: E501
# This proves that the given key (which is an account) exists on the trie rooted at this state
# root. It was obtained by querying geth via the LES protocol
state_root = b'Gu\xd8\x85\xf5/\x83:e\xf5\x9e0\x0b\xce\x86J\xcc\xe4.0\xc8#\xdaW\xb3\xbd\xd0).\x91\x17\xe8'
key = b'\x9b\xbf\xc3\x08Z\xd0\xd47\x... | state_root = b'Gu\xd8\x85\xf5/\x83:e\xf5\x9e0\x0b\xce\x86J\xcc\xe4.0\xc8#\xdaW\xb3\xbd\xd0).\x91\x17\xe8'
key = b'\x9b\xbf\xc3\x08Z\xd0\xd47\x84\xe6\xe4S4ndG|\xac\xa3\x0f^7\xd5nv\x14\x9e\x98\x84\xe7\xc2\x97'
proof = ([b'\x01\xb2\xcf/\xa7&\xef{\xec9c%\xed\xeb\x9b)\xe9n\xb5\xd5\x0e\x8c\xa9A\xc1:-{<2$)', b'\xa2\xbab\xe5J\... |
# Minizip library
unz = StaticLibrary( 'unz', sources = ['ioapi.c', 'mztools.c', 'unzip.c', 'zip.c'] )
# minizip
minizip = Executable( 'minizip', libs = [ unz, 'z' ], sources = ['minizip.c'] )
# miniunz
miniunz = Executable( 'miniunz', libs = [ unz, 'z' ], sources = ['miniunz.c'] )
# Platform specific setti... | unz = static_library('unz', sources=['ioapi.c', 'mztools.c', 'unzip.c', 'zip.c'])
minizip = executable('minizip', libs=[unz, 'z'], sources=['minizip.c'])
miniunz = executable('miniunz', libs=[unz, 'z'], sources=['miniunz.c'])
if platform == 'MacOS':
project.define('unix')
elif platform == 'iOS':
project.define(... |
_base_ = [
'./coco_resize.py'
]
data = dict(
train=dict(classes=('person',)),
val=dict(classes=('person',)),
test=dict(classes=('person',))
)
| _base_ = ['./coco_resize.py']
data = dict(train=dict(classes=('person',)), val=dict(classes=('person',)), test=dict(classes=('person',))) |
class DFS:
def __init__(self):
self.visited_node_counter = 0
def visitor(self):
self.visited_node_counter += 1
def visit(self, node):
node.accept_visitor(self.visitor)
for child in node.children: self.visit(child)
class Node:
def __init__(self):
self.children = []
def add_child(self,... | class Dfs:
def __init__(self):
self.visited_node_counter = 0
def visitor(self):
self.visited_node_counter += 1
def visit(self, node):
node.accept_visitor(self.visitor)
for child in node.children:
self.visit(child)
class Node:
def __init__(self):
s... |
n=int(input())
l=[1 for i in range(n)]
for i in range(1,n):
for x in range(n):
if x==0:
continue
else:
l[x]=l[x]+l[x-1]
print(l[-1])
| n = int(input())
l = [1 for i in range(n)]
for i in range(1, n):
for x in range(n):
if x == 0:
continue
else:
l[x] = l[x] + l[x - 1]
print(l[-1]) |
android = 70 # percents of people using nova poshta on android
ios = 30 # percents of people using nova poshta on ios
people_count = 5000000
ios_people = people_count/ 100 * ios
print (ios_people, " people using nova poshta on ios.") | android = 70
ios = 30
people_count = 5000000
ios_people = people_count / 100 * ios
print(ios_people, ' people using nova poshta on ios.') |
class Profile:
'''
Example
my = Profile('Rob')
my.company = 'CPF'
my.hobby = ['Reading','Sleeping','Eating']
print(my.name)
my.show_email()
my.show_myart()
my.show_hobby()
'''
def __init__(self,name):
self.name = name
self.company = ''
self.hobby = []
self.art = '''
|\ _... | class Profile:
"""
Example
my = Profile('Rob')
my.company = 'CPF'
my.hobby = ['Reading','Sleeping','Eating']
print(my.name)
my.show_email()
my.show_myart()
my.show_hobby()
"""
def __init__(self, name):
self.name = name
self.company = ''
self.hobby = []
self.art = "\n\t\... |
def format_duration(seconds):
years = int(seconds/(365*24*60*60))
days = int((seconds-(years*365*24*60*60))/(24*60*60))
hours = int((seconds-(years*365*24*60*60)-(days*24*60*60)) / (60*60))
mins = int((seconds-(years*365*24*60*60)-(days*24*60*60) - hours*60*60)/60)
sec = (seconds -(years*365*24*60*... | def format_duration(seconds):
years = int(seconds / (365 * 24 * 60 * 60))
days = int((seconds - years * 365 * 24 * 60 * 60) / (24 * 60 * 60))
hours = int((seconds - years * 365 * 24 * 60 * 60 - days * 24 * 60 * 60) / (60 * 60))
mins = int((seconds - years * 365 * 24 * 60 * 60 - days * 24 * 60 * 60 - hou... |
# "range(1,11)" just provides us a list of numbers 1-10 (the last number isn't included).
# The list in this case would look like this: [1,2,3,4,5,6,7,8,9,10].
# For loop
## This takes each number inside "range", and saves it as a variable "i". It does whatever is in the loop with that variable, then moves to the next... | for i in range(1, 11):
print(i)
do_loop = True
while do_loop:
user_input = input('Should I do the loop again? ')
if user_input == 'no':
do_loop = False
print('Ok, exiting loop') |
math_str = input("please input a number: ")
math = int(math_str)
math6 = 6
if math == math6:
print("Yes, it is 6!")
elif math < math6:
print("That's less than 6!")
else:
print("That's more than 6!")
| math_str = input('please input a number: ')
math = int(math_str)
math6 = 6
if math == math6:
print('Yes, it is 6!')
elif math < math6:
print("That's less than 6!")
else:
print("That's more than 6!") |
a = arr = [[False for i in range(100)] for j in range(100)]
ans = 0
sl = 0
block= []
def findLargestRectangle(blockNumber):
global sl
global block
block = blockNumber
for i in block: sl += i
for i in range(1,9):
find(i, 1)
return ans
def find(r,n):
global ans
global a
# ca... | a = arr = [[False for i in range(100)] for j in range(100)]
ans = 0
sl = 0
block = []
def find_largest_rectangle(blockNumber):
global sl
global block
block = blockNumber
for i in block:
sl += i
for i in range(1, 9):
find(i, 1)
return ans
def find(r, n):
global ans
globa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.