content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" Good morning! Here's your coding interview problem for today. This problem was asked by Square. Assume you have access to a function toss_biased() which returns 0 or 1 with a probability that's not 50-50 (but also not 0-100 or 100-0). You do not know the bias of the coin. Write a function to simulate an unbiased...
""" Good morning! Here's your coding interview problem for today. This problem was asked by Square. Assume you have access to a function toss_biased() which returns 0 or 1 with a probability that's not 50-50 (but also not 0-100 or 100-0). You do not know the bias of the coin. Write a function to simulate an unbiased...
""" * Edge Detection. * * Exposing areas of contrast within an image * by processing it through a high-pass filter. """ kernel = (( -1, -1, -1 ), ( -1, 9, -1 ), ( -1, -1, -1 )) size(200, 200) img = loadImage("house.jpg") # Load the original image image(img, 0, 0) # Displays the...
""" * Edge Detection. * * Exposing areas of contrast within an image * by processing it through a high-pass filter. """ kernel = ((-1, -1, -1), (-1, 9, -1), (-1, -1, -1)) size(200, 200) img = load_image('house.jpg') image(img, 0, 0) img.loadPixels() edge_img = create_image(img.width, img.height, RGB) for y in r...
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
""" NIST physical constants https://physics.nist.gov/cuu/Constants/ https://physics.nist.gov/cuu/Constants/Table/allascii.txt """ light_speed = 137.03599967994 bohr = 0.52917721092 bohr_si = BOHR * 1e-10 alpha = 0.0072973525664 g_electron = 2.00231930436182 e_mass = 9.10938356e-31 avogadro = 6.022140857e+23 atomic_mas...
class Agent(object): standard_key_list = [] def __init__(self, env, config, model=None): self.env = env self.config = config self.model = model self.state = None self.action = None self.reward = None self.reward_list = None pass def observ...
class Agent(object): standard_key_list = [] def __init__(self, env, config, model=None): self.env = env self.config = config self.model = model self.state = None self.action = None self.reward = None self.reward_list = None pass def observe(s...
# Beer brands that are not craft beers MAINSTREAM_BEER_BRANDS = { 'abc', 'anchor', 'asahi', 'budweiser', 'carlsberg', 'erdinger', 'guinness', 'heineken', 'hoegaarden', 'kirin', 'krausebourg' 'kronenbourg', 'royal stout', 'sapporo', 'skol', 'somersby', ...
mainstream_beer_brands = {'abc', 'anchor', 'asahi', 'budweiser', 'carlsberg', 'erdinger', 'guinness', 'heineken', 'hoegaarden', 'kirin', 'krausebourgkronenbourg', 'royal stout', 'sapporo', 'skol', 'somersby', 'strongbow', 'tiger'} skipped_items = {'cap', 'gift', 'glass', 'keg', 'litre', 'tee'}
class GEOLibError(Exception): """Base GEOLib Exception class.""" class CalculationError(GEOLibError): """CalculationError with a status_code.""" def __init__(self, status_code, message): self.status_code = status_code self.message = message class ParserError(GEOLibError): """Base cl...
class Geoliberror(Exception): """Base GEOLib Exception class.""" class Calculationerror(GEOLibError): """CalculationError with a status_code.""" def __init__(self, status_code, message): self.status_code = status_code self.message = message class Parsererror(GEOLibError): """Base clas...
class History(object): def __init__(self, intensity=2): self.hist = [] self.read_count = 0 self.intensity = intensity def __len__(self): return len(self.hist) def add(self, solution): self.hist.append(solution) def get(self): self.read_count += 1 ...
class History(object): def __init__(self, intensity=2): self.hist = [] self.read_count = 0 self.intensity = intensity def __len__(self): return len(self.hist) def add(self, solution): self.hist.append(solution) def get(self): self.read_count += 1 ...
coordinates_E0E1E1 = ((123, 106), (123, 108), (123, 109), (123, 110), (123, 112), (124, 106), (124, 110), (124, 125), (124, 127), (124, 128), (124, 129), (124, 130), (124, 132), (125, 106), (125, 108), (125, 110), (125, 126), (125, 132), (126, 106), (126, 109), (126, 126), (126, 128), (126, 129), (126, 130), (126, 13...
coordinates_e0_e1_e1 = ((123, 106), (123, 108), (123, 109), (123, 110), (123, 112), (124, 106), (124, 110), (124, 125), (124, 127), (124, 128), (124, 129), (124, 130), (124, 132), (125, 106), (125, 108), (125, 110), (125, 126), (125, 132), (126, 106), (126, 109), (126, 126), (126, 128), (126, 129), (126, 130), (126, 13...
class AllocationMap(object): # Keeps track of item allocation to caches. def __init__(self): self.alloc_o = dict() # for each item (key) maps a list of caches where it is cached. Has entries just for allocated objects. self.alloc = dict() # for each cache (key) maps the list of items it c...
class Allocationmap(object): def __init__(self): self.alloc_o = dict() self.alloc = dict() def allocate(self, item, cache): if item not in self.alloc_o.keys(): self.alloc_o[item] = [] self.alloc_o[item].append(cache) if cache not in self.alloc.keys(): ...
def romanToDecimal(S): roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} a = roman[S[0]]+roman[S[-1]] i=1 while i<len(S)-1: print(a) if (roman[S[i]] >= roman[S[i+1]]): a = a+roman[S[i]] i=i+1 else: a = a -rom...
def roman_to_decimal(S): roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} a = roman[S[0]] + roman[S[-1]] i = 1 while i < len(S) - 1: print(a) if roman[S[i]] >= roman[S[i + 1]]: a = a + roman[S[i]] i = i + 1 else: a = a ...
################################################################################## # Deeplearning4j.py # description: A wrapper service for the Deeplearning4j framework. # categories: ai # more info @: http://myrobotlab.org/service/Deeplearning4j #########################################################################...
deeplearning4j = Runtime.start('deeplearning4j', 'Deeplearning4j') deeplearning4j.loadVGG16() classifications = deeplearning4j.classifyImageFileVGG16('image0-1.png') for label in classifications: print(label + ' : ' + str(classifications.get(label)))
# Day 16: http://adventofcode.com/2016/day/16 inp = '11101000110010100' def checksum(initial, length): table = str.maketrans('01', '10') data = initial while len(data) < length: new = data[::-1].translate(table) data = f'{data}0{new}' check = data[:length] while not len(check)...
inp = '11101000110010100' def checksum(initial, length): table = str.maketrans('01', '10') data = initial while len(data) < length: new = data[::-1].translate(table) data = f'{data}0{new}' check = data[:length] while not len(check) % 2: check = [int(x == y) for (x, y) in zip...
n = 600851475143 i=2 while(i*i<=n): while(n%i==0): n=n/i i=i+1 print(n)
n = 600851475143 i = 2 while i * i <= n: while n % i == 0: n = n / i i = i + 1 print(n)
consumer_key = 'NYICJJWGEHWjLzf16L4bdOmBp' consumer_secret = 'AT8vDFvB6IkjLM5Ckz9DC5yQ0nsqut8vwGYOpnXPMFIESsHKG5' access_token = '2909697444-NNDWfyczj7Asgv7t5YvysLcnnEj3CcoC12AB46R' access_secret = 'kRaSQf3FEEz3X7TSH1o0EisdweIGoxm9Af6E0WceFzeEp'
consumer_key = 'NYICJJWGEHWjLzf16L4bdOmBp' consumer_secret = 'AT8vDFvB6IkjLM5Ckz9DC5yQ0nsqut8vwGYOpnXPMFIESsHKG5' access_token = '2909697444-NNDWfyczj7Asgv7t5YvysLcnnEj3CcoC12AB46R' access_secret = 'kRaSQf3FEEz3X7TSH1o0EisdweIGoxm9Af6E0WceFzeEp'
"""Tests for BEL2SCM test_bel2scm.py --------------- This file contains all the test functions we used to generate sample data, testing and debugging code for bel2scm algorithm. Input files: - BELSourceFiles contains bel graphs for all our test cases - Data folder contains all the input and output data files - Neu...
"""Tests for BEL2SCM test_bel2scm.py --------------- This file contains all the test functions we used to generate sample data, testing and debugging code for bel2scm algorithm. Input files: - BELSourceFiles contains bel graphs for all our test cases - Data folder contains all the input and output data files - Neu...
dct = {'one':'two', 'three':'one', 'two':'three' } v = dct['three'] for k in range(len(dct)): v = dct[v] print(v) print(v)
dct = {'one': 'two', 'three': 'one', 'two': 'three'} v = dct['three'] for k in range(len(dct)): v = dct[v] print(v) print(v)
class Solution: def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: f = flowerbed ans = 0 for i in range(len(f)): if f[i] == 0: l, r = max(0, i - 1), min(i + 1, len(f) - 1) if f[r] == 0 and f[l] == 0: f[i] = 1 ans += 1 return ans >= n
class Solution: def can_place_flowers(self, flowerbed: List[int], n: int) -> bool: f = flowerbed ans = 0 for i in range(len(f)): if f[i] == 0: (l, r) = (max(0, i - 1), min(i + 1, len(f) - 1)) if f[r] == 0 and f[l] == 0: f[i] = ...
# python alura-python/best-practices/hints.py class Name: def __init__(self, name: str, age: int) -> None: self.name = name self.age = age def testa(self, name: str) -> int: self.name = name return int(self.age) def testegain() -> str: return 'again' myname = Name('wilton "paulo" d...
class Name: def __init__(self, name: str, age: int) -> None: self.name = name self.age = age def testa(self, name: str) -> int: self.name = name return int(self.age) def testegain() -> str: return 'again' myname = name('wilton "paulo" da silva', 39) print(myname.name)
class MLPRTranspiler(object): def __init__(self, model): self.model = model self.layer_sizes = ','.join(map(lambda x : str(x), self.model.hidden_layer_sizes)) self.build_weights() self.build_layers() self.build_bias() def build_layers(self): self.networks = "" ...
class Mlprtranspiler(object): def __init__(self, model): self.model = model self.layer_sizes = ','.join(map(lambda x: str(x), self.model.hidden_layer_sizes)) self.build_weights() self.build_layers() self.build_bias() def build_layers(self): self.networks = '' ...
default_app_config = 'djadmin.apps.ActivityAppConfig' __name__ = 'djadmin' __author__ = 'Neeraj Kumar' __version__ = '1.1.7' __author_email__ = 'sainineeraj1234@gmail.com' __description__ = 'Djadmin is a django admin theme'
default_app_config = 'djadmin.apps.ActivityAppConfig' __name__ = 'djadmin' __author__ = 'Neeraj Kumar' __version__ = '1.1.7' __author_email__ = 'sainineeraj1234@gmail.com' __description__ = 'Djadmin is a django admin theme'
config = { "Virustotal": { "KEY":"718d3ef46ba51c38936a5bba67ba40e1348867aa0e9c0fa6ac8cd76c5950a983", "URL": "https://www.virustotal.com/vtapi/v2/file/report" } , "hybridanalysis": { "KEY":"yyicbmp80fa6638bnkgcw93y5c07f536iyh0qo7r5bc2fabbtojj2yo97d352208", "URL": "https://www.hybrid-analysis.com/api/...
config = {'Virustotal': {'KEY': '718d3ef46ba51c38936a5bba67ba40e1348867aa0e9c0fa6ac8cd76c5950a983', 'URL': 'https://www.virustotal.com/vtapi/v2/file/report'}, 'hybridanalysis': {'KEY': 'yyicbmp80fa6638bnkgcw93y5c07f536iyh0qo7r5bc2fabbtojj2yo97d352208', 'URL': 'https://www.hybrid-analysis.com/api/v2/'}}
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def node(self, nums, start, end): median = (start+end)//2 node = TreeNode(nums[median]) if start == end: ...
class Solution: def node(self, nums, start, end): median = (start + end) // 2 node = tree_node(nums[median]) if start == end: return node elif start < end: node.left = self.node(nums, start, median - 1) node.right = self.node(nums, median + 1, end...
#House budget while True: price = float(input("Enter price: ")) if price < 500000: print("Buy now!") else: print("Keep looking.")
while True: price = float(input('Enter price: ')) if price < 500000: print('Buy now!') else: print('Keep looking.')
a = "Dani" #if anidados -> Evalua una condicion, ejecuta la instruccion y pasa al siguiente if if a == "Dani": print("Ok") if a == "Alejandro": print("Wrong") else: print("I dont know\n") #elif -> Evalua una condicion, si es verdadera ejcuta la instruccion y sale if a == "Dani": print("Ok") elif a ...
a = 'Dani' if a == 'Dani': print('Ok') if a == 'Alejandro': print('Wrong') else: print('I dont know\n') if a == 'Dani': print('Ok') elif a == 'Alejandro': print('Wrong') else: print('I dont know') '\n==\n!=\n>\n<\n<=\n>=\n' a = False if a: print('True') else: print('False')
class TransferError(ValueError): pass class Transfer: """Class representing a transfer from a source well to a destination well. Parameters ---------- source_well A Well object representing the plate well from which to transfer. destination_well A Well object representing the pl...
class Transfererror(ValueError): pass class Transfer: """Class representing a transfer from a source well to a destination well. Parameters ---------- source_well A Well object representing the plate well from which to transfer. destination_well A Well object representing the pla...
def twoSum(nums, target): temp = nums[:] nums.sort() hi = len(nums) - 1 lo = 0 while lo < hi: if (nums[lo] + nums[hi]) < target: lo += 1 elif (nums[lo] + nums[hi]) > target: hi -= 1 else: if nums[lo] == nums[hi]: return [tem...
def two_sum(nums, target): temp = nums[:] nums.sort() hi = len(nums) - 1 lo = 0 while lo < hi: if nums[lo] + nums[hi] < target: lo += 1 elif nums[lo] + nums[hi] > target: hi -= 1 elif nums[lo] == nums[hi]: return [temp.index(nums[lo]), temp...
class Vendor: def __init__(self, token, name): self.token = token self.name = name def __lt__(self, other): return self.token < other.token
class Vendor: def __init__(self, token, name): self.token = token self.name = name def __lt__(self, other): return self.token < other.token
class CommandLineRouteHandlerError(BaseException): """ This class implements the CommandLineRouteHandlerError. """ def __init__(self, message=None): """ This method initializes an instance of the CommandLineRouteHandlerError class. :param str message: An optional messag...
class Commandlineroutehandlererror(BaseException): """ This class implements the CommandLineRouteHandlerError. """ def __init__(self, message=None): """ This method initializes an instance of the CommandLineRouteHandlerError class. :param str message: An optional messag...
n = int(input()) advice = ['advertise', 'do not advertise', 'does not matter'] results = [] for i in range(n): r, e, c = input().split() r, e, c = int(r), int(e), int(c) if r > e - c: results.append(advice[1]) elif r < e - c: results.append(advice[0]) else: results.append(a...
n = int(input()) advice = ['advertise', 'do not advertise', 'does not matter'] results = [] for i in range(n): (r, e, c) = input().split() (r, e, c) = (int(r), int(e), int(c)) if r > e - c: results.append(advice[1]) elif r < e - c: results.append(advice[0]) else: results.appe...
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None def __repr__(self): a = self value = '' while a: value = value + str(a.val) + '->' a = a.next return value class Solution(o...
class Listnode(object): def __init__(self, x): self.val = x self.next = None def __repr__(self): a = self value = '' while a: value = value + str(a.val) + '->' a = a.next return value class Solution(object): def _set_value(self, x):...
def insertionSort1(n, arr): i = n-1 val = arr[i] while(i>0 and val<arr[i-1]): arr[i] = arr[i-1] print(*arr) i-=1 arr[i] = val print(*arr)
def insertion_sort1(n, arr): i = n - 1 val = arr[i] while i > 0 and val < arr[i - 1]: arr[i] = arr[i - 1] print(*arr) i -= 1 arr[i] = val print(*arr)
class ConnectionInterrupted(Exception): def __init__(self, connection, parent=None): self.connection = connection def __str__(self): error_type = type(self.__cause__).__name__ error_msg = str(self.__cause__) return "Redis {}: {}".format(error_type, error_msg) class CompressorE...
class Connectioninterrupted(Exception): def __init__(self, connection, parent=None): self.connection = connection def __str__(self): error_type = type(self.__cause__).__name__ error_msg = str(self.__cause__) return 'Redis {}: {}'.format(error_type, error_msg) class Compressore...
# define this module's errors class ParserError(Exception): pass class Sentence(object): def __init__(self, subject, verb, obj): # these are tuples, e.g. ('noun', 'bear') self.subject = subject[1] self.verb = verb[1] self.obj = obj[1] def __str__(self): return str(...
class Parsererror(Exception): pass class Sentence(object): def __init__(self, subject, verb, obj): self.subject = subject[1] self.verb = verb[1] self.obj = obj[1] def __str__(self): return str(self.__dict__) def __eq__(self, other): return self.__dict__ == oth...
missed_list = list() for one_line in open("data/additional_data/missed_ontology"): one_line = one_line.strip() missed_list.append(one_line) f_w = open("data/test/20180405.txt", "w") for one_line in open("data/test/kill_me_plz_test.txt"): dead_flag = 0 one_line = one_line.strip() _, ontology_resul...
missed_list = list() for one_line in open('data/additional_data/missed_ontology'): one_line = one_line.strip() missed_list.append(one_line) f_w = open('data/test/20180405.txt', 'w') for one_line in open('data/test/kill_me_plz_test.txt'): dead_flag = 0 one_line = one_line.strip() (_, ontology_results...
VERSION = "v0.0.1" def version(): return VERSION
version = 'v0.0.1' def version(): return VERSION
DATABASES_ENGINE = 'django.db.backends.postgresql_psycopg2' DATABASES_NAME = 'spending' DATABASES_USER = 'postgres' DATABASES_PASSWORD = 'pg' DATABASES_HOST = '127.0.0.1' DATABASES_PORT = 5432
databases_engine = 'django.db.backends.postgresql_psycopg2' databases_name = 'spending' databases_user = 'postgres' databases_password = 'pg' databases_host = '127.0.0.1' databases_port = 5432
# Bluerred Image Detection # # Author: Jasonsey # Email: 2627866800@qq.com # # ============================================================================= """the common tools api"""
"""the common tools api"""
# # PySNMP MIB module BLADESPPALT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BLADESPPALT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:39:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint, constraints_union) ...
with open('input.txt') as f: lines = f.readlines() depth_increased = 0 for i in range(len(lines)): if (i == 0): # don't check first sonar input continue if (int(lines[i]) > int(lines[i-1])): depth_increased = depth_increased + 1 print(depth_increas...
with open('input.txt') as f: lines = f.readlines() depth_increased = 0 for i in range(len(lines)): if i == 0: continue if int(lines[i]) > int(lines[i - 1]): depth_increased = depth_increased + 1 print(depth_increased)
#!/usr/bin/python3 """ Contains the inherits_from function """ def inherits_from(obj, a_class): """returns true if obj is a subclass of a_class, otherwise false""" return(issubclass(type(obj), a_class) and type(obj) != a_class)
""" Contains the inherits_from function """ def inherits_from(obj, a_class): """returns true if obj is a subclass of a_class, otherwise false""" return issubclass(type(obj), a_class) and type(obj) != a_class
""" MappingEntry """ class MappingEntry(object): """ Defines what will be saved in the MapStorage. A MappingEntry represents a connection between a custom currency address and a Waves address. """ DICT_COIN_KEY = 'coin' DICT_WAVES_KEY = 'waves' def __init__(self, waves_address: str, coin...
""" MappingEntry """ class Mappingentry(object): """ Defines what will be saved in the MapStorage. A MappingEntry represents a connection between a custom currency address and a Waves address. """ dict_coin_key = 'coin' dict_waves_key = 'waves' def __init__(self, waves_address: str, coin_a...
WORD_TYPES = { "north" : "direction", "south" : "direction", "east" : "direction", "west" : "direction", "go" : "verb", "kill" : "verb", "eat" : "verb", "the" : "stop", "in" : "stop", "of" : "stop", "bear" : "noun", "princess" : "noun", } def convert_number(word): ...
word_types = {'north': 'direction', 'south': 'direction', 'east': 'direction', 'west': 'direction', 'go': 'verb', 'kill': 'verb', 'eat': 'verb', 'the': 'stop', 'in': 'stop', 'of': 'stop', 'bear': 'noun', 'princess': 'noun'} def convert_number(word): try: return int(word) except: return None de...
def reader(values): f=open("level1.txt", "r") # N=no. of lines #x = the position from which the substring must begin x=values[0] x-=1 #y=the position at which the substring should end list1=[] for line in range(values[2]): j=f.readline() t=j[values[0]:values[1]]...
def reader(values): f = open('level1.txt', 'r') x = values[0] x -= 1 list1 = [] for line in range(values[2]): j = f.readline() t = j[values[0]:values[1]] list1.append(t) return list1
class Solution: # Use functions to convert all to numerical value (Accepted), O(n) time and space def isSumEqual(self, a: str, b: str, t: str) -> bool: def letter_val(letter): return ord(letter) - ord('a') def numerical_val(word): s = '' for c in word: ...
class Solution: def is_sum_equal(self, a: str, b: str, t: str) -> bool: def letter_val(letter): return ord(letter) - ord('a') def numerical_val(word): s = '' for c in word: s += str(letter_val(c)) return int(s) return numeric...
def CounterClosure(init=0): value = [init] def Inc(): value[0] += 1 return value[0] return Inc class CounterClass: def __init__(self, init=0): self.value = init def Bump(self): self.value += 1 return self.value def CounterIter(init = 0): while True: init += 1 yield init if __...
def counter_closure(init=0): value = [init] def inc(): value[0] += 1 return value[0] return Inc class Counterclass: def __init__(self, init=0): self.value = init def bump(self): self.value += 1 return self.value def counter_iter(init=0): while True: ...
# 2018-6-12 # Two sum class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ result = [] leng = len(nums) i = 0 while i < leng - 1: j = i + 1 while j < l...
class Solution(object): def two_sum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ result = [] leng = len(nums) i = 0 while i < leng - 1: j = i + 1 while j < leng: ...
def commaCode(inputList): myString = '' for i in inputList: if (inputList.index(i) == (len(inputList) - 1)): myString = myString + 'and ' + str(i) else: myString = myString + str(i) + ', ' return myString inputValue = '' spam = [] print('Insert next list mem...
def comma_code(inputList): my_string = '' for i in inputList: if inputList.index(i) == len(inputList) - 1: my_string = myString + 'and ' + str(i) else: my_string = myString + str(i) + ', ' return myString input_value = '' spam = [] print('Insert next list member. Fini...
# Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ The borg package contains modules that assimilate large quantities of data into pymatgen objects for analysis. """
""" The borg package contains modules that assimilate large quantities of data into pymatgen objects for analysis. """
def my_reverse(lst): new_lst = [] count = len(lst) - 1 while count >= 0: new_lst.append(lst[count]) count -= 1 return new_lst
def my_reverse(lst): new_lst = [] count = len(lst) - 1 while count >= 0: new_lst.append(lst[count]) count -= 1 return new_lst
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Problem 062 ginortS Source : https://www.hackerrank.com/challenges/ginorts/problem """ s = input() def custom_index(c): i = ord(c) if i in range(65,91): i += 100 elif i in range(48,58): if i%2: i += 200 else: ...
"""Problem 062 ginortS Source : https://www.hackerrank.com/challenges/ginorts/problem """ s = input() def custom_index(c): i = ord(c) if i in range(65, 91): i += 100 elif i in range(48, 58): if i % 2: i += 200 else: i += 300 return i print(''.join(sorte...
""" File generated by export_config.cpp. Do not edit directly. Exports maps for: config_to_input_pages config_to_modules config_to_eqn_variables config_to_cb_cmods SSC Version: 205 Date: Sat Feb 23 13:57:48 2019 """ # List of Variables that are used in equations # ui_form_to_eqn_var_map = { 'Electric...
""" File generated by export_config.cpp. Do not edit directly. Exports maps for: config_to_input_pages config_to_modules config_to_eqn_variables config_to_cb_cmods SSC Version: 205 Date: Sat Feb 23 13:57:48 2019 """ ui_form_to_eqn_var_map = {'Electric Building Load Calculator': {('load_1', 'load_2', 'load_...
class Emoji: # noinspection PyShadowingBuiltins def __init__(self, id: str, name: str, animated: bool): self.emoji_id = id self.name = name self.animated = animated def is_unicode_emoji(self) -> bool: return self.emoji_id is None def util_id(self): if self.is_u...
class Emoji: def __init__(self, id: str, name: str, animated: bool): self.emoji_id = id self.name = name self.animated = animated def is_unicode_emoji(self) -> bool: return self.emoji_id is None def util_id(self): if self.is_unicode_emoji(): return self...
def h(n, x, y): if n >0: tmp = 6 - x-y h(n-1, x, tmp) print(x, y) h(n-1, tmp, y) n = int(input()) h(n, 1, 3)
def h(n, x, y): if n > 0: tmp = 6 - x - y h(n - 1, x, tmp) print(x, y) h(n - 1, tmp, y) n = int(input()) h(n, 1, 3)
class Fib(object): @staticmethod def fib(n): a = 0 if n == 0: return a b = 1 for _ in range(1, n): c = a + b a = b b = c return b
class Fib(object): @staticmethod def fib(n): a = 0 if n == 0: return a b = 1 for _ in range(1, n): c = a + b a = b b = c return b
class OperationEngineException(Exception): def __init__(self, message): Exception.__init__(self, message)
class Operationengineexception(Exception): def __init__(self, message): Exception.__init__(self, message)
class Solution: def minMalwareSpread(self, graph: List[List[int]], initial: List[int]) -> int: if not graph: return -1 N = len(graph) clean = set(range(N)) - set(initial) def dfs(u, seen): for v, adj in enumerate(graph[u]): if adj and v in clean a...
class Solution: def min_malware_spread(self, graph: List[List[int]], initial: List[int]) -> int: if not graph: return -1 n = len(graph) clean = set(range(N)) - set(initial) def dfs(u, seen): for (v, adj) in enumerate(graph[u]): if adj and v i...
############################################################################ # # Copyright (C) 2016 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. # # Commercial License Usage # Licensees holding valid commercial Qt licenses may use this file in # accordance with the co...
source('../../shared/qtcreator.py') def get_qt_creator_version_from_dialog(): chk = re.search('(?<=Qt Creator)\\s\\d+.\\d+.\\d+[-\\w]*', str(wait_for_object("{text?='*Qt Creator*' type='QLabel' unnamed='1' visible='1' window=':About Qt Creator_Core::Internal::VersionDialog'}").text)) try: ver = chk.gro...
class Solution(object): """ A peak element is guaranteed to exist! Use binary search method. Cannot directly apply the XXOO template. A point can have three possible scenarios: (1) ascending (compare to element at right) (2) at peak (3) descending (compare to element at left...
class Solution(object): """ A peak element is guaranteed to exist! Use binary search method. Cannot directly apply the XXOO template. A point can have three possible scenarios: (1) ascending (compare to element at right) (2) at peak (3) descending (compare to element at left...
""" PythonPackageTemplate Class """ class PythonPackageTemplate: """ PythonPackageTemplate class """ def __init__(self): """ Initialize PythonPackageTemplate. """ pass def __repr__(self): """ Return PythonPackageTemplate name. """ return self.__class__.__name__
""" PythonPackageTemplate Class """ class Pythonpackagetemplate: """ PythonPackageTemplate class """ def __init__(self): """ Initialize PythonPackageTemplate. """ pass def __repr__(self): """ Return PythonPackageTemplate name. """ return self.__class__.__name__
a = 1 b = 2 print(a,b) # 1,2 # like JS destructuring a, b = b, a print(a,b) # 2,1
a = 1 b = 2 print(a, b) (a, b) = (b, a) print(a, b)
# ASSIGNMENT 1 - C # VOLUME OF SPHERE d=int(input("Enter the diameter : ")) r=d/2 print("-> Radius is {}".format(r)) Vo=(4.0/3.0) *22/7*( r*r*r) print("-> Volume is {}".format(Vo))
d = int(input('Enter the diameter : ')) r = d / 2 print('-> Radius is {}'.format(r)) vo = 4.0 / 3.0 * 22 / 7 * (r * r * r) print('-> Volume is {}'.format(Vo))
#Postal abbreviations to three-character NHGIS state codes state_codes = { 'WA': '530', 'DE': '100', 'DC': '110', 'WI': '550', 'WV': '540', 'HI': '150', 'FL': '120', 'WY': '560', 'PR': '720', 'NJ': '340', 'NM': '350', 'TX': '480', 'LA': '220', 'NC': '370', 'ND...
state_codes = {'WA': '530', 'DE': '100', 'DC': '110', 'WI': '550', 'WV': '540', 'HI': '150', 'FL': '120', 'WY': '560', 'PR': '720', 'NJ': '340', 'NM': '350', 'TX': '480', 'LA': '220', 'NC': '370', 'ND': '380', 'NE': '310', 'TN': '470', 'NY': '360', 'PA': '420', 'AK': '020', 'NV': '320', 'NH': '330', 'VA': '510', 'CO': ...
""" :mod:`papy.util.runtime` ======================== Provides a (possibly shared, but not yet) dictionary. """ def get_runtime(): """ Returns a PAPY_RUNTIME dictionary. """ PAPY_RUNTIME = {} return PAPY_RUNTIME
""" :mod:`papy.util.runtime` ======================== Provides a (possibly shared, but not yet) dictionary. """ def get_runtime(): """ Returns a PAPY_RUNTIME dictionary. """ papy_runtime = {} return PAPY_RUNTIME
"""Callables settings ================== Dynamically build smart settings related to django-pipeline, taking into account other settings or installed packages. """ def static_storage(settings_dict): if settings_dict["PIPELINE_ENABLED"]: return "djangofloor.backends.DjangofloorPipelineCachedStorage" r...
"""Callables settings ================== Dynamically build smart settings related to django-pipeline, taking into account other settings or installed packages. """ def static_storage(settings_dict): if settings_dict['PIPELINE_ENABLED']: return 'djangofloor.backends.DjangofloorPipelineCachedStorage' re...
class SentenceReverser: vowels = ["a","e","i","o","u"] sentence = "" reverse = "" vowelCount = 0 def __init__(self,sentence): self.sentence = sentence self.reverseSentence() def reverseSentence(self): self.reverse = " ".join(reversed(self.sentence.split())) def getVowelCount(self): self.vowelCount = sum(...
class Sentencereverser: vowels = ['a', 'e', 'i', 'o', 'u'] sentence = '' reverse = '' vowel_count = 0 def __init__(self, sentence): self.sentence = sentence self.reverseSentence() def reverse_sentence(self): self.reverse = ' '.join(reversed(self.sentence.split())) ...
def fac_of_num(): global num factor = 1 flag = True while flag: flag = False try: num = int(round(float(input("Enter the Number: ")))) if num == 0: print("The Factorial of Zero is One") flag = True else: ...
def fac_of_num(): global num factor = 1 flag = True while flag: flag = False try: num = int(round(float(input('Enter the Number: ')))) if num == 0: print('The Factorial of Zero is One') flag = True elif num < 0: ...
""" Optional routine to calculate the alpha values if they have not been precalculated """ # # Calculate the alphas: # alpha = np.zeros(len(bstart)-1) # alpha_err = np.zeros(len(bstart)-1) # tdel = np.zeros(len(bstart)-1) # for i in range (1,len(bstart)): # #alpha = Fp cbol delta t /fluence ...
""" Optional routine to calculate the alpha values if they have not been precalculated """
class Signal(): def __init__(self): self.receivers = [] def connect(self, receiver): self.receivers.append(receiver) def emit(self): for receiver in self.receivers: receiver()
class Signal: def __init__(self): self.receivers = [] def connect(self, receiver): self.receivers.append(receiver) def emit(self): for receiver in self.receivers: receiver()
# Functions for working with ELB/ALB # Checks whether logging is enabled # For an ALB, load_balancer is an ARN; it's a name for an ELB def check_elb_logging_status(load_balancer, load_balancer_type, boto_session): logging_enabled = False if load_balancer_type == 'ALB': alb_client = boto_session.clien...
def check_elb_logging_status(load_balancer, load_balancer_type, boto_session): logging_enabled = False if load_balancer_type == 'ALB': alb_client = boto_session.client('elbv2') try: response = alb_client.describe_load_balancer_attributes(LoadBalancerArn=load_balancer) except ...
load( "//:versions.bzl", "SPEC_VERSION", "BIOGRAPH_VERSION", "SEQSET_VERSION", ) VERSION_TABLE = { "SPEC_VERSION": SPEC_VERSION, "BIOGRAPH_VERSION": BIOGRAPH_VERSION, "SEQSET_VERSION": SEQSET_VERSION, } def make_version_h(name, out_file): """Generates a .h file containing #defines for ...
load('//:versions.bzl', 'SPEC_VERSION', 'BIOGRAPH_VERSION', 'SEQSET_VERSION') version_table = {'SPEC_VERSION': SPEC_VERSION, 'BIOGRAPH_VERSION': BIOGRAPH_VERSION, 'SEQSET_VERSION': SEQSET_VERSION} def make_version_h(name, out_file): """Generates a .h file containing #defines for all the versions in VERSION_TABLE."...
WINDOW_SIZE = 3 def window(lines, start): if start > len(lines) - WINDOW_SIZE: return None return int(lines[start]), int(lines[start+1]), int(lines[start+2]) with open("data/input1.txt") as f: lines = f.readlines() end_idx = len(lines) - WINDOW_SIZE + 1 last_sum = None larger_count = 0 for i in ...
window_size = 3 def window(lines, start): if start > len(lines) - WINDOW_SIZE: return None return (int(lines[start]), int(lines[start + 1]), int(lines[start + 2])) with open('data/input1.txt') as f: lines = f.readlines() end_idx = len(lines) - WINDOW_SIZE + 1 last_sum = None larger_coun...
def main(): formatters = {"plain": plain, "bold": bold, "italic": italic, "header": header, "link": link, "inline-code": inline_code, "ordered-list": make_list, "unordered-list": make_list,...
def main(): formatters = {'plain': plain, 'bold': bold, 'italic': italic, 'header': header, 'link': link, 'inline-code': inline_code, 'ordered-list': make_list, 'unordered-list': make_list, 'new-line': new_line} stored_string = '' while True: user_input = input('- Choose a formatter: ').lower() ...
""" Function to define special tokens (ie : CTRL code) and update the model and tokenizer """ def add_special_tokens(model=None, tokenizer=None): """ update in place the model and tokenizer to take into account special tokens :param model: GPT2 model from huggingface :param tokenizer: GPT2 tokenizer from huggingf...
""" Function to define special tokens (ie : CTRL code) and update the model and tokenizer """ def add_special_tokens(model=None, tokenizer=None): """ update in place the model and tokenizer to take into account special tokens :param model: GPT2 model from huggingface :param tokenizer: GPT2 tokenizer from huggin...
# # PySNMP MIB module ChrComPmSonetSNT-L-Day-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ChrComPmSonetSNT-L-Day-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:35:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, value_range_constraint, constraints_union, single_value_constraint) ...
class Show(object): def __init__(self, drawable): self.drawable = drawable def next_frame(self): self.drawable.show() return False
class Show(object): def __init__(self, drawable): self.drawable = drawable def next_frame(self): self.drawable.show() return False
# -*- coding: utf-8 -*- # Copyright (c) 2015 Fredrik Eriksson <git@wb9.se> # This file is covered by the BSD-3-Clause license, read LICENSE for details. CMD_PWR_ON="poweron" CMD_PWR_OFF="poweroff" CMD_PWR_QUERY="powerquery" CMD_SRC_QUERY="sourcequery" CMD_SRC_SET="sourceset" CMD_BRT_QUERY="brightnessquery" CMD_BRT_S...
cmd_pwr_on = 'poweron' cmd_pwr_off = 'poweroff' cmd_pwr_query = 'powerquery' cmd_src_query = 'sourcequery' cmd_src_set = 'sourceset' cmd_brt_query = 'brightnessquery' cmd_brt_set = 'brightnessset'
# # Problem: Given an array of ints representing a graph, where: # - the position of the array indicates the node value # - the value of the array at that position indicates the node value that this node is attached to # - the beginning of the graph will be the item whose value is equal to the index it is in # Write a ...
class Graphnode: def __init__(self, label): self.label = label self.neighbors = set() def __repr__(self): return f'{self.label}: {self.neighbors}' def solution(T): nodes = [graph_node(i) for i in range(len(T))] capital = -1 for (idx, item) in enumerate(T): if idx =...
NEW_RANKING_RULES = ['typo', 'exactness'] DEFAULT_RANKING_RULES = [ 'words', 'typo', 'proximity', 'attribute', 'sort', 'exactness' ] def test_get_ranking_rules_default(empty_index): """Tests getting the default ranking rules.""" response = empty_index().get_ranking_rules() assert i...
new_ranking_rules = ['typo', 'exactness'] default_ranking_rules = ['words', 'typo', 'proximity', 'attribute', 'sort', 'exactness'] def test_get_ranking_rules_default(empty_index): """Tests getting the default ranking rules.""" response = empty_index().get_ranking_rules() assert isinstance(response, list) ...
def distinct(collection: list) -> int: """ Checks for the distinct values in a collection and returns the count Performs operation in nO(nlogn) time :param collection: Collection of values :returns number of distinct values in the collection """ length = len(collection) if length == 0: ...
def distinct(collection: list) -> int: """ Checks for the distinct values in a collection and returns the count Performs operation in nO(nlogn) time :param collection: Collection of values :returns number of distinct values in the collection """ length = len(collection) if length == 0: ...
# V0 # V1 # https://blog.csdn.net/fuxuemingzhu/article/details/83511833 # IDEA : DP # STATUS EQ : dp[i] = [b | A[i] for b in dp[i - 1]] + A[i] class Solution(object): def subarrayBitwiseORs(self, A): """ :type A: List[int] :rtype: int """ res = set() cur = set() ...
class Solution(object): def subarray_bitwise_o_rs(self, A): """ :type A: List[int] :rtype: int """ res = set() cur = set() for a in A: cur = {n | a for n in cur} | {a} res |= cur return len(res) class Solution(object): de...
#!/usr/bin/python # ============================================================================== # Author: Tao Li (taoli@ucsd.edu) # Date: Jun 11, 2015 # Question: 225-Implement-Stack-using-Queues # Link: https://leetcode.com/problems/implement-stack-using-queues/ # =========================================...
class Stack: def __init__(self): self.items = [] def push(self, x): self.items.append(x) def pop(self): self.items.pop() def top(self): return self.items[-1] def empty(self): return len(self.items) == 0
#!/usr/bin/env python3 def color_translator(color): if color == "red": hex_color = "#ff0000" elif color == "green": hex_color = "#00ff00" elif color == "blue": hex_color = "#0000ff" return hex_color print(color_translator("blue")) #Should be #0000fff print(color_translator("yell...
def color_translator(color): if color == 'red': hex_color = '#ff0000' elif color == 'green': hex_color = '#00ff00' elif color == 'blue': hex_color = '#0000ff' return hex_color print(color_translator('blue')) print(color_translator('yellow')) print(color_translator('red')) print(c...
def create_multi_graph(edges): graph = dict() for x, y in edges: graph[x] = [] graph[y] = [] for x, y in edges: graph[x].append(y) return graph def is_eulerian(multi_graph): number_enter = dict() number_exit = dict() for vertex in multi_graph: number_enter...
def create_multi_graph(edges): graph = dict() for (x, y) in edges: graph[x] = [] graph[y] = [] for (x, y) in edges: graph[x].append(y) return graph def is_eulerian(multi_graph): number_enter = dict() number_exit = dict() for vertex in multi_graph: number_ente...
class IntCode: def __init__(self, intcode): self.index = 0 self.output_ = 0 self.intcode = intcode def add(self, a, b): return a + b def mult(self, a, b): return a * b def store(self, v, p): self.intcode[p] = v def output(self, p): ...
class Intcode: def __init__(self, intcode): self.index = 0 self.output_ = 0 self.intcode = intcode def add(self, a, b): return a + b def mult(self, a, b): return a * b def store(self, v, p): self.intcode[p] = v def output(self, p): return ...
def math(): lists = [] count = 0 for i in range(20): j = int(input()) lists.append(j) for j in range(20)[::-1]: print('N[' + str(count) + '] =', lists[j]) count += 1 if __name__ == '__main__': math()
def math(): lists = [] count = 0 for i in range(20): j = int(input()) lists.append(j) for j in range(20)[::-1]: print('N[' + str(count) + '] =', lists[j]) count += 1 if __name__ == '__main__': math()
class NumberCheckerOnGroup: @classmethod def numberToGroup(cls, tNumber): clsNumber = 1 if tNumber >= 1 and tNumber <= 9: clsNumber = 1 elif tNumber >= 10 and tNumber <= 19: clsNumber = 10 elif tNumber >= 20 and tNumber <= 29: clsNumber = 20...
class Numbercheckerongroup: @classmethod def number_to_group(cls, tNumber): cls_number = 1 if tNumber >= 1 and tNumber <= 9: cls_number = 1 elif tNumber >= 10 and tNumber <= 19: cls_number = 10 elif tNumber >= 20 and tNumber <= 29: cls_number ...
def between_markers(text: str, begin: str, end: str) -> str: """ returns substring between two given markers """ # your code here return text[text.find(begin)+1:text.find(end)] if __name__ == '__main__': print('Example:') print(between_markers('What is >apple<', '>', '<')) # These...
def between_markers(text: str, begin: str, end: str) -> str: """ returns substring between two given markers """ return text[text.find(begin) + 1:text.find(end)] if __name__ == '__main__': print('Example:') print(between_markers('What is >apple<', '>', '<')) assert between_markers('What ...
#addBorder picture = ["abc", "ded"] def addBorder(mang): print("*****") for x in mang: print("*"+x+"*") print("*****")
picture = ['abc', 'ded'] def add_border(mang): print('*****') for x in mang: print('*' + x + '*') print('*****')
class Student: free_students = set() def __init__(self, sid: int, pref_list: list, math_grade, cs_grade, utils): self.sid = sid self.math_grade = math_grade self.cs_grade = cs_grade self.pref_list = pref_list self.project = None self.utils = utils self.pa...
class Student: free_students = set() def __init__(self, sid: int, pref_list: list, math_grade, cs_grade, utils): self.sid = sid self.math_grade = math_grade self.cs_grade = cs_grade self.pref_list = pref_list self.project = None self.utils = utils self.pa...
text = "X-DSPAM-Confidence: 0.8475" pos = text.find(':') numString = text[pos+1:] num = float(numString) print(num)
text = 'X-DSPAM-Confidence: 0.8475' pos = text.find(':') num_string = text[pos + 1:] num = float(numString) print(num)
x = [42,34,33,35,99] end = len(x) - 1 """ if len(x) % 2 == 0: m = int((0 + end) / 2) else: m = int((0 + end + 1) / 2) print(m) """ def find(arr, start, stop): # global peak if stop % 2 == 0: mid = int((start + stop) / 2) else: mid = int((start + stop - 1) / 2) if arr...
x = [42, 34, 33, 35, 99] end = len(x) - 1 '\n\n\nif len(x) % 2 == 0:\n m = int((0 + end) / 2)\nelse:\n m = int((0 + end + 1) / 2)\n \nprint(m)\n' def find(arr, start, stop): if stop % 2 == 0: mid = int((start + stop) / 2) else: mid = int((start + stop - 1) / 2) if arr[mid] > arr[mi...
def IsPrime(num): for i in range(2, num): if num % i == 0: return False return True fac = [] def solve(num): i = 2 while i <= num: if not IsPrime(i): i += 1 continue if num % i == 0: fac.append(i) num /= i else...
def is_prime(num): for i in range(2, num): if num % i == 0: return False return True fac = [] def solve(num): i = 2 while i <= num: if not is_prime(i): i += 1 continue if num % i == 0: fac.append(i) num /= i els...
#!/usr/bin/env python # -*- coding: utf-8 -*- class TrackedObj(object): def __init__(self, val): self.val = val def __str__(self): return '[%s]' % self.val class TrackField(TrackedObj): pass class TrackIndex(TrackedObj): pass class TrackVariant(TrackedObj): pass class Trac...
class Trackedobj(object): def __init__(self, val): self.val = val def __str__(self): return '[%s]' % self.val class Trackfield(TrackedObj): pass class Trackindex(TrackedObj): pass class Trackvariant(TrackedObj): pass class Tracker(object): def __init__(self): self....
class DataGridBoolColumn( DataGridColumnStyle, IComponent, IDisposable, IDataGridColumnStyleEditingNotificationService, ): """ Specifies a column in which each cell contains a check box for representing a Boolean value. DataGridBoolColumn() DataGridBoolColumn(prop: PropertyDescr...
class Datagridboolcolumn(DataGridColumnStyle, IComponent, IDisposable, IDataGridColumnStyleEditingNotificationService): """ Specifies a column in which each cell contains a check box for representing a Boolean value. DataGridBoolColumn() DataGridBoolColumn(prop: PropertyDescriptor) DataGridBoolColumn(prop...
def standardize_text(df, question_field): df[question_field] = df[question_field].str.replace(r"http\S+", "") df[question_field] = df[question_field].str.replace(r"http", "") df[question_field] = df[question_field].str.replace(r"@\S+", "") df[question_field] = df[question_field].str.replace( r"[...
def standardize_text(df, question_field): df[question_field] = df[question_field].str.replace('http\\S+', '') df[question_field] = df[question_field].str.replace('http', '') df[question_field] = df[question_field].str.replace('@\\S+', '') df[question_field] = df[question_field].str.replace('[^A-Za-z0-9(...
class Solution: def countPairs(self, nums: List[int], k: int) -> int: ans = 0 gcds = Counter() for num in nums: gcd_i = math.gcd(num, k) for gcd_j, count in gcds.items(): if gcd_i * gcd_j % k == 0: ans += count gcds[gcd_i] += 1 return ans
class Solution: def count_pairs(self, nums: List[int], k: int) -> int: ans = 0 gcds = counter() for num in nums: gcd_i = math.gcd(num, k) for (gcd_j, count) in gcds.items(): if gcd_i * gcd_j % k == 0: ans += count gcds[...
class WebDriverFactory: def __init__(self): self._drivers = {} self._driver_options = {} def register_web_driver(self, driver_type, web_driver, driver_options): self._drivers[driver_type] = web_driver self._driver_options[driver_type] = driver_options def get_registered_web...
class Webdriverfactory: def __init__(self): self._drivers = {} self._driver_options = {} def register_web_driver(self, driver_type, web_driver, driver_options): self._drivers[driver_type] = web_driver self._driver_options[driver_type] = driver_options def get_registered_we...
class Solution(object): def countConsistentStrings(self, allowed, words): """ :type allowed: str :type words: List[str] :rtype: int """ str_count = 0 for i in words: flag = True str_count += 1 for j in i: if ...
class Solution(object): def count_consistent_strings(self, allowed, words): """ :type allowed: str :type words: List[str] :rtype: int """ str_count = 0 for i in words: flag = True str_count += 1 for j in i: ...
class Image: def __init__(self): pass # @classmethod # def load(cls, path): # # raise NotImplementedError
class Image: def __init__(self): pass
''' Just like a balloon without a ribbon, an object without a reference variable cannot be used later. ''' class Mobile: def __init__(self, price, brand): self.price = price self.brand = brand Mobile(1000, "Apple") #After the above line the Mobile # object created is lost and unusable
""" Just like a balloon without a ribbon, an object without a reference variable cannot be used later. """ class Mobile: def __init__(self, price, brand): self.price = price self.brand = brand mobile(1000, 'Apple')