content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def solve(self, nums):
sameIndexAfterSortingCount = 0
sortedNums = sorted(nums)
for i in range(len(nums)):
if sortedNums[i] == nums[i]:
sameIndexAfterSortingCount += 1
return sameIndexAfterSortingCount
| class Solution:
def solve(self, nums):
same_index_after_sorting_count = 0
sorted_nums = sorted(nums)
for i in range(len(nums)):
if sortedNums[i] == nums[i]:
same_index_after_sorting_count += 1
return sameIndexAfterSortingCount |
S = 'shrubbery'
L = list(S)
print('L', L)
| s = 'shrubbery'
l = list(S)
print('L', L) |
def get_binary_nmubmer(decimal_number):
assert isinstance(decimal_number, int)
return bin(decimal_number)
print(get_binary_nmubmer(10.5)) | def get_binary_nmubmer(decimal_number):
assert isinstance(decimal_number, int)
return bin(decimal_number)
print(get_binary_nmubmer(10.5)) |
def is_kadomatsu(a):
if a[0] == a[1] or a[1] == a[2] or a[0] == a[2]:
return False
return min(a) == a[1] or max(a) == a[1]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(3):
for j in range(3):
a[i], b[j] = b[j], a[i]
if is_kadomatsu(a) and i... | def is_kadomatsu(a):
if a[0] == a[1] or a[1] == a[2] or a[0] == a[2]:
return False
return min(a) == a[1] or max(a) == a[1]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(3):
for j in range(3):
(a[i], b[j]) = (b[j], a[i])
if is_kadomatsu(a) and ... |
class Tesla:
# WRITE YOUR CODE HERE
def __init__(self, model: str, color: str, autopilot: bool = False, seats_count: int = 5, is_locked: bool = True, battery_charge: float = 99.9, efficiency: float = 0.3):
self.__model = model
self.__color = color
self.__autopilot = autopilot
sel... | class Tesla:
def __init__(self, model: str, color: str, autopilot: bool=False, seats_count: int=5, is_locked: bool=True, battery_charge: float=99.9, efficiency: float=0.3):
self.__model = model
self.__color = color
self.__autopilot = autopilot
self.__battery_charge = battery_charge
... |
def sum(*args):
total_sum = 0
for number in args:
total_sum += number
return total_sum
result = sum(1, 3, 4, 5, 8, 9, 16)
print({ 'result': result })
| def sum(*args):
total_sum = 0
for number in args:
total_sum += number
return total_sum
result = sum(1, 3, 4, 5, 8, 9, 16)
print({'result': result}) |
class VangError(Exception):
def __init__(self, msg=None, key=None):
self.msg = msg or {}
self.key = key
class InitError(Exception):
pass
| class Vangerror(Exception):
def __init__(self, msg=None, key=None):
self.msg = msg or {}
self.key = key
class Initerror(Exception):
pass |
BOS_TOKEN = '[unused98]'
EOS_TOKEN = '[unused99]'
CLS_TOKEN = '[CLS]'
SPACE_TOKEN = '[unused1]'
UNK_TOKEN = '[UNK]'
SPECIAL_TOKENS = [BOS_TOKEN, EOS_TOKEN, CLS_TOKEN, SPACE_TOKEN, UNK_TOKEN]
TRAIN = 'train'
EVAL = 'eval'
PREDICT = 'infer'
MODAL_LIST = ['image', 'others']
| bos_token = '[unused98]'
eos_token = '[unused99]'
cls_token = '[CLS]'
space_token = '[unused1]'
unk_token = '[UNK]'
special_tokens = [BOS_TOKEN, EOS_TOKEN, CLS_TOKEN, SPACE_TOKEN, UNK_TOKEN]
train = 'train'
eval = 'eval'
predict = 'infer'
modal_list = ['image', 'others'] |
def saveHigh(whatyouwant):
file = open('HighPriorityIssues.txt', 'a')
file.write(formatError(whatyouwant))
file.close()
def saveMedium(whatyouwant):
file = open('MediumPriorityIssues.txt', 'a')
file.write(formatError(whatyouwant))
file.close()
def saveLow(whatyouwant):
file = open('LowPriorityIssues.txt', 'a... | def save_high(whatyouwant):
file = open('HighPriorityIssues.txt', 'a')
file.write(format_error(whatyouwant))
file.close()
def save_medium(whatyouwant):
file = open('MediumPriorityIssues.txt', 'a')
file.write(format_error(whatyouwant))
file.close()
def save_low(whatyouwant):
file = open('Lo... |
#!/usr/bin/python3
def add(*matrices):
def check(data):
if data == 1:
return True
else:
raise ValueError
return [[sum(slice) for slice in zip(*row) if check(len(set(map(len, row))))]
for row in zip(*matrices) if check(len(set(map(len, matrices))))]
| def add(*matrices):
def check(data):
if data == 1:
return True
else:
raise ValueError
return [[sum(slice) for slice in zip(*row) if check(len(set(map(len, row))))] for row in zip(*matrices) if check(len(set(map(len, matrices))))] |
# By Websten from forums
#
# Given your birthday and the current date, calculate your age in days.
# Account for leap days.
#
# Assume that the birthday and current date are correct dates (and no
# time travel).
#
def daysBetweenDates(year1, month1, day1, year2, month2, day2):
daysOfMonths = [ 31, ... | def days_between_dates(year1, month1, day1, year2, month2, day2):
days_of_months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0]
if is_leap(year1):
daysOfMonths[1] = 29
else:
daysOfMonths[1] = 28
if year1 == year2:
return daysOfMonths[month1 - 1] - day1 + sum(daysOfMonths[m... |
class HWriter(object):
def __init__(self):
self.__bIsNewLine = True # are we at a new line position?
self.__bHasContent = False # do we already have content in this line?
self.__allParts = []
self.__prefix = ""
self.__nIndent = 0
#
def incrementIndent(self):
self.__nIndent += 1
if self.__nInde... | class Hwriter(object):
def __init__(self):
self.__bIsNewLine = True
self.__bHasContent = False
self.__allParts = []
self.__prefix = ''
self.__nIndent = 0
def increment_indent(self):
self.__nIndent += 1
if self.__nIndent > len(self.__prefix):
... |
class Symbol:
def __init__(self, name):
self.name = name
def __hash__(self):
return hash(self.name)
def __eq__(self, other):
return self.name == other.name
class SymbolTable:
def __init__(self):
self._symbol_table = dict()
def put_symbol(self, symbol):
se... | class Symbol:
def __init__(self, name):
self.name = name
def __hash__(self):
return hash(self.name)
def __eq__(self, other):
return self.name == other.name
class Symboltable:
def __init__(self):
self._symbol_table = dict()
def put_symbol(self, symbol):
s... |
#Max retorna o maior numero de um iteravel ou o maior de 2 ou mais elementos
#Min retorna o menor numero de um iteravel ou o menor de 2 ou mais elementos
lista=[9,5,2,1,4,5,3,6,21,5,4,55,0]
print(max(lista))
print(max(8,9,5,7,4,5,6))
dicionario={'a':0,'b':1,'f':51,'g':12,'q':5,'u':3,'d':2}
print(max(dicionario))
prin... | lista = [9, 5, 2, 1, 4, 5, 3, 6, 21, 5, 4, 55, 0]
print(max(lista))
print(max(8, 9, 5, 7, 4, 5, 6))
dicionario = {'a': 0, 'b': 1, 'f': 51, 'g': 12, 'q': 5, 'u': 3, 'd': 2}
print(max(dicionario))
print(max(dicionario.values()))
print(min(lista))
print(min(8, 9, 5, 7, 4, 5, 6))
dicionario1 = {'a': 0, 'b': 1, 'f': 51, 'g'... |
# Input your Wi-Fi credentials here, if applicable, and rename to "secrets.py"
ssid = ''
wpa = ''
| ssid = ''
wpa = '' |
# To use this bot you need to set up the bot in here,
# You need to decide the prefix you want to use,
# and you need your Token and Application ID from
# the discord page where you manage your apps and bots.
# You need your User ID which you can get from the
# context menu on your name in discord under Copy ID.
# if y... | bot_prefix = 'YOUR_BOT_PREFIX_HERE'
token = 'YOUR_TOKEN_HERE'
application_id = 'YOUR_APPLICATION_ID'
owners = [123456789, 987654321]
data_gov_api_key = 'DEMO_KEY'
openweather_api_key = 'YOUR_API_KEY_HERE'
wolframalpha_api_key = 'YOUR_API_KEY_HERE'
exchangerate_api_key = 'YOUR_API_KEY_HERE'
googlegeo_api_key = 'YOUR_API... |
# Constants
VERSION = '2.0'
STATUS_GREY = 'lair-grey'
STATUS_BLUE = 'lair-blue'
STATUS_GREEN = 'lair-greeen'
STATUS_ORANGE = 'lair-orange'
STATUS_RED = 'lair-red'
STATUS_MAP = [STATUS_GREY, STATUS_BLUE, STATUS_GREEN, STATUS_ORANGE, STATUS_RED]
PROTOCOL_TCP = 'tcp'
PROTOCOL_UDP = 'udp'
PROTOCOL_ICMP = 'icmp'
PRODUCT_UN... | version = '2.0'
status_grey = 'lair-grey'
status_blue = 'lair-blue'
status_green = 'lair-greeen'
status_orange = 'lair-orange'
status_red = 'lair-red'
status_map = [STATUS_GREY, STATUS_BLUE, STATUS_GREEN, STATUS_ORANGE, STATUS_RED]
protocol_tcp = 'tcp'
protocol_udp = 'udp'
protocol_icmp = 'icmp'
product_unknown = 'unkn... |
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/996/A
total = int(input())
bills = [100,20,10,5,1]
nob = 0
for b in bills:
nob += total//b
total = total%b
if total == 0:
break
print(nob)
| total = int(input())
bills = [100, 20, 10, 5, 1]
nob = 0
for b in bills:
nob += total // b
total = total % b
if total == 0:
break
print(nob) |
# Copyright (c) 2020 Anastasiia Birillo
class VkCity:
def __init__(self, data: dict) -> None:
self.id = data['id']
self.title = data.get('title')
def __str__(self):
return f"[{', '.join(map(lambda key: f'{key}={self.__dict__[key]}', self.__dict__))}]"
class VkUser:
def __init__(s... | class Vkcity:
def __init__(self, data: dict) -> None:
self.id = data['id']
self.title = data.get('title')
def __str__(self):
return f"[{', '.join(map(lambda key: f'{key}={self.__dict__[key]}', self.__dict__))}]"
class Vkuser:
def __init__(self, data: dict) -> None:
self.i... |
GENDER_VALUES = (('M', 'Male'),
('F', 'Female'),
('TG', 'Transgender'))
MARITAL_STATUS_VALUES = (('M', 'Married'),
('S', 'Single'),
('U', 'Unknown'))
CATEGORY_VALUES = (('BR', 'Bramhachari'),
('FTT', 'Full Time Teacher'),
... | gender_values = (('M', 'Male'), ('F', 'Female'), ('TG', 'Transgender'))
marital_status_values = (('M', 'Married'), ('S', 'Single'), ('U', 'Unknown'))
category_values = (('BR', 'Bramhachari'), ('FTT', 'Full Time Teacher'), ('PTT', 'Part Time Teacher'), ('FTV', 'Full Time Volunteer'), ('VOL', 'Volunteer'), ('STAFF', 'Sta... |
def solution(S):
# write your code in Python 3.6
if not S:
return 1
stack = []
for s in S:
if s == '(':
stack.append(s)
else:
if not stack:
return 0
else:
stack.pop()
if stack:
return 0
return 1
| def solution(S):
if not S:
return 1
stack = []
for s in S:
if s == '(':
stack.append(s)
elif not stack:
return 0
else:
stack.pop()
if stack:
return 0
return 1 |
class DistributionDiscriminator:
def __init__(self, dataset=None, extractor=None, criterion=None, **kwargs):
super().__init__(**kwargs)
self.dataset = dataset
self.extractor = extractor
self.criterion = criterion
def judge(self, samples):
return self.extractor.extract(samples)
def compare(self, fe... | class Distributiondiscriminator:
def __init__(self, dataset=None, extractor=None, criterion=None, **kwargs):
super().__init__(**kwargs)
self.dataset = dataset
self.extractor = extractor
self.criterion = criterion
def judge(self, samples):
return self.extractor.extract(s... |
class Solution:
def stack(self, s: str) -> list:
st = []
for x in s:
if x == '#':
if len(st) != 0:
st.pop()
continue
st.append(x)
return st
def backspaceCompare(self, S: str, T: str) -> bool:
s = self.st... | class Solution:
def stack(self, s: str) -> list:
st = []
for x in s:
if x == '#':
if len(st) != 0:
st.pop()
continue
st.append(x)
return st
def backspace_compare(self, S: str, T: str) -> bool:
s = self.... |
connections = {}
connections["Joj"] = []
connections["Emily"] = ["Joj","Jeph","Jeff"]
connections["Jeph"] = ["Joj","Geoff"]
connections["Jeff"] = ["Joj","Judge"]
connections["Geoff"] = ["Joj","Jebb"]
connections["Jebb"] = ["Joj","Emily"]
connections["Judge"] = ["Joj","Judy"]
connections["Jodge"] = ["Joj","Jebb","Stepha... | connections = {}
connections['Joj'] = []
connections['Emily'] = ['Joj', 'Jeph', 'Jeff']
connections['Jeph'] = ['Joj', 'Geoff']
connections['Jeff'] = ['Joj', 'Judge']
connections['Geoff'] = ['Joj', 'Jebb']
connections['Jebb'] = ['Joj', 'Emily']
connections['Judge'] = ['Joj', 'Judy']
connections['Jodge'] = ['Joj', 'Jebb'... |
class Constants:
def __init__(self):
pass
SIMPLE_CONFIG_DIR = "/etc/simple_grid"
GIT_PKG_NAME = "git"
DOCKER_PKG_NAME = "docker"
BOLT_PKG_NAME = "bolt"
| class Constants:
def __init__(self):
pass
simple_config_dir = '/etc/simple_grid'
git_pkg_name = 'git'
docker_pkg_name = 'docker'
bolt_pkg_name = 'bolt' |
class Solution:
def longestPrefix(self, s: str) -> str:
pi = [0]*len(s)
for i in range(1, len(s)):
k = pi[i-1]
while k > 0 and s[i] != s[k]:
k = pi[k-1]
if s[i] == s[k]:
k += 1
pi[i] = k
print('pi is... | class Solution:
def longest_prefix(self, s: str) -> str:
pi = [0] * len(s)
for i in range(1, len(s)):
k = pi[i - 1]
while k > 0 and s[i] != s[k]:
k = pi[k - 1]
if s[i] == s[k]:
k += 1
pi[i] = k
print('pi is: ', ... |
def _update_doc_distribution(
X,
exp_topic_word_distr,
doc_topic_prior,
max_doc_update_iter,
mean_change_tol,
cal_sstats,
random_state,
):
is_sparse_x = sp.issparse(X)
n_samples, n_features = X.shape
n_topics = exp_topic_word_distr.shape[0]
if random_state:
doc_topic... | def _update_doc_distribution(X, exp_topic_word_distr, doc_topic_prior, max_doc_update_iter, mean_change_tol, cal_sstats, random_state):
is_sparse_x = sp.issparse(X)
(n_samples, n_features) = X.shape
n_topics = exp_topic_word_distr.shape[0]
if random_state:
doc_topic_distr = random_state.gamma(10... |
def read_convert(input: str) -> list:
dict_list = []
input = input.split("__::__")
for lines in input:
line_dict = {}
line = lines.split("__$$__")
for l in line:
dict_value = l.split("__=__")
key = dict_value[0]
if len(dict_value) == 1:
... | def read_convert(input: str) -> list:
dict_list = []
input = input.split('__::__')
for lines in input:
line_dict = {}
line = lines.split('__$$__')
for l in line:
dict_value = l.split('__=__')
key = dict_value[0]
if len(dict_value) == 1:
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param {TreeNode} root
# @return {integer[]}
def preorderTraversal(self, root):
self.preorder = []
self.trave... | class Solution:
def preorder_traversal(self, root):
self.preorder = []
self.traverse(root)
return self.preorder
def traverse(self, root):
if root:
self.preorder.append(root.val)
self.traverse(root.left)
self.traverse(root.right) |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"websites_url": "01-training-data.ipynb",
"m": "01-training-data.ipynb",
"piece_dirs": "01-training-data.ipynb",
"assert_coord": "01-training-data.ipynb",
"Board": "01-trai... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'websites_url': '01-training-data.ipynb', 'm': '01-training-data.ipynb', 'piece_dirs': '01-training-data.ipynb', 'assert_coord': '01-training-data.ipynb', 'Board': '01-training-data.ipynb', 'Boards': '01-training-data.ipynb', 'boards': '01-training-... |
n = int(input())
i = 5
while i > 0:
root = 1
while root ** i < n:
root = root + 1
if root ** i == n:
print(root, i)
i = i - 1
| n = int(input())
i = 5
while i > 0:
root = 1
while root ** i < n:
root = root + 1
if root ** i == n:
print(root, i)
i = i - 1 |
a = [1, 2, 3, 4, 5]
print(a[0] + 1)
#length of list
x = len(a)
print(x)
print(a[-1])
#splicing
print(a[0:3])
print(a[0:])
b = "test"
print(b[0:1])
| a = [1, 2, 3, 4, 5]
print(a[0] + 1)
x = len(a)
print(x)
print(a[-1])
print(a[0:3])
print(a[0:])
b = 'test'
print(b[0:1]) |
class Solution:
def subarraySum(self, nums: List[int], k: int) -> int:
count = 0
prefix_sum = 0
dic = {0: 1}
for i in range(len(nums)):
prefix_sum += nums[i]
if prefix_sum - k in dic:
count += dic[prefix_sum - k]
if prefix_sum ... | class Solution:
def subarray_sum(self, nums: List[int], k: int) -> int:
count = 0
prefix_sum = 0
dic = {0: 1}
for i in range(len(nums)):
prefix_sum += nums[i]
if prefix_sum - k in dic:
count += dic[prefix_sum - k]
if prefix_sum in ... |
n = int(input())
a = list(map(int,input().split()))
q,w=0,0
for i in a:
if i ==25:q+=1
elif i==50:q-=1;w+=1
else:
if w>0:w-=1;q-=1
else:q-=3
if q<0 or w<0:n=0;break
if n==0:print("NO")
else:print("YES") | n = int(input())
a = list(map(int, input().split()))
(q, w) = (0, 0)
for i in a:
if i == 25:
q += 1
elif i == 50:
q -= 1
w += 1
elif w > 0:
w -= 1
q -= 1
else:
q -= 3
if q < 0 or w < 0:
n = 0
break
if n == 0:
print('NO')
else:
p... |
datas = {
'style' : 'boost',
'prefix' : ['boost','simd'],
'has_submodules' : True,
}
| datas = {'style': 'boost', 'prefix': ['boost', 'simd'], 'has_submodules': True} |
# This script was crated to calculate my net worth across all my accounts, including crypto wallets. I track my fiat
# currency using Mint. The majority of my crypto wallets are not able to sync with Mint. With this script, I answer a
# few questions regarding wallet balances, then my change in net worth (annual a... | coin_balance = float(input('How much COIN do you have? '))
denominator = coin_balance / 1000
numerator = float(input('How much XYO do you get from 1000 COIN? '))
coin_to_xyo = round(numerator * denominator, 3)
xyo__coin_gecko_plug = float(input(f'Enter USD from CoinGecko for {COIN_to_xyo} XYO. '))
print()
print('Open M... |
#
# PySNMP MIB module CISCO-ITP-GSP2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ITP-GSP2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:46:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ... |
entries = []
def parse(line):
return list(map(lambda x: tuple(x.strip().split(' ')), line.strip().split('|')))
with open("input") as file:
entries = list(map(parse, file))
count = 0
total = 0
for segments, outputs in entries:
dict = {}
for segment in segments:
length = len(segment)
... | entries = []
def parse(line):
return list(map(lambda x: tuple(x.strip().split(' ')), line.strip().split('|')))
with open('input') as file:
entries = list(map(parse, file))
count = 0
total = 0
for (segments, outputs) in entries:
dict = {}
for segment in segments:
length = len(segment)
if... |
a = [1, 2, 3, 4, 5]
print(a)
a.clear()
print(a)
| a = [1, 2, 3, 4, 5]
print(a)
a.clear()
print(a) |
#!/usr/bin/python
n = int(input())
for i in range(0, n):
row = input().strip()
for j in range(0, n):
if row[j] == 'm':
robot_x = j
robot_y = i
if row[j] == 'p':
princess_x = j
princess_y = i
for i in range(0, abs(robot_x - princess_x)... | n = int(input())
for i in range(0, n):
row = input().strip()
for j in range(0, n):
if row[j] == 'm':
robot_x = j
robot_y = i
if row[j] == 'p':
princess_x = j
princess_y = i
for i in range(0, abs(robot_x - princess_x)):
if princess_x > robot_x:
... |
class Solution:
def reverseVowels(self, s: str) -> str:
vows = [ch for ch in s[::-1] if ch.lower() in "aeiou"]
chars = list(s)
x = 0
for i, ch in enumerate(chars):
if ch.lower() in "aeiou":
chars[i] = vows[x]
x += 1
return "".join(c... | class Solution:
def reverse_vowels(self, s: str) -> str:
vows = [ch for ch in s[::-1] if ch.lower() in 'aeiou']
chars = list(s)
x = 0
for (i, ch) in enumerate(chars):
if ch.lower() in 'aeiou':
chars[i] = vows[x]
x += 1
return ''.jo... |
def defaultParamSet():
class P():
def __init__(self):
# MAP-Elites Parameters
self.nChildren = 2**7
self.mutSigma = 0.1
self.nGens = 2**8
# Infill Parameters
self.nInitialSamples = 50
self.nAdditionalSamples = 10
... | def default_param_set():
class P:
def __init__(self):
self.nChildren = 2 ** 7
self.mutSigma = 0.1
self.nGens = 2 ** 8
self.nInitialSamples = 50
self.nAdditionalSamples = 10
self.nTotalSamples = 500
self.trainingMod = 2
... |
def fatorial(n):
f = 1
for i in range(n, 0, -1):
f *= i
return f
def dobro(n):
return n*2
def triplo(n):
return n*3
| def fatorial(n):
f = 1
for i in range(n, 0, -1):
f *= i
return f
def dobro(n):
return n * 2
def triplo(n):
return n * 3 |
class Solution:
# @return a list of integers
def getRow(self, rowIndex):
tri = [1]
for i in range(rowIndex):
for j in range(len(tri) - 2, -1, -1):
tri[j + 1] = tri[j] + tri[j + 1]
tri.append(1)
return tri | class Solution:
def get_row(self, rowIndex):
tri = [1]
for i in range(rowIndex):
for j in range(len(tri) - 2, -1, -1):
tri[j + 1] = tri[j] + tri[j + 1]
tri.append(1)
return tri |
#
# PySNMP MIB module WWP-LEOS-LLDP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-LLDP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:31:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'CYX'
configs = {
'server': {
'host': '0.0.0.0',
'port': 9090
},
'qshield': {
'jars': '/home/hadoop/qshield/opaque-ext/target/scala-2.11/opaque-ext_2.11-0.1.jar,/home/hadoop/qshield/data-owner/target/scala-2.11/data-owner_2.11-0.1.jar',
'master': ... | __author__ = 'CYX'
configs = {'server': {'host': '0.0.0.0', 'port': 9090}, 'qshield': {'jars': '/home/hadoop/qshield/opaque-ext/target/scala-2.11/opaque-ext_2.11-0.1.jar,/home/hadoop/qshield/data-owner/target/scala-2.11/data-owner_2.11-0.1.jar', 'master': 'spark://SGX:7077'}} |
#
# PySNMP MIB module VLAN (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VLAN
# Produced by pysmi-0.3.4 at Mon Apr 29 21:27:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Oc... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ... |
def solution(A, B):
tmp = '{0:b}'.format(A * B)
return list(tmp).count('1')
| def solution(A, B):
tmp = '{0:b}'.format(A * B)
return list(tmp).count('1') |
class Pagination:
def __init__(self, offset, limit):
self._offset = offset
self._limit = limit
def clean_offset(self):
return self._offset >= 0
def clean_limit(self):
return self._limit > 0
def clean(self):
return self.clean_offset() and self.clean_limit()
... | class Pagination:
def __init__(self, offset, limit):
self._offset = offset
self._limit = limit
def clean_offset(self):
return self._offset >= 0
def clean_limit(self):
return self._limit > 0
def clean(self):
return self.clean_offset() and self.clean_limit()
... |
# Copyright (c) 2018-2021 Kaiyang Zhou
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
__version__ = '1.2.3'
| __version__ = '1.2.3' |
#
# PySNMP MIB module E7-Fault-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/E7-Fault-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:58:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ... |
def steps(number:int) -> int:
if number <= 0:
raise ValueError("Input must be a positive integer")
steps = 0
while number != 1:
if number % 2 == 0:
number = int(number / 2)
else:
number = int(number * 3) + 1
steps += 1
return steps
| def steps(number: int) -> int:
if number <= 0:
raise value_error('Input must be a positive integer')
steps = 0
while number != 1:
if number % 2 == 0:
number = int(number / 2)
else:
number = int(number * 3) + 1
steps += 1
return steps |
class Solution:
def arrangeCoins(self, n: int) -> int:
k = 0
while n > 0:
k += 1
n -= k
return k if not n else k - 1
| class Solution:
def arrange_coins(self, n: int) -> int:
k = 0
while n > 0:
k += 1
n -= k
return k if not n else k - 1 |
coordinates_E0E1E1 = ((127, 91),
(127, 93), (128, 92), (128, 94), (128, 142), (129, 93), (129, 95), (129, 134), (129, 135), (129, 141), (129, 142), (130, 94), (130, 133), (130, 136), (130, 140), (130, 142), (131, 95), (131, 102), (131, 133), (131, 135), (131, 138), (131, 139), (131, 142), (132, 96), (132, 98), (132, ... | coordinates_e0_e1_e1 = ((127, 91), (127, 93), (128, 92), (128, 94), (128, 142), (129, 93), (129, 95), (129, 134), (129, 135), (129, 141), (129, 142), (130, 94), (130, 133), (130, 136), (130, 140), (130, 142), (131, 95), (131, 102), (131, 133), (131, 135), (131, 138), (131, 139), (131, 142), (132, 96), (132, 98), (132, ... |
l=[]
n=int(input("enter the elements:"))
for i in range(0,n):
l.append(int(input()))
i=0
for i in range(len(l)):
for j in range(i+1,len(l)):
if l[i]>l[j]:
l[i],l[j]=l[j],l[i]
print("sorted list is",l)
| l = []
n = int(input('enter the elements:'))
for i in range(0, n):
l.append(int(input()))
i = 0
for i in range(len(l)):
for j in range(i + 1, len(l)):
if l[i] > l[j]:
(l[i], l[j]) = (l[j], l[i])
print('sorted list is', l) |
# Modifying 'value_error_numbers.py' program.
# Using a while loop so that the user can continue to enter numbers even if
# they make a mistake by entering a non-numerical input value.
print("Enter two numbers, and we will add them together.")
print("Enter 'q' to quit.")
while True:
first_number = input("\nFirst... | print('Enter two numbers, and we will add them together.')
print("Enter 'q' to quit.")
while True:
first_number = input('\nFirst number: ')
if first_number == 'q':
break
second_number = input('Second number: ')
try:
answer = int(first_number) + int(second_number)
except ValueError:
... |
#########################################
# Servo01_stop.py
# categories: intro
# more info @: http://myrobotlab.org/service/Intro
#########################################
# uncomment for virtual hardware
# Platform.setVirtual(True)
# Every settings like limits / port number / controller are saved after initial use
#... | Runtime.releaseService('arduino')
Runtime.releaseService('servo01')
intro.broadcastState() |
tout = np.linspace(0, 10)
k_vals = 0.42, 0.17 # arbitrary in this case
y0 = [1, 1, 0]
yout = odeint(rhs, y0, tout, k_vals) # EXERCISE: rhs, y0, tout, k_vals
| tout = np.linspace(0, 10)
k_vals = (0.42, 0.17)
y0 = [1, 1, 0]
yout = odeint(rhs, y0, tout, k_vals) |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"Hline": "00_core.ipynb",
"ImageBuffer": "00_core.ipynb",
"grid_subsampling": "00_core.ipynb",
"getDirctionVectorsByPCA": "00_core.ipynb",
"pointsProjectAxis": "00_core.ipy... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'Hline': '00_core.ipynb', 'ImageBuffer': '00_core.ipynb', 'grid_subsampling': '00_core.ipynb', 'getDirctionVectorsByPCA': '00_core.ipynb', 'pointsProjectAxis': '00_core.ipynb', 'radiusOfCylinderByLeastSq': '00_core.ipynb', 'get_start_end_line': '00_... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
a = list(map(int, input().split()))
happy = 0
n = a[0]
m = a[1]
b = list(map(int, input().split()))
b = b[0:n]
c = list(map(int, input().split()))
c = c[0:m]
d = list(map(int, input().split()))
d = d[0:m]
for i in c:
if b.count(i)!= 0:
ha... | a = list(map(int, input().split()))
happy = 0
n = a[0]
m = a[1]
b = list(map(int, input().split()))
b = b[0:n]
c = list(map(int, input().split()))
c = c[0:m]
d = list(map(int, input().split()))
d = d[0:m]
for i in c:
if b.count(i) != 0:
happy = happy + 1
for i in d:
if b.count(i) != 0:
happy = h... |
#Embedded file name: ACEStream\Video\defs.pyo
PLAYBACKMODE_INTERNAL = 0
PLAYBACKMODE_EXTERNAL_DEFAULT = 1
PLAYBACKMODE_EXTERNAL_MIME = 2
OTHERTORRENTS_STOP_RESTART = 0
OTHERTORRENTS_STOP = 1
OTHERTORRENTS_CONTINUE = 2
MEDIASTATE_PLAYING = 1
MEDIASTATE_PAUSED = 2
MEDIASTATE_STOPPED = 3
BGP_STATE_IDLE = 0
BGP_STATE_PREBU... | playbackmode_internal = 0
playbackmode_external_default = 1
playbackmode_external_mime = 2
othertorrents_stop_restart = 0
othertorrents_stop = 1
othertorrents_continue = 2
mediastate_playing = 1
mediastate_paused = 2
mediastate_stopped = 3
bgp_state_idle = 0
bgp_state_prebuffering = 1
bgp_state_downloading = 2
bgp_stat... |
src = Split('''
starterkitgui.c
''')
component = aos_component('starterkitgui', src)
component.add_comp_deps('kernel/yloop', 'tools/cli')
component.add_global_macros('AOS_NO_WIFI')
| src = split('\n starterkitgui.c\n')
component = aos_component('starterkitgui', src)
component.add_comp_deps('kernel/yloop', 'tools/cli')
component.add_global_macros('AOS_NO_WIFI') |
def saludar():
return "Hola mundo"
saludar()
print(saludar())
print('----------')
m = saludar()
print(m)
print('------------')
def saludo(nombre, mensaje='hola '):
print(mensaje, nombre)
saludo('roberto')
| def saludar():
return 'Hola mundo'
saludar()
print(saludar())
print('----------')
m = saludar()
print(m)
print('------------')
def saludo(nombre, mensaje='hola '):
print(mensaje, nombre)
saludo('roberto') |
# Not finished
rows = int(input())
array = [[0 for x in range(3)] for y in range(rows)]
for i in range(rows):
line = [float(i) for i in input().split()]
for j in range(3):
array[i][j] = int(line[j])
totalcount = 0
for k in range(rows):
counter=array[k][0] +array[k][1] +array[k][2]
if(counter >= ... | rows = int(input())
array = [[0 for x in range(3)] for y in range(rows)]
for i in range(rows):
line = [float(i) for i in input().split()]
for j in range(3):
array[i][j] = int(line[j])
totalcount = 0
for k in range(rows):
counter = array[k][0] + array[k][1] + array[k][2]
if counter >= 2:
... |
def find_ranges(nums):
if not nums:
return []
first = last = nums[0]
ranges = []
def append_range(first, last):
ranges.append('{}->{}'.format(first, last))
for num in nums:
if abs(num - last) > 1:
append_range(first, last)
first = num
last = num
# Remaining
append_range(fi... | def find_ranges(nums):
if not nums:
return []
first = last = nums[0]
ranges = []
def append_range(first, last):
ranges.append('{}->{}'.format(first, last))
for num in nums:
if abs(num - last) > 1:
append_range(first, last)
first = num
last = n... |
# 77. Combinations
# Time: k*nCk (Review: nCk combinations each of length k)
# Space: k*nCk
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
if n==0:
return []
if k==0:
return [[]]
if k==1:
return [[i] for i in range(1,n+1)]
... | class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
if n == 0:
return []
if k == 0:
return [[]]
if k == 1:
return [[i] for i in range(1, n + 1)]
without_n = self.combine(n - 1, k)
with_n = self.combine(n - 1, k - 1)
... |
# return masked string
def maskify(cc):
if len(cc) < 5:
return cc
return '#' * int(len(cc)-4) + cc[-4:] | def maskify(cc):
if len(cc) < 5:
return cc
return '#' * int(len(cc) - 4) + cc[-4:] |
modules = dict()
def register(module_name):
def decorate_action(func):
if module_name in modules:
modules[module_name][func.__name__] = func
else:
modules[module_name] = dict()
modules[module_name][func.__name__] = func
return func
return de... | modules = dict()
def register(module_name):
def decorate_action(func):
if module_name in modules:
modules[module_name][func.__name__] = func
else:
modules[module_name] = dict()
modules[module_name][func.__name__] = func
return func
return decorate_ac... |
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
res = []
self.helper(res, '', n, n)
return res
def helper(self, res, tempList, left, right):
if left > right:
return
if left == 0 and right == 0:
res.append(tempList)
... | class Solution:
def generate_parenthesis(self, n: int) -> List[str]:
res = []
self.helper(res, '', n, n)
return res
def helper(self, res, tempList, left, right):
if left > right:
return
if left == 0 and right == 0:
res.append(tempList)
if... |
#!/usr/bin/python
#
#Stores the configuration information that will be used across entire project
#
# 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... | watch_folder = '/mnt/cluster-programs/watch-folder'
conversion_types = ['iPod-LQ', 'iPod-HQ', 'Movie-Archive', 'Movie-LQ', 'TV-Show-Archive', 'TV-Show-LQ']
job_folder = '/mnt/cluster-programs/handbrake/jobs/'
base_dir = '/mnt/cluster-programs/handbrake/'
ftp_port = 2010
message_server = 'Chiana'
vhost = 'cluster'
messa... |
class Solution:
def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool:
output = []
push = 0
pop = 0
while push < len(pushed) or pop < len(popped):
if len(output) != 0 and pop < len(popped) and output[-1] == popped[pop]:
output.pop(... | class Solution:
def validate_stack_sequences(self, pushed: List[int], popped: List[int]) -> bool:
output = []
push = 0
pop = 0
while push < len(pushed) or pop < len(popped):
if len(output) != 0 and pop < len(popped) and (output[-1] == popped[pop]):
output... |
PET_LEVELS = [
100,
110,
120,
130,
145,
160,
175,
190,
210,
230,
250,
275,
300,
330,
360,
400,
440,
490,
540,
600,
660,
730,
800,
880,
960,
1050,
1150,
1260,
1380,
1510,
1650,
1800,
1960,
... | pet_levels = [100, 110, 120, 130, 145, 160, 175, 190, 210, 230, 250, 275, 300, 330, 360, 400, 440, 490, 540, 600, 660, 730, 800, 880, 960, 1050, 1150, 1260, 1380, 1510, 1650, 1800, 1960, 2130, 2310, 2500, 2700, 2920, 3160, 3420, 3700, 4000, 4350, 4750, 5200, 5700, 6300, 7000, 7800, 8700, 9700, 10800, 12000, 13300, 1470... |
def sortarray(arr):
total_len = len(arr)
if total_len == 0 or total_len == 1:
return 0
sorted_array = sorted(arr)
ptr1 = 0
ptr2 = 0
counter = 0
idx = 0
while idx < total_len:
if sorted_array[ptr1] == arr[ptr2]:
ptr1 = ptr1 +1
counter = ... | def sortarray(arr):
total_len = len(arr)
if total_len == 0 or total_len == 1:
return 0
sorted_array = sorted(arr)
ptr1 = 0
ptr2 = 0
counter = 0
idx = 0
while idx < total_len:
if sorted_array[ptr1] == arr[ptr2]:
ptr1 = ptr1 + 1
counter = counter + 1... |
#!/usr/bin/env python3
class MyRange:
def __init__(self, start, end=None, step=1):
if step == 0:
raise
if end == None:
start, end = 0, start
self._start = start
self._end = end
self._step = step
self._pointer = start
def __getitem__(... | class Myrange:
def __init__(self, start, end=None, step=1):
if step == 0:
raise
if end == None:
(start, end) = (0, start)
self._start = start
self._end = end
self._step = step
self._pointer = start
def __getitem__(self, key):
res ... |
N, K, S = map(int, input().split())
if S == 1:
const = S + 1
else:
const = S - 1
ans = []
for i in range(N):
if i < K:
ans.append(S)
else:
ans.append(const)
print(*ans)
| (n, k, s) = map(int, input().split())
if S == 1:
const = S + 1
else:
const = S - 1
ans = []
for i in range(N):
if i < K:
ans.append(S)
else:
ans.append(const)
print(*ans) |
num = int(input('Digite um numero : '))
tot=0
for c in range(1,num + 1):
if num % c == 0 :
print(' {} '.format(c))
tot +=1
else:
print('{} '.format(c)) | num = int(input('Digite um numero : '))
tot = 0
for c in range(1, num + 1):
if num % c == 0:
print(' {} '.format(c))
tot += 1
else:
print('{} '.format(c)) |
def nb_year(p0, percent, aug, p):
count = 0
while p0 < p:
pop = p0 + p0 * (percent/100) + aug
p0 = pop
###this is kinda gross...should have just done something like###
### p0 += p0 * percent/100 + aug ####
count += 1
return count
| def nb_year(p0, percent, aug, p):
count = 0
while p0 < p:
pop = p0 + p0 * (percent / 100) + aug
p0 = pop
count += 1
return count |
###########################################################################
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | dcm__field__lookup = {'Video_Unmutes': 'INTEGER', 'Zip_Postal_Code': 'STRING', 'Path_Length': 'INTEGER', 'Measurable_Impressions_For_Audio': 'INTEGER', 'Average_Interaction_Time': 'FLOAT', 'Invalid_Impressions': 'INTEGER', 'Floodlight_Variable_40': 'STRING', 'Floodlight_Variable_41': 'STRING', 'Floodlight_Variable_42':... |
def factorial(n):
# return base case
if n == 1:
return 1
return n * factorial(n - 1)
def steps(n):
# step 0
if n == 0:
return [[0]]
# step 1
if n == 1:
return [[0, 1]]
n_1 = [a_list + [n] for a_list in steps(n-1)]
n_2 = [a_list + [n] for a_list in steps(n-... | def factorial(n):
if n == 1:
return 1
return n * factorial(n - 1)
def steps(n):
if n == 0:
return [[0]]
if n == 1:
return [[0, 1]]
n_1 = [a_list + [n] for a_list in steps(n - 1)]
n_2 = [a_list + [n] for a_list in steps(n - 2)]
return n_1 + n_2
def my_bad_max(my_list... |
pkgname = "dash"
pkgver = "0.5.11.3"
pkgrel = 0
build_style = "gnu_configure"
pkgdesc = "POSIX-compliant Unix shell, much smaller than GNU bash"
maintainer = "q66 <daniel@octaforge.org>"
license = "BSD-3-Clause"
url = "http://gondor.apana.org.au/~herbert/dash"
sources = [f"http://gondor.apana.org.au/~herbert/dash/files... | pkgname = 'dash'
pkgver = '0.5.11.3'
pkgrel = 0
build_style = 'gnu_configure'
pkgdesc = 'POSIX-compliant Unix shell, much smaller than GNU bash'
maintainer = 'q66 <daniel@octaforge.org>'
license = 'BSD-3-Clause'
url = 'http://gondor.apana.org.au/~herbert/dash'
sources = [f'http://gondor.apana.org.au/~herbert/dash/files... |
class Movie:
def __init__(self,name,genre,watched):
self.name= name
self.genre = genre
self.watched = watched
def __repr__(self):
return 'Movie : {} and Genre : {}'.format(self.name,self.genre )
def json(self):
return {
'name': self.name,
... | class Movie:
def __init__(self, name, genre, watched):
self.name = name
self.genre = genre
self.watched = watched
def __repr__(self):
return 'Movie : {} and Genre : {}'.format(self.name, self.genre)
def json(self):
return {'name': self.name, 'genre': self.genre, 'w... |
f=0
for i in range(0,n):
st=str(a[i])
rev=st[::-1]
if(st==rev):
f=1
else:
f=0
if(f==0):
return 0
else:
return 1
| f = 0
for i in range(0, n):
st = str(a[i])
rev = st[::-1]
if st == rev:
f = 1
else:
f = 0
if f == 0:
return 0
else:
return 1 |
class PresentationSettings():
def __init__(self, settings:dict = {}):
self.title = settings['title'] if 'title' in settings else 'Presentation'
self.theme = settings['theme'] if 'theme' in settings else 'black'
| class Presentationsettings:
def __init__(self, settings: dict={}):
self.title = settings['title'] if 'title' in settings else 'Presentation'
self.theme = settings['theme'] if 'theme' in settings else 'black' |
#
# PySNMP MIB module ZhoneProductRegistrations (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZhoneProductRegistrations
# Produced by pysmi-0.3.4 at Wed May 1 15:52:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint, constraints_union) ... |
class Solution:
def solve(self, nums):
# Write your code here
if len(nums) == 0:
return nums
s = nums[0]
flag = True
for i in range(1,len(nums)):
if flag:
k = nums[i]
nums[i] = s
if k < s:
... | class Solution:
def solve(self, nums):
if len(nums) == 0:
return nums
s = nums[0]
flag = True
for i in range(1, len(nums)):
if flag:
k = nums[i]
nums[i] = s
if k < s:
s = k
fl... |
A, B, K = map(int, input().rstrip().split())
for n in range(A, B + 1):
if n < A + K or n > B - K:
print(n) | (a, b, k) = map(int, input().rstrip().split())
for n in range(A, B + 1):
if n < A + K or n > B - K:
print(n) |
# Attributes in different classes are isolated, changing one class does not
# affected the other, the same way that changing an object does not modify
# another.
email = 'contact@redi-school.org'
class Student:
email = 'student@redi-school.org'
def __init__(self, name, birthday, courses):
# class p... | email = 'contact@redi-school.org'
class Student:
email = 'student@redi-school.org'
def __init__(self, name, birthday, courses):
self.full_name = name
self.first_name = name.split(' ')[0]
self.birthday = birthday
self.courses = courses
self.attendance = []
class Teacher... |
class InvalidGroupError(Exception):
pass
class MaxInvalidIterationsError(Exception):
pass
| class Invalidgrouperror(Exception):
pass
class Maxinvaliditerationserror(Exception):
pass |
friend_ages = {"Rolf": 25, "Anne": 37, "Charlie": 31, "Bob": 22}
for name in friend_ages:
print(name)
for age in friend_ages.values():
print(age)
for name, age in friend_ages.items():
print(f"{name} is {age} years old.")
| friend_ages = {'Rolf': 25, 'Anne': 37, 'Charlie': 31, 'Bob': 22}
for name in friend_ages:
print(name)
for age in friend_ages.values():
print(age)
for (name, age) in friend_ages.items():
print(f'{name} is {age} years old.') |
__author__ = "Matthew Wardrop"
__author_email__ = "mpwardrop@gmail.com"
__version__ = "1.2.3"
__dependencies__ = []
| __author__ = 'Matthew Wardrop'
__author_email__ = 'mpwardrop@gmail.com'
__version__ = '1.2.3'
__dependencies__ = [] |
# Average the numbers from 1 to n
n = int(input("Enter number:"))
avg = 0
for i in range(n + 1):
avg += i
avg = avg/n
print(avg) | n = int(input('Enter number:'))
avg = 0
for i in range(n + 1):
avg += i
avg = avg / n
print(avg) |
# import math
# from fractions import *
# from exceptions import *
# from point import *
# from line import *
# from ellipse import *
# from polygon import *
# from hyperbola import *
# from triangle import *
# from rectangle import *
# from graph import *
# from delaunay import *
class Se... | class Segment:
def __init__(self, p, q):
self.p = p
self.q = q
@classmethod
def find_intersection(cls, segment):
return None |
# -*- coding:utf-8 -*-
PROXY_RAW_KEY = "proxy_raw"
PROXY_VALID_KEY = "proxy_valid"
| proxy_raw_key = 'proxy_raw'
proxy_valid_key = 'proxy_valid' |
#
# PySNMP MIB module ALVARION-BANDWIDTH-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-BANDWIDTH-CONTROL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:06:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2')
(alvarion_priority_queue,) = mibBuilder.importSymbols('ALVARION-TC', 'AlvarionPriorityQueue')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mib... |
class Bat:
species = 'Baty'
def __init__(self, can_fly=True):
self.fly = can_fly
def say(self, msg):
msg = ".."
return msg
def sonar(self):
return "))..(("
if __name__ == '__main__':
b = Bat()
b.say('w')
b.sonar | class Bat:
species = 'Baty'
def __init__(self, can_fly=True):
self.fly = can_fly
def say(self, msg):
msg = '..'
return msg
def sonar(self):
return '))..(('
if __name__ == '__main__':
b = bat()
b.say('w')
b.sonar |
l, r = map(int, input().split())
while(l != 0 and r != 0):
print(l + r)
l, r = map(int, input().split()) | (l, r) = map(int, input().split())
while l != 0 and r != 0:
print(l + r)
(l, r) = map(int, input().split()) |
expected_output = {
"slot": {
"lc": {
"1": {
"16x400G Ethernet Module": {
"hardware": "3.1",
"mac_address": "bc-4a-56-ff-fa-5b to bc-4a-56-ff-fb-dd",
"model": "N9K-X9716D-GX",
"online_diag_status": "P... | expected_output = {'slot': {'lc': {'1': {'16x400G Ethernet Module': {'hardware': '3.1', 'mac_address': 'bc-4a-56-ff-fa-5b to bc-4a-56-ff-fb-dd', 'model': 'N9K-X9716D-GX', 'online_diag_status': 'Pass', 'ports': '16', 'serial_number': 'FOC24322RBW', 'slot': '1', 'slot/world_wide_name': 'LC1', 'software': '10.1(0.233)', '... |
#
# PySNMP MIB module SNIA-SML-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNIA-SML-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:08:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, single_value_constraint, value_range_constraint) ... |
class Human(object):
def __init__(self, first_name, last_name, age, gender):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.gender = gender
def as_dict(self):
return {
'first_name': self.first_name,
'last_name': self.... | class Human(object):
def __init__(self, first_name, last_name, age, gender):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.gender = gender
def as_dict(self):
return {'first_name': self.first_name, 'last_name': self.last_name, 'age': self.ag... |
class Solution:
def countConsistentStrings(self, allowed: str, words: List[str]) -> int:
consistent_strings = 0
for word in words:
consistent = True
for c in word:
if c not in allowed:
consistent = False
break
... | class Solution:
def count_consistent_strings(self, allowed: str, words: List[str]) -> int:
consistent_strings = 0
for word in words:
consistent = True
for c in word:
if c not in allowed:
consistent = False
break
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.