content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# HEAD # Destructing or Multiple Assignment Operators # DESCRIPTION # Describe incorrect usage of # multiple assignation which throws error # RESOURCES # # The number of items in the destructuring # have to be the same as variables used for assignation cat = ['fat', 'orange', 'loud'] # Will give an err...
cat = ['fat', 'orange', 'loud'] (size, color, disposition, name) = cat
pkg_dnf = { 'bind-utils': {}, 'bzip2': {}, 'coreutils': {}, 'curl': {}, 'diffutils': {}, 'file': {}, 'gcc': {}, 'gcc-c++': {}, 'git': {}, 'grep': {}, 'gzip': {}, 'hexedit': {}, 'hostname': {}, 'iotop': {}, 'iputils': {}, 'less': {}, 'lsof': {}, 'ly...
pkg_dnf = {'bind-utils': {}, 'bzip2': {}, 'coreutils': {}, 'curl': {}, 'diffutils': {}, 'file': {}, 'gcc': {}, 'gcc-c++': {}, 'git': {}, 'grep': {}, 'gzip': {}, 'hexedit': {}, 'hostname': {}, 'iotop': {}, 'iputils': {}, 'less': {}, 'lsof': {}, 'lynx': {}, 'man-db': {}, 'mlocate': {}, 'ncdu': {}, 'net-tools': {}, 'nmap'...
"""NVX Impedance data.""" class Impedance: """Impedance holds impedance data from all EEG channels, as well as GND.""" _INVALID = 2147483647 # INT_MAX (assuming int is 4 bytes) """Invalid (not connected) impedance value.""" def __init__(self, raw_data, count_eeg): self.raw_data = raw_data ...
"""NVX Impedance data.""" class Impedance: """Impedance holds impedance data from all EEG channels, as well as GND.""" _invalid = 2147483647 'Invalid (not connected) impedance value.' def __init__(self, raw_data, count_eeg): self.raw_data = raw_data self.count_eeg = count_eeg def ...
# A - Set Lot Charge, Piece Price, Added Lead Time variables lot_charge = var('Lot Charge', 0, 'Lot charge for outside_service service', currency) piece_price = var('Piece Price', 0, 'Price per unit for the outside_service service', currency) added_lead_time = var('Added Lead Time', 0, 'Days of added lead time for outs...
lot_charge = var('Lot Charge', 0, 'Lot charge for outside_service service', currency) piece_price = var('Piece Price', 0, 'Price per unit for the outside_service service', currency) added_lead_time = var('Added Lead Time', 0, 'Days of added lead time for outside_service service', number) extended_price = part.qty * pie...
# # PySNMP MIB module ZHONE-GEN-VOICESTAT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-GEN-VOICESTAT # Produced by pysmi-0.3.4 at Wed May 1 15:47:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ...
'''https://practice.geeksforgeeks.org/problems/common-elements1132/1 Common elements Easy Accuracy: 38.69% Submissions: 81306 Points: 2 Given three arrays sorted in increasing order. Find the elements that are common in all three arrays. Note: can you take care of the duplicates without using any additional Data Struc...
"""https://practice.geeksforgeeks.org/problems/common-elements1132/1 Common elements Easy Accuracy: 38.69% Submissions: 81306 Points: 2 Given three arrays sorted in increasing order. Find the elements that are common in all three arrays. Note: can you take care of the duplicates without using any additional Data Struc...
# the follow code is for key handover KEY_ACCEPTED = 1 KEY_NOT_ACCEPTED = 0 KEY_DESTINATION = 0 KEY_ESTATE = 1 KEY_ILOCK = 2 KEY_OTHER = 3 # the follow code is for note NOTE_USED = 1 NOTE_DISCARDED = 0 NOTE_TYPE_HOME = 0 NOTE_TYPE_OFFER = 1 NOTE_TYPE_USER = 2 # the follow code is for Utility UTILITY_USED = 1 UTILI...
key_accepted = 1 key_not_accepted = 0 key_destination = 0 key_estate = 1 key_ilock = 2 key_other = 3 note_used = 1 note_discarded = 0 note_type_home = 0 note_type_offer = 1 note_type_user = 2 utility_used = 1 utility_discarded = 0 is_active_used = 1 is_active_discarded = 0 offer_ready_message = 0 offer_finished_message...
class Tile: """ map tile properties like opacity and movement block """ def __init__(self,blocked, block_sight=None): self.blocked = blocked #default movement blocking causes sight blocking if block_sight is None: block_sight = blocked self.b...
class Tile: """ map tile properties like opacity and movement block """ def __init__(self, blocked, block_sight=None): self.blocked = blocked if block_sight is None: block_sight = blocked self.block_sight = block_sight
def mergeSort(lst): pass print(mergeSort([2,3,4,5,15,19,26,27,36,38,44,46,47,48,50] ))
def merge_sort(lst): pass print(merge_sort([2, 3, 4, 5, 15, 19, 26, 27, 36, 38, 44, 46, 47, 48, 50]))
def attach_label_operation(label_id: 'Long' = None, campaign_id: 'Long' = None, ad_id: 'Long' = None, ad_group_id: 'Long' = None, criterion_id: 'Long' = None, customer_id: 'Long' = None, operator: 'String' = 'ADD', ...
def attach_label_operation(label_id: 'Long'=None, campaign_id: 'Long'=None, ad_id: 'Long'=None, ad_group_id: 'Long'=None, criterion_id: 'Long'=None, customer_id: 'Long'=None, operator: 'String'='ADD', **kwargs): operation = {'operator': operator.upper(), 'operand': {'labelId': label_id}} if customer_id: ...
"""Regression Follow jupyter notebook workflow for better understanding of how to apply data_reader and Regression model to train your AI. https://kotsky.github.io/projects/ai_from_scratch/regression_workflow.html Jupiter notebook: https://github.com/kotsky/ai-dev/blob/main/regression_workflow.ipynb Package:...
"""Regression Follow jupyter notebook workflow for better understanding of how to apply data_reader and Regression model to train your AI. https://kotsky.github.io/projects/ai_from_scratch/regression_workflow.html Jupiter notebook: https://github.com/kotsky/ai-dev/blob/main/regression_workflow.ipynb Package: https:/...
# Source : https://leetcode.com/problems/shortest-palindrome/ # Author : henrytine # Date : 2020-07-23 ##################################################################################################### # # Given a string s, you are allowed to convert it to a palindrome by adding characters in front of # it. Fin...
class Solution: def shortest_palindrome(self, s: str) -> str: r = s[::-1] for i in range(len(s) + 1): if s.startswith(r[i:]): return r[:i] + s
# -*- coding: utf-8 -*- """ Created on Tue Feb 14 20:22:47 2017 @author: Zachary """ def f(i): return i + 2 def g(i): return i > 5 def applyF_filterG(L, f, g): listA = [] for i in L: if g(f(i)) == True: listA.append(i) L[:] = listA if len(L) == 0: ...
""" Created on Tue Feb 14 20:22:47 2017 @author: Zachary """ def f(i): return i + 2 def g(i): return i > 5 def apply_f_filter_g(L, f, g): list_a = [] for i in L: if g(f(i)) == True: listA.append(i) L[:] = listA if len(L) == 0: return -1 else: return ma...
def update_parameters(parameters, gradients, lr, batch_size, a): parameters["Wax"] = parameters["Wax"] - (lr/batch_size) * gradients["dWax"] parameters["Waa"] = parameters["Waa"] - (lr / batch_size) * gradients["dWaa"] parameters["ba"] = parameters["ba"] - (lr / batch_size) * gradients["dba"] if a == ...
def update_parameters(parameters, gradients, lr, batch_size, a): parameters['Wax'] = parameters['Wax'] - lr / batch_size * gradients['dWax'] parameters['Waa'] = parameters['Waa'] - lr / batch_size * gradients['dWaa'] parameters['ba'] = parameters['ba'] - lr / batch_size * gradients['dba'] if a == 'd': ...
#!/usr/bin/python3 s='ODITSZAPC' p='ba9876420' for comb in range(0, 2**9): x = comb i = 0 c = '' v = 0 while x != 0: f = x % 2 if f == 1: c += s[i] v += 1<<int(p[i], 16) i += 1 x = int(x/2) if c == '': continue print('Z%s = 0x%...
s = 'ODITSZAPC' p = 'ba9876420' for comb in range(0, 2 ** 9): x = comb i = 0 c = '' v = 0 while x != 0: f = x % 2 if f == 1: c += s[i] v += 1 << int(p[i], 16) i += 1 x = int(x / 2) if c == '': continue print('Z%s = 0x%x' % (c, v...
""" author : Ali Emre SAVAS Link : https://www.hackerrank.com/challenges/30-exceptions-string-to-integer/problem """ S = input().strip() try: print(int(S)) except: print("Bad String")
""" author : Ali Emre SAVAS Link : https://www.hackerrank.com/challenges/30-exceptions-string-to-integer/problem """ s = input().strip() try: print(int(S)) except: print('Bad String')
MAX_INT8 = 1 << 7 - 1 MIN_INT8 = -1 << 7 MAX_INT16 = 1 << 15 - 1 MIN_INT16 = -1 << 15 MAX_INT32 = 1 << 31 - 1 MIN_INT32 = -1 << 31 MAX_INT64 = 1 << 63 - 1 MIN_INT64 = -1 << 63 MAX_UINT8 = 1 << 8 - 1 MAX_UINT16 = 1 << 16 - 1 MAX_UINT32 = 1 << 32 - 1 MAX_UINT64 = 1 << 64 - 1
max_int8 = 1 << 7 - 1 min_int8 = -1 << 7 max_int16 = 1 << 15 - 1 min_int16 = -1 << 15 max_int32 = 1 << 31 - 1 min_int32 = -1 << 31 max_int64 = 1 << 63 - 1 min_int64 = -1 << 63 max_uint8 = 1 << 8 - 1 max_uint16 = 1 << 16 - 1 max_uint32 = 1 << 32 - 1 max_uint64 = 1 << 64 - 1
# board # display board # play game # handle turn # check win # check rows # check coumns # check diagonals # check tie # flip player #--------Global Variables------ #Game board board = ["-","-","-", "-","-","-", "-","-","-",] #if game is still going game_still_going = True #Who won? or tie? win...
board = ['-', '-', '-', '-', '-', '-', '-', '-', '-'] game_still_going = True winner = None current_player = 'X' def display_board(): print(board[0] + ' | ' + board[1] + ' | ' + board[2]) print(board[3] + ' | ' + board[4] + ' | ' + board[5]) print(board[6] + ' | ' + board[7] + ' | ' + board[8]) def play_g...
# -*- coding: utf-8 -*- """ Created on Fri Jun 30 18:29:52 2017 MIT 6.00.1x course on edX.org: Midterm P6 Task: Write a function that satisfies the docstring @author: Andrey Tymofeiuk Important: This code is placed at GitHub to track my progress in programming and to show my way of thinking. Also I will be ha...
""" Created on Fri Jun 30 18:29:52 2017 MIT 6.00.1x course on edX.org: Midterm P6 Task: Write a function that satisfies the docstring @author: Andrey Tymofeiuk Important: This code is placed at GitHub to track my progress in programming and to show my way of thinking. Also I will be happy if somebody will fin...
def __somefunc__(): return 42 def not_dunder_func(arg1, arg2): """Docstring of function1""" return 42
def __somefunc__(): return 42 def not_dunder_func(arg1, arg2): """Docstring of function1""" return 42
# 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, l2): p1=l1 p2=l2 count=0 while p1 and p2: count+=p1.val count+=p2.val ...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def add_two_numbers(self, l1, l2): p1 = l1 p2 = l2 count = 0 while p1 and p2: count += p1.val count += p2.val p1.val = coun...
height = 6 num = 1 for i in range(height,-height-1,-1): for j in range(1,abs(i)+1): print(end=" ") if(i >= 0) : num = 1 else: num = abs(i) + 1; for j in range(height,abs(i)+1,-1): print(num,end=" ") num += 1 print() # ...
height = 6 num = 1 for i in range(height, -height - 1, -1): for j in range(1, abs(i) + 1): print(end=' ') if i >= 0: num = 1 else: num = abs(i) + 1 for j in range(height, abs(i) + 1, -1): print(num, end=' ') num += 1 print()
f1 = 1 f2 = 2 not_a_flag = 3 print("step: 1") print("stat_1: 0.5") print("stat_2: 0.6") print("step: 2") print("stat_1: 0.7") print("stat_2: 0.8")
f1 = 1 f2 = 2 not_a_flag = 3 print('step: 1') print('stat_1: 0.5') print('stat_2: 0.6') print('step: 2') print('stat_1: 0.7') print('stat_2: 0.8')
# -*- coding: utf-8 -*- """ Created on Sun Oct 27 00:30:31 2019 dogName1 = "One" dogName2 = "Two" dogName3 = "Three" dogName4 = "Four" dogName5 = "Five" dogName6 = "Six" @author: Gunardi Saputra """ print("Enter the name of dog 1: ") dogName1 = input() print("Enter the name of dog 2: ") dogName2 = input() print("E...
""" Created on Sun Oct 27 00:30:31 2019 dogName1 = "One" dogName2 = "Two" dogName3 = "Three" dogName4 = "Four" dogName5 = "Five" dogName6 = "Six" @author: Gunardi Saputra """ print('Enter the name of dog 1: ') dog_name1 = input() print('Enter the name of dog 2: ') dog_name2 = input() print('Enter the name of dog 3: ...
load("@obazl_rules_ocaml//ocaml:providers.bzl", "OpamConfig", "BuildConfig") opam_pkg = { "async": ["v0.12.0"], "bignum": ["v0.12.0"], # WARNING: depends on zarith which depends on libgmp-dev on local system "bin_prot": ["v0.12.0"], "core": ["v0.12.1"], "core_kernel": ["v0.12.3"], "digestif": [...
load('@obazl_rules_ocaml//ocaml:providers.bzl', 'OpamConfig', 'BuildConfig') opam_pkg = {'async': ['v0.12.0'], 'bignum': ['v0.12.0'], 'bin_prot': ['v0.12.0'], 'core': ['v0.12.1'], 'core_kernel': ['v0.12.3'], 'digestif': ['0.9.0'], 'fieldslib': ['v0.12.0'], 'num': ['1.1'], 'ppx_assert': ['v0.12.0', ['ppx_assert.runtime-...
keyFinancialIncomeStatement = [ # Valuation Measures "Revenue", "Total Revenue", "Cost of Revenue", ]
key_financial_income_statement = ['Revenue', 'Total Revenue', 'Cost of Revenue']
def classic_levenshtein(string_1, string_2): """ Calculates the Levenshtein distance between two strings. This version is easier to read, but significantly slower than the version below (up to several orders of magnitude). Useful for learning, less so otherwise. Usage:: >>> classic_le...
def classic_levenshtein(string_1, string_2): """ Calculates the Levenshtein distance between two strings. This version is easier to read, but significantly slower than the version below (up to several orders of magnitude). Useful for learning, less so otherwise. Usage:: >>> classic_le...
""" 981 time based key-value store medium Create a timebased key-value store class TimeMap, that supports two operations. 1. set(string key, string value, int timestamp) Stores the key and value, along with the given timestamp. 2. get(string key, int timestamp) Returns a value such that set(key, value, timestamp_pr...
""" 981 time based key-value store medium Create a timebased key-value store class TimeMap, that supports two operations. 1. set(string key, string value, int timestamp) Stores the key and value, along with the given timestamp. 2. get(string key, int timestamp) Returns a value such that set(key, value, timestamp_pr...
""" Module: 'network' on pySBC 1.13.0 with FW1.5.12-264 """ # MCU: (sysname='pySBC', nodename='pySBC', release='1.13.0 with FW1.5.12', version='v1.13-264-gb0c6ec5bb-dirty on 2020-11-25', machine='simpleRTK-SBC with STM32F745') # Stubber: 1.3.4 class SMS: '' def callback(): pass def send(): pass def isbusy()...
""" Module: 'network' on pySBC 1.13.0 with FW1.5.12-264 """ class Sms: """""" def callback(): pass def send(): pass def isbusy(): pass def iserror(): pass class Gsm: """""" authtype_chap = 2 authtype_eap = 5 authtype_mschap = 3 authtype_mscha...
# Author: Ben Wichser # Date: 12/12/2019 # Description: Jupiter oon movement. see www.adventofcode.com/2019 (day 12) for more information class Moon: """ Moon class.""" def __init__(self, position_x, position_y, position_z): """Initialization. Creates moon at given position. Creates initial veloc...
class Moon: """ Moon class.""" def __init__(self, position_x, position_y, position_z): """Initialization. Creates moon at given position. Creates initial velocity of zero in all three dimensions as well.""" self.position_x = position_x self.position_y = position_y self.positio...
# -*- coding: utf-8 -*- """ Created on Sun Feb 26 17:29:16 2017 @author: Thautwarm """ template=\ """ package _PACKAGE_; import _ENTITY_PACKAGE_; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import GraceJava.SQL; import GraceJava.ToStr; public class _ENTITY_CLASS_NAME_Dao exten...
""" Created on Sun Feb 26 17:29:16 2017 @author: Thautwarm """ template = '\npackage _PACKAGE_;\nimport _ENTITY_PACKAGE_;\nimport java.sql.ResultSet;\nimport java.sql.SQLException;\nimport java.util.ArrayList;\nimport GraceJava.SQL;\nimport GraceJava.ToStr;\npublic class _ENTITY_CLASS_NAME_Dao extends SQL{\n\n\tpublic...
def wordInTarget(word, target): ''' Can a 'word', be made using letters from 'target'. ''' targetlist = list(target) i = 0 while i < len(word): letter = word[i] if letter in targetlist: targetlist.remove(letter) i += 1 else: ...
def word_in_target(word, target): """ Can a 'word', be made using letters from 'target'. """ targetlist = list(target) i = 0 while i < len(word): letter = word[i] if letter in targetlist: targetlist.remove(letter) i += 1 else: return Fa...
N = int(input()) first_word = input() W = [input() for _ in range(N - 1)] last = first_word[-1] word_set = set([first_word]) for w in W: if w[0] != last or w in word_set: print("No") break word_set.add(w) last = w[-1] else: print("Yes")
n = int(input()) first_word = input() w = [input() for _ in range(N - 1)] last = first_word[-1] word_set = set([first_word]) for w in W: if w[0] != last or w in word_set: print('No') break word_set.add(w) last = w[-1] else: print('Yes')
''' este grupo de numeros tiene un bucle, digamos que hacemos el algoritmo para "x" numero la sucesion comenzara con (2, 2x, 2, ... , 2, 2x, 2, ...) donde ... es un bucle entonces cuando 2x aparezca por segunda vez cortamos alli la sucesion y sacamos el maximo ''' def algoritmo(a): lista = [] i = 0 cont = 0 xam = ...
""" este grupo de numeros tiene un bucle, digamos que hacemos el algoritmo para "x" numero la sucesion comenzara con (2, 2x, 2, ... , 2, 2x, 2, ...) donde ... es un bucle entonces cuando 2x aparezca por segunda vez cortamos alli la sucesion y sacamos el maximo """ def algoritmo(a): lista = [] i = 0 cont = ...
def getConfidenceInterval(df): """ Compute 95% confidence interval (frequentist approach) Args: dataframe: first column is name(string), second column is score(numeric) Return: dataframe(three columns:name,lower_bound,upper_bound) """ pass def getCredibleInterval(df): """ com...
def get_confidence_interval(df): """ Compute 95% confidence interval (frequentist approach) Args: dataframe: first column is name(string), second column is score(numeric) Return: dataframe(three columns:name,lower_bound,upper_bound) """ pass def get_credible_interval(df): """ ...
""" https://leetcode.com/problems/special-positions-in-a-binary-matrix/ Given a rows x cols matrix mat, where mat[i][j] is either 0 or 1, return the number of special positions in mat. A position (i,j) is called special if mat[i][j] == 1 and all other elements in row i and column j are 0 (rows and columns are 0-indexe...
""" https://leetcode.com/problems/special-positions-in-a-binary-matrix/ Given a rows x cols matrix mat, where mat[i][j] is either 0 or 1, return the number of special positions in mat. A position (i,j) is called special if mat[i][j] == 1 and all other elements in row i and column j are 0 (rows and columns are 0-indexe...
class FpsCounter: def __init__(self, update_interval_seconds = 0.5): """ read self.fps for output """ self.fps = 0. self.interval = update_interval_seconds self._counter = 0. self._age = 0. self._last_output_age = 0. def tick(self, dt): ...
class Fpscounter: def __init__(self, update_interval_seconds=0.5): """ read self.fps for output """ self.fps = 0.0 self.interval = update_interval_seconds self._counter = 0.0 self._age = 0.0 self._last_output_age = 0.0 def tick(self, dt): ...
'''> Greater that - True if left operand is greater than the right x > y < Less that - True if left operand is less than the right x < y == Equal to - True if both operands are equal x == y != Not equal to - True if operands are not equal x != y >= Greater than or equal to - True if left operand is greater than or equa...
"""> Greater that - True if left operand is greater than the right x > y < Less that - True if left operand is less than the right x < y == Equal to - True if both operands are equal x == y != Not equal to - True if operands are not equal x != y >= Greater than or equal to - True if left operand is greater than or equa...
expected_output = { "vrf": { "default": { "address_family": { "ipv4": { "instance": { "65109": { "areas": { "0.0.0.8": { "database": { ...
expected_output = {'vrf': {'default': {'address_family': {'ipv4': {'instance': {'65109': {'areas': {'0.0.0.8': {'database': {'lsa_types': {1: {'lsa_type': 1, 'lsas': {'192.168.165.220': {'adv_router': '192.168.165.220', 'lsa_id': '192.168.165.220', 'ospfv2': {'header': {'adv_router': '192.168.165.220', 'age': 113, 'che...
"""Graphite-beacon -- simple alerting system for Graphite.""" __version__ = "0.27.5" __license__ = "MIT"
"""Graphite-beacon -- simple alerting system for Graphite.""" __version__ = '0.27.5' __license__ = 'MIT'
{ "variables": { "major_version": "<!(node -pe 'v=process.versions.node.split(\".\"); v[0];')", "minor_version": "<!(node -pe 'v=process.versions.node.split(\".\"); v[1];')", "micro_version": "<!(node -pe 'v=process.versions.node.split(\".\"); v[2];')" }, "targets": [ { ...
{'variables': {'major_version': '<!(node -pe \'v=process.versions.node.split("."); v[0];\')', 'minor_version': '<!(node -pe \'v=process.versions.node.split("."); v[1];\')', 'micro_version': '<!(node -pe \'v=process.versions.node.split("."); v[2];\')'}, 'targets': [{'target_name': 'poppler', 'sources': ['src/poppler.cc'...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def levelOrder(self, root: TreeNode): if not root: return [] parents = [root] res = [] while parents: ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def level_order(self, root: TreeNode): if not root: return [] parents = [root] res = [] while parents: cur_values = [] ...
def get_stats(data, country_list=None): country_list = list(country_list) country_list_slugs = [] country_list_codes = [] error_lst = [] cases = [] new_cases = [] deaths = [] new_deaths = [] recovered = [] new_recovered = [] names = [] codes = [] stats = [] ...
def get_stats(data, country_list=None): country_list = list(country_list) country_list_slugs = [] country_list_codes = [] error_lst = [] cases = [] new_cases = [] deaths = [] new_deaths = [] recovered = [] new_recovered = [] names = [] codes = [] stats = [] if not...
def sum_up_diagonals(matrix): """Given a matrix [square list of lists], return sum of diagonals. Sum of TL-to-BR diagonal along with BL-to-TR diagonal: >>> m1 = [ ... [1, 2], ... [30, 40], ... ] >>> sum_up_diagonals(m1) 73 >>> m2 = [ ....
def sum_up_diagonals(matrix): """Given a matrix [square list of lists], return sum of diagonals. Sum of TL-to-BR diagonal along with BL-to-TR diagonal: >>> m1 = [ ... [1, 2], ... [30, 40], ... ] >>> sum_up_diagonals(m1) 73 >>> m2 = [ ....
""" Randy Zhu 11-06-2020 """ number_of_inputs = int(input()) inputs: "list[str]" = [] for _ in range(number_of_inputs): inputs += input().split(" ") # new_inputs = [] # for row in enumerate(inputs): # new_inputs += inputs[row[0]].split(" ") print(inputs)
""" Randy Zhu 11-06-2020 """ number_of_inputs = int(input()) inputs: 'list[str]' = [] for _ in range(number_of_inputs): inputs += input().split(' ') print(inputs)
class Platform: def set_nonblocking(self, read_fd): raise NotImplementedError( "Non-blocking capture not impelemented on this platform" ) def apply_workarounds(self): pass
class Platform: def set_nonblocking(self, read_fd): raise not_implemented_error('Non-blocking capture not impelemented on this platform') def apply_workarounds(self): pass
#request class DmRequest(object): __slots__ = ['gatewayobj'] def __init__(self, gatewayobj): self.gatewayobj = gatewayobj def DMchannel(self, channel_id): self.gatewayobj.send({'op':self.gatewayobj.OPCODE.DM_UPDATE,'d':{'channel_id':channel_id}})
class Dmrequest(object): __slots__ = ['gatewayobj'] def __init__(self, gatewayobj): self.gatewayobj = gatewayobj def d_mchannel(self, channel_id): self.gatewayobj.send({'op': self.gatewayobj.OPCODE.DM_UPDATE, 'd': {'channel_id': channel_id}})
numbers = [] # Going up first (1st digit cannot be 0) for digit1 in range(1, 10): for digit2 in range(0, 10): for digit3 in range(0, 10): if digit2 > digit1 and digit3 < digit2: numbers.append(str(digit1) + str(digit2) + str(digit3)) # Going down first for digit1 in range(1, 10...
numbers = [] for digit1 in range(1, 10): for digit2 in range(0, 10): for digit3 in range(0, 10): if digit2 > digit1 and digit3 < digit2: numbers.append(str(digit1) + str(digit2) + str(digit3)) for digit1 in range(1, 10): for digit2 in range(0, 10): for digit3 in range...
# -*- coding: utf-8 -*- """ Handler utility to parse slicing keys. """ def parse_slice(ds_slice): """ Parse dataset slice Parameters ---------- ds_slice : tuple | int | slice | list Slice to extract from dataset Returns ------- ds_slice : tuple slice for axis (0, 1) ...
""" Handler utility to parse slicing keys. """ def parse_slice(ds_slice): """ Parse dataset slice Parameters ---------- ds_slice : tuple | int | slice | list Slice to extract from dataset Returns ------- ds_slice : tuple slice for axis (0, 1) """ if not isinsta...
def MeasureTime( v, t ): sT = time.process_time( ) leer_matriz(v, t) triangulo_superior(v, t) eT = time.process_time( ) return float( eT - sT ) def leer_matriz(v, t): for i in range (t): for j in range (t): print ("Escriba el elemento %u de la columna %u: ", j+1, i+1) v[i][j] = input() for...
def measure_time(v, t): s_t = time.process_time() leer_matriz(v, t) triangulo_superior(v, t) e_t = time.process_time() return float(eT - sT) def leer_matriz(v, t): for i in range(t): for j in range(t): print('Escriba el elemento %u de la columna %u: ', j + 1, i + 1) ...
a = 'In this letter I make some remarks on a general principle relevant to enciphering in general and my machine.' b = 'If qualified opinions incline to believe in the exponential conjecture, then I think we cannot afford not to make use of it.' c = 'The most direct computation would be for the enemy to try all 2^r pos...
a = 'In this letter I make some remarks on a general principle relevant to enciphering in general and my machine.' b = 'If qualified opinions incline to believe in the exponential conjecture, then I think we cannot afford not to make use of it.' c = 'The most direct computation would be for the enemy to try all 2^r pos...
weight=1 def run(): r.absrot(90) r.absrot(0) r.absrot(-90) r.absrot(90)
weight = 1 def run(): r.absrot(90) r.absrot(0) r.absrot(-90) r.absrot(90)
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '8/14/2020 6:00 PM' class Solution: def __init__(self): self.data = ['1', '11', '21', '1211', '111221'] def read(self, string): pre = string[0] count = 1 res = [] for val in string[1:]: if...
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '8/14/2020 6:00 PM' class Solution: def __init__(self): self.data = ['1', '11', '21', '1211', '111221'] def read(self, string): pre = string[0] count = 1 res = [] for val in string[1:]: if ...
class JobState(basestring): """ Jobs execute as self-contained state machines. They follow a series of careful steps from creation to destruction. These steps are dictated by the states that they find themselves in as well as the allowable list of states they may transition into. The state can...
class Jobstate(basestring): """ Jobs execute as self-contained state machines. They follow a series of careful steps from creation to destruction. These steps are dictated by the states that they find themselves in as well as the allowable list of states they may transition into. The state can...
# Sorting ## Sorting with keys airports = [ ('MROC', 'San Jose, CR'), ('KLAS', 'Las Vegas, USA'), ('EDDM', 'Munich, DE'), ('LSZH', 'Zurich, CH'), ('VNLK', 'Lukla, NEP') ] sorted_airports = dict(sorted(airports, key=lambda x:x[0])) print(sorted_airports)
airports = [('MROC', 'San Jose, CR'), ('KLAS', 'Las Vegas, USA'), ('EDDM', 'Munich, DE'), ('LSZH', 'Zurich, CH'), ('VNLK', 'Lukla, NEP')] sorted_airports = dict(sorted(airports, key=lambda x: x[0])) print(sorted_airports)
# Create Trend Filter to remove linear, annual, and semi-annual trend fl_tf = skdiscovery.data_structure.table.filters.TrendFilter('TrendFilter', []) # Create stage container for the trend filter sc_tf = StageContainer(fl_tf)
fl_tf = skdiscovery.data_structure.table.filters.TrendFilter('TrendFilter', []) sc_tf = stage_container(fl_tf)
# encode categorical protocol name to number def encode_protocol(text): # put frequent cases to the front if 'tcp' in text: return 6 elif 'udp' in text: return 17 elif 'icmp' in text: return 1 elif 'hopopt' in text: return 0 elif 'igmp' in text: return 2 elif 'ggp' in text: return ...
def encode_protocol(text): if 'tcp' in text: return 6 elif 'udp' in text: return 17 elif 'icmp' in text: return 1 elif 'hopopt' in text: return 0 elif 'igmp' in text: return 2 elif 'ggp' in text: return 3 elif 'ipv4' in text: return 4 ...
class WebServer: def __init__(): pass
class Webserver: def __init__(): pass
class super: name ="" age ="" def set_user(self,a,b): self.name = a self.age = b def show(self): print(str(self.name)) print(str(self.age)) class sub(super): def pp(self): print("Python") obj1 = sub() obj1.set_user("AungMoe...
class Super: name = '' age = '' def set_user(self, a, b): self.name = a self.age = b def show(self): print(str(self.name)) print(str(self.age)) class Sub(super): def pp(self): print('Python') obj1 = sub() obj1.set_user('AungMoeKyaw', '22') obj1.show() obj1...
# Python3 code to find the element that occur only once INT_SIZE = 32 def getSingle(arr, n) : result = 0 for i in range(0, INT_SIZE) : sm = 0 x = (1 << i) for j in range(0, n) : if (arr[j] & x) : sm = sm + 1 if ((sm % 3)!= 0) : result = result | x return result arr = [12, 1, 12, 3, 1...
int_size = 32 def get_single(arr, n): result = 0 for i in range(0, INT_SIZE): sm = 0 x = 1 << i for j in range(0, n): if arr[j] & x: sm = sm + 1 if sm % 3 != 0: result = result | x return result arr = [12, 1, 12, 3, 12, 1, 1, 2, 3, 2, ...
# -*- coding: utf-8 -*- __about__ = """ This project demonstrates the use of a waiting list and signup codes for sites in private beta. Otherwise it is the same as basic_project. """
__about__ = '\nThis project demonstrates the use of a waiting list and signup codes for\nsites in private beta. Otherwise it is the same as basic_project.\n'
""" Convert a non-negative integer num to its English words representation. Example 1: Input: num = 123 Output: "One Hundred Twenty Three" Example 2: Input: num = 12345 Output: "Twelve Thousand Three Hundred Forty Five" Example 3: Input: num = 1234567 Output: "One Million Two Hundred Thirty Four Thousand Five Hun...
""" Convert a non-negative integer num to its English words representation. Example 1: Input: num = 123 Output: "One Hundred Twenty Three" Example 2: Input: num = 12345 Output: "Twelve Thousand Three Hundred Forty Five" Example 3: Input: num = 1234567 Output: "One Million Two Hundred Thirty Four Thousand Five Hun...
#!/usr/bin/env python __version__ = "3.0.0" version = __version__
__version__ = '3.0.0' version = __version__
def closest_intersections(first_wire, second_wire): least_no_of_steps = None shortest_mh_distance = None steps_taken_first = 0 point_a_first = (0, 0) for instr_first in first_wire: point_b_first, steps_to_b_first = next_point(point_a_first, instr_first) steps_taken_second = 0 ...
def closest_intersections(first_wire, second_wire): least_no_of_steps = None shortest_mh_distance = None steps_taken_first = 0 point_a_first = (0, 0) for instr_first in first_wire: (point_b_first, steps_to_b_first) = next_point(point_a_first, instr_first) steps_taken_second = 0 ...
_COURSIER_CLI_VERSION = "2.12" _COURSIER_VERSION = "1.1.0-M9" COURSIER_CLI_SHA256 = "8e7333506bb0db2a262d747873a434a476570dd09b30b61bcbac95aff18a8a9b" COURSIER_CLI_MAVEN_PATH = "io/get-coursier/coursier-cli_{COURSIER_CLI_VERSION}/{COURSIER_VERSION}/coursier-cli_{COURSIER_CLI_VERSION}-{COURSIER_VERSION}-standalone.jar"....
_coursier_cli_version = '2.12' _coursier_version = '1.1.0-M9' coursier_cli_sha256 = '8e7333506bb0db2a262d747873a434a476570dd09b30b61bcbac95aff18a8a9b' coursier_cli_maven_path = 'io/get-coursier/coursier-cli_{COURSIER_CLI_VERSION}/{COURSIER_VERSION}/coursier-cli_{COURSIER_CLI_VERSION}-{COURSIER_VERSION}-standalone.jar'....
userinput = "" print("Before User input ", userinput) userinput = input("EnterSomething :") print("After User input ", userinput)
userinput = '' print('Before User input ', userinput) userinput = input('EnterSomething :') print('After User input ', userinput)
''' WRITTEN BY Ramon Rossi PURPOSE The prime number is position one is 2. The prime number in position two is 3. The prime number is position three is 5. This function is_prime() finds the prime number at any position. It accepts an integer as an argument which is the position of the prime number t...
""" WRITTEN BY Ramon Rossi PURPOSE The prime number is position one is 2. The prime number in position two is 3. The prime number is position three is 5. This function is_prime() finds the prime number at any position. It accepts an integer as an argument which is the position of the prime number t...
# -*- coding: utf-8 -*- # @Author: Anderson # @Date: 2018-10-05 01:44:18 # @Last Modified by: Anderson # @Last Modified time: 2018-11-26 11:20:20 def anagrams(strs): word_dict = {} for word in strs: sorted_word = ''.join(sorted(word)) if sorted_word not in word_dict: word_dict[...
def anagrams(strs): word_dict = {} for word in strs: sorted_word = ''.join(sorted(word)) if sorted_word not in word_dict: word_dict[sorted_word] = [word] else: word_dict[sorted_word].append(word) count = 0 for item in word_dict: if len(word_dict[it...
name = input("Enter your name: ") print("Your name is", name, ".") age = int(input("Enter your age: ")) if age > 18: print(name, "is", age, "years old.") height = float(input("Enter your Height(cm):")) if height > 0: print("That's a positive size!") weight = float(input("Enter your Weigh...
name = input('Enter your name: ') print('Your name is', name, '.') age = int(input('Enter your age: ')) if age > 18: print(name, 'is', age, 'years old.') height = float(input('Enter your Height(cm):')) if height > 0: print("That's a positive size!") weight = float(input('Enter your Weight(kg):')) if weight > 0:...
t=int(input()) for i in range(t): n=int(input()) dp=[0 for i in range(n+1)] dp[0]=1 dp[1]=1 for i in range(2,n+1): for j in range(0,i): dp[i]+=dp[j]*dp[i-j-1] print(dp[n])
t = int(input()) for i in range(t): n = int(input()) dp = [0 for i in range(n + 1)] dp[0] = 1 dp[1] = 1 for i in range(2, n + 1): for j in range(0, i): dp[i] += dp[j] * dp[i - j - 1] print(dp[n])
# You have a red lottery ticket showing ints a, b, and c, each of which is 0, 1, or 2. # If they are all the value 2, the result is 10. # Otherwise if they are all the same, the result is 5. # Otherwise so long as both b and c are different from a, the result is 1. # Otherwise the result is 0. # Write a function t...
def find_ticket_value(a, b, c): try: if a == 2 and b == 2 and (c == 2): return 10 elif a == b and b == c and (a == c): return 5 elif b != a and c != a: return 1 else: return 0 except TypeError: return 'wrong Data Type!' if _...
#!/usr/bin/env python3 """player module.""" class Player: """Player for Checkers.""" def __init__(self, token): """Initialize object.""" self._token = token.lower() self._unpromoted = 12 self._promoted = 0 self._total = self._unpromoted + self._promoted def get_to...
"""player module.""" class Player: """Player for Checkers.""" def __init__(self, token): """Initialize object.""" self._token = token.lower() self._unpromoted = 12 self._promoted = 0 self._total = self._unpromoted + self._promoted def get_token(self): """Re...
# 1 Write a Python function, which gets 2 numbers, and return True if the second number is first number divider, otherwise False. def divider(a, b): if b % a == 0: return True else: return False # 2 Write a Python function, which gets a number, and return True if that number is palindrome, oth...
def divider(a, b): if b % a == 0: return True else: return False def palindrome(s): s = str(s) if s == s[::-1]: return True else: return False def prime(x): if x <= 1: return False for i in range(2, x): if x % i == 0: return False...
def get_fibonacci_huge(n): if n <= 1: return n previous = 0 current =1 sum = 1 for __ in range(2,n+1): previous,current = current, previous+current sum = sum+(current*current) # print(sum, ' ', current*current) return sum%10 if __name__ == '__main__': n ...
def get_fibonacci_huge(n): if n <= 1: return n previous = 0 current = 1 sum = 1 for __ in range(2, n + 1): (previous, current) = (current, previous + current) sum = sum + current * current return sum % 10 if __name__ == '__main__': n = int(input()) print(get_fibon...
class Particle(object): def __init__(self, sprite): self.gravity = PVector(0, 0.1) self.lifespan = 255 self.velocity = PVector() partSize = random(10, 60) self.part = createShape() self.part.beginShape(QUAD) self.part.noStroke() self.part.texture(spri...
class Particle(object): def __init__(self, sprite): self.gravity = p_vector(0, 0.1) self.lifespan = 255 self.velocity = p_vector() part_size = random(10, 60) self.part = create_shape() self.part.beginShape(QUAD) self.part.noStroke() self.part.texture(...
# # PySNMP MIB module ZYXEL-OAM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-OAM-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:51:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ...
def intro(task): title = f" ** {task} ** " print ("\n") print ("*" * len(title)) print (title) print ("*" * len(title)) print ("\n") intro("School") class Person: def __init__(self, firstname, lastname, age, phone, email=None): self.firstname = firstname self.lastname = las...
def intro(task): title = f' ** {task} ** ' print('\n') print('*' * len(title)) print(title) print('*' * len(title)) print('\n') intro('School') class Person: def __init__(self, firstname, lastname, age, phone, email=None): self.firstname = firstname self.lastname = lastname...
def foo(y): x=y return x bar = foo(7)
def foo(y): x = y return x bar = foo(7)
class Solution: def countPrimes(self, n: int) -> int: primes = [] for i in range(2, n): for prime in primes: if i % prime == 0: break else: primes.append(i) return len(primes)
class Solution: def count_primes(self, n: int) -> int: primes = [] for i in range(2, n): for prime in primes: if i % prime == 0: break else: primes.append(i) return len(primes)
""" N 1^2 + 2^2 + 3^2 + ... + N^2 """ N = int(input()) sum = 0 for i in range(1, N + 1): sum += i ** 2 print(sum)
""" N 1^2 + 2^2 + 3^2 + ... + N^2 """ n = int(input()) sum = 0 for i in range(1, N + 1): sum += i ** 2 print(sum)
#!/usr/bin/env python # -*- coding: utf-8 -*- # Used to simulate an enum with unique values class Enumeration(set): def __getattr__(self, name): if name in self: return name raise AttributeError def __setattr__(self, name, value): raise RuntimeError("Cannot override values"...
class Enumeration(set): def __getattr__(self, name): if name in self: return name raise AttributeError def __setattr__(self, name, value): raise runtime_error('Cannot override values') def __delattr__(self, name): raise runtime_error('Cannot delete values')
def fib(n, c={0:1, 1:1}): if n not in c: x = n // 2 c[n] = fib(x-1) * fib(n-x-1) + fib(x) * fib(n - x) return c[n] fib(10000000) # calculating it takes a few seconds, printing it takes eons
def fib(n, c={0: 1, 1: 1}): if n not in c: x = n // 2 c[n] = fib(x - 1) * fib(n - x - 1) + fib(x) * fib(n - x) return c[n] fib(10000000)
def build_and(left, right): return {'type':'and','left':left,'right':right} def build_or(left,right): return {'type':'or','left':left,'right':right} def build_atom(atom): return {'type':'atom','atom':atom} def equal(p0,p1): if p0['type'] == p1['type']: if p1['type'] == 'atom': ret...
def build_and(left, right): return {'type': 'and', 'left': left, 'right': right} def build_or(left, right): return {'type': 'or', 'left': left, 'right': right} def build_atom(atom): return {'type': 'atom', 'atom': atom} def equal(p0, p1): if p0['type'] == p1['type']: if p1['type'] == 'atom': ...
self.con_win_size = 9 self.halfwin = con_win_size // 2 def load_data(self): for i in range(self.n_file): self.log("n." + str(i+1)) inp = np.load(os.path.join(self.data_path, os.listdir(self.data_path)[i])) full_x = np.pad(inp["imgs"], [(self.halfwin,self.halfwin), (0,0)], mode='constant'...
self.con_win_size = 9 self.halfwin = con_win_size // 2 def load_data(self): for i in range(self.n_file): self.log('n.' + str(i + 1)) inp = np.load(os.path.join(self.data_path, os.listdir(self.data_path)[i])) full_x = np.pad(inp['imgs'], [(self.halfwin, self.halfwin), (0, 0)], mode='constant...
"""Serves as an interface for the two different console parsers (characterize and JUnit)""" class DefaultConsoleParser: # noinspection PyUnusedLocal def __init__(self, pipeline_name, pipeline_counter, stage_index, stage_name, job_name): self.console_log = None self.response = None self...
"""Serves as an interface for the two different console parsers (characterize and JUnit)""" class Defaultconsoleparser: def __init__(self, pipeline_name, pipeline_counter, stage_index, stage_name, job_name): self.console_log = None self.response = None self.success = True def insert_i...
class TTRssException(Exception): pass class TTRssArgumentException(TTRssException): pass class TTRssConfigurationException(TTRssException): pass
class Ttrssexception(Exception): pass class Ttrssargumentexception(TTRssException): pass class Ttrssconfigurationexception(TTRssException): pass
# # Represents a vertex in a DAG # # Copyright (c) 2013 by Michael Luckeneder # class Vertex(object): """Represents a vertex in a DAG""" def __init__(self, name): """Initialize the vertex""" self.name = name def __str__(self): """Returns String representation of vertex""" ...
class Vertex(object): """Represents a vertex in a DAG""" def __init__(self, name): """Initialize the vertex""" self.name = name def __str__(self): """Returns String representation of vertex""" return self.name
lista = ('carro','moto','trator','caminhao','coracao','ovo', 'mao','paralelepipedo','borboleta','onibus','Brasil','papai') for i in lista: print(f'\nA palavra {i}, possui as vogais: ',end='') for j in i: if j.lower() in 'aeiou': print(j, end=' ')
lista = ('carro', 'moto', 'trator', 'caminhao', 'coracao', 'ovo', 'mao', 'paralelepipedo', 'borboleta', 'onibus', 'Brasil', 'papai') for i in lista: print(f'\nA palavra {i}, possui as vogais: ', end='') for j in i: if j.lower() in 'aeiou': print(j, end=' ')
def find(n,m,index,cursor): if index == m: print(" ".join(map(str,foundlist))) return else: for i in range(cursor,n+1): if findnum[i] == True: continue else: findnum[i] = True foundlist[index] = cursor = i find(n,m,index+1,cursor) findnum[i] = False ...
def find(n, m, index, cursor): if index == m: print(' '.join(map(str, foundlist))) return else: for i in range(cursor, n + 1): if findnum[i] == True: continue else: findnum[i] = True foundlist[index] = cursor = i ...
#!/usr/bin/python3 """Create""" def text_indentation(text): """text indentation """ if type(text) is not str: raise TypeError("text must be a string") i = 0 while i < len(text): if text[i] not in [".", "?", ":"]: print(text[i], end='') else: print('{}\n'...
"""Create""" def text_indentation(text): """text indentation """ if type(text) is not str: raise type_error('text must be a string') i = 0 while i < len(text): if text[i] not in ['.', '?', ':']: print(text[i], end='') else: print('{}\n'.format(text[i])) ...
ONES = {0: '', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'} TEENS = {11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen'} TENS = {0: '', 1: 'ten', 2: 'twenty', 3: 'thirty', 4: 'for...
ones = {0: '', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'} teens = {11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen'} tens = {0: '', 1: 'ten', 2: 'twenty', 3: 'thirty', 4: 'for...
class Solution: def numDupDigitsAtMostN(self, N: int) -> int: list_n = list(map(int, str(N + 1))) res = 0 len_n = len(list_n) for i in range(1, len_n): res += 9 * self.get_cnt(9, i - 1) s = set() for i, x in enumerate(list_n): for y in range(...
class Solution: def num_dup_digits_at_most_n(self, N: int) -> int: list_n = list(map(int, str(N + 1))) res = 0 len_n = len(list_n) for i in range(1, len_n): res += 9 * self.get_cnt(9, i - 1) s = set() for (i, x) in enumerate(list_n): for y in ...
# -*- coding: utf-8 -*- # @Time :2021/3/8 10:48 # @Author :Ma Liang # @Email :mal818@126.com # @File :gameuniterror.py.py class GameUnitError(Exception): """Custom exception class for the 'AbstractGameUnit' and its subclasses""" def __init__(self, message=''): super().__init__(message) ...
class Gameuniterror(Exception): """Custom exception class for the 'AbstractGameUnit' and its subclasses""" def __init__(self, message=''): super().__init__(message) self.padding = '~' * 50 + '\r\n' self.error_message = 'Unspecified Error!' class Healthmeterexception(GameUnitError): ...
# # PySNMP MIB module HPN-ICF-COMMON-SYSTEM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-COMMON-SYSTEM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:37:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
## Recursion with memoization # Time: O(n^3) class Solution: def wordBreak(self, s: str, wordDict: List[str]) -> bool: @lru_cache def recur( s, word_dict, start ): if start == len(s): return True for end in range( start+1, len(s)+1 ): if s[star...
class Solution: def word_break(self, s: str, wordDict: List[str]) -> bool: @lru_cache def recur(s, word_dict, start): if start == len(s): return True for end in range(start + 1, len(s) + 1): if s[start:end] in word_dict and recur(s, word_dict...
expected_output = { "active_translations": {"dynamic": 0, "extended": 0, "static": 0, "total": 0}, "cef_punted_pkts": 0, "cef_translated_pkts": 0, "dynamic_mappings": { "inside_source": { "id": { 1: { "access_list": "test-robot", ...
expected_output = {'active_translations': {'dynamic': 0, 'extended': 0, 'static': 0, 'total': 0}, 'cef_punted_pkts': 0, 'cef_translated_pkts': 0, 'dynamic_mappings': {'inside_source': {'id': {1: {'access_list': 'test-robot', 'match': 'access-list test-robot pool test-robot', 'pool': {'test-robot': {'allocated': 0, 'all...
# Copyright (C) 2021 Clinton Garwood # MIT Open Source Initiative Approved License # while_true_clinton.py # CIS-135 Python # Assignment #9 # # # Lab 9 # Get while_yes and enter Loop # Initial Value received from input is a string value # print("While Looping Exercises") #while_yes = input("Yes or No? Input ...
while_false = False while while_false != True: print('While False loop will exit if True (#1) is entered') t_f = int(input('Enter 1 for True, or 2 for False ')) if t_f == 1: while_false = True else: print('') print('Exited While False Loop Successfully')
class Glass: capacity = 250 def __init__(self): self.content = 0 def get_space_left(self): return self.capacity - self.content def fill(self, ml): """ Fills water in the glass If no space for ml, nothing is filled in the glass """ if sel...
class Glass: capacity = 250 def __init__(self): self.content = 0 def get_space_left(self): return self.capacity - self.content def fill(self, ml): """ Fills water in the glass If no space for ml, nothing is filled in the glass """ if sel...
engine.run_script('init-touchcursor') # https://github.com/autokey/autokey/issues/127 # Can't simulate multimedia keys #127 # xmodmap -pk | grep XF86AudioRaiseVolume # 123 0x1008ff13 (XF86AudioRaiseVolume) 0x0000 (NoSymbol) 0x1008ff13 (XF86AudioRaiseVolume) # keyboard.send_keys("<code123>") # ...
engine.run_script('init-touchcursor') system.exec_command('pactl -- set-sink-volume 0 +5%', getOutput=False)
class Solution: def twoSum(self, nums: list[int], target: int) -> list[int]: l = len(nums) data = {} for i in range(l): xa = nums[i] if xa in data: return [data[xa], i] xb = target - xa data[xb] = i return [] de...
class Solution: def two_sum(self, nums: list[int], target: int) -> list[int]: l = len(nums) data = {} for i in range(l): xa = nums[i] if xa in data: return [data[xa], i] xb = target - xa data[xb] = i return [] def ...