content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# deliberatly not in file_dep, so a change to sizes doesn't force rerenders def get_map_size(obj_name): map_size = 512 # maybe let a custom attr raise this sometimes, or determine it from obj size? if obj_name.startswith('gnd.'): if obj_name != 'gnd.023': return None, None map_...
def get_map_size(obj_name): map_size = 512 if obj_name.startswith('gnd.'): if obj_name != 'gnd.023': return (None, None) map_size = 2048 if obj_name in ['building_022.outer.003']: map_size = 2048 if obj_name.startswith('leaf.'): return (None, None) return ...
def find2020(list): for i in range(0, len(list)): for j in range(i+1, len(list)): for k in range(j+1, len(list)): if list[i] + list[j] + list[k] == 2020: print(list[i] * list[j] * list[k]) if __name__ == '__main__': with open("test2.txt") as file: ...
def find2020(list): for i in range(0, len(list)): for j in range(i + 1, len(list)): for k in range(j + 1, len(list)): if list[i] + list[j] + list[k] == 2020: print(list[i] * list[j] * list[k]) if __name__ == '__main__': with open('test2.txt') as file: ...
class MyHashMap: def eval_hash(self, key): return ((key*1031237) & (1<<20) - 1)>>5 def __init__(self): self.arr = [[] for _ in range(1<<15)] def put(self, key, value): t = self.eval_hash(key) for i,(k,v) in enumerate(self.arr[t]): if k == key: ...
class Myhashmap: def eval_hash(self, key): return (key * 1031237 & (1 << 20) - 1) >> 5 def __init__(self): self.arr = [[] for _ in range(1 << 15)] def put(self, key, value): t = self.eval_hash(key) for (i, (k, v)) in enumerate(self.arr[t]): if k == key: ...
numWords = 2 mostCommonWords = ["the","of","to","and","a","in","is","it","you","that"] def addWord(d,group,word): if d.get(group) == None: d[group] = {word : 1} else: if d[group].get(word) == None: d[group][word] = 1 else: d[group][word] = d[group][word] + 1 def...
num_words = 2 most_common_words = ['the', 'of', 'to', 'and', 'a', 'in', 'is', 'it', 'you', 'that'] def add_word(d, group, word): if d.get(group) == None: d[group] = {word: 1} elif d[group].get(word) == None: d[group][word] = 1 else: d[group][word] = d[group][word] + 1 def make_opti...
# An integer has sequential digits # if and only if each digit in the number is one more than the previous digit. # Return a sorted list of all the integers in the range [low, high] inclusive that have sequential digits. # Example 1: # Input: low = 100, high = 300 # Output: [123,234] # Example 2: # Input: low = 1000...
class Solution: def sequential_digits(self, low: int, high: int) -> List[int]: res = [] for i in range(1, 10): num = i for j in range(i + 1, 10): num = num * 10 + j if low <= num <= high: res.append(num) return sort...
#!/usr/bin/python3 with open('05_input', 'r') as f: lines = f.readlines() lines = [r.strip() for r in lines] def get_seat_id(code): row_str = code[0:7] col_str = code[7:10] row_num = row_str.replace('F','0').replace('B','1') col_num = col_str.replace('L','0').replace('R','1') row = int(row_nu...
with open('05_input', 'r') as f: lines = f.readlines() lines = [r.strip() for r in lines] def get_seat_id(code): row_str = code[0:7] col_str = code[7:10] row_num = row_str.replace('F', '0').replace('B', '1') col_num = col_str.replace('L', '0').replace('R', '1') row = int(row_num, 2) col = i...
# pseudo code taken from CLRS book def lcs(X, Y): c = {} # c[(i,j)] represents length of lcs of [x0, x1, ... , xi] and [y0, y1, ... , yj] m = len(X) n = len(Y) for i in range(m): c[(i, -1)] = 0 for j in range(n): c[(-1, j)] = 0 for i in range(m): for j in range(n): ...
def lcs(X, Y): c = {} m = len(X) n = len(Y) for i in range(m): c[i, -1] = 0 for j in range(n): c[-1, j] = 0 for i in range(m): for j in range(n): if X[i] == Y[j]: c[i, j] = 1 + c[i - 1, j - 1] elif c[i - 1, j] >= c[i, j - 1]: ...
class TreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def insert(root, node): if root is None: root = node else: if root.data >= node.data: if root.left == None: root.left = node else: ...
class Treenode: def __init__(self, data): self.data = data self.left = None self.right = None def insert(root, node): if root is None: root = node elif root.data >= node.data: if root.left == None: root.left = node else: insert(root.l...
## <hr>Dummy value. # # No texture, but the value to be used as 'texture semantic' # (#aiMaterialProperty::mSemantic) for all material properties # *not* related to textures. # aiTextureType_NONE = 0x0 ## <hr>The texture is combined with the result of the diffuse # lighting equation. # aiTextureType_DIFFUSE = 0x1 ## ...
ai_texture_type_none = 0 ai_texture_type_diffuse = 1 ai_texture_type_specular = 2 ai_texture_type_ambient = 3 ai_texture_type_emissive = 4 ai_texture_type_height = 5 ai_texture_type_normals = 6 ai_texture_type_shininess = 7 ai_texture_type_opacity = 8 ai_texture_type_displacement = 9 ai_texture_type_lightmap = 10 ai_te...
# -*- coding: cp852 -*- #en_EN Locale class language(): VERSION='Version' CREATING_BACKUP='Creating backup' NO_PERM='No Permission' COPYING_FILES='Copying files' COULD_NOT_COPY='Could not copy files' DONE='Done' REWRITING_FLUXION_BASH='Rewriting fluxion bash' RECONFIGURE_FLUXION_BASH='R...
class Language: version = 'Version' creating_backup = 'Creating backup' no_perm = 'No Permission' copying_files = 'Copying files' could_not_copy = 'Could not copy files' done = 'Done' rewriting_fluxion_bash = 'Rewriting fluxion bash' reconfigure_fluxion_bash = 'Reconfiguring fluxion bash...
def sycl_library_path(name): return "lib/lib{}.so".format(name) def readlink_command(): return "readlink"
def sycl_library_path(name): return 'lib/lib{}.so'.format(name) def readlink_command(): return 'readlink'
class Sources: def __init__(self,id,name,description,language): self.id = id self.name = name self.description = description self.language = language class Articles: def __init__(self,author,title,description,url,publishedAt,urlToImage): self.author = author self...
class Sources: def __init__(self, id, name, description, language): self.id = id self.name = name self.description = description self.language = language class Articles: def __init__(self, author, title, description, url, publishedAt, urlToImage): self.author = author ...
num_list = list(map(int, input().split())) high=max(num_list) low=min(num_list) print(low,sum(num_list),high)
num_list = list(map(int, input().split())) high = max(num_list) low = min(num_list) print(low, sum(num_list), high)
def clock_degree(clock_time): hour, minutes = (int(a) for a in clock_time.split(':')) if not (24 > hour >= 0 and 60 > minutes >= 0): return 'Check your time !' return '{}:{}'.format((hour % 12) * 30 or 360, minutes * 6 or 360)
def clock_degree(clock_time): (hour, minutes) = (int(a) for a in clock_time.split(':')) if not (24 > hour >= 0 and 60 > minutes >= 0): return 'Check your time !' return '{}:{}'.format(hour % 12 * 30 or 360, minutes * 6 or 360)
# def quick_sort(the_list): # # left index # l = 0 # # pivot index # p = len(the_list) # # right index # r = pivot - 1 # if l < r: # # increment l till we have an appropriate value # while the_list[l] <= the_list[p] && l < len(the_list): # l += 1 # # d...
def quick_sort(arr, l, r): if l < r: position = partition(arr, l, r) quick_sort(arr, l, position - 1) quick_sort(arr, position + 1, r) def partition(arr, l, r): p = arr[r]
class ProductionConfig(): DEBUG = False MONGODB_HOST = 'localhost' MONGODB_DBNAME = 'their_tweets' MONGODB_SETTINGS = { 'host' : 'localhost', 'DB' : 'new', 'port' : 27017 } SECRET_KEY = 'thisissecret' MULTIPLE_AUTH_HEADERS = ['access_token', 'device'] PORT = 8...
class Productionconfig: debug = False mongodb_host = 'localhost' mongodb_dbname = 'their_tweets' mongodb_settings = {'host': 'localhost', 'DB': 'new', 'port': 27017} secret_key = 'thisissecret' multiple_auth_headers = ['access_token', 'device'] port = 8000 propogate_exceptions = True ...
__author__ = "" __version__ = "0.0.1" __date__ = "" __all__ = ["__author__", "__version__", "__date__"]
__author__ = '' __version__ = '0.0.1' __date__ = '' __all__ = ['__author__', '__version__', '__date__']
def analog_state(analog_input): if analog_input.read(): return 'UP' else: return 'DOWN'
def analog_state(analog_input): if analog_input.read(): return 'UP' else: return 'DOWN'
def getRoot(config): if not config.parent: return config return getRoot(config.parent) root = getRoot(config) if 'libdispatch' in root.available_features: additional_cflags = ' -fblocks ' for index, (template, replacement) in enumerate(config.substitutions): if template in ['%clang_tsan ', '%clangxx_t...
def get_root(config): if not config.parent: return config return get_root(config.parent) root = get_root(config) if 'libdispatch' in root.available_features: additional_cflags = ' -fblocks ' for (index, (template, replacement)) in enumerate(config.substitutions): if template in ['%clang_...
UNBOXED_PRIMITIVE_DEFAULT_EMPTY = "__prim_empty_slot" UNBOXED_PRIMITIVE_DEFAULT_ZERO = "__prim_zero_slot" IO_CLASS = "IO" OBJECT_CLASS = "Object" INTEGER_CLASS = "Int" BOOLEAN_CLASS = "Bool" STRING_CLASS = "String" BUILT_IN_CLASSES = [ IO_CLASS, OBJECT_CLASS, INTEGER_CLASS, BOOLEAN_CLASS, STRING_CLAS...
unboxed_primitive_default_empty = '__prim_empty_slot' unboxed_primitive_default_zero = '__prim_zero_slot' io_class = 'IO' object_class = 'Object' integer_class = 'Int' boolean_class = 'Bool' string_class = 'String' built_in_classes = [IO_CLASS, OBJECT_CLASS, INTEGER_CLASS, BOOLEAN_CLASS, STRING_CLASS] void_type = 'Void...
## gera novo arquivo sped a partir do banco de dados def exec(filename,cursor): arquivo = open("out/" + filename + '_r.txt', 'w') for row in cursor.execute('SELECT * FROM principal order by r0'): line = [i for i in row if i is not None] line = '|' + '|'.join(line[1:]) + '|' + '\n' arqu...
def exec(filename, cursor): arquivo = open('out/' + filename + '_r.txt', 'w') for row in cursor.execute('SELECT * FROM principal order by r0'): line = [i for i in row if i is not None] line = '|' + '|'.join(line[1:]) + '|' + '\n' arquivo.write(line) arquivo.close()
def array123(nums): # Note: iterate with length-2, so can use i+1 and i+2 in the loop for i in range(len(nums)-2): if nums[i]==1 and nums[i+1]==2 and nums[i+2]==3: return True return False
def array123(nums): for i in range(len(nums) - 2): if nums[i] == 1 and nums[i + 1] == 2 and (nums[i + 2] == 3): return True return False
class Solution: def findSwapValues(self,a, n, b, m): summA = sum(a) summB = sum(b) diff = (summA - summB) if diff % 2 != 0 : return -1 diff = diff / 2 # We need to find num1 in a and num2 in b such that # summA - num1 + num2 = summB - num2 + num1 ...
class Solution: def find_swap_values(self, a, n, b, m): summ_a = sum(a) summ_b = sum(b) diff = summA - summB if diff % 2 != 0: return -1 diff = diff / 2 i = 0 j = 0 while i < n and j < m: d = a[i] - b[j] if d == dif...
_base_ = ['../../_base_/default_runtime.py'] # dataset settings dataset_type = 'MOTChallengeDataset' img_norm_cfg = dict( mean=[0, 0, 0], std=[255, 255, 255], to_rgb=True) train_pipeline = [ dict(type='LoadMultiImagesFromFile', to_float32=True), dict(type='SeqLoadAnnotations', with_bbox=True, with_track=T...
_base_ = ['../../_base_/default_runtime.py'] dataset_type = 'MOTChallengeDataset' img_norm_cfg = dict(mean=[0, 0, 0], std=[255, 255, 255], to_rgb=True) train_pipeline = [dict(type='LoadMultiImagesFromFile', to_float32=True), dict(type='SeqLoadAnnotations', with_bbox=True, with_track=True), dict(type='SeqResize', img_sc...
def calculate_best_trade(prices): # Check if there are less than two prices in the list # If so, the function cannot calculate max profit # Else, there are at least two prices in the list and so run the function if len(prices) < 2: print("List of prices does not have at least two elements! Cann...
def calculate_best_trade(prices): if len(prices) < 2: print('List of prices does not have at least two elements! Cannot run the function.') else: num_shares = 10000 min_price = 0 max_price = 0 for price in prices: if min_price == 0 and max_price == 0: ...
# # PySNMP MIB module Unisphere-Data-SONET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-SONET-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:25:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, constraints_union, single_value_constraint) ...
''' It is often convenient to build a large DataFrame by parsing many files as DataFrames and concatenating them all at once. You'll do this here with three files, but, in principle, this approach can be used to combine data from dozens or hundreds of files. Here, you'll work with DataFrames compiled from The Guardian...
""" It is often convenient to build a large DataFrame by parsing many files as DataFrames and concatenating them all at once. You'll do this here with three files, but, in principle, this approach can be used to combine data from dozens or hundreds of files. Here, you'll work with DataFrames compiled from The Guardian...
''' Many-to-many data merge The final merging scenario occurs when both DataFrames do not have unique keys for a merge. What happens here is that for each duplicated key, every pairwise combination will be created. Two example DataFrames that share common key values have been pre-loaded: df1 and df2. Another DataFram...
""" Many-to-many data merge The final merging scenario occurs when both DataFrames do not have unique keys for a merge. What happens here is that for each duplicated key, every pairwise combination will be created. Two example DataFrames that share common key values have been pre-loaded: df1 and df2. Another DataFram...
boxWidth = 50 # Width of square boxes inside grid margin = 15 # Margin around grid border = 2 # grid thickness steps = 11 # no. of loki movement b/w two maze boxes in animation # COLORS grey = (67,67,67) black = (0,0,0) white = (255,255,255) yellow = (50,226,249) red = (1,23,182) green = (0,114,1)
box_width = 50 margin = 15 border = 2 steps = 11 grey = (67, 67, 67) black = (0, 0, 0) white = (255, 255, 255) yellow = (50, 226, 249) red = (1, 23, 182) green = (0, 114, 1)
#!/usr/bin/env python # encoding: utf-8 version_info = (0, 2, 1) version = ".".join(map(str, version_info))
version_info = (0, 2, 1) version = '.'.join(map(str, version_info))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Administrator' class Screen(object): @property def width(self): return self._width @width.setter def width(self, value): if not isinstance(value, int): raise ValueError('width must be an integer!') self....
__author__ = 'Administrator' class Screen(object): @property def width(self): return self._width @width.setter def width(self, value): if not isinstance(value, int): raise value_error('width must be an integer!') self._width = value @property def height(se...
liste = list() liste2 = [1,2,3,4]
liste = list() liste2 = [1, 2, 3, 4]
# # Connection Transport # # Exception classes used by this module. class ExceptionPxTransport(ExceptionPexpect): '''Raised for pxtransport exceptions. ''' class pxtransport(object): '''The carrier of the info.''' def __init__(self, hostname=None, info=None): if hostname is None and info is N...
class Exceptionpxtransport(ExceptionPexpect): """Raised for pxtransport exceptions. """ class Pxtransport(object): """The carrier of the info.""" def __init__(self, hostname=None, info=None): if hostname is None and info is None: raise exception_px_transport('insufficient connectio...
while True: nx, ny, w = input().split() nx = int(nx) ny = int(ny) w = float(w) if nx == ny and ny == w and w == 0: break xs = sorted(map(float, input().split())) ys = sorted(map(float, input().split())) xbroke = xs[0] - w / 2 > 0 or xs[-1] + w / 2 < 75 ybroke = ys[0] - w / ...
while True: (nx, ny, w) = input().split() nx = int(nx) ny = int(ny) w = float(w) if nx == ny and ny == w and (w == 0): break xs = sorted(map(float, input().split())) ys = sorted(map(float, input().split())) xbroke = xs[0] - w / 2 > 0 or xs[-1] + w / 2 < 75 ybroke = ys[0] - w ...
# -*- coding: utf-8 -*- # For simplicity, these values are shared among both threads and comments. MAX_THREADS = 1000 MAX_NAME = 50 MAX_DESCRIPTION = 3000 MAX_ADMINS = 2 # status DEAD = 0 ALIVE = 1 STATUS = { DEAD: 'dead', ALIVE: 'alive', } BASE_SUBREDDITS = {'biology': ['biochemistry', ...
max_threads = 1000 max_name = 50 max_description = 3000 max_admins = 2 dead = 0 alive = 1 status = {DEAD: 'dead', ALIVE: 'alive'} base_subreddits = {'biology': ['biochemistry', 'bioengineering', 'bioinformatics', 'biophysics', 'evolution', 'genetics', 'genomics', 'molecular_biology', 'systems_biology', 'software'], 'st...
# directory list DATA_DIR = "./plugins/data/" # cv window MAIN_WINDOW_NAME = 'main' MASK_WINDOW_NAME = 'mask' KEY_WAIT_DURATION = 1
data_dir = './plugins/data/' main_window_name = 'main' mask_window_name = 'mask' key_wait_duration = 1
def split_tag(tag): if tag == 'O': state = 'O' label = None elif tag == '-X-': state = 'O' label = None else: state, label = tag.split('-') return state, label def iob2bio(tags): processed_tags = [] # should be bio format prev_state = None prev...
def split_tag(tag): if tag == 'O': state = 'O' label = None elif tag == '-X-': state = 'O' label = None else: (state, label) = tag.split('-') return (state, label) def iob2bio(tags): processed_tags = [] prev_state = None prev_label = None for (t, ...
class OnTheFarmDivTwo: def animals(self, heads, legs): if legs < 2 * heads or legs > 4 * heads or legs % 2: return tuple() x = (legs - 2 * heads) / 2 return heads - x, x
class Onthefarmdivtwo: def animals(self, heads, legs): if legs < 2 * heads or legs > 4 * heads or legs % 2: return tuple() x = (legs - 2 * heads) / 2 return (heads - x, x)
# # Copyright (c) 2010-2016, Fabric Software Inc. All rights reserved. # Direct = 0 Reference = 1 Pointer = 2
direct = 0 reference = 1 pointer = 2
class GtExampleDependency: def __init__(self,gt_example): self.gt_example = gt_example self.parent_dependencies = [] self.child_dependencies = [] def add_parent(self, parent_dependency): self.parents().append(parent_dependency) def add_child(self, child_dependency): ...
class Gtexampledependency: def __init__(self, gt_example): self.gt_example = gt_example self.parent_dependencies = [] self.child_dependencies = [] def add_parent(self, parent_dependency): self.parents().append(parent_dependency) def add_child(self, child_dependency): ...
n=int(input()) t=[[0]*n for i in range (n)] i,j=0,0 for k in range(1, n*n+1): t[i][j]=k if k==n*n: break if i<=j+1 and i+j<n-1: j+=1 elif i<j and i+j>=n-1: i+=1 elif i>=j and i+j>n-1: j-=1 elif i>j+1 and i+j<=n-1: i-=1 for i in range(n): print(*t[i])
n = int(input()) t = [[0] * n for i in range(n)] (i, j) = (0, 0) for k in range(1, n * n + 1): t[i][j] = k if k == n * n: break if i <= j + 1 and i + j < n - 1: j += 1 elif i < j and i + j >= n - 1: i += 1 elif i >= j and i + j > n - 1: j -= 1 elif i > j + 1 and i...
#use of the while loop to determine the number of digits of an integer n: n = int(input()) length = 0 while n > 0: n = n//10 length = length + 1 print("number of digits in the given number n =" , length) #On each iteration we cut the last digit of the number using # integer division by 10 (n //= 10). In the...
n = int(input()) length = 0 while n > 0: n = n // 10 length = length + 1 print('number of digits in the given number n =', length)
class ShapeConfig(): def __init__( self, shape=[74, 74, 125, 125], verbose=False ): self.shape = shape self._number_of_substrip = len(self.shape) self._number_of_pixels = 0 for pixel_number in self.shape: self._number_of_pixels += pixel_numbe...
class Shapeconfig: def __init__(self, shape=[74, 74, 125, 125], verbose=False): self.shape = shape self._number_of_substrip = len(self.shape) self._number_of_pixels = 0 for pixel_number in self.shape: self._number_of_pixels += pixel_number self._offsets = [] ...
class Solution: def maxProfit(self, prices: List[int]) -> int: minn = float("inf") profit = 0 for price in prices: if minn > price : minn = price if price - minn > profit : profit = price - minn return profit
class Solution: def max_profit(self, prices: List[int]) -> int: minn = float('inf') profit = 0 for price in prices: if minn > price: minn = price if price - minn > profit: profit = price - minn return profit
coordinates_E0E1E1 = ((125, 117), (125, 120), (126, 96), (126, 117), (126, 119), (126, 127), (127, 94), (127, 97), (127, 109), (127, 118), (127, 119), (127, 127), (128, 93), (128, 98), (128, 108), (128, 109), (128, 118), (128, 119), (129, 92), (129, 94), (129, 96), (129, 100), (129, 101), (129, 103), (129, 107), (129...
coordinates_e0_e1_e1 = ((125, 117), (125, 120), (126, 96), (126, 117), (126, 119), (126, 127), (127, 94), (127, 97), (127, 109), (127, 118), (127, 119), (127, 127), (128, 93), (128, 98), (128, 108), (128, 109), (128, 118), (128, 119), (129, 92), (129, 94), (129, 96), (129, 100), (129, 101), (129, 103), (129, 107), (129...
class EMA: def __init__(self): self.EMA_12 = [] self.EMA_20 = [] self.EMA_26 = [] self.EMA_50 = [] self.EMA_80 = [] self.EMA_85 = [] self.EMA_90 = [] self.EMA_95 = [] self.EMA_100 = [] self.EMA_160 = [] @staticmethod def EMA(da...
class Ema: def __init__(self): self.EMA_12 = [] self.EMA_20 = [] self.EMA_26 = [] self.EMA_50 = [] self.EMA_80 = [] self.EMA_85 = [] self.EMA_90 = [] self.EMA_95 = [] self.EMA_100 = [] self.EMA_160 = [] @staticmethod def ema(d...
def solution(x): s = 0 for i in range(x): if i%3 == 0 or i%5 == 0: s += i return s
def solution(x): s = 0 for i in range(x): if i % 3 == 0 or i % 5 == 0: s += i return s
class Iris: def __init__(self, features, label): self.features = features self.label = label def sum(self): return sum(self.features) for *features, label in DATA: iris = Iris(features, label) result[iris.label] = iris.sum()
class Iris: def __init__(self, features, label): self.features = features self.label = label def sum(self): return sum(self.features) for (*features, label) in DATA: iris = iris(features, label) result[iris.label] = iris.sum()
class CameraInterface: def get_image(self): raise NotImplementedError() def get_depth(self): raise NotImplementedError()
class Camerainterface: def get_image(self): raise not_implemented_error() def get_depth(self): raise not_implemented_error()
class HTTPCache(ValueError): pass __all__ = ("HTTPCache",)
class Httpcache(ValueError): pass __all__ = ('HTTPCache',)
class Warning(StandardError): pass class Error(StandardError): pass class InterfaceError(Error): pass class DatabaseError(Error): pass class DataError(DatabaseError): pass class OperationalError(DatabaseError): pass class IntegrityError(DatabaseError): pass class InternalError(DatabaseError...
class Warning(StandardError): pass class Error(StandardError): pass class Interfaceerror(Error): pass class Databaseerror(Error): pass class Dataerror(DatabaseError): pass class Operationalerror(DatabaseError): pass class Integrityerror(DatabaseError): pass class Internalerror(Databas...
# This makes this folder a package and can be left empty if you like. # the __all__ special variable indicates what modules to load then the * star # is used for importing. __all__ = ['aCoolModule']
__all__ = ['aCoolModule']
main_colors = ['red', 'yellow', 'blue'] secondary_colors = { 'orange': ('red', 'yellow'), 'purple': ('red', 'blue'), 'green': ('yellow', 'blue') } base_strings = input().split() made_colors_all = [] made_colors_final = [] while base_strings: first_string = base_strings.pop(0) second_string = base_s...
main_colors = ['red', 'yellow', 'blue'] secondary_colors = {'orange': ('red', 'yellow'), 'purple': ('red', 'blue'), 'green': ('yellow', 'blue')} base_strings = input().split() made_colors_all = [] made_colors_final = [] while base_strings: first_string = base_strings.pop(0) second_string = base_strings.pop() if...
def inc(c, d): return chr(ord(c) + d) def dec(c, d): return chr(ord(c) - d) arg1 = ["+"] * 29 arg1[0x13] = '6' arg1[0x10] = 'n' arg1[0xd] = 'r' arg1[0x14] = dec('%', -8) arg1[0xf] = 'n' arg1[10] = 'p' arg1[0x10] = dec('u', 7) arg1[3] = '{' arg1[0x13] = '6' arg1[0x15] = 'q' arg1[2] = 'n' arg1[0] = 's' arg1[7]...
def inc(c, d): return chr(ord(c) + d) def dec(c, d): return chr(ord(c) - d) arg1 = ['+'] * 29 arg1[19] = '6' arg1[16] = 'n' arg1[13] = 'r' arg1[20] = dec('%', -8) arg1[15] = 'n' arg1[10] = 'p' arg1[16] = dec('u', 7) arg1[3] = '{' arg1[19] = '6' arg1[21] = 'q' arg1[2] = 'n' arg1[0] = 's' arg1[7] = 'l' arg1[14] ...
class SequentialProcessor(object): def process(self, vertice, executor): results = [] for vertex in vertice: result = executor.execute(executor.param(vertex)) results.append((vertex, result)) return results
class Sequentialprocessor(object): def process(self, vertice, executor): results = [] for vertex in vertice: result = executor.execute(executor.param(vertex)) results.append((vertex, result)) return results
n = input().split() K=int(n[0]) N=int(n[1]) M=int(n[2]) need= K*N if need>M: print(need-M) else: print('0')
n = input().split() k = int(n[0]) n = int(n[1]) m = int(n[2]) need = K * N if need > M: print(need - M) else: print('0')
def aoc(data): jolts = 0 ones = 0 threes = 1 for psu in sorted([int(i) for i in data.split()]): if psu == jolts + 1: ones += 1 if psu == jolts + 3: threes += 1 jolts = psu return ones * threes
def aoc(data): jolts = 0 ones = 0 threes = 1 for psu in sorted([int(i) for i in data.split()]): if psu == jolts + 1: ones += 1 if psu == jolts + 3: threes += 1 jolts = psu return ones * threes
# -*- coding: utf8 -*- # Copyright 2017-2019 NLCI (http://www.nlci.in/fonts/) # Apache License v2.0 class Charset: common_name = 'NLCI: Tamil script' native_name = 'Tamil script' abbreviation = 'Taml' key = 0x0B95 glyphs = [ 0x0B82, # TAMIL SIGN ANUSVARA 0x0B83, # TAMIL SIGN VISA...
class Charset: common_name = 'NLCI: Tamil script' native_name = 'Tamil script' abbreviation = 'Taml' key = 2965 glyphs = [2946, 2947, 2949, 2950, 2951, 2952, 2953, 2954, 2958, 2959, 2960, 2962, 2963, 2964, 2965, 2969, 2970, 2972, 2974, 2975, 2979, 2980, 2984, 2985, 2986, 2990, 2991, 2992, 2993, 2994...
def run_length_encoding(string: str) -> str: counter = 0 current_character = None output = [] for character in string: if current_character == character: counter += 1 else: if current_character: output.append(current_character + str(counter if c...
def run_length_encoding(string: str) -> str: counter = 0 current_character = None output = [] for character in string: if current_character == character: counter += 1 else: if current_character: output.append(current_character + str(counter if coun...
###***********************************### ''' Grade Notifier File: refresh_result.py Author: Ehud Adler Core Maintainers: Ehud Adler, Akiva Sherman, Yehuda Moskovits Copyright: Copyright 2019, Ehud Adler License: MIT ''' ###***********************************### class RefreshResult(): def __init__(self, classes, g...
""" Grade Notifier File: refresh_result.py Author: Ehud Adler Core Maintainers: Ehud Adler, Akiva Sherman, Yehuda Moskovits Copyright: Copyright 2019, Ehud Adler License: MIT """ class Refreshresult: def __init__(self, classes, gpa): self.classes = classes self.gpa = gpa
''' key -> value store any types -> any type ''' english = { 'apple': 'fruit blah blah', 'apetite': 'desire for something, usually food', 'pluto': 'a gray planet' } print(english['apple']) #print(english['banana']) fails with KeyError print(english.get('banana')) #handles KeyError and return Non...
""" key -> value store any types -> any type """ english = {'apple': 'fruit blah blah', 'apetite': 'desire for something, usually food', 'pluto': 'a gray planet'} print(english['apple']) print(english.get('banana')) print(english.get('banana', 'unknown word')) english['banana'] = 'yellow fleshy fruit' print(eng...
def __is_integer(some_string): try: int(some_string) return True except: return False def compute(expression: str = None) -> int: stack = [] for element in expression.split(): if __is_integer(element): stack.append(int(element)) continue ...
def __is_integer(some_string): try: int(some_string) return True except: return False def compute(expression: str=None) -> int: stack = [] for element in expression.split(): if __is_integer(element): stack.append(int(element)) continue sec...
# encoding=utf-8 class Player(object): '''A basic player with a name and a Bot. bot may be a subclass of LightCycleBaseBot or a string with its Python source code. ''' def __init__(self, name, bot, **kwargs): for attr, value in kwargs.items(): if not hasattr(self, attr): ...
class Player(object): """A basic player with a name and a Bot. bot may be a subclass of LightCycleBaseBot or a string with its Python source code. """ def __init__(self, name, bot, **kwargs): for (attr, value) in kwargs.items(): if not hasattr(self, attr): setatt...
RATE_1MBIT = 0 RATE_250KBIT = 2 RATE_2MBIT = 1 def config(): pass def off(): pass def on(): pass def receive(): pass def receive_bytes(): pass def receive_bytes_into(): pass def receive_full(): pass def reset(): pass def send(): pass def send_bytes(): pass
rate_1_mbit = 0 rate_250_kbit = 2 rate_2_mbit = 1 def config(): pass def off(): pass def on(): pass def receive(): pass def receive_bytes(): pass def receive_bytes_into(): pass def receive_full(): pass def reset(): pass def send(): pass def send_bytes(): pass
price = 49 txt = "The price is {} dollars" print(txt.format(price)) txt = "The price is {:.2f} dollars" print(txt.format(price)) quantity = 3 itemno = 567 price = 49 myorder = "I want {} pieces of item number {} for {:.2f} dollars." print(myorder.format(quantity, itemno, price)) quantity = 3 itemno = 567 price = 49 ...
price = 49 txt = 'The price is {} dollars' print(txt.format(price)) txt = 'The price is {:.2f} dollars' print(txt.format(price)) quantity = 3 itemno = 567 price = 49 myorder = 'I want {} pieces of item number {} for {:.2f} dollars.' print(myorder.format(quantity, itemno, price)) quantity = 3 itemno = 567 price = 49 myo...
# 8 kyu def reverse_words(s): return " ".join(reversed(s.split()))
def reverse_words(s): return ' '.join(reversed(s.split()))
def tower_builder(n_floors): tower = [] d = '*' for i in range(1, 2 * n_floors + 1 , 2): tower.append((d * i).center(2 * i - 1)) return tower print(tower_builder(3))
def tower_builder(n_floors): tower = [] d = '*' for i in range(1, 2 * n_floors + 1, 2): tower.append((d * i).center(2 * i - 1)) return tower print(tower_builder(3))
# # PySNMP MIB module Netrake-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Netrake-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:16:34 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, 0...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ...
numbers = [1,2,3,4,5] numbers_again = [n for n in numbers] even_numbers = [n for n in numbers if n%2 == 0] odd_squares = [n**2 for n in numbers if n%2 == 1] matrix = [[1,2,3], [4,5,6], [7,8,9]] flattened_matrix = [n for row in x for n in row]
numbers = [1, 2, 3, 4, 5] numbers_again = [n for n in numbers] even_numbers = [n for n in numbers if n % 2 == 0] odd_squares = [n ** 2 for n in numbers if n % 2 == 1] matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] flattened_matrix = [n for row in x for n in row]
# -*- coding: utf-8 -*- class BaseProcessor(object): def __init__(self, exporter, generator_info): super(BaseProcessor, self).__init__() self.exporter = exporter self.generator_info = generator_info def run(self): pass
class Baseprocessor(object): def __init__(self, exporter, generator_info): super(BaseProcessor, self).__init__() self.exporter = exporter self.generator_info = generator_info def run(self): pass
n = int(input()) dic = {} for i in range(n): c = input() if c == "Q": n = input() if n in dic.keys(): print(dic[n]) else: print("NONE") elif c == "A": n, p = input().split(" ") dic[n] = p
n = int(input()) dic = {} for i in range(n): c = input() if c == 'Q': n = input() if n in dic.keys(): print(dic[n]) else: print('NONE') elif c == 'A': (n, p) = input().split(' ') dic[n] = p
class Solution: def nextBeautifulNumber(self, n: int) -> int: def isBalance(num: int) -> bool: count = [0] * 10 while num: if num % 10 == 0: return False count[num % 10] += 1 num //= 10 return all(c == i for i, c in enumerate(count) if c) n += 1 while n...
class Solution: def next_beautiful_number(self, n: int) -> int: def is_balance(num: int) -> bool: count = [0] * 10 while num: if num % 10 == 0: return False count[num % 10] += 1 num //= 10 return all((c...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim :set ft=py: # blosc args DEFAULT_TYPESIZE = 8 DEFAULT_CLEVEL = 7 DEFAULT_SHUFFLE = True DEFAULT_CNAME = 'blosclz' # bloscpack args DEFAULT_OFFSETS = True DEFAULT_CHECKSUM = 'adler32' DEFAULT_MAX_APP_CHUNKS = lambda x: 10 * x DEFAULT_CHUNK_SIZE = '1M' # metadata ar...
default_typesize = 8 default_clevel = 7 default_shuffle = True default_cname = 'blosclz' default_offsets = True default_checksum = 'adler32' default_max_app_chunks = lambda x: 10 * x default_chunk_size = '1M' default_magic_format = b'JSON' default_meta_checksum = 'adler32' default_meta_codec = 'zlib' default_meta_level...
class Heroes: ana = 1 bastion = 2 dva = 3 genji = 4 hanzo = 5 junkrat = 6 lucio = 7 mccree = 8 mei = 9 mercy = 10 pharah = 11 reaper = 12 reinhardt = 13 roadhog = 14 soldier76 = 15 symmetra = 16 torbjorn = 17 tracer = 18 widowmaker = 19 win...
class Heroes: ana = 1 bastion = 2 dva = 3 genji = 4 hanzo = 5 junkrat = 6 lucio = 7 mccree = 8 mei = 9 mercy = 10 pharah = 11 reaper = 12 reinhardt = 13 roadhog = 14 soldier76 = 15 symmetra = 16 torbjorn = 17 tracer = 18 widowmaker = 19 win...
#-------------------# # Measures #-------------------# json_save = False measures = { "z":"[i * pF.dz for i in range(pN.n_z)]", "phi":"getDryProfile('phiPart')", "vx":"getVxPartProfile()", "dirs":"getOrientationHist(5.0, 0.0)", "mdirs":"getVectorMeanOrientation()", "ori":"getOrientationProfiles(pM.z_ground,...
json_save = False measures = {'z': '[i * pF.dz for i in range(pN.n_z)]', 'phi': "getDryProfile('phiPart')", 'vx': 'getVxPartProfile()', 'dirs': 'getOrientationHist(5.0, 0.0)', 'mdirs': 'getVectorMeanOrientation()', 'ori': 'getOrientationProfiles(pM.z_ground, pF.dz*20, int(pN.n_z/20))'}
# encoding: utf-8 ################################################## # This script shows an example of a header section. This sections is a group of commented lines (lines starting with # the "#" character) that describes general features of the script such as the type of licence (defined by the # developer), authors,...
city_name = 'Calgary' city_area = 200000 city_population = 3000 city_density = city_population / city_area print('The most awesome city is ' + city_name) print('Population Density is') print(city_density) print('Population Density ' + str(city_density) + ' inhabitants per hectare')
def consecutive_pairalign(reversed_part, identical_part): count = 0 lrev = len(reversed_part) no_iter = min(len(reversed_part), len(identical_part)) i = 0 for i in range(0, no_iter): if (reversed_part[lrev - i - 1] + identical_part[i]) in [ "au", "ua", "gc...
def consecutive_pairalign(reversed_part, identical_part): count = 0 lrev = len(reversed_part) no_iter = min(len(reversed_part), len(identical_part)) i = 0 for i in range(0, no_iter): if reversed_part[lrev - i - 1] + identical_part[i] in ['au', 'ua', 'gc', 'cg', 'ug', 'gu']: count...
myconfig = { "name": "Your Name", "email": None, "password": None, "categories": ["physics:cond-mat"] }
myconfig = {'name': 'Your Name', 'email': None, 'password': None, 'categories': ['physics:cond-mat']}
fin = open('sum.in', 'r') fout = open('sum.out', 'w') while True: True result = sum(map(int, fin.readline().strip().split())) fout.write(str(result)+'\n')
fin = open('sum.in', 'r') fout = open('sum.out', 'w') while True: True result = sum(map(int, fin.readline().strip().split())) fout.write(str(result) + '\n')
# -*- coding: utf-8 -*- __author__ = 'Hugo Martiniano' __email__ = 'hugomartiniano@gmail.com' __version__ = '0.1.7' __url__ = 'https://github.com/hmartiniano/faz'
__author__ = 'Hugo Martiniano' __email__ = 'hugomartiniano@gmail.com' __version__ = '0.1.7' __url__ = 'https://github.com/hmartiniano/faz'
word = input() length = len(word) def firstLine(): for i in range(0, length): if (i == 0): print(".", end='') if (i % 3 == 2): print(".*..", end='') else: print(".#..", end='') print() def secondLine(): for i in range(0, length): if (i...
word = input() length = len(word) def first_line(): for i in range(0, length): if i == 0: print('.', end='') if i % 3 == 2: print('.*..', end='') else: print('.#..', end='') print() def second_line(): for i in range(0, length): if i == 0:...
# Here will be implemented the runtime stats calculators class statsCalculator: # Average of file sizes that were opened, written or read. (Before write operation) avgFileSizes_open = 0 open_counter = 0 avgFileSizes_read = 0 read_counter = 0 avgFileSizes_write = 0 write_counter = 0 def...
class Statscalculator: avg_file_sizes_open = 0 open_counter = 0 avg_file_sizes_read = 0 read_counter = 0 avg_file_sizes_write = 0 write_counter = 0 def avg_file_sizes_update(self, filesMap, fileName, type): if filesMap.get(fileName): if type == 'open': se...
def power(x, y): if(y == 0): return 1 if(y < 0): n = (1/x) * power(x, (y+1)/2) return n*n if(y%2 == 0): m = power(x, y/2) return m*m else: return x * power(x, y-1) def main(): print("To calculate x^y ...\n") x = float(input("Please e...
def power(x, y): if y == 0: return 1 if y < 0: n = 1 / x * power(x, (y + 1) / 2) return n * n if y % 2 == 0: m = power(x, y / 2) return m * m else: return x * power(x, y - 1) def main(): print('To calculate x^y ...\n') x = float(input('Please ente...
print('Accumulated value of a scheduled savings account') p = float(input('Type the value of the monthly application constant: ')) i = float(input('The tax: ')) n = int(input('How many months: ')) accumulated_value = p*((1 + i)**n - 1) / i print(f'The accumulated value is $${accumulated_value}.')
print('Accumulated value of a scheduled savings account') p = float(input('Type the value of the monthly application constant: ')) i = float(input('The tax: ')) n = int(input('How many months: ')) accumulated_value = p * ((1 + i) ** n - 1) / i print(f'The accumulated value is $${accumulated_value}.')
def ngram(s, num): res = [] slen = len(s) - num + 1 for i in range(slen): ss = s[i:i + num] res.append(ss) return res def diff_ngram(sa, sb, num): a = ngram(sa, num) b = ngram(sb, num) r = [] cnt = 0 for i in a: for j in b: if i == j: cnt += 1 r.append(i) return cn...
def ngram(s, num): res = [] slen = len(s) - num + 1 for i in range(slen): ss = s[i:i + num] res.append(ss) return res def diff_ngram(sa, sb, num): a = ngram(sa, num) b = ngram(sb, num) r = [] cnt = 0 for i in a: for j in b: if i == j: ...
def some_function(): for i in range(4): yield i for i in some_function(): print(i)
def some_function(): for i in range(4): yield i for i in some_function(): print(i)
def spiralCopy(inputMatrix): numRows = len(inputMatrix) numCols = len(inputMatrix[0]) # keep track of where we are along each # of the four sides of the matrix topRow = 0 bottomRow = numRows - 1 leftCol = 0 rightCol = numCols - 1 result = [] # iterate throughout the entire matr...
def spiral_copy(inputMatrix): num_rows = len(inputMatrix) num_cols = len(inputMatrix[0]) top_row = 0 bottom_row = numRows - 1 left_col = 0 right_col = numCols - 1 result = [] while topRow <= bottomRow and leftCol <= rightCol: for i in range(leftCol, rightCol + 1): res...
class Config(object): JOOX_API_DOMAIN = "https://api-jooxtt.sanook.com/web-fcgi-bin" JOOX_AUTH_PATH = "/web_wmauth" JOOX_GETFAV_PATH = "/web_getfav" JOOX_ADD_DIR_PATH = "/web_fav_add_dir" JOOX_DEL_DIR_PATH = "/web_fav_del_dir" JOOX_ADD_SONG_PATH = "/web_fav_add_song" JOOX_DEL_SONG_PATH = "/...
class Config(object): joox_api_domain = 'https://api-jooxtt.sanook.com/web-fcgi-bin' joox_auth_path = '/web_wmauth' joox_getfav_path = '/web_getfav' joox_add_dir_path = '/web_fav_add_dir' joox_del_dir_path = '/web_fav_del_dir' joox_add_song_path = '/web_fav_add_song' joox_del_song_path = '/w...
n=int(input()) squareMatrix=[] k=0; i=0 while k<n: row=input() squareMatrix.append([]) for j in range(0,len(row)): squareMatrix[i].append(row[j]) k+=1; i+=1 symbolToFind=input() rowFound=0; colFound=0; symbolFound=False for k in range(0,len(squareMatrix)): if symbolFound=...
n = int(input()) square_matrix = [] k = 0 i = 0 while k < n: row = input() squareMatrix.append([]) for j in range(0, len(row)): squareMatrix[i].append(row[j]) k += 1 i += 1 symbol_to_find = input() row_found = 0 col_found = 0 symbol_found = False for k in range(0, len(squareMatrix)): if ...
def czy_pal(tekst): for x in range(len(tekst)): if tekst[x] != tekst[len(tekst)-1-x]: return False return True def nowy_pal(tekst): odp = tekst for x in range(len(tekst)): odp += tekst[len(tekst)-1-x] return odp tekst = input() results = czy_pal(tekst) if result...
def czy_pal(tekst): for x in range(len(tekst)): if tekst[x] != tekst[len(tekst) - 1 - x]: return False return True def nowy_pal(tekst): odp = tekst for x in range(len(tekst)): odp += tekst[len(tekst) - 1 - x] return odp tekst = input() results = czy_pal(tekst) if results...
class Ts2xlException(Exception): ''' Used for expected errors, where the command-line tool shouldn't show a full stack trace. ''' pass
class Ts2Xlexception(Exception): """ Used for expected errors, where the command-line tool shouldn't show a full stack trace. """ pass
class Example1: def __init__(self): self.field1 = 1 class Example2(Example1): def __init__(self): # Some valuable comment here Example1.__init__(self)
class Example1: def __init__(self): self.field1 = 1 class Example2(Example1): def __init__(self): Example1.__init__(self)
A, B, C = map(int, input().split()) K = int(input()) for _ in range(K): if A >= B: B *= 2 elif B >= C: C *= 2 if A < B < C: print('Yes') else: print('No')
(a, b, c) = map(int, input().split()) k = int(input()) for _ in range(K): if A >= B: b *= 2 elif B >= C: c *= 2 if A < B < C: print('Yes') else: print('No')
class TestResult: def __init__(self): self.runCount = 0 self.errorCount = 0 def testStarted(self): self.runCount = self.runCount + 1 def testFailed(self): self.errorCount = self.errorCount + 1 def summary(self): return "%d run, %d failed" % (self.runCount, self.er...
class Testresult: def __init__(self): self.runCount = 0 self.errorCount = 0 def test_started(self): self.runCount = self.runCount + 1 def test_failed(self): self.errorCount = self.errorCount + 1 def summary(self): return '%d run, %d failed' % (self.runCount, s...
#Topic Class for handling msg from device #Jon Durrant #17-Sep-2021 #Topic handler superclass. Respond to a message on a particular topic channel class Topic: # handle a topic message # @param topicName - string name of the topic # @param data - string data # @param twin - twin interface...
class Topic: def handle(self, topicName: str, data: object, twin): return
# capitlize certain letters in plain text # how to decide which letters to capitalize ? # => Idea1: bool array with same length as plain_text # -> set the required letters (positions) to True # specify letters -> use range (start, end) position class FormattedText: def __init__(self, plain_text): ...
class Formattedtext: def __init__(self, plain_text): self.plain_text = plain_text self.caps = [False] * len(plain_text) def capitalize(self, start, end): for i in range(start, end): self.caps[i] = True def __str__(self): result = [] for i in range(len(s...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. _multi_phase = False def enable_multi_phase(): global _multi_phase _multi_phase = True def multi_phase_enabled(): return _multi_phase
_multi_phase = False def enable_multi_phase(): global _multi_phase _multi_phase = True def multi_phase_enabled(): return _multi_phase
def numbers_divisible_by_5_and_7_between_values(start_value, end_value): result = [] for e in range(start_value, end_value + 1, 5): if e % 7 == 0: result.append(e) return result def numbers_divisible_by_5_and_13_between_values(start_value, end_value): result = [] for e in range...
def numbers_divisible_by_5_and_7_between_values(start_value, end_value): result = [] for e in range(start_value, end_value + 1, 5): if e % 7 == 0: result.append(e) return result def numbers_divisible_by_5_and_13_between_values(start_value, end_value): result = [] for e in range(...
#!/usr/bin/python # -*- coding: iso8859-1 -*- # This should be not uploaded to repo, but since we're using test credentials is ok # Should use env variables, local_settings not uploaded to repo or pass protect this BASE_URL = 'http://22566bf6.ngrok.io/' # This might change with ngrok everytime...need to set it each tim...
base_url = 'http://22566bf6.ngrok.io/' secretkeyprod = '' secretkeytest = '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF' pbx_site = '1999888' pbx_identifiant = '107904482' pbx_rang = '32'
class Superman: def __init__(self): self.superpowers = ['flight'] def print_superpowers(self): print(f"Superpowers {self.superpowers}") sm = Superman() sm.print_superpowers() class Megaman(Superman): def __init__(self, megaman_powers=[]): super().__init__() self.superpowe...
class Superman: def __init__(self): self.superpowers = ['flight'] def print_superpowers(self): print(f'Superpowers {self.superpowers}') sm = superman() sm.print_superpowers() class Megaman(Superman): def __init__(self, megaman_powers=[]): super().__init__() self.superpowe...