content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
class SourceTuples:
def __init__(self, tuples=[]):
self.tuples = tuples
def __call__(self):
return self.tuples
| class Sourcetuples:
def __init__(self, tuples=[]):
self.tuples = tuples
def __call__(self):
return self.tuples |
years = range(2008, 2010)
vars = ['ta_2m', 'pr', 'psl', 'rss', 'rls', 'wss_10m', 'hur_2m',
'albedo', 'ps', 'ts_0m']
hourres = ['1H', '1H', '1H', '3H', '3H', '1H', '1H', '1H', '3H', '1H']
b11b = 'NORA10'
b11c = '11km'
paths = ['%s_%s_%s_%s_%s.nc' % (b11b, hourres[vi], b11c, vars[vi], y)
for vi in ran... | years = range(2008, 2010)
vars = ['ta_2m', 'pr', 'psl', 'rss', 'rls', 'wss_10m', 'hur_2m', 'albedo', 'ps', 'ts_0m']
hourres = ['1H', '1H', '1H', '3H', '3H', '1H', '1H', '1H', '3H', '1H']
b11b = 'NORA10'
b11c = '11km'
paths = ['%s_%s_%s_%s_%s.nc' % (b11b, hourres[vi], b11c, vars[vi], y) for vi in range(9) for y in years... |
class Demo:
a1 = 1
b1 = 2
c1 = 3
d1 = 4
def __init__(self):
print(self.a1) # access SV inside constructor using self
print(Demo.a1) # access SV inside constructor using classname
def mymethod1(self):
print(self.b1) # access SV inside instance method using ... | class Demo:
a1 = 1
b1 = 2
c1 = 3
d1 = 4
def __init__(self):
print(self.a1)
print(Demo.a1)
def mymethod1(self):
print(self.b1)
print(Demo.b1)
@classmethod
def mymethod2(cls):
print(cls.c1)
print(Demo.c1)
@staticmethod
def mymetho... |
bits = []
val = 190
while val > 0:
bits.append(val & 1)
val = int(val / 2)
print(bits)
# find the longest length of bits of 1s with one flip or None
lens = []
count = 0
if len(bits) == 1:
print(bits[0])
for bit in bits:
if bit:
count += 1
else:
lens.append(count)
lens.append(bit)
count = 0
... | bits = []
val = 190
while val > 0:
bits.append(val & 1)
val = int(val / 2)
print(bits)
lens = []
count = 0
if len(bits) == 1:
print(bits[0])
for bit in bits:
if bit:
count += 1
else:
lens.append(count)
lens.append(bit)
count = 0
if count:
lens.append(count)
print(... |
def isPalindrome(x: int) -> bool:
if x < 0:
return False
reverse_num = contador = 0
while x // 10**contador != 0:
reverse_num = (reverse_num*10) + (x // 10**contador % 10)
contador += 1
return x == reverse_num
| def is_palindrome(x: int) -> bool:
if x < 0:
return False
reverse_num = contador = 0
while x // 10 ** contador != 0:
reverse_num = reverse_num * 10 + x // 10 ** contador % 10
contador += 1
return x == reverse_num |
# Ex-1 Update Values in Dictionaries and Lists
x = [ [5,2,3], [10,8,9] ]
students = [
{'first_name': 'Michael', 'last_name' : 'Jordan'},
{'first_name' : 'John', 'last_name' : 'Rosales'}
]
sports_directory = {
'basketball' : ['Kobe', 'Jordan', 'James', 'Curry'],
'soccer' : ['Messi', 'Ronaldo', 'Roo... | x = [[5, 2, 3], [10, 8, 9]]
students = [{'first_name': 'Michael', 'last_name': 'Jordan'}, {'first_name': 'John', 'last_name': 'Rosales'}]
sports_directory = {'basketball': ['Kobe', 'Jordan', 'James', 'Curry'], 'soccer': ['Messi', 'Ronaldo', 'Rooney']}
z = [{'x': 10, 'y': 20}]
x[1][0] = 15
students[0]['last_name'] = 'Br... |
__all__ = [
'Dcscn',
'DnCnn',
'Espcn',
'Idn',
'Rdn',
'Srcnn',
'Vdsr',
'Drcn',
'LapSrn',
'Drrn',
'Dbpn',
'Edsr',
'SrGan',
'Exp',
]
| __all__ = ['Dcscn', 'DnCnn', 'Espcn', 'Idn', 'Rdn', 'Srcnn', 'Vdsr', 'Drcn', 'LapSrn', 'Drrn', 'Dbpn', 'Edsr', 'SrGan', 'Exp'] |
class Solution:
def XXX(self, root: TreeNode) -> int:
def XXX(root):
if not root: return 0
if not root.left: return XXX(root.right) + 1
if not root.right: return XXX(root.left) + 1
leftDepth = XXX(root.left)
rightDepth = XXX(root.right)
... | class Solution:
def xxx(self, root: TreeNode) -> int:
def xxx(root):
if not root:
return 0
if not root.left:
return xxx(root.right) + 1
if not root.right:
return xxx(root.left) + 1
left_depth = xxx(root.left)
... |
def handle_error_by_throwing_exception():
raise Exception("ERROR: something went wrong")
def handle_error_by_returning_none(input_data):
try:
return int(input_data)
except ValueError:
return None
def handle_error_by_returning_tuple(input_data):
try:
return True, int(input_... | def handle_error_by_throwing_exception():
raise exception('ERROR: something went wrong')
def handle_error_by_returning_none(input_data):
try:
return int(input_data)
except ValueError:
return None
def handle_error_by_returning_tuple(input_data):
try:
return (True, int(input_data... |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
m = {} # { value: index }
for i in range(0, len(nums)):
remainder = target - nums[i]
if remainder in m:
return [i, m[remainder]]
m[nums[i]] = i
| class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
m = {}
for i in range(0, len(nums)):
remainder = target - nums[i]
if remainder in m:
return [i, m[remainder]]
m[nums[i]] = i |
def f04(s):
within = lambda n : n in [1, 5, 6, 7, 8, 9, 15, 16, 19]
get_letters = lambda pred, w: [w[:2], w[0]][pred]
wt, wdic = ((i + 1, w) for i, w in enumerate(s.split())), {}
for index, word in wt:
wdic[get_letters(within(index), word)] = index
return wdic
s = 'Hi He Lied Because Boron Could Not... | def f04(s):
within = lambda n: n in [1, 5, 6, 7, 8, 9, 15, 16, 19]
get_letters = lambda pred, w: [w[:2], w[0]][pred]
(wt, wdic) = (((i + 1, w) for (i, w) in enumerate(s.split())), {})
for (index, word) in wt:
wdic[get_letters(within(index), word)] = index
return wdic
s = 'Hi He Lied Because ... |
def special_case_2003(request):
pass
def year_archive(request,year):
pass
def month_archive(request,year,month):
pass
def article_detail(request,year,month,title):
pass
| def special_case_2003(request):
pass
def year_archive(request, year):
pass
def month_archive(request, year, month):
pass
def article_detail(request, year, month, title):
pass |
class UF:
def __init__(self, n: int):
self.id = list(range(n))
def union(self, u: int, v: int) -> None:
self.id[self.find(u)] = self.find(v)
def connected(self, u: int, v: int) -> bool:
return self.find(self.id[u]) == self.find(self.id[v])
def reset(self, u: int):
self.id[u] = u
def find(s... | class Uf:
def __init__(self, n: int):
self.id = list(range(n))
def union(self, u: int, v: int) -> None:
self.id[self.find(u)] = self.find(v)
def connected(self, u: int, v: int) -> bool:
return self.find(self.id[u]) == self.find(self.id[v])
def reset(self, u: int):
sel... |
class Templates:
NotAnyMessage = '$var cannot be empty (should contain at least one element).'
NotEqualMessage = 'Equality precondition not met.'
NotNullMessage = '$var cannot be Null.'
NotGreaterThanMessage = "$var cannot be greater than $value."
NotLessThanMessage = "$var cannot be less than $valu... | class Templates:
not_any_message = '$var cannot be empty (should contain at least one element).'
not_equal_message = 'Equality precondition not met.'
not_null_message = '$var cannot be Null.'
not_greater_than_message = '$var cannot be greater than $value.'
not_less_than_message = '$var cannot be les... |
class FunnyRect:
cx =0.
cy=0.
fsize=0.
def setCenter (self, x, y):
self.cx = x
self.cy = y
def setSize (self, size):
self.fsize = size
def render (self):
rect (self.cx , self.cy , self.fsize , self.fsize )
funnyRectObj = FunnyRect ()
de... | class Funnyrect:
cx = 0.0
cy = 0.0
fsize = 0.0
def set_center(self, x, y):
self.cx = x
self.cy = y
def set_size(self, size):
self.fsize = size
def render(self):
rect(self.cx, self.cy, self.fsize, self.fsize)
funny_rect_obj = funny_rect()
def setup():
globa... |
class FloorLayout:
def countBoards(self, layout):
c = 0
for i in xrange(len(layout)):
for j in xrange(len(layout[i])):
if j > 0 and layout[i][j] == '-' and layout[i][j-1] == '-':
continue
if i > 0 and layout[i][j] == '|' and layout[i-1]... | class Floorlayout:
def count_boards(self, layout):
c = 0
for i in xrange(len(layout)):
for j in xrange(len(layout[i])):
if j > 0 and layout[i][j] == '-' and (layout[i][j - 1] == '-'):
continue
if i > 0 and layout[i][j] == '|' and (layo... |
def main():
choice='z'
if choice == 'a':
print("You chose 'a'.")
elif choice == 'b':
print("You chose 'b'.")
elif choice == 'c':
print("You chose 'c'.")
else:
print("Invalid choice.")
if __name__ == '__main__':
main()
| def main():
choice = 'z'
if choice == 'a':
print("You chose 'a'.")
elif choice == 'b':
print("You chose 'b'.")
elif choice == 'c':
print("You chose 'c'.")
else:
print('Invalid choice.')
if __name__ == '__main__':
main() |
{
'conditions': [
['OS=="win"', {
'variables': {
'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle
'with_jpeg%': 'false',
'with_gif%': 'false',
'with_pango%': 'false',
'with_freetype%': 'false'
}
}, { # 'OS!="win"'
'variables': {
... | {'conditions': [['OS=="win"', {'variables': {'GTK_Root%': 'C:/GTK', 'with_jpeg%': 'false', 'with_gif%': 'false', 'with_pango%': 'false', 'with_freetype%': 'false'}}, {'variables': {'with_jpeg%': '<!(./util/has_lib.sh jpeg)', 'with_gif%': '<!(./util/has_lib.sh gif)', 'with_pango%': '<!(./util/has_lib.sh pangocairo)', 'w... |
# Funcion para hacer flat un arreglo
def flatten_array(array):
return [item for sublist in array for item in sublist]
# Funcion para calcular matriz transpuesta
def transpose(matA):
transMatrix=[[0 for j in range(len(matA))] for i in range(len(matA[0]))]
for i in range(len(matA)):
for j in range(... | def flatten_array(array):
return [item for sublist in array for item in sublist]
def transpose(matA):
trans_matrix = [[0 for j in range(len(matA))] for i in range(len(matA[0]))]
for i in range(len(matA)):
for j in range(len(matA[0])):
transMatrix[j][i] = matA[i][j]
return transMatri... |
class FeatureExtractor:
def __init__(self):
preprocess = False
data_dir = "H:/data/createddata/feature/"
os.mkdirs(data_dir)
years = {2016, 2017}
for year in years:
splitFiles(year)
print("year\tday\tmeanValue\tmedianValue\thoMedian\tmean... | class Featureextractor:
def __init__(self):
preprocess = False
data_dir = 'H:/data/createddata/feature/'
os.mkdirs(data_dir)
years = {2016, 2017}
for year in years:
split_files(year)
print('year\tday\tmeanValue\tmedianValue\thoMedian\tmeanDegree\tmedianDe... |
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
index = 0
for i in range(len(t)):
if index < len(s) and t[i] == s[index]:
index += 1
return index == len(s)
| class Solution:
def is_subsequence(self, s: str, t: str) -> bool:
index = 0
for i in range(len(t)):
if index < len(s) and t[i] == s[index]:
index += 1
return index == len(s) |
inputs = open('../input.txt', 'r')
data = inputs.readlines()
frequency = 0
for frequency_change in data:
try:
change = int(frequency_change.rstrip())
if change:
frequency += change
except:
print('Bad value: {}'.format(repr(frequency_change)))
print('frequency: {}'.format(fr... | inputs = open('../input.txt', 'r')
data = inputs.readlines()
frequency = 0
for frequency_change in data:
try:
change = int(frequency_change.rstrip())
if change:
frequency += change
except:
print('Bad value: {}'.format(repr(frequency_change)))
print('frequency: {}'.format(freq... |
#
# PySNMP MIB module LINKSWITCH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LINKSWITCH-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:56:49 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... | (a3_com,) = mibBuilder.importSymbols('A3Com-products-MIB', 'a3Com')
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, c... |
error_messages = {
'type_invalid': 'Expected value of type %s, found %s',
'field_type_invalid': 'Expected value of type %s for field %s, found %s',
'length_invalid': 'value is not of required length',
'object_length_invalid': 'object does not have required number of elements',
'not_in_options': 'val... | error_messages = {'type_invalid': 'Expected value of type %s, found %s', 'field_type_invalid': 'Expected value of type %s for field %s, found %s', 'length_invalid': 'value is not of required length', 'object_length_invalid': 'object does not have required number of elements', 'not_in_options': 'value not in list of opt... |
''' Compound Conditions
Logical Operators
AND Operator
Or operator
Not operator
A type of condition where we combine or connect differient relational expressions using some connectors
Example: if x> 10 and y <= 9
if p == 5 or q < 10
P | Q | P and Q # P and Q is a com... | """ Compound Conditions
Logical Operators
AND Operator
Or operator
Not operator
A type of condition where we combine or connect differient relational expressions using some connectors
Example: if x> 10 and y <= 9
if p == 5 or q < 10
P | Q | P and Q # P and Q is a com... |
input() # Ignore first line
s = input().split(' ')
L = len(s)
N = sorted([int(i) for i in s])
median = N[L//2] if L % 2 != 0 else (N[(L//2) - 1] + N[L//2])/2
total = 0
mode, mode_c = None, 0
cmode, cmode_c = None, 0
for n in N:
total += n
if cmode_c > mode_c:
mode = cmode
mode_c = cmode_c
... | input()
s = input().split(' ')
l = len(s)
n = sorted([int(i) for i in s])
median = N[L // 2] if L % 2 != 0 else (N[L // 2 - 1] + N[L // 2]) / 2
total = 0
(mode, mode_c) = (None, 0)
(cmode, cmode_c) = (None, 0)
for n in N:
total += n
if cmode_c > mode_c:
mode = cmode
mode_c = cmode_c
if n != ... |
for i in range(10):
print(i)
for i in range(ord('a'), ord('z')+1):
print(chr(i))
| for i in range(10):
print(i)
for i in range(ord('a'), ord('z') + 1):
print(chr(i)) |
class S:
def __init__(self, name):
self.name = name
def __repr__(self):
return f'{self.__dict__}'
def __str__(self):
return f'Name: {self.name}'
def __add__(self, other):
return S(f'{self.name} {other.name}')
class Deck:
def __init__(self):
self.cards = [... | class S:
def __init__(self, name):
self.name = name
def __repr__(self):
return f'{self.__dict__}'
def __str__(self):
return f'Name: {self.name}'
def __add__(self, other):
return s(f'{self.name} {other.name}')
class Deck:
def __init__(self):
self.cards = ... |
#
# PySNMP MIB module RADLAN-ippreflist-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-ippreflist-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:42:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, single_value_constraint, constraints_union, value_range_constraint) ... |
class Point2D:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return "(" + str(self.x) + ", " + str(self.y) + ")"
def __add__(self, other):
return Point2D(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Point2D(self.x - other.x, self.y - other.y)
... | class Point2D:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return '(' + str(self.x) + ', ' + str(self.y) + ')'
def __add__(self, other):
return point2_d(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return point2_d(self.x... |
def is_pesel_valid(pesel):
if re.match(PATTERN, pesel):
return True
else:
return False
def is_pesel_woman(pesel):
if int(pesel[-2]) % 2 == 0:
return True
else:
return False
| def is_pesel_valid(pesel):
if re.match(PATTERN, pesel):
return True
else:
return False
def is_pesel_woman(pesel):
if int(pesel[-2]) % 2 == 0:
return True
else:
return False |
def default_dict():
dict_ = {
'Name': '',
'Mobile': '',
'Email': '',
'City': '',
'State': '',
'Resources': '',
'Description': ''
}
return dict_
def default_chat_dict():
dict_ = {
'updateID': '',
'chatID': '',
'Text': ''
... | def default_dict():
dict_ = {'Name': '', 'Mobile': '', 'Email': '', 'City': '', 'State': '', 'Resources': '', 'Description': ''}
return dict_
def default_chat_dict():
dict_ = {'updateID': '', 'chatID': '', 'Text': ''}
return dict_ |
class ProductQuantity(object):
def __init__(self, str_quantity):
self.StrQuantity = str_quantity
def __str__(self):
return self.StrQuantity
| class Productquantity(object):
def __init__(self, str_quantity):
self.StrQuantity = str_quantity
def __str__(self):
return self.StrQuantity |
def three_LCS(A,B,C):
m=len(A)
n=len(B)
o=len(C)
L=[[[0 for i in range(o+1)]for j in range(n+1)]for k in range(m+1)]
for i in range(m+1):
for j in range(n+1):
for k in range(o+1):
if (i==0 or j==0 or k==0):
L[i][j][k]=0
elif (A[... | def three_lcs(A, B, C):
m = len(A)
n = len(B)
o = len(C)
l = [[[0 for i in range(o + 1)] for j in range(n + 1)] for k in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
for k in range(o + 1):
if i == 0 or j == 0 or k == 0:
L[i][j][k... |
pytest_plugins = (
"tests.plugins.home",
"tests.plugins.about",
"tests.plugins.login",
"tests.plugins.register",
"tests.plugins.account",
"tests.plugins.posts",
"tests.plugins.status_codes",
"tests.plugins.endpoints",
"tests.plugins.hooks",
)
| pytest_plugins = ('tests.plugins.home', 'tests.plugins.about', 'tests.plugins.login', 'tests.plugins.register', 'tests.plugins.account', 'tests.plugins.posts', 'tests.plugins.status_codes', 'tests.plugins.endpoints', 'tests.plugins.hooks') |
def length_message(x):
print("The length of", repr(x), "is", len(x))
length_message('Fnord')
length_message([1, 2, 3])
print()
| def length_message(x):
print('The length of', repr(x), 'is', len(x))
length_message('Fnord')
length_message([1, 2, 3])
print() |
sum=0
for j in range(int(input())):
sum += (j+1)
print(sum)
| sum = 0
for j in range(int(input())):
sum += j + 1
print(sum) |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# ProjectName: HW2
# FileName: write
# Description:
# TodoList:
def writeOutput(result, path="output.txt"):
res = ""
if result == "PASS":
res = "PASS"
else:
res += str(result[0]) + ',' + str(result[1])
with open(path, 'w') as f:
f.write(re... | def write_output(result, path='output.txt'):
res = ''
if result == 'PASS':
res = 'PASS'
else:
res += str(result[0]) + ',' + str(result[1])
with open(path, 'w') as f:
f.write(res)
def write_pass(path='output.txt'):
with open(path, 'w') as f:
f.write('PASS')
def write... |
# https://www.hackerrank.com/challenges/bigger-is-greater
def bigger_is_greater(string):
s = list(string)
if len(set(s)) == 1:
return 'no answer'
else:
last = s[-1]
for i, c in reversed(list(enumerate(s))):
if c > last:
last = c
elif c < last... | def bigger_is_greater(string):
s = list(string)
if len(set(s)) == 1:
return 'no answer'
else:
last = s[-1]
for (i, c) in reversed(list(enumerate(s))):
if c > last:
last = c
elif c < last:
sub = s.index(min((char for char in s[i ... |
class ApiError(Exception):
def __init__(self, error, status_code):
self.message = error
self.status_code = status_code
def __str__(self):
return self.message
| class Apierror(Exception):
def __init__(self, error, status_code):
self.message = error
self.status_code = status_code
def __str__(self):
return self.message |
value = input('Digite a chave de entrada: ')
flag = 0
sample = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
for i in value:
if i in sample:
flag += 1
if flag == 1:
print("Chave correta.")
elif flag > 1:
print("A chave possui mais de um interiro.")
else:
print("A chave faltando o caracter ... | value = input('Digite a chave de entrada: ')
flag = 0
sample = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
for i in value:
if i in sample:
flag += 1
if flag == 1:
print('Chave correta.')
elif flag > 1:
print('A chave possui mais de um interiro.')
else:
print('A chave faltando o caracter n... |
# Copyright 2010-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | {'variables': {'relative_dir': 'chrome/nacl', 'gen_out_dir': '<(SHARED_INTERMEDIATE_DIR)/<(relative_dir)', 'dummy_input_file': 'nacl_extension.gyp', 'browser_tester_dir': '../../third_party/browser_tester', 'nacl_mozc_files': ['<(gen_out_dir)/nacl_mozc/_locales/en/messages.json', '<(gen_out_dir)/nacl_mozc/_locales/ja/m... |
# Python Program To Handle IO Error Produced By Open() Function
'''
Function Name : Open() Function
Function Date : 23 Sep 2020
Function Author : Prasad Dangare
Input : String
Output : String
'''
try:
name = input('Enter Filename : ')
f = open(name, 'r')
exc... | """
Function Name : Open() Function
Function Date : 23 Sep 2020
Function Author : Prasad Dangare
Input : String
Output : String
"""
try:
name = input('Enter Filename : ')
f = open(name, 'r')
except IOError:
print('File Not Found : ', name)
else:
n = len(f.readlines())
... |
#!/usr/bin/env python3
def foo():
print('This is foo')
print('Starting the program')
foo()
print('Ending the program')
| def foo():
print('This is foo')
print('Starting the program')
foo()
print('Ending the program') |
#
# PySNMP MIB module REDLINE-AN50-PMP-V2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REDLINE-AN50-PMP-V2-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:55:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, constraints_union, value_range_constraint) ... |
#
# PySNMP MIB module ALCATEL-IND1-TIMETRA-OAM-TEST-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-TIMETRA-OAM-TEST-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:19:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (timetra_srmib_modules, tmnx_sr_objs, tmnx_sr_confs, tmnx_sr_notify_prefix) = mibBuilder.importSymbols('ALCATEL-IND1-TIMETRA-GLOBAL-MIB', 'timetraSRMIBModules', 'tmnxSRObjs', 'tmnxSRConfs', 'tmnxSRNotifyPrefix')
(t_profile,) = mibBuilder.importSymbols('ALCATEL-IND1-TIMETRA-QOS-MIB', 'TProfile')
(sdp_id, sdp_bind_vc_typ... |
class HashMapList(object):
def __init__(self, size=None, hash_function=hash):
assert isinstance(size, int)
self.array = list()
for x in range(size):
self.array.append(list())
self.size = size
self.hash_function = hash_function
def __setitem__(self, key, valu... | class Hashmaplist(object):
def __init__(self, size=None, hash_function=hash):
assert isinstance(size, int)
self.array = list()
for x in range(size):
self.array.append(list())
self.size = size
self.hash_function = hash_function
def __setitem__(self, key, valu... |
#! /usr/bin/python3
def backpack(value_1, value_2, weight, i, capacity, store={}):
if i in store:
if capacity in store[i]:
return store[i][capacity]
else:
store[i] = {}
result = 0
if i != len(weight) and capacity != 0:
if weight[i] > capacity:
return ... | def backpack(value_1, value_2, weight, i, capacity, store={}):
if i in store:
if capacity in store[i]:
return store[i][capacity]
else:
store[i] = {}
result = 0
if i != len(weight) and capacity != 0:
if weight[i] > capacity:
return value_1[i] + backpack(val... |
def flatten_list(arr):
result = []
for item in arr:
if isinstance(item, list):
result.extend(flatten_list(item))
else:
result.append(item)
return result
def flatten_list(mapping):
for key in mapping:
if isinstance(mapping[key], dict):
value = ... | def flatten_list(arr):
result = []
for item in arr:
if isinstance(item, list):
result.extend(flatten_list(item))
else:
result.append(item)
return result
def flatten_list(mapping):
for key in mapping:
if isinstance(mapping[key], dict):
value = ... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def getMinimumDifference(self, root: TreeNode) -> int:
if not root: return -inf
prev = -inf... | class Solution:
def get_minimum_difference(self, root: TreeNode) -> int:
if not root:
return -inf
prev = -inf
result = inf
node = root
nodes = []
while True:
while node:
nodes.append(node)
node = node.left
... |
class ContainerRegistry:
def __init__(self, server, username, password):
self.server = server
self.username = username
self.password = password
| class Containerregistry:
def __init__(self, server, username, password):
self.server = server
self.username = username
self.password = password |
class Solution:
def countPrimes(self, n: 'int') -> 'int':
primeChecker = [True] * n
if n < 2:
return 0
primeChecker[0] = primeChecker[1] = False
for i in range(2, int(n ** 0.5) + 1):
if primeChecker[i]:
primeChecker[i*i:n:i] = [False] * len(pri... | class Solution:
def count_primes(self, n: 'int') -> 'int':
prime_checker = [True] * n
if n < 2:
return 0
primeChecker[0] = primeChecker[1] = False
for i in range(2, int(n ** 0.5) + 1):
if primeChecker[i]:
primeChecker[i * i:n:i] = [False] * le... |
NUM_LEN = 12
def extract_with_bit(numbers, index, bit_value):
return [number for number in numbers if number[index] == bit_value]
def count_frequencies(numbers):
# for each of the NUM_LEN bits, count the frequency of each bit
freqs = [{"0": 0, "1": 0} for _ in range(NUM_LEN)]
for number in numbers:... | num_len = 12
def extract_with_bit(numbers, index, bit_value):
return [number for number in numbers if number[index] == bit_value]
def count_frequencies(numbers):
freqs = [{'0': 0, '1': 0} for _ in range(NUM_LEN)]
for number in numbers:
number = number.strip()
for i in range(NUM_LEN):
... |
SERVICE_PATTERNS = {
"LATEST": {
"Stopping": re.compile(r'.*Stopping.*(service|container).*'),
"Stopped": re.compile(r'.*Stopped.*(service|container).*'),
"Starting": re.compile(r'.*Starting.*(service|container).*'),
"Started": re.compile(r'.*Started.*(service|container).*')
},
... | service_patterns = {'LATEST': {'Stopping': re.compile('.*Stopping.*(service|container).*'), 'Stopped': re.compile('.*Stopped.*(service|container).*'), 'Starting': re.compile('.*Starting.*(service|container).*'), 'Started': re.compile('.*Started.*(service|container).*')}, '201911': {'Stopping': re.compile('.*Stopping.*'... |
has_bi_direction = False
consider_literal = False
kb_prefix = 'http://dbpedia.org/resource/'
# kb_prefix = 'http://rdf.freebase.com/ns/'
kb_type_predicate_list = ['a', 'rdf:type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type']
oracle_canidates_file = 'E:\kb_oracle_canidates_file'
| has_bi_direction = False
consider_literal = False
kb_prefix = 'http://dbpedia.org/resource/'
kb_type_predicate_list = ['a', 'rdf:type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type']
oracle_canidates_file = 'E:\\kb_oracle_canidates_file' |
n = int(input().strip())
N = n
i = 2
while i * i <= n:
if n % i:
i += 1
else:
n //= i
if n == N:
print(True)
else:
print(False)
| n = int(input().strip())
n = n
i = 2
while i * i <= n:
if n % i:
i += 1
else:
n //= i
if n == N:
print(True)
else:
print(False) |
#
# Copyright (c) 2011-2015 Advanced Micro Devices, Inc.
# All rights reserved.
#
# For use for simulation and test purposes only
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source co... | def tlb_options(parser):
parser.add_option('--TLB-config', type='string', default='perCU', help='Options are: perCU (default), mono, 2CU, or perLane')
parser.add_option('--L1TLBentries', type='int', default='32')
parser.add_option('--L1TLBassoc', type='int', default='32')
parser.add_option('--L1AccessLa... |
# Write your code here
string = input()
dict = {}
maximum = 0
for i in string :
if i in dict :
dict[i] += 1
if dict[i] > maximum :
maximum = dict[i]
else :
dict[i] = 1
for key,value in sorted(dict.items()) :
if value == maximum :
print(str(key),str(value))
... | string = input()
dict = {}
maximum = 0
for i in string:
if i in dict:
dict[i] += 1
if dict[i] > maximum:
maximum = dict[i]
else:
dict[i] = 1
for (key, value) in sorted(dict.items()):
if value == maximum:
print(str(key), str(value))
break |
TRANSPARENT = 0
BLACK = 1
RED = 2
GREEN = 3
YELLOW = 4
BLUE = 5
MAGENTA = 6
CYAN = 7
WHITE = 8
| transparent = 0
black = 1
red = 2
green = 3
yellow = 4
blue = 5
magenta = 6
cyan = 7
white = 8 |
a = []
def splitter(n, user_num):
user_num_str = str(user_num)
for i in range(0, n, 1):
x = str(user_num_str[i])
a.append(x)
x = 0
def mainer():
try:
user = str(input())
a.append(user.split())
print(*a[0], sep='\n')
except EOFError:
print... | a = []
def splitter(n, user_num):
user_num_str = str(user_num)
for i in range(0, n, 1):
x = str(user_num_str[i])
a.append(x)
x = 0
def mainer():
try:
user = str(input())
a.append(user.split())
print(*a[0], sep='\n')
except EOFError:
print('')
mai... |
#Special Pythagorean triplet
def Euler9(sum):
for a in range(1,sum):
for b in range(1,sum):
c=sum-a-b
#print(str(a)+'\t\t'+str(b)+'\t\t'+str(c))
if (a*a+b*b)==(c*c):
return (a,b,c,a*b*c)
for i in range(1000,1001):
print(str(i)+'\t\t'+str(Euler9(i))) | def euler9(sum):
for a in range(1, sum):
for b in range(1, sum):
c = sum - a - b
if a * a + b * b == c * c:
return (a, b, c, a * b * c)
for i in range(1000, 1001):
print(str(i) + '\t\t' + str(euler9(i))) |
t = int(input())
for i in range(t):
n,a,b = map(int, input().split())
s = []
for j in range(n):
s.append(chr(97 + (j%b)))
print(''.join(s))
| t = int(input())
for i in range(t):
(n, a, b) = map(int, input().split())
s = []
for j in range(n):
s.append(chr(97 + j % b))
print(''.join(s)) |
while True:
flagGreen = hero.findFlag("green")
flagBlack = hero.findFlag("black")
if flagGreen:
pos = flagGreen.pos
hero.buildXY("fence", pos.x, pos.y)
hero.pickUpFlag(flagGreen)
if flagBlack:
pos = flagBlack.pos
hero.buildXY("fire-trap", pos.x, pos.y)
... | while True:
flag_green = hero.findFlag('green')
flag_black = hero.findFlag('black')
if flagGreen:
pos = flagGreen.pos
hero.buildXY('fence', pos.x, pos.y)
hero.pickUpFlag(flagGreen)
if flagBlack:
pos = flagBlack.pos
hero.buildXY('fire-trap', pos.x, pos.y)
h... |
# This function modifies global variable 's'
def f():
global s
print (s)
s = "Look for Wikitechy Python Section"
print (s)
# Global Scope
s = "Python is great!"
f()
print (s) | def f():
global s
print(s)
s = 'Look for Wikitechy Python Section'
print(s)
s = 'Python is great!'
f()
print(s) |
data = input("File where data is stored: ")
content = open(data, 'r')
text = content.read()
option = input("Read or write: ")
if option == "read":
for i in content.readlines():
first_name, last_name, dob = i.split(",")
print(first_name, last_name, dob)
content.close()
elif option == "write":
... | data = input('File where data is stored: ')
content = open(data, 'r')
text = content.read()
option = input('Read or write: ')
if option == 'read':
for i in content.readlines():
(first_name, last_name, dob) = i.split(',')
print(first_name, last_name, dob)
content.close()
elif option == 'write':
... |
class TwoHeadDragon():
def __init__(self):
self.left_head = IceDragon(self)
self.right_head = FireDragon(self)
def ice_breath(self):
return self.left_head.ice_breath()
def fire_breath(self):
return self.right_head.fire_breath()
def get_left_head(self):
return s... | class Twoheaddragon:
def __init__(self):
self.left_head = ice_dragon(self)
self.right_head = fire_dragon(self)
def ice_breath(self):
return self.left_head.ice_breath()
def fire_breath(self):
return self.right_head.fire_breath()
def get_left_head(self):
return ... |
def grader(score: float) -> str:
"Translated scores into grade code letter."
TRANSLATE = ((0.9,"A"), (0.8,"B"), (0.7,"C"), (0.6,"D"))
if score > 1 or score < 0:
# Error case, score out of range
return 'F'
for limit,code in TRANSLATE:
if score >= limit:
return code
... | def grader(score: float) -> str:
"""Translated scores into grade code letter."""
translate = ((0.9, 'A'), (0.8, 'B'), (0.7, 'C'), (0.6, 'D'))
if score > 1 or score < 0:
return 'F'
for (limit, code) in TRANSLATE:
if score >= limit:
return code
return 'F' |
#!/bin/python3
t = int(input().strip())
for _ in range(0, t):
n = int(input().strip())
flag = False
strings = [''.join(sorted(input().strip())) for line in range(0, n)]
for column in range(0, len(strings[0])):
for row in range(1, n):
up = strings[row-1][column]
now = s... | t = int(input().strip())
for _ in range(0, t):
n = int(input().strip())
flag = False
strings = [''.join(sorted(input().strip())) for line in range(0, n)]
for column in range(0, len(strings[0])):
for row in range(1, n):
up = strings[row - 1][column]
now = strings[row][colu... |
N = int(input())
m2 = 0
m3 = 0
m4 = 0
m5 = 0
values = input().split(' ')
values_correctly = values[:N]
for i in range(N):
values_correctly[i] = int(values_correctly[i])
if(values_correctly[i] % 2 ==0):
m2+=1
if(values_correctly[i] % 3 ==0):
m3+=1
if(values_correctly[i] % 4 ==0):
... | n = int(input())
m2 = 0
m3 = 0
m4 = 0
m5 = 0
values = input().split(' ')
values_correctly = values[:N]
for i in range(N):
values_correctly[i] = int(values_correctly[i])
if values_correctly[i] % 2 == 0:
m2 += 1
if values_correctly[i] % 3 == 0:
m3 += 1
if values_correctly[i] % 4 == 0:
... |
class Solution:
def isMonotonic(self, A: List[int]) -> bool:
# two pass
# check adjacent elements
return all(A[i]<=A[i+1] for i in range(len(A)-1)) or all(A[i]>=A[i+1] for i in range(len(A)-1))
# Time: O(N)
# Space:O(1)
# One pass
class Solution(object):
def isMonotonic(se... | class Solution:
def is_monotonic(self, A: List[int]) -> bool:
return all((A[i] <= A[i + 1] for i in range(len(A) - 1))) or all((A[i] >= A[i + 1] for i in range(len(A) - 1)))
class Solution(object):
def is_monotonic(self, A):
increasing = decreasing = True
for i in xrange(len(A) - 1):
... |
# Data parsing constants
US_STATE_CODE_DICT = {'alabama': 0,
'alaska': 1,
'arizona': 2,
'arkansas': 3,
'california': 4,
'colorado': 5,
'connecticut': 6,
'delaware': 7,
... | us_state_code_dict = {'alabama': 0, 'alaska': 1, 'arizona': 2, 'arkansas': 3, 'california': 4, 'colorado': 5, 'connecticut': 6, 'delaware': 7, 'florida': 8, 'georgia': 9, 'hawaii': 10, 'idaho': 11, 'illinois': 12, 'indiana': 13, 'iowa': 14, 'kansas': 15, 'kentucky': 16, 'louisiana': 17, 'maine': 18, 'maryland': 19, 'ma... |
class TemplatesAdminHook(object):
'''
Hook baseclass
'''
@classmethod
def pre_save(cls, request, form, template_path):
pass
@classmethod
def post_save(cls, request, form, template_path):
pass
@classmethod
def contribute_to_form(cls, form, template_path):
r... | class Templatesadminhook(object):
"""
Hook baseclass
"""
@classmethod
def pre_save(cls, request, form, template_path):
pass
@classmethod
def post_save(cls, request, form, template_path):
pass
@classmethod
def contribute_to_form(cls, form, template_path):
re... |
'''
2
Check if a number is odd or even
'''
def odd_or_even_using_modulus(n):
if n%2 == 0:
return("Even")
else:
return("Odd")
def odd_or_even_using_bitwise_and(n):
if n&1 == 0:
return("Even")
else:
return("Odd")
if __name__ == "__main__":
n = int(input("Number? ... | """
2
Check if a number is odd or even
"""
def odd_or_even_using_modulus(n):
if n % 2 == 0:
return 'Even'
else:
return 'Odd'
def odd_or_even_using_bitwise_and(n):
if n & 1 == 0:
return 'Even'
else:
return 'Odd'
if __name__ == '__main__':
n = int(input('Number? '))
... |
class Solution:
def verifyPostorder(self, postorder: List[int]) -> bool:
def recursion(startIdx, endIdx):
if startIdx >= endIdx: return True
curIdx = startIdx
while postorder[curIdx] < postorder[endIdx]:
curIdx += 1
rightStartIdx = curIdx
while postorder[curIdx] > postorder[e... | class Solution:
def verify_postorder(self, postorder: List[int]) -> bool:
def recursion(startIdx, endIdx):
if startIdx >= endIdx:
return True
cur_idx = startIdx
while postorder[curIdx] < postorder[endIdx]:
cur_idx += 1
right_s... |
# darwin64.py
# Mac OS X platform specific configuration
def config(env,args):
debug = args.get('debug',0)
if int(debug):
env.Append(CXXFLAGS = env.Split('-g -O0'))
else:
env.Append(CXXFLAGS = '-O')
env.Append(CPPDEFINES= 'NDEBUG')
env.Append(CPPDEFINES= 'WITH_DEBUG')
env... | def config(env, args):
debug = args.get('debug', 0)
if int(debug):
env.Append(CXXFLAGS=env.Split('-g -O0'))
else:
env.Append(CXXFLAGS='-O')
env.Append(CPPDEFINES='NDEBUG')
env.Append(CPPDEFINES='WITH_DEBUG')
env.Append(CXXFLAGS=env.Split('-Wall -fPIC'))
env.Append(CPPDEFI... |
class ProjectView(object):
def __init__(self, project_id, name, status, selected_cluster_id):
self.id = project_id
self.name = name
self.status = status
self.selected_cluster_id = selected_cluster_id
class ClusterView(object):
def __init__(self, cluster_id, anchor, selected=... | class Projectview(object):
def __init__(self, project_id, name, status, selected_cluster_id):
self.id = project_id
self.name = name
self.status = status
self.selected_cluster_id = selected_cluster_id
class Clusterview(object):
def __init__(self, cluster_id, anchor, selected=Fa... |
b2bi_strings = {
19: "g1VrCfVNFH+rV57qwbKeQla3oBPyyFjb4gEwtD6wgY2IlHxi8PIxjhilZLQd3c+N2dF9vKj79McEnR128FDVDU7ah4JipfLyAoRr8uy7R4FirnY8Xox1OSAS23Chz39lWmFFAq0lmg0C5s62acgk2ALzDECWwvguqPfmsc+Uv77MtWF1ubIFwQEGJhtOCKDKTim1gG6E+eYH0k1NmX5orDwhHmDzdJAt8AcmIJKPxlSSxdrfmp+4iNaFdUMDqOHw38QBUydx36LhOqhwgmsjRMjTjAnYP+ccxUxg2vtU... | b2bi_strings = {19: 'g1VrCfVNFH+rV57qwbKeQla3oBPyyFjb4gEwtD6wgY2IlHxi8PIxjhilZLQd3c+N2dF9vKj79McEnR128FDVDU7ah4JipfLyAoRr8uy7R4FirnY8Xox1OSAS23Chz39lWmFFAq0lmg0C5s62acgk2ALzDECWwvguqPfmsc+Uv77MtWF1ubIFwQEGJhtOCKDKTim1gG6E+eYH0k1NmX5orDwhHmDzdJAt8AcmIJKPxlSSxdrfmp+4iNaFdUMDqOHw38QBUydx36LhOqhwgmsjRMjTjAnYP+ccxUxg2vtUSok... |
class StringUtils(object):
@staticmethod
def get_first_row_which_starts_with(text, starts_with):
rows = str(text).split("\n")
for row in rows:
str_row = str(row)
if str_row.startswith(starts_with):
return str_row
@staticmethod
def get_value_afte... | class Stringutils(object):
@staticmethod
def get_first_row_which_starts_with(text, starts_with):
rows = str(text).split('\n')
for row in rows:
str_row = str(row)
if str_row.startswith(starts_with):
return str_row
@staticmethod
def get_value_after... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class PinValidationError(Exception):
pass
class PinChangingError(Exception):
pass
class AccountWithoutBalanceError(Exception):
pass
class Account:
def __init__(self, id: str, pin: str, balance: float):
self.__id = id
self.__pin = pin
... | class Pinvalidationerror(Exception):
pass
class Pinchangingerror(Exception):
pass
class Accountwithoutbalanceerror(Exception):
pass
class Account:
def __init__(self, id: str, pin: str, balance: float):
self.__id = id
self.__pin = pin
self.__balance = balance
def id(self)... |
model_lib = {
'fasterrcnn_mobilenet_v3_large_320_fpn': {
'model_path': 'fasterrcnn_mobilenet_v3_large_320_fpn-907ea3f9.pth',
'tx2_delay': 0.18,
'cloud_delay': 0.024,
'precision': None,
'service_type': 'object_detection'
},
'fasterrcnn_mobilenet_v3_large_fpn': {
... | model_lib = {'fasterrcnn_mobilenet_v3_large_320_fpn': {'model_path': 'fasterrcnn_mobilenet_v3_large_320_fpn-907ea3f9.pth', 'tx2_delay': 0.18, 'cloud_delay': 0.024, 'precision': None, 'service_type': 'object_detection'}, 'fasterrcnn_mobilenet_v3_large_fpn': {'model_path': 'fasterrcnn_mobilenet_v3_large_fpn-fb6a3cc7.pth'... |
#
# PySNMP MIB module RBN-BIND-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBN-BIND-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:44:05 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,... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint, constraints_union) ... |
text = "W. W. W. S. S. S. S. W. W. S. UNLOCK FRONT DOOR. S. WAIT. NO. LOOK AT WEATHER. WAIT. N. W. W. S. W. N. GET FOLDER AND MASK. MOVE BODY. LOOK IN WASTE BASKET. GET CARD AND OBJECT. S. E. N. E. E. E. E. N. W. DROP PEN AND NOTEBOOK. GET WET OVERCOAT. E. E. E. E. SHOW FOLDER TO ASTRONAUT. SHOW CARD TO ASTRONAUT. EXAM... | text = 'W. W. W. S. S. S. S. W. W. S. UNLOCK FRONT DOOR. S. WAIT. NO. LOOK AT WEATHER. WAIT. N. W. W. S. W. N. GET FOLDER AND MASK. MOVE BODY. LOOK IN WASTE BASKET. GET CARD AND OBJECT. S. E. N. E. E. E. E. N. W. DROP PEN AND NOTEBOOK. GET WET OVERCOAT. E. E. E. E. SHOW FOLDER TO ASTRONAUT. SHOW CARD TO ASTRONAUT. EXAM... |
API_TOKEN = "xxxxxxxxx"
DEFAULT_REPLY = "Sorry but I didn't understand you"
PLUGINS = [
'slackbot.plugins'
] | api_token = 'xxxxxxxxx'
default_reply = "Sorry but I didn't understand you"
plugins = ['slackbot.plugins'] |
'''
You've been using list comprehensions to build lists of values, sometimes using operations to create these values.
An interesting mechanism in list comprehensions is that you can also create lists with values that meet only a certain condition. One way of doing this is by using conditionals on iterator variables. ... | """
You've been using list comprehensions to build lists of values, sometimes using operations to create these values.
An interesting mechanism in list comprehensions is that you can also create lists with values that meet only a certain condition. One way of doing this is by using conditionals on iterator variables. ... |
print("\n")
name = input("What's your name? ")
age = input("How old are you? ")
city = input("Where do you live? ")
print("\n")
print("Hello,", name)
print("Your age is", age)
print("You live in", city)
print("\n") | print('\n')
name = input("What's your name? ")
age = input('How old are you? ')
city = input('Where do you live? ')
print('\n')
print('Hello,', name)
print('Your age is', age)
print('You live in', city)
print('\n') |
#cerner_2tothe5th_2021
# Get all substrings of a given string using slicing of string
# initialize the string
input_string = "floccinaucinihilipilification"
# print the input string
print("The input string is : " + str(input_string))
# Get all substrings of the string
result = [input_string[i: j] for ... | input_string = 'floccinaucinihilipilification'
print('The input string is : ' + str(input_string))
result = [input_string[i:j] for i in range(len(input_string)) for j in range(i + 1, len(input_string) + 1)]
print('All substrings of the input string are : ' + str(result)) |
#Sasikala Varatharajan G00376470
#Program to find all divisors between the given two numbers
#In this program we are going to find the numbers divisble by 6 but not by 12
#Get two inputs from the user - As per the instructions it should use 1000 as int_From and 10000 as int_to.
#But I have given an option to the user... | int__from = int(input('Enter the Range of numbers starts with : '))
int__to = int(input('Enter the Range of numbers ends with : '))
print('Divisable by 6 but not by 12 between', int_From, 'and', int_To, 'are:')
for num in range(int_From, int_To + 1):
if num % 6 == 0 and num % 12 != 0:
print(num)
else:
... |
# Author: weiwei
class BaseEvaluator:
def __init__(self, result_dir):
self.result_dir = result_dir
def evaluate(self, output, batch):
raise NotImplementedError()
def summarize(self):
raise NotImplementedError()
| class Baseevaluator:
def __init__(self, result_dir):
self.result_dir = result_dir
def evaluate(self, output, batch):
raise not_implemented_error()
def summarize(self):
raise not_implemented_error() |
#
# PySNMP MIB module HP-ICF-RIP (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-RIP
# Produced by pysmi-0.3.4 at Mon Apr 29 19:22:40 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:... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, constraints_intersection, single_value_constraint, value_size_constraint) ... |
{
'name': "MOBtexting SMS Gateway",
'version': '1.0',
'author': "MOBtexting",
'category': 'Tools',
'summary':'MOBtexting SMS Gateway',
'description':'You can use sms template to send SMS using MOBtexting Intergration.',
'website': "http://www.mobtexting.com",
'depends': ['base','web',],
... | {'name': 'MOBtexting SMS Gateway', 'version': '1.0', 'author': 'MOBtexting', 'category': 'Tools', 'summary': 'MOBtexting SMS Gateway', 'description': 'You can use sms template to send SMS using MOBtexting Intergration.', 'website': 'http://www.mobtexting.com', 'depends': ['base', 'web'], 'sequence': -80, 'data': ['view... |
def quicksort (lst):
if lst == []:
return []
else:
smallsorted = quicksort([x for x in lst[1:] if x <= lst[0]])
bigsorted = quicksort([x for x in lst[1:] if x > lst[0]])
return smallsorted + [lst[0]] + bigsorted
| def quicksort(lst):
if lst == []:
return []
else:
smallsorted = quicksort([x for x in lst[1:] if x <= lst[0]])
bigsorted = quicksort([x for x in lst[1:] if x > lst[0]])
return smallsorted + [lst[0]] + bigsorted |
class Board():
def __init__(self):
self.grid = [[5,3,0,0,7,0,0,0,0],
[6,0,0,1,9,5,0,0,0],
[0,9,8,0,0,0,0,6,0],
[8,0,0,0,6,0,0,0,3],
[4,0,0,8,0,3,0,0,1],
[7,0,0,0,2,0,0,0,6],
[0,6,0,0,0,0... | class Board:
def __init__(self):
self.grid = [[5, 3, 0, 0, 7, 0, 0, 0, 0], [6, 0, 0, 1, 9, 5, 0, 0, 0], [0, 9, 8, 0, 0, 0, 0, 6, 0], [8, 0, 0, 0, 6, 0, 0, 0, 3], [4, 0, 0, 8, 0, 3, 0, 0, 1], [7, 0, 0, 0, 2, 0, 0, 0, 6], [0, 6, 0, 0, 0, 0, 2, 8, 0], [0, 0, 0, 4, 1, 9, 0, 0, 5], [0, 0, 0, 0, 8, 0, 0, 7, 9]]
... |
aos_global_config.set('no_with_lwip', 1)
src = Split('''
soc/uart.c
main/arg_options.c
main/main.c
main/hw.c
main/wifi_port.c
main/ota_port.c
main/nand.c
main/vfs_trap.c
''')
global_cflags = Split('''
-m32
-std=gnu99
-Wall
-Wno-missing-field-initializers
-Wno-strict... | aos_global_config.set('no_with_lwip', 1)
src = split('\n soc/uart.c\n main/arg_options.c\n main/main.c\n main/hw.c\n main/wifi_port.c\n main/ota_port.c\n main/nand.c\n main/vfs_trap.c\n')
global_cflags = split('\n -m32\n -std=gnu99\n -Wall\n -Wno-missing-field-initializers\n -Wno-... |
myl1 = [1,2,3,4,5]
myl2 = myl1.copy()
print(id(myl1))
print(id(myl2))
print("Initially")
print(" myl1 is: ", myl1)
print(" myl2 is: ", myl2)
print("--------------------")
myl1[2] = 13
print("Modifying myl1")
print(" myl1 is: ", myl1)
print(" myl2 is: ", myl2)
print("--------------------")
myl2[3] = 14
print("Modifying ... | myl1 = [1, 2, 3, 4, 5]
myl2 = myl1.copy()
print(id(myl1))
print(id(myl2))
print('Initially')
print(' myl1 is: ', myl1)
print(' myl2 is: ', myl2)
print('--------------------')
myl1[2] = 13
print('Modifying myl1')
print(' myl1 is: ', myl1)
print(' myl2 is: ', myl2)
print('--------------------')
myl2[3] = 14
print('Modify... |
if __name__=="__main__":
t=int(input())
while(t>0):
(n, k) = map(int, input().split())
li=list(map(int, input().split()[:n]))
min = 99999999
for i in range(len(li)):
if li[i] < min:
min=li[i]
if k-min > 0:
print(k-min)
else:... | if __name__ == '__main__':
t = int(input())
while t > 0:
(n, k) = map(int, input().split())
li = list(map(int, input().split()[:n]))
min = 99999999
for i in range(len(li)):
if li[i] < min:
min = li[i]
if k - min > 0:
print(k - min)
... |
people = [
[['Kay', 'McNulty'], 'mcnulty@eniac.org'],
[['Betty', 'Jennings'], 'jennings@eniac.org'],
[['Marlyn', 'Wescoff'], 'mwescoff@eniac.org']
]
for [[first, last], email] in people:
print('{} {} <{}>'.format(first, last, email))
| people = [[['Kay', 'McNulty'], 'mcnulty@eniac.org'], [['Betty', 'Jennings'], 'jennings@eniac.org'], [['Marlyn', 'Wescoff'], 'mwescoff@eniac.org']]
for [[first, last], email] in people:
print('{} {} <{}>'.format(first, last, email)) |
# Helper function to get the turning performance with moving in upward right lane and
# turn left.
def UpLeftRightLane(line1, line2, flag, x, y):
laneWidth = abs(line2[0][0]-line2[0][1])
half = line2[0][0] + laneWidth/2 + 2
Rang1_1 = [[half-2, half],[ line2[1][0], line2[1][1] ]]
Rang1_2 = [[half, half... | def up_left_right_lane(line1, line2, flag, x, y):
lane_width = abs(line2[0][0] - line2[0][1])
half = line2[0][0] + laneWidth / 2 + 2
rang1_1 = [[half - 2, half], [line2[1][0], line2[1][1]]]
rang1_2 = [[half, half + 0.5], [line2[1][0], line2[1][1]]]
rang2_1 = [[half - 3, half - 2], [line2[1][0], line... |
a,b,c = input().split(" ")
A = int(a)
B = int(b)
C = int(c)
MAIORAB = (A + B + abs(A-B))/2
MAIOR = (MAIORAB + C + abs(MAIORAB - C))/2
print("%d eh o maior" %MAIOR)
| (a, b, c) = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
maiorab = (A + B + abs(A - B)) / 2
maior = (MAIORAB + C + abs(MAIORAB - C)) / 2
print('%d eh o maior' % MAIOR) |
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
'''
Hivy
----
Hivy exposes a RESTful API to the Unide (unide.co) platform. Create, destroy
and configure collaborative development environments and services around it.
:copyright (c) 2014 Xavier Bruhier.
:license: Apache 2.0, see LICENSE for more details.
'''
__... | """
Hivy
----
Hivy exposes a RESTful API to the Unide (unide.co) platform. Create, destroy
and configure collaborative development environments and services around it.
:copyright (c) 2014 Xavier Bruhier.
:license: Apache 2.0, see LICENSE for more details.
"""
__project__ = 'hivy'
__author__ = 'Xavier Bruh... |
MEMORY_SIZE = 64 * 1024
WORD_LENGTH = 255
_IN = "IN" # constant to specify input ports
_OUT = "OUT" # constant to specify output ports
| memory_size = 64 * 1024
word_length = 255
_in = 'IN'
_out = 'OUT' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.