content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Change our pairplot to # * plot more samples # * reduce the number of variables to the first three (leave out the group) # * make the plot a bit larger # Optional # * fit linear regression models to the scatter plots # * give each group a different type of marker, use https://matplotlib.org/api/markers_api.html as a...
sample_df = df.sample(n=300, random_state=42) sns.set(font_scale=2) sns.pairplot(sample_df, hue='group', palette={0: '#AA4444', 1: '#006000', 2: '#EEEE44'}, vars=['speed', 'age', 'miles'], height=5, markers=['o', 's', 'D'])
class CreateBeam(): def __init__(self,concrete,x,y,z): self.concrete = concrete.concrete_type self.concrete_price = concrete.concrete_price self.x = int(x) self.y = int(y) self.y = int(y) self.volume = x * y * z self.price = self.volume * self.concre...
class Createbeam: def __init__(self, concrete, x, y, z): self.concrete = concrete.concrete_type self.concrete_price = concrete.concrete_price self.x = int(x) self.y = int(y) self.y = int(y) self.volume = x * y * z self.price = self.volume * self.concrete_pric...
N = int(input()) if N%2 == 0: print(1 / 2) else: print((N//2+1) / N)
n = int(input()) if N % 2 == 0: print(1 / 2) else: print((N // 2 + 1) / N)
N_ELEMNT = 10000 CBOW_N_WORDS = 3 SKIPGRAM_N_WORDS = 3 # context = 3 words before, 3 words after the target word MIN_WORD_FREQUENCY = 30 MAX_SEQ_LENGTH = 256 # define it to 0 for no truncature EMBEDDING_DIM = 256 VOCAB_SIZE = 4096 BATCH_SIZE = 64 LANGUAGE = 'french' BUFFER_SIZE = 8192
n_elemnt = 10000 cbow_n_words = 3 skipgram_n_words = 3 min_word_frequency = 30 max_seq_length = 256 embedding_dim = 256 vocab_size = 4096 batch_size = 64 language = 'french' buffer_size = 8192
# Setting to True clearly shows the neat Fibonacci pattern of: # Odd, Odd, Even, O, O, E, O, O, E.... DEBUG = False total = 0 curr = 1 prev = 1 while curr < 4000000: if curr % 2 == 0: if DEBUG: print('adding {}'.format(curr)) total += curr else: if DEBUG: print...
debug = False total = 0 curr = 1 prev = 1 while curr < 4000000: if curr % 2 == 0: if DEBUG: print('adding {}'.format(curr)) total += curr elif DEBUG: print('skipping {}'.format(curr)) curr = prev + curr prev = curr - prev print(total)
class Node: def __init__(self,value=None): self.value = value self.next = None def __str__(self): return str(self.value) class LinkedList: def __init__(self): self.head = None self.tail = None def __iter__(self): node = self.head while n...
class Node: def __init__(self, value=None): self.value = value self.next = None def __str__(self): return str(self.value) class Linkedlist: def __init__(self): self.head = None self.tail = None def __iter__(self): node = self.head while node: ...
a = input().split(" ") l,b = int(a[0]), int(a[1]) y = 0 while( l<=b ) : l=l*3 b=b*2 y+=1 print(y)
a = input().split(' ') (l, b) = (int(a[0]), int(a[1])) y = 0 while l <= b: l = l * 3 b = b * 2 y += 1 print(y)
class Folder: def __init__(self, **kwargs): self.folder = { 'rescanIntervalS' : 60, 'copiers' : 0, 'pullerPauseS' : 0, 'autoNormalize' : True, 'id' : kwargs['id'] , 'scanProgressIntervalS' : 0, 'hashers' : 0, 'pullers' : 0, 'invalid' : '', 'label' : kw...
class Folder: def __init__(self, **kwargs): self.folder = {'rescanIntervalS': 60, 'copiers': 0, 'pullerPauseS': 0, 'autoNormalize': True, 'id': kwargs['id'], 'scanProgressIntervalS': 0, 'hashers': 0, 'pullers': 0, 'invalid': '', 'label': kwargs['label'], 'minDiskFreePct': 1, 'pullerSleepS': 0, 'type': 'rea...
class User: ''' class to creates instances of class User. ''' user_list = [] def save_user(self): ''' save user method that appends objects to our user_list list. ''' User.user_list.append(self) def delete_user(self): ''' method to d...
class User: """ class to creates instances of class User. """ user_list = [] def save_user(self): """ save user method that appends objects to our user_list list. """ User.user_list.append(self) def delete_user(self): """ method to delete user fr...
x=range(1,10,2) print (x) for item in x: print(item,end=",")
x = range(1, 10, 2) print(x) for item in x: print(item, end=',')
# coding: utf-8 ROUTING_VIEWS = [ ("/", "app.IndexController", "foo"), ("/hoge/<id>", "hoge.HogeController", "hoge"), ("/fuga", "template.TemplateController", "fuga") ]
routing_views = [('/', 'app.IndexController', 'foo'), ('/hoge/<id>', 'hoge.HogeController', 'hoge'), ('/fuga', 'template.TemplateController', 'fuga')]
class Solution: def allCellsDistOrder(self, R, C, r0, c0): cells = [[x, y] for x in range(R) for y in range(C)] cells = sorted(cells, key=lambda c: abs(c[0] - r0) + abs(c[1] - c0)) return cells
class Solution: def all_cells_dist_order(self, R, C, r0, c0): cells = [[x, y] for x in range(R) for y in range(C)] cells = sorted(cells, key=lambda c: abs(c[0] - r0) + abs(c[1] - c0)) return cells
# Equation checker def is_balanced(equation): parenthesis = ''.join([p for p in equation if p in '(){}[]']) return is_valid(parenthesis) def is_valid(parenthesis): stack = [] for p in parenthesis: if p in '(': stack.append(p) elif p in ')': if stack == []: ...
def is_balanced(equation): parenthesis = ''.join([p for p in equation if p in '(){}[]']) return is_valid(parenthesis) def is_valid(parenthesis): stack = [] for p in parenthesis: if p in '(': stack.append(p) elif p in ')': if stack == []: return Fa...
class crafting: def __init__(self,inv,items): self.inv = inv self.items = items def getCrafts(self): itemsChecked = [] itemAmounts = [] for i in range(len(self.inv.inventory)): if self.inv.inventory[i][0] != None: item = self.inv.inventory[i] ...
class Crafting: def __init__(self, inv, items): self.inv = inv self.items = items def get_crafts(self): items_checked = [] item_amounts = [] for i in range(len(self.inv.inventory)): if self.inv.inventory[i][0] != None: item = self.inv.invento...
class Foo(object): pass @decorator class Bar(object): def foo(self): pass def baz(arg1, arg2): pass foo() | bar()
class Foo(object): pass @decorator class Bar(object): def foo(self): pass def baz(arg1, arg2): pass foo() | bar()
{ 'targets': [ { 'target_name': 'xwalk_test_base', 'type': 'static_library', 'dependencies': [ # FIXME(tmpsantos): we should depend on runtime # here but it is not really a module yet. '../../../base/base.gyp:base', '../../../base/base.gyp:test_support_base', ...
{'targets': [{'target_name': 'xwalk_test_base', 'type': 'static_library', 'dependencies': ['../../../base/base.gyp:base', '../../../base/base.gyp:test_support_base', '../../../content/content.gyp:content_browser', '../../../content/content_shell_and_tests.gyp:test_support_content../../../net/net.gyp:net', '../../../ski...
for i in range(5): print("I will not chew gum in class.") repetitions = int(input("How many times should i repeat?")) for i in range(repetitions): print("I will not chew gum in class") def print_about_gum(repetitions): for i in range(repetitions): print("I will not chew gum in class.") def main...
for i in range(5): print('I will not chew gum in class.') repetitions = int(input('How many times should i repeat?')) for i in range(repetitions): print('I will not chew gum in class') def print_about_gum(repetitions): for i in range(repetitions): print('I will not chew gum in class.') def main():...
def get_current_channel_planning(mist_session, site_id): uri = "/api/v1/sites/%s/rrm/current" % site_id resp = mist_session.mist_get(uri, site_id=site_id) return resp def get_device_rrm_info(mist_session, site_id, device_id, band): uri = "/api/v1/sites/%s/rrm/current/devices/%s/band/%s" % (site_id, d...
def get_current_channel_planning(mist_session, site_id): uri = '/api/v1/sites/%s/rrm/current' % site_id resp = mist_session.mist_get(uri, site_id=site_id) return resp def get_device_rrm_info(mist_session, site_id, device_id, band): uri = '/api/v1/sites/%s/rrm/current/devices/%s/band/%s' % (site_id, dev...
class Solution: def canVisitAllRooms(self, rooms: List[List[int]]) -> bool: seen = [False] * len(rooms) seen[0] = True stack = [0] #At the beginning, we have a todo list "stack" of keys to use. #'seen' represents at some point we have entered this room. while stack: ...
class Solution: def can_visit_all_rooms(self, rooms: List[List[int]]) -> bool: seen = [False] * len(rooms) seen[0] = True stack = [0] while stack: node = stack.pop() for nei in rooms[node]: if not seen[nei]: seen[nei] = Tru...
# https://open.kattis.com/problems/greetingcard n = int(input()) points = {tuple(map(int, input().split())) for _ in range(n)} neighbor_distances = {(0, 2018), (1118, 1680), (1680, 1118), (2018, 0), (1118, -1680), ...
n = int(input()) points = {tuple(map(int, input().split())) for _ in range(n)} neighbor_distances = {(0, 2018), (1118, 1680), (1680, 1118), (2018, 0), (1118, -1680), (1680, -1118), (0, -2018), (-1118, -1680), (-1680, -1118), (-2018, 0), (-1118, 1680), (-1680, 1118)} pairs = 0 for point in points: for nd in neighbor...
def make_car(manufacturer_name,model_name,**props): car = { 'manufacturer': manufacturer_name, 'model': model_name, } for prop,value in props.items(): car[prop] = value print(car) car = make_car('subaru', 'outback', color='blue', tow_package=True)
def make_car(manufacturer_name, model_name, **props): car = {'manufacturer': manufacturer_name, 'model': model_name} for (prop, value) in props.items(): car[prop] = value print(car) car = make_car('subaru', 'outback', color='blue', tow_package=True)
# import pretty_midi # from omnizart.music import app as music_app # from omnizart.drum import app as drum_app # from omnizart.chord import app as chord_app def process(input_audio, model_path=None, output="./"): pass
def process(input_audio, model_path=None, output='./'): pass
n = int(input()) p = list(map(int, input().split())) cnt = 0 for i in range(1, n-1): if (p[i-1] <= p[i] <= p[i+1]) or (p[i+1] <= p[i] <= p[i-1]): cnt += 1 print(cnt)
n = int(input()) p = list(map(int, input().split())) cnt = 0 for i in range(1, n - 1): if p[i - 1] <= p[i] <= p[i + 1] or p[i + 1] <= p[i] <= p[i - 1]: cnt += 1 print(cnt)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isSubStructure(self, A: TreeNode, B: TreeNode) -> bool: if B is None: return False if A is None: return False result = Fals...
class Solution: def is_sub_structure(self, A: TreeNode, B: TreeNode) -> bool: if B is None: return False if A is None: return False result = False if A.val == B.val: result = self.hasSubTree(A, B) if result == False: result = s...
class fun1: # test testVal = 1 def __init__(self, a): print("class init") self.a = a def __call__(self, x): return x + self.a def __str__(self) -> str: return "Sina changed this function as" def id(self): return 'a=%a' % self.a @classmethod ...
class Fun1: test_val = 1 def __init__(self, a): print('class init') self.a = a def __call__(self, x): return x + self.a def __str__(self) -> str: return 'Sina changed this function as' def id(self): return 'a=%a' % self.a @classmethod def update_v...
#pj24 foo = '0123456789' def thingamy(foo): foo.sort()
foo = '0123456789' def thingamy(foo): foo.sort()
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def binaryTreePaths(self, root: TreeNode) -> List[str]: if not root: return [] ans = [] self.dfs(root...
class Solution: def binary_tree_paths(self, root: TreeNode) -> List[str]: if not root: return [] ans = [] self.dfs(root, ans, '' + str(root.val)) return ans def dfs(self, root, ans, path): if root.left == None and root.right == None: ans.append(p...
SURFACE_HARD = 1 SURFACE_CLAY = 2 ADAM_EL_MIHDAWY = 'Adam El Mihdawy' ADAM_MOUNDIR = 'Adam Moundir' ADAM_PAVLASEK = 'Adam Pavlasek' ADHAM_GABER = 'Adham Gabr' ADMIR_KALENDER = 'Admir Kalender' ANDRES_MOLTENI = 'Andres Molteni' ADRIAN_ANDREEV = 'Adrian Andreev' ADRIAN_BODMER = 'Adrian Bodmer' ADRIAN_MANNARINO = 'Adrian...
surface_hard = 1 surface_clay = 2 adam_el_mihdawy = 'Adam El Mihdawy' adam_moundir = 'Adam Moundir' adam_pavlasek = 'Adam Pavlasek' adham_gaber = 'Adham Gabr' admir_kalender = 'Admir Kalender' andres_molteni = 'Andres Molteni' adrian_andreev = 'Adrian Andreev' adrian_bodmer = 'Adrian Bodmer' adrian_mannarino = 'Adrian ...
net_type = 'resnet' #type=str, workers = 4 # type=int, help='number of data loading workers (default: 4)' epochs = 2 # type=int, metavar='N', help='number of total epochs to run' batch_size = 128 #type=int, help='mini-batch size (default: 256)' lr = 0.1 #help='initial learning rate') momentum = 0.9 # help='momentum') w...
net_type = 'resnet' workers = 4 epochs = 2 batch_size = 128 lr = 0.1 momentum = 0.9 weight_decay = 0.0001 print_freq = 1 depth = 32 dataset = '../../Datasets/Kvasir - Aziz' verbose = False alpha = 300 expname = 'TEST' beta = 0 cutmix_prob = 0 iterations = 2
class ApiException(Exception): pass class DBConnectionIssue(ApiException): def __str__(self): return "Database Error: %s" % self.message class DBError(ApiException): def __init__(self, *args): # args can have 1 or 2 parameters try: self.errno = args[0] self....
class Apiexception(Exception): pass class Dbconnectionissue(ApiException): def __str__(self): return 'Database Error: %s' % self.message class Dberror(ApiException): def __init__(self, *args): try: self.errno = args[0] self.message = args[1] except IndexEr...
class Tweet: def __init__(self, uuid, name, screen_name, tweet_id, tweet, date_time, retweet_count, favourites_count, link): self.uuid = uuid self.name = name self.screen_name = screen_name self.tweet_id = tweet_id self.tweet = tweet self.date_time = date_time ...
class Tweet: def __init__(self, uuid, name, screen_name, tweet_id, tweet, date_time, retweet_count, favourites_count, link): self.uuid = uuid self.name = name self.screen_name = screen_name self.tweet_id = tweet_id self.tweet = tweet self.date_time = date_time ...
def part1(): x, y = 0, 0 for line in open("in.txt").read().splitlines(): direction, num = line.split() num = int(num) if direction == "forward": x += num elif direction == "down": y += num elif direction == "up": y -= num print(x * ...
def part1(): (x, y) = (0, 0) for line in open('in.txt').read().splitlines(): (direction, num) = line.split() num = int(num) if direction == 'forward': x += num elif direction == 'down': y += num elif direction == 'up': y -= num prin...
arr = [] for arr_i in range(6): arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')] arr.append(arr_t) smax = -9 * 7 for row in range(len(arr) - 2): for column in range(len(arr[row]) - 2): tl = arr[row][column] tc = arr[row][column + 1] tr = arr[row][column + 2] mc = arr[row + 1][column + 1] ...
arr = [] for arr_i in range(6): arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')] arr.append(arr_t) smax = -9 * 7 for row in range(len(arr) - 2): for column in range(len(arr[row]) - 2): tl = arr[row][column] tc = arr[row][column + 1] tr = arr[row][column + 2] ...
class LSystem(object): def __init__(self): self.steps = 0 self.axiom = "F" self.rule = "F+F-F" self.startLength = 190.0 self.theta = radians(120.0) self.reset() def reset(self): self.production = self.axiom self.drawLength = self.startLength ...
class Lsystem(object): def __init__(self): self.steps = 0 self.axiom = 'F' self.rule = 'F+F-F' self.startLength = 190.0 self.theta = radians(120.0) self.reset() def reset(self): self.production = self.axiom self.drawLength = self.startLength ...
threshold = 0 today = "2020-06-01" github_tokens = [] clone_all = True delete_after = False FEATURES = ['architecture', 'management' 'community', 'continuous_integration', 'documentation', 'history', 'license', 'unit_test']
threshold = 0 today = '2020-06-01' github_tokens = [] clone_all = True delete_after = False features = ['architecture', 'managementcommunity', 'continuous_integration', 'documentation', 'history', 'license', 'unit_test']
frase = 'Curso em Video Python' print(frase[3:13]) print(frase[1:15]) print(frase[2:18:2]) print(frase[::3]) print(frase.replace('Python','Android')) print(frase.split()) print(len(frase)) print(frase.count('o')) print(frase.upper().split()) print(frase.lower().find('em'))
frase = 'Curso em Video Python' print(frase[3:13]) print(frase[1:15]) print(frase[2:18:2]) print(frase[::3]) print(frase.replace('Python', 'Android')) print(frase.split()) print(len(frase)) print(frase.count('o')) print(frase.upper().split()) print(frase.lower().find('em'))
str_original = 'Hello' bytes_encoded = str_original.encode(encoding='utf-8') print(type(bytes_encoded)) str_decoded = bytes_encoded.decode() print(type(str_decoded)) print('Encoded bytes =', bytes_encoded) print('Decoded String =', str_decoded) print('str_original equals str_decoded =', str_original == str_decoded) ...
str_original = 'Hello' bytes_encoded = str_original.encode(encoding='utf-8') print(type(bytes_encoded)) str_decoded = bytes_encoded.decode() print(type(str_decoded)) print('Encoded bytes =', bytes_encoded) print('Decoded String =', str_decoded) print('str_original equals str_decoded =', str_original == str_decoded) str...
def mst_prim(G, w, r): for u in G.V: u.key = float('inf') u.p = None r.key = 0 Q = G.V while len(Q) != 0: u = extract_min(Q) for i in range(n): if G.matrix[u][i] == 1 and i in Q and w(u, i) < v.key: i.p = u i.key = w(u, i)
def mst_prim(G, w, r): for u in G.V: u.key = float('inf') u.p = None r.key = 0 q = G.V while len(Q) != 0: u = extract_min(Q) for i in range(n): if G.matrix[u][i] == 1 and i in Q and (w(u, i) < v.key): i.p = u i.key = w(u, i)
lr = 0.0001 dropout_rate = 0.5 max_epoch = 3136 #3317 batch_size = 4096 w = 19 u = 9 num_hidden_1 = 512 num_hidden_2 = 512
lr = 0.0001 dropout_rate = 0.5 max_epoch = 3136 batch_size = 4096 w = 19 u = 9 num_hidden_1 = 512 num_hidden_2 = 512
# # PySNMP MIB module TPLINK-TC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-TC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:16:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, single_value_constraint, value_range_constraint) ...
# Author : Guru prasad Raju ''' This program will print index of each characters in the string''' def givenString(new_string): for i in range(len(new_string)): print("index[", i, "]", new_string[i]) givenString("Life")
""" This program will print index of each characters in the string""" def given_string(new_string): for i in range(len(new_string)): print('index[', i, ']', new_string[i]) given_string('Life')
[ ## this file was manually modified by jt { 'functor' : { 'description' :['This function is mainly for inner usage and allows', 'speedy writing of \c next, \c nextafter and like functions','\par', 'It transforms a floating point value in a pattern of ...
[{'functor': {'description': ['This function is mainly for inner usage and allows', 'speedy writing of \\c next, \\c nextafter and like functions', '\\par', 'It transforms a floating point value in a pattern of bits', 'stored in an integer with different formulas according to', 'the floating point sign (it is the conve...
# -*- coding: utf-8 -*- def mean(x): return sum(x) / len(x)
def mean(x): return sum(x) / len(x)
# 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 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'
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)
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/'}}
#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.')
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
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...
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
# # 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)
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: ...
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...
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
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...
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': ...
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: ...
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 ...
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() ...
# # 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 =...
#!/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 ...