content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# # @lc app=leetcode.cn id=1228 lang=python3 # # [1228] minimum-cost-tree-from-leaf-values # None # @lc code=end
None
__version__ = "0.1.94" __license__ = "MIT License" __website__ = "https://oss.navio.tech/navio-aws/" __download_url__ = ('https://github.com/naviotech/navio-aws/archive' '/{}.tar.gz'.format(__version__)),
__version__ = '0.1.94' __license__ = 'MIT License' __website__ = 'https://oss.navio.tech/navio-aws/' __download_url__ = ('https://github.com/naviotech/navio-aws/archive/{}.tar.gz'.format(__version__),)
# https://github.com/DeFiCh/jellyfish/blob/main/packages/whale-api-client/src/api/Transactions.ts class Transactions: def __init__(self, ocean): self._ocean = ocean def get(self, id): return self._ocean._conn.get(f"transactions/{id}") def getVins(self, txid, size=30, next=None): r...
class Transactions: def __init__(self, ocean): self._ocean = ocean def get(self, id): return self._ocean._conn.get(f'transactions/{id}') def get_vins(self, txid, size=30, next=None): return self._ocean._conn.get(f'transactions/{txid}/vins', size=size, next=next) def get_vouts...
def funcao1(): return 1 def funcao2(): return 2 dicionario_funcoes = { 1: funcao1, 2: funcao2 } escolha = int(input('Escolha uma opcao: ')) print(dicionario_funcoes[escolha]()) #https://pt.stackoverflow.com/q/515548/101
def funcao1(): return 1 def funcao2(): return 2 dicionario_funcoes = {1: funcao1, 2: funcao2} escolha = int(input('Escolha uma opcao: ')) print(dicionario_funcoes[escolha]())
try: arquivo = open('pessoa.csv') for registro in arquivo: registro = registro.split(',') print(f'Nome: {registro[0]}, Idade: {registro[1].strip()} anos') except: print('Aconteceu algo de errado! ') finally: arquivo.close()
try: arquivo = open('pessoa.csv') for registro in arquivo: registro = registro.split(',') print(f'Nome: {registro[0]}, Idade: {registro[1].strip()} anos') except: print('Aconteceu algo de errado! ') finally: arquivo.close()
class Static(): counter = 0 def __init__(self): self.cls_counter = Static.counter def __repr__(self): return f"Static class {self.__class__.__name__} with counter {Static.counter}" @staticmethod def myfunc(): Static.counter += 1 return Static.counter...
class Static: counter = 0 def __init__(self): self.cls_counter = Static.counter def __repr__(self): return f'Static class {self.__class__.__name__} with counter {Static.counter}' @staticmethod def myfunc(): Static.counter += 1 return Static.counter if __name__ == '...
class AlreadyTracked(Exception): pass class PageDoesNotExist(Exception): pass class TestFailedError(Exception): pass
class Alreadytracked(Exception): pass class Pagedoesnotexist(Exception): pass class Testfailederror(Exception): pass
# https://leetcode.com/problems/two-sum/ # -> Challenge: # Given an array of integers, return indices of the two numbers such that they add up to a specific target. # You may assume that each input would have exactly one solution, and you may not use the same element twice. # Example: # Given nums = [2, 7, 11, 15], ...
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: seen = {} for (pos, num) in enumerate(nums): pair = target - num if pair in seen: return [seen[pair], pos] else: seen[num] = pos
a = [1, 7, 5, 9, 7, 2, 5, 4, 3] pivot = 5 start = 0 end = len(a) - 1 while True: while start < end and a[start] <= pivot: start += 1 if start >= end: break while start < end and a[end] > pivot: end -= 1 if start >= end: break a[start], a[end] = a[end], a[start] pr...
a = [1, 7, 5, 9, 7, 2, 5, 4, 3] pivot = 5 start = 0 end = len(a) - 1 while True: while start < end and a[start] <= pivot: start += 1 if start >= end: break while start < end and a[end] > pivot: end -= 1 if start >= end: break (a[start], a[end]) = (a[end], a[start]) pr...
def get_currency(): currencies = [ "INR", "USD", "EUR", "ACU", "GBP", "JPY", "AUD", "BGN", "BRL", "CAD", "CHF", "CNY", "CZK", "DKK", "HKD", "HRK", "HUF", "IDR", "ILS", "KRW", "MXN", "MYR", "NOK", "NZD", "PHP", "P...
def get_currency(): currencies = ['INR', 'USD', 'EUR', 'ACU', 'GBP', 'JPY', 'AUD', 'BGN', 'BRL', 'CAD', 'CHF', 'CNY', 'CZK', 'DKK', 'HKD', 'HRK', 'HUF', 'IDR', 'ILS', 'KRW', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PLN', 'RON', 'RUB', 'SEK', 'SGD', 'THB', 'TRY', 'ZAR', 'TWD', 'AED', 'TPE'] return currencies def get...
def parse(line): info = ['', ''] i = 1 for character in line: if(character == " "): info[0] = line[0:i-1] break i+=1 info[1] = line[i:] return info
def parse(line): info = ['', ''] i = 1 for character in line: if character == ' ': info[0] = line[0:i - 1] break i += 1 info[1] = line[i:] return info
def color_subset(graph, vertices_set, colors, min_color): def dfs(v, shift): colors[v] = min_color + shift for incident in graph[v]: if incident in vertices_set: if colors[incident] is None: if not dfs(incident, 1 - shift): ret...
def color_subset(graph, vertices_set, colors, min_color): def dfs(v, shift): colors[v] = min_color + shift for incident in graph[v]: if incident in vertices_set: if colors[incident] is None: if not dfs(incident, 1 - shift): ret...
# Data sources for kinetics database( thermoLibraries = ['primaryThermoLibrary'], reactionLibraries = [], seedMechanisms = [], kineticsDepositories = 'default', #this section lists possible reaction families to find reactioons with kineticsFamilies = ['R_Recombination'], kineticsEstimator...
database(thermoLibraries=['primaryThermoLibrary'], reactionLibraries=[], seedMechanisms=[], kineticsDepositories='default', kineticsFamilies=['R_Recombination'], kineticsEstimator='rate rules') species(label='Propyl', reactive=True, structure=smiles('CC[CH3]')) species(label='H', reactive=True, structure=smiles('[H]'))...
class Solution: def countBits(self, n: int) -> List[int]: def bitCount(n): counter = 0 while n!= 0: if n%2 != 0: counter = counter + 1 n = n // 2 return counter result = [] for i in range(n+1): ...
class Solution: def count_bits(self, n: int) -> List[int]: def bit_count(n): counter = 0 while n != 0: if n % 2 != 0: counter = counter + 1 n = n // 2 return counter result = [] for i in range(n + 1): ...
class Article: #class that defines news objects def __init__(self,author,title,description,url,urlToImage,published_at): self.author = author self.title = title self.description = description self.url = url self.urlToImage = urlToImage self.published_at = publis...
class Article: def __init__(self, author, title, description, url, urlToImage, published_at): self.author = author self.title = title self.description = description self.url = url self.urlToImage = urlToImage self.published_at = published_at class Source: def _...
def createFile (name): open(name, "w") for num in range(0, 25): print("Criando o arquivo: " + str(num)) createFile(str(num))
def create_file(name): open(name, 'w') for num in range(0, 25): print('Criando o arquivo: ' + str(num)) create_file(str(num))
def brute_force(s, p): # introduce cinvention betwen notation n,m = len(s), len(p) #try every potential starting index within T for i in range(n-m+1): k = 0 while k < m and s[i+k] == p[k]: k += 1 if k == m: return i return -1 print(brute_force('fdhg...
def brute_force(s, p): (n, m) = (len(s), len(p)) for i in range(n - m + 1): k = 0 while k < m and s[i + k] == p[k]: k += 1 if k == m: return i return -1 print(brute_force('fdhgfhsdhjshkdfhksdfkjsdkjfskjfhkjsd', 'gfhsdhjsh'))
class LinkedList: def __init__(self, value): self.value = value self.next = None # O(n + m) time | O(1) space - where n is the number of nodes in the first # Linked List and m is the number of nodes in the second Linked List def mergeLinkedLists(headOne, headTwo): p1 = headOne...
class Linkedlist: def __init__(self, value): self.value = value self.next = None def merge_linked_lists(headOne, headTwo): p1 = headOne p1_prev = None p2 = headTwo while p1 is not None and p2 is not None: if p1.value < p2.value: p1_prev = p1 p1 = p1....
# Author: btjanaka (Bryon Tjanaka) # Problem: (HackerRank) halloween-sale # Title: Halloween Sale # Link: https://www.hackerrank.com/challenges/halloween-sale/problem # Idea: The problem is small enough to brute force. # Difficulty: easy # Tags: implementation, math p, d, m, s = map(int, input().split()) i = 0 while s ...
(p, d, m, s) = map(int, input().split()) i = 0 while s >= 0: s -= max(p - d * i, m) i += 1 print(i - 1)
def smallestSubWithSum(arr, n, x): min_len = n + 1 for start in range(0, n): curr_sum = arr[start] if (curr_sum > x): return 1 for end in range(start+1, n): curr_sum += arr[end] if curr_sum > x and (end - start + 1) < min_len: min_len =...
def smallest_sub_with_sum(arr, n, x): min_len = n + 1 for start in range(0, n): curr_sum = arr[start] if curr_sum > x: return 1 for end in range(start + 1, n): curr_sum += arr[end] if curr_sum > x and end - start + 1 < min_len: min_len ...
class QuickFind: def __init__(self, elements): self.ids = elements def union(self, p, q): pid = self.ids[p] qid = self.ids[q] self.ids[q] = p for i, v in enumerate(self.ids): if v == qid: self.ids[i] = pid def connected(self, p, q): ...
class Quickfind: def __init__(self, elements): self.ids = elements def union(self, p, q): pid = self.ids[p] qid = self.ids[q] self.ids[q] = p for (i, v) in enumerate(self.ids): if v == qid: self.ids[i] = pid def connected(self, p, q): ...
# Chinese Spring Fireworks Damage Skin success = sm.addDamageSkin(2433588) if success: sm.chat("The Chinese Spring Fireworks Damage Skin has been added to your account's damage skin collection.")
success = sm.addDamageSkin(2433588) if success: sm.chat("The Chinese Spring Fireworks Damage Skin has been added to your account's damage skin collection.")
FROM_YOUTUBE_DOCS = ''' downloads the video from the given YouTube `url` \ and uses frames from that video to create a photo mosaic \ of the given `image_path` image ''' FROM_VIDEO_DOCS = ''' uses frames from the given `video_path` video \ to create a photo mosaic of the given `image_path` image ''' FROM_FOLDER_DOC...
from_youtube_docs = '\ndownloads the video from the given YouTube `url` and uses frames from that video to create a photo mosaic of the given `image_path` image\n' from_video_docs = '\nuses frames from the given `video_path` video to create a photo mosaic of the given `image_path` image\n' from_folder_docs = '\nuses im...
#!/usr/bin/env python # coding: utf-8 # Copyright (c) tjdevries. # Distributed under the terms of the Modified BSD License. # NOTE: Must keep in sync w/ pyproject.toml to publish version_info = (0, 1, 23) __version__ = ".".join(map(str, version_info))
version_info = (0, 1, 23) __version__ = '.'.join(map(str, version_info))
#takes a 4*4 array and a key size (128, 192 or 256) and shift the row according to AES standard def shiftRows(message, keySize): #tests if the message is valid (i.e. a 4*4 array) if len(message) == 4: for i in range(4): if len(message[i]) != 4: raise ValueError('Bad messag...
def shift_rows(message, keySize): if len(message) == 4: for i in range(4): if len(message[i]) != 4: raise value_error('Bad message size in shiftRows(message, keysize)') else: raise value_error('Bad message size in shiftRows(message, keysize)') if int(keySize) == 1...
class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: m = len(heights) n = len(heights[0]) dirs = [0, 1, 0, -1, 0] qP = deque() qA = deque() seenP = [[False] * n for _ in range(m)] seenA = [[False] * n for _ in range(m)] for i in range(m): qP.ap...
class Solution: def pacific_atlantic(self, heights: List[List[int]]) -> List[List[int]]: m = len(heights) n = len(heights[0]) dirs = [0, 1, 0, -1, 0] q_p = deque() q_a = deque() seen_p = [[False] * n for _ in range(m)] seen_a = [[False] * n for _ in range(m)]...
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the message...
def test(): assert slider.input == 'range', 'Make sure you are creating slider range binding.' assert slider.name == 'Body mass (g)', 'Make sure you are providing the correct name to the slider range object.' assert slider.max == 6300.0, 'Make sure you are taking the max of the body_mass_g column in the sli...
class Note: def __init__(self, _time, _lineIndex, _lineLayer, _type, _cutDirection, **_customData): '''a note object which contains info on a note.\n `beat` - The beat of the note.\n `index` - The lineIndex of the note\n `layer` - The lineLayer of the note\n `type` - The note...
class Note: def __init__(self, _time, _lineIndex, _lineLayer, _type, _cutDirection, **_customData): """a note object which contains info on a note. `beat` - The beat of the note. `index` - The lineIndex of the note `layer` - The lineLayer of the note `type` - The note ty...
# IEDA adapter production config # IEDA sitemap index URL. The 'sitemap' paths below are appended to this URL. SITEMAP_ROOT = 'http://get.iedadata.org/sitemaps' GMN_BASE_URL = 'https://gmn.dataone.org/ieda' # Absolute path to the root of the certificate storage. The certificate paths below are # relative to this dire...
sitemap_root = 'http://get.iedadata.org/sitemaps' gmn_base_url = 'https://gmn.dataone.org/ieda' cert_path_root = '' sitemap_list = [{'sitemap': 'ecl_sitemap.xml', 'gmn_path': 'earthchem', 'cert_pem_path': 'client_cert.pem', 'cert_key_path': 'client_key_nopassword.pem'}, {'sitemap': 'mgdl_sitemap.xml', 'gmn_path': 'mgdl...
for n in range(1, 101): print( "FizzBuzz" if n % 15 == 0 else "Fizz" if n % 3 == 0 else "Buzz" if n % 5 == 0 else str(n) )
for n in range(1, 101): print('FizzBuzz' if n % 15 == 0 else 'Fizz' if n % 3 == 0 else 'Buzz' if n % 5 == 0 else str(n))
def job_count_to_simulation_count(job_count: int) -> int: if job_count <= 1: return job_count return job_count - 1
def job_count_to_simulation_count(job_count: int) -> int: if job_count <= 1: return job_count return job_count - 1
lons = np.array([-13.7, -10.8, -13.2, -96.8, -7.99, 7.5, -17.3, -3.7]) lats = np.array([9.6, 6.3, 8.5, 32.7, 12.5, 8.9, 14.7, 40.39]) cases = np.array([1971, 7069, 6073, 4, 6, 20, 1, 1]) deaths = np.array([1192, 2964, 1250, 1, 5, 8, 0, 0]) places = np.array(['Guinea', 'Liberia', 'Sierra Leone','United States', 'Mali', ...
lons = np.array([-13.7, -10.8, -13.2, -96.8, -7.99, 7.5, -17.3, -3.7]) lats = np.array([9.6, 6.3, 8.5, 32.7, 12.5, 8.9, 14.7, 40.39]) cases = np.array([1971, 7069, 6073, 4, 6, 20, 1, 1]) deaths = np.array([1192, 2964, 1250, 1, 5, 8, 0, 0]) places = np.array(['Guinea', 'Liberia', 'Sierra Leone', 'United States', 'Mali',...
Km = float(input('Quantos Km foram rodados pelo carro? ')) D = int(input('Por quantos dias o carro foi alugado? ')) P = (D * 60) + (Km * 0.15) print('Andando {:.2f}Km em {} dias, quem alugou o carro devera pagar R${:.2f}'.format(Km, D, P))
km = float(input('Quantos Km foram rodados pelo carro? ')) d = int(input('Por quantos dias o carro foi alugado? ')) p = D * 60 + Km * 0.15 print('Andando {:.2f}Km em {} dias, quem alugou o carro devera pagar R${:.2f}'.format(Km, D, P))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]: first,flag1,flag2,val1,val2,carry = 0,0,0,l1.v...
class Solution: def add_two_numbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]: (first, flag1, flag2, val1, val2, carry) = (0, 0, 0, l1.val, l2.val, 0) l3 = list_node() result = l3 while flag1 == 0 or flag2 == 0: if first == 1: ...
def base_to_dec(num, base): num = str(num) length = len(num) dec = 0 for i in range(length): dec = int(num[length - i - 1]) * (base ** i) + dec return dec def dec_to_base(dec, base): base_num = '' while dec != 0: rem = dec % base base_num = str(rem) + base_num ...
def base_to_dec(num, base): num = str(num) length = len(num) dec = 0 for i in range(length): dec = int(num[length - i - 1]) * base ** i + dec return dec def dec_to_base(dec, base): base_num = '' while dec != 0: rem = dec % base base_num = str(rem) + base_num ...
# 2020.01.13 # Problem Statement: # https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ # Finally figured out when to push a new array to the list of arries # Referred to the DFS solution here: # https://leetcode.com/problems/binary-tree-level-order-traversal-ii/discuss/34970/Is-there-any-better-idea-th...
class Solution: def level_order_bottom(self, root: TreeNode) -> List[List[int]]: if not root: return [] self.answer = [] self.levelOrderBottomDFS(root, 0) return self.answer def level_order_bottom_dfs(self, root, level): if not root: return ...
def computepay(hours , rate ): if hours > 40.0: overtimePay = (hours * rate ) + (hours - 40.0) * (rate * 0.5) pay = overtimePay else: regularpay = hours * rate pay = regularpay return pay hoursWorked = input("Please enter the number of hours worked: ") hourlyRate = input...
def computepay(hours, rate): if hours > 40.0: overtime_pay = hours * rate + (hours - 40.0) * (rate * 0.5) pay = overtimePay else: regularpay = hours * rate pay = regularpay return pay hours_worked = input('Please enter the number of hours worked: ') hourly_rate = input('Pleas...
print(type(123)) print(type('')) print(type(None)) class Animal(object): def __init__(self): self.name = 'cc' self.__name = 'cc' def __len__(self): return 1 a = Animal() print(type(a)) print(type(a) == Animal) print(type(111) == int) print(type(a) == object) print(isinstance(a, obj...
print(type(123)) print(type('')) print(type(None)) class Animal(object): def __init__(self): self.name = 'cc' self.__name = 'cc' def __len__(self): return 1 a = animal() print(type(a)) print(type(a) == Animal) print(type(111) == int) print(type(a) == object) print(isinstance(a, object...
youtube_api_key = 'my_secret' #If you're looking through git history for my API key. That one was destroyed. :) #destroy and create new API key using # https://developers.google.com/youtube/registering_an_application
youtube_api_key = 'my_secret'
#!/usr/bin/env PYTHONHASHSEED=1234 python3 __all__ = ['Projectile'] class Projectile: def __init__(self, mass, velocity): self.mass = mass self.velocity = velocity
__all__ = ['Projectile'] class Projectile: def __init__(self, mass, velocity): self.mass = mass self.velocity = velocity
''' Access Specifier is used to define the class attribute accessing scope at outside of the class Access Specifiers: public => declare noraml way Ex:=> Myname = "Balavignesh" protected => Ex:=> _Myname = "Balavignesh" private => Ex:=> __Myname = "Balavignesh" ...
""" Access Specifier is used to define the class attribute accessing scope at outside of the class Access Specifiers: public => declare noraml way Ex:=> Myname = "Balavignesh" protected => Ex:=> _Myname = "Balavignesh" private => Ex:=> __Myname = "Balavignesh" ...
randList = ["string", 1.234, 28] # print(randList) # oneToTen = list(range(11)) # print(oneToTen) # # randList = randList + oneToTen # print(randList) # # # print(randList[0]) # # # print("List Length :", len(randList)) # # # first3 = randList[0:3] # print(first3) # print("string" in first3) # print("Index of string...
rand_list = ['string', 1.234, 28] print('Index of string :', first3.index('string'))
class MaxHeap: def __init__(self): self.heap = [] def push(self,value): self.heap.append(value) self.float_up(len(self.heap)-1) def float_up(self,index): if index==0: return else: if index%2==0: ...
class Maxheap: def __init__(self): self.heap = [] def push(self, value): self.heap.append(value) self.float_up(len(self.heap) - 1) def float_up(self, index): if index == 0: return else: if index % 2 == 0: parent_of_index = in...
L=list(map(int,input().split())) L1=[] L2=[] for i in L: if i!=0: L1+=[i] else: L2+=[i] print(L1+L2)
l = list(map(int, input().split())) l1 = [] l2 = [] for i in L: if i != 0: l1 += [i] else: l2 += [i] print(L1 + L2)
#!/usr/bin/env python3 def gitPull(repository): cmd = ['git', 'pull'] p = subprocess.Popen(cmd, cwd = repository) return p.wait() def gitClone(directory, repository): cmd = ['git', 'clone', repository] p = subprocess.Popen(cmd, cwd = directory) p.wait()
def git_pull(repository): cmd = ['git', 'pull'] p = subprocess.Popen(cmd, cwd=repository) return p.wait() def git_clone(directory, repository): cmd = ['git', 'clone', repository] p = subprocess.Popen(cmd, cwd=directory) p.wait()
nada = ['nada', 'cara', 'baka', 'muFja', 'iwika', 'iwiSa', 'upaka', 'lamaka', 'SalafkuSalafkaMca', 'sapwala', 'vAjapya', 'wika', 'agniSarmanvqSagaNe', 'prANa', 'nara', 'sAyaka', 'xAsa', 'miwra', 'xvIpa', 'pifgara', 'pifgala', 'kifkara', 'kifkala', 'kAwara', 'kAwala', 'kASya', 'kASyapa', 'kAvya', 'aja', 'amuRya', 'kqRNa...
nada = ['nada', 'cara', 'baka', 'muFja', 'iwika', 'iwiSa', 'upaka', 'lamaka', 'SalafkuSalafkaMca', 'sapwala', 'vAjapya', 'wika', 'agniSarmanvqSagaNe', 'prANa', 'nara', 'sAyaka', 'xAsa', 'miwra', 'xvIpa', 'pifgara', 'pifgala', 'kifkara', 'kifkala', 'kAwara', 'kAwala', 'kASya', 'kASyapa', 'kAvya', 'aja', 'amuRya', 'kqRNa...
#By using while loop:- list=[1,2,3,4,5,6,3,4,5,7,8,9,0] i=0 while i<len(list): print(list[i]) i=i+1 #by using for loop:- list=[1,2,3,4,5,6,7,8,3,4,5,8] for x in list: print(x)
list = [1, 2, 3, 4, 5, 6, 3, 4, 5, 7, 8, 9, 0] i = 0 while i < len(list): print(list[i]) i = i + 1 list = [1, 2, 3, 4, 5, 6, 7, 8, 3, 4, 5, 8] for x in list: print(x)
WEATHER_DATA = b''' Dy MxT MnT AvT HDDay AvDP 1HrP TPcpn WxType PDir AvSp Dir MxS SkyC MxR MnR AvSLP 1 1 2 74 53.8 0.00 F 280 9.6 270 17 1.6 93 23 1004.5 2 1 3 71 46.5 0.00 330 8.7 340 23 3.3 70 28 1004.5 3 1 4 66 39.6 ...
weather_data = b' Dy MxT MnT AvT HDDay AvDP 1HrP TPcpn WxType PDir AvSp Dir MxS SkyC MxR MnR AvSLP\n\n 1 1 2 74 53.8 0.00 F 280 9.6 270 17 1.6 93 23 1004.5\n 2 1 3 71 46.5 0.00 330 8.7 340 23 3.3 70 28 1004.5\n 3 1 4 66 39.6...
def Hello(name): print("hello:%s" % name) if __name__ == '__main__': Hello("fanpf")
def hello(name): print('hello:%s' % name) if __name__ == '__main__': hello('fanpf')
# -*- coding: utf-8 -*- seconds = int(input()) minutes = seconds / 60 hours = minutes / 60 print("%d:%d:%d" % (int(hours), int(minutes % 60), int(seconds % 60)))
seconds = int(input()) minutes = seconds / 60 hours = minutes / 60 print('%d:%d:%d' % (int(hours), int(minutes % 60), int(seconds % 60)))
self.description = "Replace a package providing package with actual package" sp = pmpkg("foo") self.addpkg2db("sync", sp) lp = pmpkg("bar") lp.provides = ["foo"] lp.conflicts = ["foo"] self.addpkg2db("local", lp) lp1 = pmpkg("pkg1") lp1.depends = ["foo"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.depends ...
self.description = 'Replace a package providing package with actual package' sp = pmpkg('foo') self.addpkg2db('sync', sp) lp = pmpkg('bar') lp.provides = ['foo'] lp.conflicts = ['foo'] self.addpkg2db('local', lp) lp1 = pmpkg('pkg1') lp1.depends = ['foo'] self.addpkg2db('local', lp1) lp2 = pmpkg('pkg2') lp2.depends = ['...
# -*- coding: utf-8 -*- ############################################################################### # # searchexception.py # # class SearchException: custom exception # ############################################################################### class SearchException(Exception): def __init__(self, *args): ...
class Searchexception(Exception): def __init__(self, *args): Exception.__init__(self, *args)
used_labels = [ # 'banded', # 'blotchy', # 'braided', # 'bubbly', # 'bumpy', 'chequered', # 'cobwebbed', # 'cracked', # 'crosshatched', 'crystalline', # 'dotted', 'fibrous', # 'flecked', # 'freckled', # 'frilly', # 'gauzy', # 'grid', #...
used_labels = ['chequered', 'crystalline', 'fibrous', 'lined', 'polka-dotted']
class EncodingHelper: @staticmethod def encodeArray(arrays): L = [] for array in arrays: lt = len(array) asBytes = lt.to_bytes(4, byteorder="big") L.append(asBytes + array) return b"".join(L) @staticmethod def decodeArray(barr): L = [...
class Encodinghelper: @staticmethod def encode_array(arrays): l = [] for array in arrays: lt = len(array) as_bytes = lt.to_bytes(4, byteorder='big') L.append(asBytes + array) return b''.join(L) @staticmethod def decode_array(barr): l ...
# -*- coding: utf-8 -*- AUDIODBKEY = '95424d43204d6564696538' AUDIODBURL = 'https://www.theaudiodb.com/api/v1/json/%s/%s' AUDIODBSEARCH = 'search.php?s=%s' AUDIODBDETAILS = 'artist-mb.php?i=%s' AUDIODBDISCOGRAPHY = 'discography-mb.php?s=%s' MUSICBRAINZURL = 'https://musicbrainz.org/ws/2/artist/%s' MUSICBRAINZSEARCH =...
audiodbkey = '95424d43204d6564696538' audiodburl = 'https://www.theaudiodb.com/api/v1/json/%s/%s' audiodbsearch = 'search.php?s=%s' audiodbdetails = 'artist-mb.php?i=%s' audiodbdiscography = 'discography-mb.php?s=%s' musicbrainzurl = 'https://musicbrainz.org/ws/2/artist/%s' musicbrainzsearch = '?query="%s"&fmt=json' mu...
imports = ["baseline_base.py"] device = torch.device( type_str="cuda", index=0, ) optimizer = torch.optim.Optimizer( optimizer_cls=torch.optim.Adam(), model=model, ) collate_fn = mlprogram.functools.Sequence( funcs=collections.OrderedDict( items=[ [ "to_episode", ...
imports = ['baseline_base.py'] device = torch.device(type_str='cuda', index=0) optimizer = torch.optim.Optimizer(optimizer_cls=torch.optim.Adam(), model=model) collate_fn = mlprogram.functools.Sequence(funcs=collections.OrderedDict(items=[['to_episode', mlprogram.functools.Map(func=to_episode)], ['flatten', flatten()],...
class SongCreator(): def __init__(self, session): self.session = session def create_in_batch(self, total, batch_size): raise NotImplementedError def batch_all(self, batch_size): raise NotImplementedError
class Songcreator: def __init__(self, session): self.session = session def create_in_batch(self, total, batch_size): raise NotImplementedError def batch_all(self, batch_size): raise NotImplementedError
# (C) William W. Cohen and Carnegie Mellon University, 2016 # # version number tracking for Tensorlog VERSION = '1.3.6' # externally visible changes: # # version 1.0: refactored cleaned-up version of nips-submission codebase # version 1.1: thread-safe gradient and eval computation, and a parallel learner # version 1....
version = '1.3.6'
# print("1 is a number") # print(300.99) # print(24 * 23 * 45) # print("30 days are " + str(30 * 24 * 60) + " seconds") # print(f"30 days are {30 * 24 * 60} minutes") # calculation_to_unit = 24 * 60 # name_of_unit = "minutes" # print(f"30 days are {30 * calculation_to_unit} {name_of_unit}") # print(f"40 day...
def day_to_unit11(days, conversion_unit): if conversion_unit == 'hour': return f'{days} days are {days * 24} hours' elif conversion_unit == 'minute': return f'{days} days are {days * 24 * 60} minutes' else: return 'you have entered unsupported conversion unit' def execute_and_valida...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( arr , n ) : result = 0 ; for i in range ( 0 , n ) : for j in range ( i + 1 , n ) : prod...
def f_gold(arr, n): result = 0 for i in range(0, n): for j in range(i + 1, n): product = arr[i] * arr[j] for k in range(0, n): if arr[k] == product: result = result + 1 break return result if __name__ == '__main__': ...
def absoluteValuesSumMinimization(a): sums = {} for num in a: total = sum([abs(a[i] - num) for i in range(len(a))]) if total not in sums: sums[total] = num return sums[min(sums)] if __name__ == "__main__": a= [-10, 100, 200, 300, 400, 500, 500, 500, 500, 500, 500, 500, 50...
def absolute_values_sum_minimization(a): sums = {} for num in a: total = sum([abs(a[i] - num) for i in range(len(a))]) if total not in sums: sums[total] = num return sums[min(sums)] if __name__ == '__main__': a = [-10, 100, 200, 300, 400, 500, 500, 500, 500, 500, 500, 500, 50...
def get_prime_number(num): print(num) is_prime = 0 if num > 0: for i in range(2, num): result = num % i #print("num: %s, i: %s , result: %s" % (num, i, result)) if num % i == 0: is_prime += 1 elif num == 0: pass elif num < 0: ...
def get_prime_number(num): print(num) is_prime = 0 if num > 0: for i in range(2, num): result = num % i if num % i == 0: is_prime += 1 elif num == 0: pass elif num < 0: pass if is_prime == 0: return True else: re...
''' 1. subproblems: dp(i, j): whether or not substring text[i : j] is a palindrome. 2. guesses: is the current substring dp(i, j) is a palindrome? 3. relate subproblems: 3.1 base case: dp(i, i) = T dp(i, i + 1) = T if text[i] = text[i + 1] 3.2 dp(i, j) = dp(i + 1, j - 1) if text[i] = text[j]...
""" 1. subproblems: dp(i, j): whether or not substring text[i : j] is a palindrome. 2. guesses: is the current substring dp(i, j) is a palindrome? 3. relate subproblems: 3.1 base case: dp(i, i) = T dp(i, i + 1) = T if text[i] = text[i + 1] 3.2 dp(i, j) = dp(i + 1, j - 1) if text[i] = text[j]...
#!/usr/bin/env python3 # https://codeforces.com/contest/4/problem/B def get_values(time, sumtime): studied_hours = [] total_min_time, total_max_time = 0, 0 for i in range(len(time)): total_min_time += time[i][0] total_max_time += time[i][1] if total_min_time <= sumtime and sumtime...
def get_values(time, sumtime): studied_hours = [] (total_min_time, total_max_time) = (0, 0) for i in range(len(time)): total_min_time += time[i][0] total_max_time += time[i][1] if total_min_time <= sumtime and sumtime <= total_max_time: for (i, line) in enumerate(time): ...
output = 0 count = int(input()) value = (input()) var = input() if var != "": value = value+" "+var lt = value.split() print(lt) while count > 0: count -= 1 output += int(lt[count]) print(output)
output = 0 count = int(input()) value = input() var = input() if var != '': value = value + ' ' + var lt = value.split() print(lt) while count > 0: count -= 1 output += int(lt[count]) print(output)
class Node: def __init__(self, prevNode=None, nextNode=None, surface='', feature='') -> None: self.surface = surface self.feature = feature self.prev = prevNode self.next = nextNode class Tagger: def __init__(self) -> None: pass def parseToNode(self, parsed_text: ...
class Node: def __init__(self, prevNode=None, nextNode=None, surface='', feature='') -> None: self.surface = surface self.feature = feature self.prev = prevNode self.next = nextNode class Tagger: def __init__(self) -> None: pass def parse_to_node(self, parsed_text...
def veriVertiHori(L): for i in range(9): if (len(set(L[i]))<9) or (len(set([row[i] for row in L]))<9): return 0 return 1 def square(L): for i in range(0,9,3): for j in range(0,9,3): a=[] for k in range(3): for l in range(3): ...
def veri_verti_hori(L): for i in range(9): if len(set(L[i])) < 9 or len(set([row[i] for row in L])) < 9: return 0 return 1 def square(L): for i in range(0, 9, 3): for j in range(0, 9, 3): a = [] for k in range(3): for l in range(3): ...
def test_busca_cep_previous_found(correios): objeto = correios.busca_por_cep( cep="28620000", start_cod="QC067757540BR", previous=5, next=0 ) assert objeto == "QC067757494BR" def test_busca_cep_next_found(correios): objeto = correios.busca_por_cep( cep="28620000", start_cod="QC0677574...
def test_busca_cep_previous_found(correios): objeto = correios.busca_por_cep(cep='28620000', start_cod='QC067757540BR', previous=5, next=0) assert objeto == 'QC067757494BR' def test_busca_cep_next_found(correios): objeto = correios.busca_por_cep(cep='28620000', start_cod='QC067757400BR', previous=0, next=9...
"Shows how you might create a macro for the autogeneratd Jest rule" # https://github.com/bazelbuild/rules_nodejs/blob/89e04753b2e795d27afadd3b3a8f54931041edc6/examples/jest/jest.bzl#L1 load("@npm//jest-cli:index.bzl", "jest", _jest_test = "jest_test") load("@npm//@bazel/typescript:index.bzl", "ts_library") def jest_t...
"""Shows how you might create a macro for the autogeneratd Jest rule""" load('@npm//jest-cli:index.bzl', 'jest', _jest_test='jest_test') load('@npm//@bazel/typescript:index.bzl', 'ts_library') def jest_test(name, srcs, deps, jest_config=None, data=None, **kwargs): """A macro around the autogenerated jest_test rule...
if __name__ == '__main__': countries = set() for _ in range(int(input("Enter number of countries: "))): countries.add(input("Enter one country: ")) print("Number of distinct countries: {}".format(len(countries)))
if __name__ == '__main__': countries = set() for _ in range(int(input('Enter number of countries: '))): countries.add(input('Enter one country: ')) print('Number of distinct countries: {}'.format(len(countries)))
# Data processing with open('input') as f: in_data = [int(line.rstrip()) for line in f] in_data.append(max(in_data)+3) in_data.append(0) in_data.sort() diff_1 = 0 diff_3 = 0 for i in range(1, len(in_data)): diff = in_data[i] - in_data[i-1] if diff == 1: diff_1+=1 elif diff == 3: diff_...
with open('input') as f: in_data = [int(line.rstrip()) for line in f] in_data.append(max(in_data) + 3) in_data.append(0) in_data.sort() diff_1 = 0 diff_3 = 0 for i in range(1, len(in_data)): diff = in_data[i] - in_data[i - 1] if diff == 1: diff_1 += 1 elif diff == 3: diff_3 += 1 print(di...
class Node: def __init__(self,data): self.data=data self.next=None class LinkedList: def __init__(self): self.head=None def push(self,data): new_node=Node(data) new_node.next=self.head self.head=new_node def middle(self): first_ptr=self.head second_ptr=self.head while(first_ptr.next!=None): ...
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def push(self, data): new_node = node(data) new_node.next = self.head self.head = new_node def middle(self): first_p...
POINT = {"type": "Point", "coordinates": [-140.0, 35.0]} POLYGON = { "type": "Polygon", "coordinates": [ [[-95.0, 42.0], [-93.0, 42.0], [-93.0, 40.0], [-95.0, 41.0], [-95.0, 42.0]] ], }
point = {'type': 'Point', 'coordinates': [-140.0, 35.0]} polygon = {'type': 'Polygon', 'coordinates': [[[-95.0, 42.0], [-93.0, 42.0], [-93.0, 40.0], [-95.0, 41.0], [-95.0, 42.0]]]}
class Solution: def fourSumCount(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: List[int]) -> int: cnt = 0 m = {} for num1 in nums1: for num2 in nums2: m[num1 + num2] = m.get(num1 + num2, 0) + 1 for num3 in nums3: for num4 i...
class Solution: def four_sum_count(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: List[int]) -> int: cnt = 0 m = {} for num1 in nums1: for num2 in nums2: m[num1 + num2] = m.get(num1 + num2, 0) + 1 for num3 in nums3: for num...
class Solution: def floodFill(self, image: list[list[int]], row: int, col: int, new_color: int) -> list[list[int]]: if len(image) == 0: return image rows, cols = len(image), len(image[0]) original_color = image[row][col] # Edge case: start color is already the same as e...
class Solution: def flood_fill(self, image: list[list[int]], row: int, col: int, new_color: int) -> list[list[int]]: if len(image) == 0: return image (rows, cols) = (len(image), len(image[0])) original_color = image[row][col] if original_color == new_color: r...
connect('<OIG_WEBLOGIC_USER>','<OIG_WEBLOGIC_PWD>','t3://<OIG_DOMAIN_NAME>-adminserver.<OIGNS>.svc.cluster.local:<OIG_ADMIN_PORT>') grantAppRole(appStripe="soa-infra", appRoleName="SOAAdmin",principalClass="weblogic.security.principal.WLSGroupImpl", principalName="<OUD_WLSADMIN_GRP>") grantAppRole(appStripe="wsm-pm", ...
connect('<OIG_WEBLOGIC_USER>', '<OIG_WEBLOGIC_PWD>', 't3://<OIG_DOMAIN_NAME>-adminserver.<OIGNS>.svc.cluster.local:<OIG_ADMIN_PORT>') grant_app_role(appStripe='soa-infra', appRoleName='SOAAdmin', principalClass='weblogic.security.principal.WLSGroupImpl', principalName='<OUD_WLSADMIN_GRP>') grant_app_role(appStripe='wsm...
#var #i: inteiro for i in range(0,21,2): print(i)
for i in range(0, 21, 2): print(i)
i = 4 d = 4.0 s = 'HackerRank ' # Declare second integer, double, and String variables. second = int(input()) double = float(input()) string = str(input()) # Print the sum of both integer variables on a new line. print(i+second) # Print the sum of the double variables on a new line. print(d+double) # Concatenate an...
i = 4 d = 4.0 s = 'HackerRank ' second = int(input()) double = float(input()) string = str(input()) print(i + second) print(d + double) print(s + string)
# -*- coding: utf-8 -*- # **************************************** # * Pywikibot settings file for this bot * # **************************************** # Required by Pywikibot, but not needed for anything we use mylang = 'en' family = 'wikipedia' # Username across the cluster usernames['wikipedia']['*'] = \ user...
mylang = 'en' family = 'wikipedia' usernames['wikipedia']['*'] = usernames['wikibooks']['*'] = usernames['wikinews']['*'] = usernames['wikiquote']['*'] = usernames['wikisource']['*'] = usernames['wikiversity']['*'] = usernames['wikivoyage']['*'] = usernames['wiktionary']['*'] = usernames['test']['*'] = 'Community Tech ...
FibMem = {} def fib_mem(n): if n < 2: return n if FibMem.get(n) is None: FibMem[n] = fib_mem(n-1) + fib_mem(n-2) return FibMem[n] FibTab = {0: 0, 1: 1} def fib_tab(n): if FibTab.get(n) is None: for n in range(2, n+1): # print(n) FibTab[n] = FibTab[n-...
fib_mem = {} def fib_mem(n): if n < 2: return n if FibMem.get(n) is None: FibMem[n] = fib_mem(n - 1) + fib_mem(n - 2) return FibMem[n] fib_tab = {0: 0, 1: 1} def fib_tab(n): if FibTab.get(n) is None: for n in range(2, n + 1): FibTab[n] = FibTab[n - 1] + FibTab[n - 2...
def test(t, _): with t("Reduces something"): t@{ "it": "works", "i": (lambda a, b: a + b, 0, [1, 2, 3, 4]), "e": 10 }
def test(t, _): with t('Reduces something'): t @ {'it': 'works', 'i': (lambda a, b: a + b, 0, [1, 2, 3, 4]), 'e': 10}
def nearest_library(street_address, zip, lat, lon): libraries = [{'id': 1, 'name': 'East Regional Library', 'address': '211 Lick Creek Lane', 'phone': '(919) 560-0203', 'url': 'https://durhamcountylibrary.org/location/east/', 'lat': 35.977852, 'lon': -78.8102151706306}, {'id': 2, 'name': 'North Regional L...
def nearest_library(street_address, zip, lat, lon): libraries = [{'id': 1, 'name': 'East Regional Library', 'address': '211 Lick Creek Lane', 'phone': '(919) 560-0203', 'url': 'https://durhamcountylibrary.org/location/east/', 'lat': 35.977852, 'lon': -78.8102151706306}, {'id': 2, 'name': 'North Regional Library', '...
# # Copyright (C) Intel Corporation. All rights reserved. # Licensed under the MIT License. # # tool version: <major version>.<minor version>.<micro version> # <major version> increase the version for any new feature, major feature update # <minor version> increase the version for any function change (new/modify funct...
version = '2.5.1'
class StarshipRadiators: name = "Starship Integrated Radiators" params = [ { "key": "deep_space_max_heat_rejection_kw", "label": "", "units": "kw", "private": False, "value": 200, "confidence": 0, "notes": "", ...
class Starshipradiators: name = 'Starship Integrated Radiators' params = [{'key': 'deep_space_max_heat_rejection_kw', 'label': '', 'units': 'kw', 'private': False, 'value': 200, 'confidence': 0, 'notes': '', 'source': 'fake'}, {'key': 'mars_max_heat_rejection_kw', 'label': '', 'units': 'kw', 'private': False, '...
n = int(input()) ar = [] bestvals = [] best_stored =[0]*n for x in range(n): ar.append(int(input())) best_stored.append(0) best_stored[0] = 1 for i in range(n): maxval = 1 for j in range(i): if((ar[i] % ar[j]) ==0): maxval = max(maxval,(best_stored[j])+1) best_stored[i] = maxval print(max(best_...
n = int(input()) ar = [] bestvals = [] best_stored = [0] * n for x in range(n): ar.append(int(input())) best_stored.append(0) best_stored[0] = 1 for i in range(n): maxval = 1 for j in range(i): if ar[i] % ar[j] == 0: maxval = max(maxval, best_stored[j] + 1) best_stored[i] = maxval pr...
pycos_version = "p/b" reset_causes = ["PWRON", "HARD", "WDT", "DEEPSLEEP", "SOFT"] sysconfig_path = "/system/sysconfig.json" usrconfig_path = "/system/usrconfig.json"
pycos_version = 'p/b' reset_causes = ['PWRON', 'HARD', 'WDT', 'DEEPSLEEP', 'SOFT'] sysconfig_path = '/system/sysconfig.json' usrconfig_path = '/system/usrconfig.json'
a, b = 0, 1 index = 0 while True: a, b = b, a + b index+=1 if len(str(a)) >= 1000: break print(index)
(a, b) = (0, 1) index = 0 while True: (a, b) = (b, a + b) index += 1 if len(str(a)) >= 1000: break print(index)
# Copyright 2021 Pants project contributors. # Licensed under the Apache License, Version 2.0 (see LICENSE). DEV_PORTS = { "helloworld.service.frontend": 8000, "helloworld.service.admin": 8001, "helloworld.service.user": 8010, "helloworld.service.welcome": 8020, } def get_dev_port(service: str) -> i...
dev_ports = {'helloworld.service.frontend': 8000, 'helloworld.service.admin': 8001, 'helloworld.service.user': 8010, 'helloworld.service.welcome': 8020} def get_dev_port(service: str) -> int: try: return DEV_PORTS[service] except KeyError: raise value_error(f'No dev port found for service {serv...
#Make your Discord app a Bot discord = dict( key = "<TOKEN>" ) #Click on "Keys and Access Tokens" on your Twitter App page. twitter = dict( consumer_key = "<KEY>", consumer_secret = "<SECRET>", access_token = "<TOKEN>", access_secret = "<TOKEN SECRET>" )
discord = dict(key='<TOKEN>') twitter = dict(consumer_key='<KEY>', consumer_secret='<SECRET>', access_token='<TOKEN>', access_secret='<TOKEN SECRET>')
class_ = ''' [COMMENT_LINE_IMPORTS] # System # Pip # Local [COMMENT_LINE] [COMMENT_LINE_CLASS_NAME] class [CLASS_NAME]: [TAB][COMMENT_LINE_INIT] [TAB]def __init__( [TAB][TAB]self [TAB]): [TAB][TAB]return [TAB][COMMENT_LINE_PUBLIC_PROPERTIES] [TAB][COMMENT_LINE_PUBLIC_METHODS] [TAB][COMMENT_LINE_P...
class_ = '\n[COMMENT_LINE_IMPORTS]\n\n# System\n\n\n# Pip\n\n\n# Local\n\n\n[COMMENT_LINE]\n\n\n\n[COMMENT_LINE_CLASS_NAME]\n\nclass [CLASS_NAME]:\n\n[TAB][COMMENT_LINE_INIT]\n\n[TAB]def __init__(\n[TAB][TAB]self\n[TAB]):\n[TAB][TAB]return\n\n\n[TAB][COMMENT_LINE_PUBLIC_PROPERTIES]\n\n\n\n\n[TAB][COMMENT_LINE_PUBLIC_ME...
# Variables to use during game. flag_variables = { 'variable1': False, 'variable2': False } dialog_settings = { 'width': '80%', 'height': '20%', 'max_lines': 'auto', 'txt_wrap_length': 70, # Can also use 'auto' to fit between x_txt_padding 'gradual_typing': True, 'typing_speed': 15, # ...
flag_variables = {'variable1': False, 'variable2': False} dialog_settings = {'width': '80%', 'height': '20%', 'max_lines': 'auto', 'txt_wrap_length': 70, 'gradual_typing': True, 'typing_speed': 15, 'font_name': 'Georgia', 'font_size': 25, 'bold': False, 'name_tag_font_size': 40, 'name_tag_y': -35, 'name_tag_x_multiplie...
#!/usr/bin/python3 for i in range(10): for j in range(10): if i < j: print("{:d}{:d},".format(i, j), end=" ")
for i in range(10): for j in range(10): if i < j: print('{:d}{:d},'.format(i, j), end=' ')
''' Leap Year har 4 saal me ek baar ahta hai aur woh bi ush saal me joh 4 se divisible hota hai. Lekin saat hi agar woh saal 100 se divisible hai toh ushe 400 se divisible hona padega warna woh Leap Year nhi kehlayega. Eg: 1800 Leap Year nhi hai kyunki yeh 100 se divisible hai magar 400 se divisible nhi hai 2000 Leap ...
""" Leap Year har 4 saal me ek baar ahta hai aur woh bi ush saal me joh 4 se divisible hota hai. Lekin saat hi agar woh saal 100 se divisible hai toh ushe 400 se divisible hona padega warna woh Leap Year nhi kehlayega. Eg: 1800 Leap Year nhi hai kyunki yeh 100 se divisible hai magar 400 se divisible nhi hai 2000 Leap ...
def main(): print("What is your name?") name=input("") print("What is your favorite animal?") animal=input("") print("Oh! So your name is",name,"and your favorite animal is a",animal,"? Cool!") main()
def main(): print('What is your name?') name = input('') print('What is your favorite animal?') animal = input('') print('Oh! So your name is', name, 'and your favorite animal is a', animal, '? Cool!') main()
defaults = { 'gamma': 0.99, # Multiplier to reduce step size if domain is invalid 'd': 5, # Diagonal offset for generating PD matrix 'p': 0, # Multiplier for offsetting negative entropy from zero 'max_domain_iterations': 300000, # Per calculation, max amount of laps } simple_test_params = { 'Ma...
defaults = {'gamma': 0.99, 'd': 5, 'p': 0, 'max_domain_iterations': 300000} simple_test_params = {'MatrixSquareSum': {'params': {'NewtonsMethod': {'tolerance': [0.0001], 'max_iterations': [10000]}, 'GradientDescentMethod': {'tolerance': [0.0001], 'max_iterations': [10000]}, 'ConjugateGradientMethod': {'tolerance': [0.0...
# Time: O(n^2) # Space: O(n) class Solution: def gcd(self, a, b): return gcd(b % a, a) if a != 0 else b def maxPoints(self, points: List[List[int]]) -> int: if not points: return 0 pointsInLine = {} for i in range(len(points)): for j in range(i+1...
class Solution: def gcd(self, a, b): return gcd(b % a, a) if a != 0 else b def max_points(self, points: List[List[int]]) -> int: if not points: return 0 points_in_line = {} for i in range(len(points)): for j in range(i + 1, len(points)): ...
# format: [[type, opcode/funct], operands...] # operands: # d, s, t - registers # i<number> - <number>-bit integer instructions = { "add" : [['R', '100000'], 'd', 's', 't'], "addi" : [['I', '001000'], 't', 's', 'i16'], "addiu" : [['I', '001001'], 't', 's', 'i16'], "addu" : [['R', '100001'], 'd', 's...
instructions = {'add': [['R', '100000'], 'd', 's', 't'], 'addi': [['I', '001000'], 't', 's', 'i16'], 'addiu': [['I', '001001'], 't', 's', 'i16'], 'addu': [['R', '100001'], 'd', 's', 't'], 'and': [['R', '100100'], 'd', 's', 't'], 'andi': [['I', '001100'], 't', 's', 'i16'], 'lui': [['I', '001111'], 't', 'i16'], 'slti': [...
# # PySNMP MIB module IPX-PRIVATE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPX-PRIVATE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:56:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint) ...
class Motor: def __init__(self, port, direction=None, gears=None): pass def dc(self, duty): pass def angle(self): return 0.0 def speed(self, ) : return 100.0 def stop(self, stop_type=None) : pass def run(self, speed) : pass def run_time(self, speed, time, stop_type=None, wait=True) : p...
class Motor: def __init__(self, port, direction=None, gears=None): pass def dc(self, duty): pass def angle(self): return 0.0 def speed(self): return 100.0 def stop(self, stop_type=None): pass def run(self, speed): pass def run_time(self,...
expected_output = { "directory": { "/bin": { "available": 26637041664, "filesystem": "/dev/mapper/vg_ifc0-boot", "mounted_on": "/bin", "total": 42141548544, "use_percentage": 34, "used": 13340246016 }, "/data/techsupport...
expected_output = {'directory': {'/bin': {'available': 26637041664, 'filesystem': '/dev/mapper/vg_ifc0-boot', 'mounted_on': '/bin', 'total': 42141548544, 'use_percentage': 34, 'used': 13340246016}, '/data/techsupport': {'available': 39721684992, 'filesystem': '/dev/mapper/vg_ifc0-techsupport', 'mounted_on': '/data/tech...