content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Node: def __init__(self, value, next_=None): self.value = value self.next = next_ class Stack: def __init__(self, top=None): self.top = top def push(self, value): self.top = Node(value, self.top) def pop(self): if self.top: ret = self.top.value self.top = self.top.next ...
class Node: def __init__(self, value, next_=None): self.value = value self.next = next_ class Stack: def __init__(self, top=None): self.top = top def push(self, value): self.top = node(value, self.top) def pop(self): if self.top: ret = self.top.va...
class Vector: #exercise 01 def __init__(self,inputlist): self._vector = [] _vector = inputlist #exercise 02 def __str__(self): return "<" + str(self._vector).strip("[]") + ">" #exercise 03 def dim(self): return len(self._vector) #exercise 04 def get...
class Vector: def __init__(self, inputlist): self._vector = [] _vector = inputlist def __str__(self): return '<' + str(self._vector).strip('[]') + '>' def dim(self): return len(self._vector) def get(self, index): return self._vector[index] def set(self, i...
# Protein sequence given seq = "MPISEPTFFEIF" # Split the sequence into its component amino acids seq_list = list(seq) # Use a set to establish the unique amino acids unique_amino_acids = set(seq_list) # Print out the unique amino acids print(unique_amino_acids)
seq = 'MPISEPTFFEIF' seq_list = list(seq) unique_amino_acids = set(seq_list) print(unique_amino_acids)
DEPTH = 16 # the number of filters of the first conv layer of the encoder of the UNet # Training hyperparameters BATCHSIZE = 16 EPOCHS = 100 OPTIMIZER = "adam"
depth = 16 batchsize = 16 epochs = 100 optimizer = 'adam'
string=input("Enter a string:") length=len(string) mid=length//2 rev=-1 for a in range(mid): if string[a]==string[rev]: a+=1 rev=-1 else: print(string,"is a palindrome") break else: print(string,"is not a palindrome")
string = input('Enter a string:') length = len(string) mid = length // 2 rev = -1 for a in range(mid): if string[a] == string[rev]: a += 1 rev = -1 else: print(string, 'is a palindrome') break else: print(string, 'is not a palindrome')
""" Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A[i] > B[i]. Return any permutation of A that maximizes its advantage with respect to B. Example 1: Input: A = [2,7,11,15], B = [1,10,4,11] Output: [2,11,7,15] ID...
""" Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A[i] > B[i]. Return any permutation of A that maximizes its advantage with respect to B. Example 1: Input: A = [2,7,11,15], B = [1,10,4,11] Output: [2,11,7,15] ID...
""" Problem 10: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million. """ sum = 0 size = 2000000 slots = [True for i in range(size)] slots[0] = False slots[1] = False for stride in range(2, size // 2): pos = stride while pos < size - stride: ...
""" Problem 10: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million. """ sum = 0 size = 2000000 slots = [True for i in range(size)] slots[0] = False slots[1] = False for stride in range(2, size // 2): pos = stride while pos < size - stride: p...
# Argus was charged with guarding Io, which is not an ordinary cow. Io is quite an explorer, and she wanders off rather frequently, making Argus' life stressful. So the cowherd decided to construct an enclosed pasture for Io. # There are nnn trees growing along the river, where Argus tends Io. For this problem, the riv...
t = int(input()) for i in range(t): n = int(input()) xs = list(map(int, input().split()))
''' Compute a digest message ''' def answer(digest): ''' solve for m[1] ''' message = [] for i, v in enumerate(digest): pv = message[i - 1] if i > 0 else 0 m = 0.1 a = 0 while m != int(m): m = ((256 * a) + (v ^ pv)) / 129.0 a += 1 m = int(m) ...
""" Compute a digest message """ def answer(digest): """ solve for m[1] """ message = [] for (i, v) in enumerate(digest): pv = message[i - 1] if i > 0 else 0 m = 0.1 a = 0 while m != int(m): m = (256 * a + (v ^ pv)) / 129.0 a += 1 m = int(m) ...
""" Obkey package informations. This file is a part of Openbox Key Editor Code under GPL (originally MIT) from version 1.3 - 2018. See Licenses information in ../obkey . """ MAJOR = 1 MINOR = 3 PATCH = 2 __version__ = "{0}.{1}.{2}".format(MAJOR, MINOR, PATCH) __description__ = 'Openbox Key Editor' __long_des...
""" Obkey package informations. This file is a part of Openbox Key Editor Code under GPL (originally MIT) from version 1.3 - 2018. See Licenses information in ../obkey . """ major = 1 minor = 3 patch = 2 __version__ = '{0}.{1}.{2}'.format(MAJOR, MINOR, PATCH) __description__ = 'Openbox Key Editor' __long_descr...
# October 27th, 2021 # INFOTC 4320 # Josh Block # Challenge: Anagram Alogrithm and Big-O # References: https://bradfieldcs.com/algos/analysis/an-anagram-detection-example/ print("===Anagram Dector===") print("This program determines if two words are anagrams of each other\n") first_word = input("Please enter first wo...
print('===Anagram Dector===') print('This program determines if two words are anagrams of each other\n') first_word = input('Please enter first word: ') second_word = input('Please enter second word: ') def dector(first_word, second_word): return sorted(first_word) == sorted(second_word) print(dector(first_word, s...
a=int(input()) b=int(input()) c=int(input()) if(a>b and a>c): print("number 1 is greatest") elif(b>a and b>c): print("number 2 is greatest") else: print("number 3 is greatest")
a = int(input()) b = int(input()) c = int(input()) if a > b and a > c: print('number 1 is greatest') elif b > a and b > c: print('number 2 is greatest') else: print('number 3 is greatest')
def main(): # Create and print a list named fruit. fruit_list = ["pear", "banana", "apple", "mango"] print(f"original: {fruit_list}") fruit_list.reverse() print(f"Reverse {fruit_list}") fruit_list.append("Orange") print(f"Append Orange {fruit_list}") pos = fruit_list.index("apple") ...
def main(): fruit_list = ['pear', 'banana', 'apple', 'mango'] print(f'original: {fruit_list}') fruit_list.reverse() print(f'Reverse {fruit_list}') fruit_list.append('Orange') print(f'Append Orange {fruit_list}') pos = fruit_list.index('apple') fruit_list.insert(pos, 'cherry') print(f...
__author__ = "Eric Dose :: New Mexico Mira Project, Albuquerque" # PyInstaller (__init__.py file should be in place as peer to .py file to run): # in Windows Command Prompt (E. Dose dev PC): # cd c:\Dev\prepoint\prepoint # C:\Programs\Miniconda\Scripts\pyinstaller app.spec
__author__ = 'Eric Dose :: New Mexico Mira Project, Albuquerque'
""" Spring. Click, drag, and release the horizontal bar to start the spring. """ # Spring drawing constants for top bar springHeight = 32 # Height left = 0 # Left position right = 0 # Right position max = 200 # Maximum Y value min = 100 # Minimum Y value over = False # If mouse over move = False ...
""" Spring. Click, drag, and release the horizontal bar to start the spring. """ spring_height = 32 left = 0 right = 0 max = 200 min = 100 over = False move = False m = 0.8 k = 0.2 d = 0.92 r = 150 ps = R v = 0.0 a = 0 f = 0 def setup(): size(640, 360) rect_mode(CORNERS) no_stroke() left = width / 2...
""" Space : O(1) Time : O(n**2) """ class Solution: def containsNearbyAlmostDuplicate(self, nums: List[int], k: int, t: int) -> bool: if t == 0 and len(nums) == len(set(nums)): return False for i, cur_val in enumerate(nums): for j in range(i+1, min(i+k+1, len(nums))): ...
""" Space : O(1) Time : O(n**2) """ class Solution: def contains_nearby_almost_duplicate(self, nums: List[int], k: int, t: int) -> bool: if t == 0 and len(nums) == len(set(nums)): return False for (i, cur_val) in enumerate(nums): for j in range(i + 1, min(i + k + 1, le...
def make_interval(depth, depth_integer_multiplier, num, step_num, start_val): all_groups_str = "[\n" for n in range(num): all_groups_str += "\t[" for d in range(depth): val = str(start_val * pow(depth_integer_multiplier, d)) if d == depth - 1: i...
def make_interval(depth, depth_integer_multiplier, num, step_num, start_val): all_groups_str = '[\n' for n in range(num): all_groups_str += '\t[' for d in range(depth): val = str(start_val * pow(depth_integer_multiplier, d)) if d == depth - 1: if n == num ...
class Config: __instance = None @staticmethod def get_instance(): """ Static access method. """ if Config.__instance == None: Config() return Config.__instance def __init__(self): if Config.__instance != None: raise Exception("This class can't b...
class Config: __instance = None @staticmethod def get_instance(): """ Static access method. """ if Config.__instance == None: config() return Config.__instance def __init__(self): if Config.__instance != None: raise exception("This class can't be...
class AFGR: @staticmethod def af_to_gr(dict_af): dict_swap = {} for keys in dict_af: dict_swap[keys] = [] for list in dict_af[keys]: dict_swap[keys].insert(len(dict_swap[keys]), list[0]) dict_swap[keys].insert(len(dict_swap[keys]), list[1]...
class Afgr: @staticmethod def af_to_gr(dict_af): dict_swap = {} for keys in dict_af: dict_swap[keys] = [] for list in dict_af[keys]: dict_swap[keys].insert(len(dict_swap[keys]), list[0]) dict_swap[keys].insert(len(dict_swap[keys]), list[1]...
animals = ["Gully", "Rhubarb", "Zephyr", "Henry"] for index, animal in enumerate(animals): # if index % 2 == 0: # continue # print(animal) print(f"{index+1}.\t{animal}")
animals = ['Gully', 'Rhubarb', 'Zephyr', 'Henry'] for (index, animal) in enumerate(animals): print(f'{index + 1}.\t{animal}')
class FittingAndAccessoryCalculationType(Enum, IComparable, IFormattable, IConvertible): """ Enum of fitting and accessory pressure drop calculation type. enum FittingAndAccessoryCalculationType,values: CalculateDefaultSettings (2),CalculatePressureDrop (1),Undefined (0),ValidateCurrentSettings (4) ""...
class Fittingandaccessorycalculationtype(Enum, IComparable, IFormattable, IConvertible): """ Enum of fitting and accessory pressure drop calculation type. enum FittingAndAccessoryCalculationType,values: CalculateDefaultSettings (2),CalculatePressureDrop (1),Undefined (0),ValidateCurrentSettings (4) """ ...
# Given an integer array arr, count element x such that x + 1 is also in arr. # If there're duplicates in arr, count them seperately. # Example 1: # Input: arr = [1,2,3] # Output: 2 # Explanation: 1 and 2 are counted cause 2 and 3 are in arr. # Example 2: # Input: arr = [1,1,3,3,5,5,7,7] # Output: 0 # Explanatio...
def count_elements(arr): d = {} for i in arr: d[i] = 1 count = 0 for num in arr: num_plus = num + 1 if num_plus in d: count += 1 return count print(count_elements([1, 1, 2, 2]))
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-uberon' ES_DOC_TYPE = 'anatomy' API_PREFIX = 'uberon' API_VERSION = ''
es_host = 'localhost:9200' es_index = 'pending-uberon' es_doc_type = 'anatomy' api_prefix = 'uberon' api_version = ''
class Solution: def solve(self, nums): integersDict = {} for i in range(len(nums)): try: integersDict[nums[i]] += 1 except: integersDict[nums[i]] = 1 for integer in integersDict: if integersDict[integer] != 3: ...
class Solution: def solve(self, nums): integers_dict = {} for i in range(len(nums)): try: integersDict[nums[i]] += 1 except: integersDict[nums[i]] = 1 for integer in integersDict: if integersDict[integer] != 3: ...
class CharacterRaceList(object): DEVA = 'DEVA' DRAGONBORN = 'DRAGONBORN' DWARF = 'DWARF' ELADRIN = 'ELADRIN' ELF = 'ELF' GITHZERAI = 'GITHZERAI' GNOME = 'GNOME' GOLIATH = 'GOLIATH' HALFELF = 'HALFELF' HALFLING = 'HALFLING' HALFORC = 'HALFORC' HUMAN = 'HUMAN' MINOTAUR...
class Characterracelist(object): deva = 'DEVA' dragonborn = 'DRAGONBORN' dwarf = 'DWARF' eladrin = 'ELADRIN' elf = 'ELF' githzerai = 'GITHZERAI' gnome = 'GNOME' goliath = 'GOLIATH' halfelf = 'HALFELF' halfling = 'HALFLING' halforc = 'HALFORC' human = 'HUMAN' minotaur ...
def inner_stroke(im): pass def outer_stroke(im): pass
def inner_stroke(im): pass def outer_stroke(im): pass
a, b, c = map(int, input().split()) h, l = map(int, input().split()) if a <= h and b <= l: print("S") elif a <= h and c <= l: print("S") elif b <= h and a <= l: print("S") elif b <= h and c <= l: print("S") elif c <= h and a <= l: print("S") elif c <= h and b <= l: print("S") else:...
(a, b, c) = map(int, input().split()) (h, l) = map(int, input().split()) if a <= h and b <= l: print('S') elif a <= h and c <= l: print('S') elif b <= h and a <= l: print('S') elif b <= h and c <= l: print('S') elif c <= h and a <= l: print('S') elif c <= h and b <= l: print('S') else: print...
def funcao1 (a, b): mult= a * b return mult def funcao2 (a, b): divi = a / b return divi multiplicacao = funcao1(3, 2) valor = funcao2(multiplicacao, 2) print(multiplicacao) print(int(valor))
def funcao1(a, b): mult = a * b return mult def funcao2(a, b): divi = a / b return divi multiplicacao = funcao1(3, 2) valor = funcao2(multiplicacao, 2) print(multiplicacao) print(int(valor))
# Plotting distributions pairwise (1) # Print the first 5 rows of the DataFrame print(auto.head()) # Plot the pairwise joint distributions from the DataFrame sns.pairplot(auto) # Display the plot plt.show()
print(auto.head()) sns.pairplot(auto) plt.show()
def log_text(file_path, log): if not log.endswith('\n'): log += '\n' print(log) with open(file_path, 'a') as f: f.write(log) def log_args(file_path, args): log = f"Args: {args}\n" log_text(file_path, log) def log_train_epoch(file_path, epoch, train_loss, train_accuracy): log...
def log_text(file_path, log): if not log.endswith('\n'): log += '\n' print(log) with open(file_path, 'a') as f: f.write(log) def log_args(file_path, args): log = f'Args: {args}\n' log_text(file_path, log) def log_train_epoch(file_path, epoch, train_loss, train_accuracy): log = ...
class Node: def __init__(self, value, next): self.value = value self.next = next class LinkedList: def __init__(self): self.head = None def add(self, value): self.head = Node(value, self.head) def remove(self): to_remove = self.head self.head = self.hea...
class Node: def __init__(self, value, next): self.value = value self.next = next class Linkedlist: def __init__(self): self.head = None def add(self, value): self.head = node(value, self.head) def remove(self): to_remove = self.head self.head = self.h...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Advent of Code 2020 Day 13, Part 1 """ def main(): with open('in.txt') as f: lines = f.readlines() arrival = int(lines[0].strip()) bus_ids = [] for n in lines[1].strip().split(','): if n == 'x': continue else: ...
""" Advent of Code 2020 Day 13, Part 1 """ def main(): with open('in.txt') as f: lines = f.readlines() arrival = int(lines[0].strip()) bus_ids = [] for n in lines[1].strip().split(','): if n == 'x': continue else: bus_ids.append(int(n)) waiting_time =...
#!/usr/bin/env python # # ---------------------------------------------------------------------- # # Brad T. Aagaard, U.S. Geological Survey # Charles A. Williams, GNS Science # Matthew G. Knepley, University of Chicago # # This code was developed as part of the Computational Infrastructure # for Geodynamics (http://ge...
__all__ = ['EqDeformation', 'Explicit', 'Implicit', 'Problem', 'Solver', 'SolverLinear', 'SolverNonlinear', 'TimeDependent', 'TimeStep', 'TimeStepUniform', 'TimeStepUser', 'TimeStepAdapt', 'ProgressMonitor']
t = int(input()) while (t!=0): a,b,c = map(int,input().split()) if (a+b+c == 180): print('YES') else: print('NO') t-=1
t = int(input()) while t != 0: (a, b, c) = map(int, input().split()) if a + b + c == 180: print('YES') else: print('NO') t -= 1
# cool.py def cool_func(): print('cool_func(): Super Cool!') print('__name__:', __name__) if __name__ == '__main__': print('Call it locally') cool_func()
def cool_func(): print('cool_func(): Super Cool!') print('__name__:', __name__) if __name__ == '__main__': print('Call it locally') cool_func()
""" https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits/ Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order....
""" https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits/ Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order....
class FieldDoesNotExist(Exception): def __init__(self, **kwargs): super().__init__(f"{self.__class__.__name__}: {kwargs}") self.kwargs = kwargs
class Fielddoesnotexist(Exception): def __init__(self, **kwargs): super().__init__(f'{self.__class__.__name__}: {kwargs}') self.kwargs = kwargs
""" Queue https://algorithm.yuanbin.me/zh-hans/basics_data_structure/queue.html """
""" Queue https://algorithm.yuanbin.me/zh-hans/basics_data_structure/queue.html """
# # PySNMP MIB module Unisphere-Products-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Products-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:26:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
class Solution(object): def findSubsequences(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ ans = [] def dfs(nums, start, path, ans): if len(path) >= 2: ans.append(tuple(path + [])) fo...
class Solution(object): def find_subsequences(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ ans = [] def dfs(nums, start, path, ans): if len(path) >= 2: ans.append(tuple(path + [])) for i in range(start, l...
# Calculate factorial of a number def factorial(n): ''' Returns the factorial of n. e.g. factorial(7) = 7x76x5x4x3x2x1 = 5040. ''' answer = 1 for i in range(1,n+1): answer = answer * i return answer if __name__ == "__main__": assert factorial(7) == 5040
def factorial(n): """ Returns the factorial of n. e.g. factorial(7) = 7x76x5x4x3x2x1 = 5040. """ answer = 1 for i in range(1, n + 1): answer = answer * i return answer if __name__ == '__main__': assert factorial(7) == 5040
line = input().split() n = int(line[0]) m = int(line[1]) print(str(abs(n-m)))
line = input().split() n = int(line[0]) m = int(line[1]) print(str(abs(n - m)))
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"c_imshow": "01_nn_utils.ipynb", "Flatten": "01_nn_utils.ipynb", "conv3x3": "01_nn_utils.ipynb", "get_proto_accuracy": "01_nn_utils.ipynb", "get_accuracy": "02_maml_pl.ipyn...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'c_imshow': '01_nn_utils.ipynb', 'Flatten': '01_nn_utils.ipynb', 'conv3x3': '01_nn_utils.ipynb', 'get_proto_accuracy': '01_nn_utils.ipynb', 'get_accuracy': '02_maml_pl.ipynb', 'collate_task': '01b_data_loaders_pl.ipynb', 'collate_task_batch': '01b_d...
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
entrada = input() def fibonacci(n): fib = [0, 1, 1] if n > 0 and n <= 2: return fib[1] elif n == 0: return fib[0] else: for x in range(3, n+1): fib.append(0) fib[x] = fib[x-1] + fib[x-2] return fib[n] numeros = entrada.split(' ') numeros = l...
entrada = input() def fibonacci(n): fib = [0, 1, 1] if n > 0 and n <= 2: return fib[1] elif n == 0: return fib[0] else: for x in range(3, n + 1): fib.append(0) fib[x] = fib[x - 1] + fib[x - 2] return fib[n] numeros = entrada.split(' ') numeros = l...
class AXFundAddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
class Axfundaddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
class Usuario(object): def __init__(self, email='', senha=''): self.email = email self.senha = senha def __str__(self): return f'{self.email}' class Equipe(object): def __init__(self, nome='', sigla='', local=''): self.nome = nome self.sigla = sigla self....
class Usuario(object): def __init__(self, email='', senha=''): self.email = email self.senha = senha def __str__(self): return f'{self.email}' class Equipe(object): def __init__(self, nome='', sigla='', local=''): self.nome = nome self.sigla = sigla self.l...
''' | Write a program that should prompt the user to type some sentences. It should then print number of words, number of characters, number of digits and number of special characters in it. | |------------------------------------------------------------------------------------------------------------------------------...
""" | Write a program that should prompt the user to type some sentences. It should then print number of words, number of characters, number of digits and number of special characters in it. | |------------------------------------------------------------------------------------------------------------------------------...
def problem1_1(): print("Problem Set 1") pass # replace this pass (a do-nothing) statement with your code
def problem1_1(): print('Problem Set 1') pass
"""Calculation Class""" class Calculation: """ calculation abstract base class""" # pylint: disable=too-few-public-methods def __init__(self,values: tuple): """ constructor method""" self.values = Calculation.convert_args_to_tuple_of_float(values) @classmethod def create(cls,values: ...
"""Calculation Class""" class Calculation: """ calculation abstract base class""" def __init__(self, values: tuple): """ constructor method""" self.values = Calculation.convert_args_to_tuple_of_float(values) @classmethod def create(cls, values: tuple): """ factory method""" ...
# # PySNMP MIB module CTRON-SSR-CONFIG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SSR-CONFIG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:15:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) ...
seats = [] with open("input.txt") as f: for line in f: line = line.replace("\n", "") seat = {} seat["raw"] = line seat["row"] = int(seat["raw"][:7].replace("F", "0").replace("B", "1"), 2) seat["column"] = int(seat["raw"][-3:].replace("L", "0").replace("R", "1"), 2) s...
seats = [] with open('input.txt') as f: for line in f: line = line.replace('\n', '') seat = {} seat['raw'] = line seat['row'] = int(seat['raw'][:7].replace('F', '0').replace('B', '1'), 2) seat['column'] = int(seat['raw'][-3:].replace('L', '0').replace('R', '1'), 2) se...
class MLModelInterface: def fit(self, features, labels): raise NotImplementedError def predict(self, data): raise NotImplementedError class KNeighborsClassifier(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class LinearRegres...
class Mlmodelinterface: def fit(self, features, labels): raise NotImplementedError def predict(self, data): raise NotImplementedError class Kneighborsclassifier(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class Linearregres...
{ "targets": [ { "target_name": "gpio", "sources": ["gpio.cc", "tizen-gpio.cc"] } ] }
{'targets': [{'target_name': 'gpio', 'sources': ['gpio.cc', 'tizen-gpio.cc']}]}
songs = { ('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('Miles Davis', 'Stella by Starlight'), ('Nickelback', 'Animals') } # Using a set comprehension, create a new set that contains all songs that were not performed by Nickelback. nonNickelback = {}
songs = {('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('Miles Davis', 'Stella by Starlight'), ('Nickelback', 'Animals')} non_nickelback = {}
def assign_variable(robot_instance, variable_name, args): """Assign a robotframework variable.""" variable_value = robot_instance.run_keyword(*args) robot_instance._variables.__setitem__(variable_name, variable_value) return variable_value
def assign_variable(robot_instance, variable_name, args): """Assign a robotframework variable.""" variable_value = robot_instance.run_keyword(*args) robot_instance._variables.__setitem__(variable_name, variable_value) return variable_value
file1 = open("./logs/pythonlog.txt", 'r+') avg1 = 0.0 lines1 = 0.0 for line in file1: lines1 = lines1 + 1.0 avg1 = (avg1 + float(line)) avg1 = avg1/lines1 print(avg1, "for Python with", lines1, "lines") file2 = open("./logs/clog.txt", 'r+') avg2 = 0.0 lines2 = 0.0 for line in file2: lines2 = lines2 + 1.0 ...
file1 = open('./logs/pythonlog.txt', 'r+') avg1 = 0.0 lines1 = 0.0 for line in file1: lines1 = lines1 + 1.0 avg1 = avg1 + float(line) avg1 = avg1 / lines1 print(avg1, 'for Python with', lines1, 'lines') file2 = open('./logs/clog.txt', 'r+') avg2 = 0.0 lines2 = 0.0 for line in file2: lines2 = lines2 + 1.0 ...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: if head is None: return None # 1 - check cycle p1 = head p2 = head.next ...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def detect_cycle(self, head: ListNode) -> ListNode: if head is None: return None p1 = head p2 = head.next has_cycle = False while p2 is not None and p2.next...
#!/usr/bin/python def add(a,b): return a+b def sub(a,b): return a-b def mul(a,b): return a*b def div(a,b): return a/b a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) print("Please select operation : \n" \ "1. Addition \n" \ "2. Subtraction \n" \ ...
def add(a, b): return a + b def sub(a, b): return a - b def mul(a, b): return a * b def div(a, b): return a / b a = int(input('Enter first number: ')) b = int(input('Enter second number: ')) print('Please select operation : \n1. Addition \n2. Subtraction \n3. Multiplication \n4. Division \n') select ...
# The classroom scheduling problem # Suppose you have a classroom and you want to hold as many classes as possible # __________________________ #| class | start | end | #|_______|_________|________| #| Art | 9:00 am | 10:30am| #|_______|_________|________| #| Eng | 9:30am | 10:30am| #|_______|_________|_____...
def schedule(classes): possible_classes = [] possible_classes.append(classes[0]) print(possible_classes) for i in range(2, len(classes)): if possible_classes[-1][1] <= classes[i][0]: possible_classes.append(classes[i]) return possible_classes
class restaurantvalidator(): def valideaza(self, restaurant): erori = [] if len(restaurant.nume) == 0: erori.append('numele nu trb sa fie null') if erori: raise ValueError(erori)
class Restaurantvalidator: def valideaza(self, restaurant): erori = [] if len(restaurant.nume) == 0: erori.append('numele nu trb sa fie null') if erori: raise value_error(erori)
OVERALL_CATEGORY_ID = '0x02E00000FFFFFFFF' HERO_CATEGORY_IDS = { 'reaper': '0x02E0000000000002', 'tracer': '0x02E0000000000003', 'mercy': '0x02E0000000000004', 'hanzo': '0x02E0000000000005', 'torbjorn': '0x02E0000000000006', 'reinhardt': '0x02E0000000000007', 'pharah': '0x02E0000000000008',...
overall_category_id = '0x02E00000FFFFFFFF' hero_category_ids = {'reaper': '0x02E0000000000002', 'tracer': '0x02E0000000000003', 'mercy': '0x02E0000000000004', 'hanzo': '0x02E0000000000005', 'torbjorn': '0x02E0000000000006', 'reinhardt': '0x02E0000000000007', 'pharah': '0x02E0000000000008', 'winston': '0x02E000000000000...
class Section: def get_display_text(self): pass def get_children(self): pass
class Section: def get_display_text(self): pass def get_children(self): pass
def solution(prices): if len(prices) == 0: return 0 # We are always paying the first price. total = prices[0] min_price = prices[0] for i in range(1, len(prices)): if prices[i] > min_price: total += prices[i] - min_price if prices[i] < min_price: min_p...
def solution(prices): if len(prices) == 0: return 0 total = prices[0] min_price = prices[0] for i in range(1, len(prices)): if prices[i] > min_price: total += prices[i] - min_price if prices[i] < min_price: min_price = prices[i] return total def num_d...
# /////////////////////////////////////////////////////////////////////////// # # # # /////////////////////////////////////////////////////////////////////////// class GLLight: def __init__(self, pos=(0.0,0.0,0.0), color=(1.0,1.0,1.0)): self.pos = pos self.color = color self.ambient = (1.0...
class Gllight: def __init__(self, pos=(0.0, 0.0, 0.0), color=(1.0, 1.0, 1.0)): self.pos = pos self.color = color self.ambient = (1.0, 1.0, 1.0) self.diffuse = (1.0, 1.0, 1.0) self.constant = 1.0 self.linear = 0.09 self.quadratic = 0.032
def splitbylength(wordlist): initlen = len(wordlist[0]) lastlen = len(wordlist[-1]) splitlist = [] for i in range(initlen, lastlen+1): curlist = [] for x in wordlist: if len(x) == i: curlist.append(x.capitalize()) splitlist.append(sorte...
def splitbylength(wordlist): initlen = len(wordlist[0]) lastlen = len(wordlist[-1]) splitlist = [] for i in range(initlen, lastlen + 1): curlist = [] for x in wordlist: if len(x) == i: curlist.append(x.capitalize()) splitlist.append(sorted(curlist)) ...
if __name__ == '__main__': checksum = 0 while True: try: numbers = input() except EOFError: break numbers = map(int, numbers.split('\t')) numbers = sorted(numbers) checksum += numbers[-1] - numbers[0] print(checksum)
if __name__ == '__main__': checksum = 0 while True: try: numbers = input() except EOFError: break numbers = map(int, numbers.split('\t')) numbers = sorted(numbers) checksum += numbers[-1] - numbers[0] print(checksum)
# # PySNMP MIB module ITOUCH-RADIUS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ITOUCH-RADIUS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:47:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ...
# -*- coding: utf-8 -*- """ Created on Tue May 31 17:02:24 2016 @author: rmondoncancel """ # Deprecated priorityList = [ { 'name': 'fistOfFire', 'group': 'monk', 'prepull': True, 'condition': { 'type': 'buffPresent', 'name': 'fistOfFire', 'compa...
""" Created on Tue May 31 17:02:24 2016 @author: rmondoncancel """ priority_list = [{'name': 'fistOfFire', 'group': 'monk', 'prepull': True, 'condition': {'type': 'buffPresent', 'name': 'fistOfFire', 'comparison': 'is', 'value': False}}, {'name': 'perfectBalance', 'group': 'pugilist', 'prepull': True}, {'name': 'blood...
hyper_params = { 'weight_decay': float(1e-6), 'epochs': 30, 'batch_size': 256, 'validate_every': 3, 'early_stop': 3, 'max_seq_len': 10, }
hyper_params = {'weight_decay': float(1e-06), 'epochs': 30, 'batch_size': 256, 'validate_every': 3, 'early_stop': 3, 'max_seq_len': 10}
# 1073 n = int(input()) if 5 < n < 2000: for i in range(2, n + 1, 2): print("{}^{} = {}".format(i, 2, i ** 2))
n = int(input()) if 5 < n < 2000: for i in range(2, n + 1, 2): print('{}^{} = {}'.format(i, 2, i ** 2))
class BinaryIndexedTree(object): def __init__(self): self.BITTree = [0] # Returns sum of arr[0..index]. This function assumes # that the array is preprocessed and partial sums of # array elements are stored in BITree[]. def getsum(self, i): s = 0 # initialize result # inde...
class Binaryindexedtree(object): def __init__(self): self.BITTree = [0] def getsum(self, i): s = 0 i = i + 1 while i > 0: s += self.BITTree[i] i -= i & -i return s def get_sum(self, a, b): return self.getsum(b) - self.getsum(a - 1) i...
s = input() t = int(input()) xy = [0, 0] cnt = 0 for i in range(len(s)): if s[i] == 'U': xy[1] += 1 elif s[i] == 'D': xy[1] -= 1 elif s[i] == 'R': xy[0] += 1 elif s[i] == 'L': xy[0] -= 1 else: cnt += 1 ans = abs(xy[0]) + abs(xy[1]) if t == 1: ans += cnt else: if ans >= cnt: ans -= ...
s = input() t = int(input()) xy = [0, 0] cnt = 0 for i in range(len(s)): if s[i] == 'U': xy[1] += 1 elif s[i] == 'D': xy[1] -= 1 elif s[i] == 'R': xy[0] += 1 elif s[i] == 'L': xy[0] -= 1 else: cnt += 1 ans = abs(xy[0]) + abs(xy[1]) if t == 1: ans += cnt el...
def is_valid_session(session: dict) -> bool: """ checks if passed dict has enough info to display event :param session: dict representing a session :return: True if it has enough info (title, start time, end time), False otherwise """ try: session_keys = session.keys() except Attri...
def is_valid_session(session: dict) -> bool: """ checks if passed dict has enough info to display event :param session: dict representing a session :return: True if it has enough info (title, start time, end time), False otherwise """ try: session_keys = session.keys() except Attrib...
class Solution: def intToRoman(self, num: int) -> str: convertor = [ ["","M", "MM", "MMM"], ["","C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"], ["","X", "XX", "XXX", "XL", "L", "LX","LXX","LXXX", "XC"], ["","I","II","III","IV","V","VI","VII","VIII","I...
class Solution: def int_to_roman(self, num: int) -> str: convertor = [['', 'M', 'MM', 'MMM'], ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'], ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'], ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']] return convertor[0]...
# 2. Multiples List # Write a program that receives two numbers (factor and count) and creates a list with length of the given count # and contains only elements that are multiples of the given factor. factor = int(input()) count = int(input()) list = [] for counter in range(1, count+1): list.append(factor * cou...
factor = int(input()) count = int(input()) list = [] for counter in range(1, count + 1): list.append(factor * counter) print(list)
# # PySNMP MIB module H3C-IPSEC-MONITOR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-IPSEC-MONITOR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:09:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ...
# # PySNMP MIB module CISCO-CAS-IF-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CAS-IF-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:35:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
""" Copyright 2018 Arm Ltd. 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 applicable law or agreed to in writing, software distribut...
""" Copyright 2018 Arm Ltd. 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 applicable law or agreed to in writing, software distribut...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sortedArrayToBST(self, nums) -> TreeNode: def func(left, right) -> TreeNode: if left > right: return None ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sorted_array_to_bst(self, nums) -> TreeNode: def func(left, right) -> TreeNode: if left > right: return None mid = (left + right)...
def msg(m): """ Shorthand for print statement """ print(m) def dashes(cnt=40): """ Print dashed line """ msg('-' * cnt) def msgt(m): """ Add dashed line pre/post print statment """ dashes() msg(m) dashes()
def msg(m): """ Shorthand for print statement """ print(m) def dashes(cnt=40): """ Print dashed line """ msg('-' * cnt) def msgt(m): """ Add dashed line pre/post print statment """ dashes() msg(m) dashes()
# -*- coding: utf-8 -*- """ Created on Tue May 10 08:18:02 2016 @author: WELG """ class Coordinate(object): def __init__(self, x, y): self.x = x self.y = y def distance(self, other): x_diff_sq = (self.x-other.x)**2 y_diff_sq = (self.y-other.y)**2 return (x_diff_sq + y...
""" Created on Tue May 10 08:18:02 2016 @author: WELG """ class Coordinate(object): def __init__(self, x, y): self.x = x self.y = y def distance(self, other): x_diff_sq = (self.x - other.x) ** 2 y_diff_sq = (self.y - other.y) ** 2 return (x_diff_sq + y_diff_sq) ** 0.5...
class Solution: def isPalindrome(self, s: str) -> bool: lo, hi = 0, len(s) - 1 while lo < hi: if not s[lo].isalnum(): lo += 1 elif not s[hi].isalnum(): hi -= 1 else: if s[lo].lower() != s[hi].lower(): ...
class Solution: def is_palindrome(self, s: str) -> bool: (lo, hi) = (0, len(s) - 1) while lo < hi: if not s[lo].isalnum(): lo += 1 elif not s[hi].isalnum(): hi -= 1 else: if s[lo].lower() != s[hi].lower(): ...
# Change these values and rename this file to "settings_secret.py" # SECURITY WARNING: If you are using this in production, do NOT use the default SECRET KEY! # See: https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-SECRET_KEY SECRET_KEY = '!!super_secret!!' # https://docs.djangoproject.com/en/3.0/ref/se...
secret_key = '!!super_secret!!' allowed_hosts = ['*']
def maxPower(s: str) -> int: if not s or len(s) == 0: return 0 result = 1 temp_result = 1 curr = s[0] for c in s[1:]: if c == curr: temp_result += 1 else: result = max(result, temp_result) temp_result = 1 curr = c ...
def max_power(s: str) -> int: if not s or len(s) == 0: return 0 result = 1 temp_result = 1 curr = s[0] for c in s[1:]: if c == curr: temp_result += 1 else: result = max(result, temp_result) temp_result = 1 curr = c return ma...
class data: def __init__(self): self._ = {} def set(self, key, data_): self._[key] = data_ return data_ def get(self, key): if key in self._: return self._[key] else: return False
class Data: def __init__(self): self._ = {} def set(self, key, data_): self._[key] = data_ return data_ def get(self, key): if key in self._: return self._[key] else: return False
#This application is supposed to mimics #a seat reservation system for a bus company #or railroad like Amtrak or Greyhound. class Seat: def __init__(self): self.first_name = '' self.last_name = '' self.paid = False def reserve(self, fn, ln, pd): self.first_name = fn se...
class Seat: def __init__(self): self.first_name = '' self.last_name = '' self.paid = False def reserve(self, fn, ln, pd): self.first_name = fn self.last_name = ln self.paid = pd def make_empty(self): self.first_name = '' self.last_name = '' ...
# author: elia deppe # date 6/4/21 # # simple password confirmation program that confirms a password of size 12 to 48, with at least: one lower-case letter # one upper-case letter, one number, and one special character. # constants MIN_LENGTH, MAX_LENGTH = 8, 48 # min and max length of password # dictionaries LO...
(min_length, max_length) = (8, 48) (lower_case, upper_case) = ('abcdefghijklmnopqrstuvwxz', 'ABCDEFGHJKLMNOPQRSTUVWXYZ') (numbers, special_chars) = ('0123456789', '!@#$%^&()-_+=[{]}|:;<,>.?/') full_dictionary = LOWER_CASE + UPPER_CASE + NUMBERS + SPECIAL_CHARS def get_password(): password = input('>> password\n>> ...
"""Constant and messages definition for MT communication.""" class MID: """Values for the message id (MID)""" ## Error message, 1 data byte Error = 0x42 ErrorCodes = { 0x03: "Invalid period", 0x04: "Invalid message", 0x1E: "Timer overflow", 0x20: "Invalid baudrate", 0x21: "Invalid parameter" } # Stat...
"""Constant and messages definition for MT communication.""" class Mid: """Values for the message id (MID)""" error = 66 error_codes = {3: 'Invalid period', 4: 'Invalid message', 30: 'Timer overflow', 32: 'Invalid baudrate', 33: 'Invalid parameter'} go_to_measurement = 16 go_to_config = 48 rese...
# Copyright 2010 Google Inc. # # 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 applicable law or agreed to ...
crc_table = [] for n in range(256): c = n for k in range(8): if c & 1: c = 3988292384 ^ c >> 1 else: c >>= 1 CRC_TABLE.append(c) def png_crc32(string): crc = 4294967295 for char in string: crc = CRC_TABLE[crc & 255 ^ ord(char)] ^ crc >> 8 return c...
FORMAT_MSG_HIGH_ALERT = "High traffic generated an alert - hits = %s, triggered at %s" FORMAT_MSG_RECOVERED_ALERT = "Traffic recovered - hits = %s, triggered at %s" HIGHEST_HITS_HEADER = "Highest hits" ALERTS_HEADER = "Alerts"
format_msg_high_alert = 'High traffic generated an alert - hits = %s, triggered at %s' format_msg_recovered_alert = 'Traffic recovered - hits = %s, triggered at %s' highest_hits_header = 'Highest hits' alerts_header = 'Alerts'
model = dict( type='ImageClassifier', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3, ), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict( type='LinearClsHead', num_classes=1000, in_channels=2048, ...
model = dict(type='ImageClassifier', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=2048, loss=dict(type='CrossEntropyLoss', loss_weight=1.0), topk=(1, 5))) dataset_type = 'Ima...
float_num = 3.14159265 # float_num is a variable which has been assigned a float print(type(float_num)) # prints the type of float_num print(str(float_num) + " is a float") # prints "3.14159265 is a float" print("\"Hello, I'm Leonardo, nice to meet you!\"")
float_num = 3.14159265 print(type(float_num)) print(str(float_num) + ' is a float') print('"Hello, I\'m Leonardo, nice to meet you!"')
x = 3 y = 12.5 print('The rabbit is ', x, '.', sep='') print('The rabbit is', x, 'years old.') print(y, 'is average.') print(y, ' * ', x, '.', sep='') print(y, ' * ', x, ' is ', x*y, '.', sep='')
x = 3 y = 12.5 print('The rabbit is ', x, '.', sep='') print('The rabbit is', x, 'years old.') print(y, 'is average.') print(y, ' * ', x, '.', sep='') print(y, ' * ', x, ' is ', x * y, '.', sep='')
name = 'ConsulClient' __author__ = 'Rodrigo Alejandro Loza Lucero / lozuwaucb@gmail.com' __version__ = '0.1.0' __log__ = 'Consul api client for python'
name = 'ConsulClient' __author__ = 'Rodrigo Alejandro Loza Lucero / lozuwaucb@gmail.com' __version__ = '0.1.0' __log__ = 'Consul api client for python'
# Copyright 2012 Dietrich Epp <depp@zdome.net> # See LICENSE.txt for details. @test def skip_this(): skip() @test def pass_this(): pass @test def skip_rest(): skip_module() @test def fail_this(): fail("shouldn't get here")
@test def skip_this(): skip() @test def pass_this(): pass @test def skip_rest(): skip_module() @test def fail_this(): fail("shouldn't get here")
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > counter else counter
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > c...
class TransportType: NAPALM = "napalm" NCCLIENT = "ncclient" NETMIKO = "netmiko" class DeviceType: IOS = "ios" NXOS = "nxos" NXOS_SSH = "nxos_ssh" NEXUS = "nexus" CISCO_NXOS = "cisco_nxos"
class Transporttype: napalm = 'napalm' ncclient = 'ncclient' netmiko = 'netmiko' class Devicetype: ios = 'ios' nxos = 'nxos' nxos_ssh = 'nxos_ssh' nexus = 'nexus' cisco_nxos = 'cisco_nxos'
inf = 100000 def dijkstra(src, dest, graph: list[list], matrix: list[list]): number_of_nodes = len(matrix) visitors = [0 for i in range(len(matrix))] previous = [-1 for i in range(len(matrix))] distances = [inf for i in range(len(matrix))] distances[src] = 0 current_node = getPriority(distan...
inf = 100000 def dijkstra(src, dest, graph: list[list], matrix: list[list]): number_of_nodes = len(matrix) visitors = [0 for i in range(len(matrix))] previous = [-1 for i in range(len(matrix))] distances = [inf for i in range(len(matrix))] distances[src] = 0 current_node = get_priority(distance...
# process local states local = range(12) # L states L = {"x0" : [6], "x1" : [7], "x2" : [8], "f0" : [9], "f1" : [10], "f2" : [11], "v0" : [0, 3, 6, 9], "v1" : [1, 4, 7, 10], "v2" : [2, 5, 8, 11], "corr0" : [0, 6], "corr1" : [1, 7], "corr2" : [2, 8]} # receive variables rcv_vars = ["nr0", "nr1", "nr2"] #...
local = range(12) l = {'x0': [6], 'x1': [7], 'x2': [8], 'f0': [9], 'f1': [10], 'f2': [11], 'v0': [0, 3, 6, 9], 'v1': [1, 4, 7, 10], 'v2': [2, 5, 8, 11], 'corr0': [0, 6], 'corr1': [1, 7], 'corr2': [2, 8]} rcv_vars = ['nr0', 'nr1', 'nr2'] initial = local rules = [] rules.append({'idx': 0, 'from': 0, 'to': 0, 'guard': '(a...