content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" 39.61% return ['Fizz' * (not i % 3) + 'Buzz' * (not i % 5) or str(i) for i in range(1, n+1)] """ class Solution(object): def fizzBuzz(self, n): """ :type n: int :rtype: List[str] """ result = [] for i in range(1, n+1): if i % 3 == 0 and i % 5 == 0: ...
""" 39.61% return ['Fizz' * (not i % 3) + 'Buzz' * (not i % 5) or str(i) for i in range(1, n+1)] """ class Solution(object): def fizz_buzz(self, n): """ :type n: int :rtype: List[str] """ result = [] for i in range(1, n + 1): if i % 3 == 0 and i % 5 == ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"generate": "00_numpy.ipynb", "square_root_by_exhaustive": "01_python03.ipynb", "square_root_by_binary_search": "01_python03.ipynb", "square_root_by_newton": "01_python03.ipynb", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'generate': '00_numpy.ipynb', 'square_root_by_exhaustive': '01_python03.ipynb', 'square_root_by_binary_search': '01_python03.ipynb', 'square_root_by_newton': '01_python03.ipynb', 'search': '01_python03.ipynb', 'select_sort': '01_python03.ipynb'} mod...
class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ if len(s) == 0: return 0 else: words = s.split() return len(words[len(words) - 1])
class Solution(object): def length_of_last_word(self, s): """ :type s: str :rtype: int """ if len(s) == 0: return 0 else: words = s.split() return len(words[len(words) - 1])
answer1 = widget_inputs["radio1"] answer2 = widget_inputs["radio2"] answer3 = widget_inputs["radio3"] answer4 = widget_inputs["radio4"] is_correct = False comments = [] def commentizer(new): if new not in comments: comments.append(new) if answer1 == True: is_correct = True else: is_correct = is_c...
answer1 = widget_inputs['radio1'] answer2 = widget_inputs['radio2'] answer3 = widget_inputs['radio3'] answer4 = widget_inputs['radio4'] is_correct = False comments = [] def commentizer(new): if new not in comments: comments.append(new) if answer1 == True: is_correct = True else: is_correct = is_cor...
# -*- coding: utf-8 -*- """Top-level package for botorum.""" __author__ = """JP White""" __email__ = 'jpwhite3@gmail.com' __version__ = '0.1.0'
"""Top-level package for botorum.""" __author__ = 'JP White' __email__ = 'jpwhite3@gmail.com' __version__ = '0.1.0'
# Open file for reading inputFile = open('input_1', 'rt') # Put values into array inputValues = [] for x in inputFile: inputValues.append(int(x)) inputFile.close() """ PUZZLE ONE """ increaseCount = 0 for currentIndex in range(len(inputValues)-1): if inputValues[currentIndex+1]-inputValues[currentIndex] > 0:...
input_file = open('input_1', 'rt') input_values = [] for x in inputFile: inputValues.append(int(x)) inputFile.close() '\nPUZZLE ONE\n' increase_count = 0 for current_index in range(len(inputValues) - 1): if inputValues[currentIndex + 1] - inputValues[currentIndex] > 0: increase_count += 1 print('Increas...
"""Message type identifiers for Routing.""" MESSAGE_FAMILY = "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/routing/1.0" FORWARD = f"{MESSAGE_FAMILY}/forward" ROUTE_QUERY_REQUEST = f"{MESSAGE_FAMILY}/route-query-request" ROUTE_QUERY_RESPONSE = f"{MESSAGE_FAMILY}/route-query-response" ROUTE_UPDATE_REQUEST = f"{MESSAGE_FAMILY}/...
"""Message type identifiers for Routing.""" message_family = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/routing/1.0' forward = f'{MESSAGE_FAMILY}/forward' route_query_request = f'{MESSAGE_FAMILY}/route-query-request' route_query_response = f'{MESSAGE_FAMILY}/route-query-response' route_update_request = f'{MESSAGE_FAMILY}/rou...
digit = input('Enter number:') name = input("Name:") if not digit.i: print("Input must be a digit") exit(1) print(int(digit) + 1)
digit = input('Enter number:') name = input('Name:') if not digit.i: print('Input must be a digit') exit(1) print(int(digit) + 1)
num1 = 11 num2 = 222 num3 = 3333333 num3 = 333 num4 = 44444
num1 = 11 num2 = 222 num3 = 3333333 num3 = 333 num4 = 44444
# mock data OP_STATIC_ATTRS = { "objectClass": ["top", "oxAuthClient"], "oxAuthScope": [ "inum=F0C4,ou=scopes,o=gluu", "inum=C4F5,ou=scopes,o=gluu", ], "inum": "w124asdgggAGs", } ADD_OP_TEST_ARGS = { "oxAuthLogoutSessionRequired": False, "oxAuthTrustedClient": False, "oxAut...
op_static_attrs = {'objectClass': ['top', 'oxAuthClient'], 'oxAuthScope': ['inum=F0C4,ou=scopes,o=gluu', 'inum=C4F5,ou=scopes,o=gluu'], 'inum': 'w124asdgggAGs'} add_op_test_args = {'oxAuthLogoutSessionRequired': False, 'oxAuthTrustedClient': False, 'oxAuthResponseType': 'token', 'oxAuthTokenEndpointAuthMethod': 'client...
#!/usr/bin/env python3 # Day 15: Non-overlapping Intervals # # Given a collection of intervals, find the minimum number of intervals you # need to remove to make the rest of the intervals non-overlapping. # # Note: # - You may assume the interval's end point is always bigger than its start # point. # - Intervals lik...
class Solution: def erase_overlap_intervals(self, intervals: [[int]]) -> int: if len(intervals) == 0: return 0 start = lambda interval: interval[0] end = lambda interval: interval[1] intervals = sorted(intervals, key=end) intervals_to_remove = 0 previous_...
aux = 0 num = int(input("Ingrese un numero entero positivo: ")) if num>0: for x in range(0,num+1): aux = aux + x print (aux)
aux = 0 num = int(input('Ingrese un numero entero positivo: ')) if num > 0: for x in range(0, num + 1): aux = aux + x print(aux)
start = [8,13,1,0,18,9] last_said = None history = {} def say(num, turn_no): print(f'turn {i}\tsay {num}') for i in range(30000000): if i < len(start): num = start[i] else: # print(f'turn {i} last said {last_said} {history}') if last_said in history: # print('in') ...
start = [8, 13, 1, 0, 18, 9] last_said = None history = {} def say(num, turn_no): print(f'turn {i}\tsay {num}') for i in range(30000000): if i < len(start): num = start[i] elif last_said in history: num = i - history[last_said] - 1 else: num = 0 if last_said is not None: ...
""" ****************************************************** Author: Mark Arakaki October 15, 2017 Personal Practice Use ***************************************************** Divisors: Create a program that asks the user for a number and then prints out a list of all the divisors of that number. (If you don't know wha...
""" ****************************************************** Author: Mark Arakaki October 15, 2017 Personal Practice Use ***************************************************** Divisors: Create a program that asks the user for a number and then prints out a list of all the divisors of that number. (If you don't know wha...
num1 = '100' num2 = '200' # 100200 print(num1 + num2) # Casting - 300 num1 = int(num1) num2 = int(num2) print(num1 + num2)
num1 = '100' num2 = '200' print(num1 + num2) num1 = int(num1) num2 = int(num2) print(num1 + num2)
# Databricks notebook source exported at Sun, 13 Mar 2016 23:07:00 UTC # MAGIC %md # <img width="300px" src="http://cdn.arstechnica.net/wp-content/uploads/2015/09/2000px-Wikipedia-logo-v2-en-640x735.jpg"/> Clickstream Analysis # MAGIC # MAGIC ** Dataset: 3.2 billion requests collected during the month of February 2015...
clickstream_raw = sqlContext.read.format('com.databricks.spark.csv').options(header='true', delimiter='\t', mode='PERMISSIVE', inferSchema='true').load('dbfs:///databricks-datasets/wikipedia-datasets/data-001/clickstream/raw-uncompressed') clickstreamRaw.write.mode('overwrite').format('parquet').save('/datasets/wiki-cl...
"""This file contains constants used used by the Ethereum JSON RPC interface.""" BLOCK_TAG_EARLIEST = "earliest" BLOCK_TAG_LATEST = "latest" BLOCK_TAG_PENDING = "pending" BLOCK_TAGS = (BLOCK_TAG_EARLIEST, BLOCK_TAG_LATEST, BLOCK_TAG_PENDING)
"""This file contains constants used used by the Ethereum JSON RPC interface.""" block_tag_earliest = 'earliest' block_tag_latest = 'latest' block_tag_pending = 'pending' block_tags = (BLOCK_TAG_EARLIEST, BLOCK_TAG_LATEST, BLOCK_TAG_PENDING)
# ------- FUNCTION BASICS -------- def allotEmail(firstName, surname): return firstName+'.'+surname+'@pythonabc.org' name = input("Enter your name: ") fName, sName = name.split() compEmail = allotEmail(fName, sName) print(compEmail) def get_sum(*args): sum = 0 for i in args: sum += i return...
def allot_email(firstName, surname): return firstName + '.' + surname + '@pythonabc.org' name = input('Enter your name: ') (f_name, s_name) = name.split() comp_email = allot_email(fName, sName) print(compEmail) def get_sum(*args): sum = 0 for i in args: sum += i return sum print('sum =', get_su...
''' An approximation of network latency in the Bitcoin network based on the following paper: https://ieeexplore.ieee.org/document/6688704/. From the green line in Fig 1, we can approximate the function as: Network latency (sec) = 19/300 sec/KB * KB + 1 sec If we assume a transaction is 500 bytes or 1/2 KB, we...
""" An approximation of network latency in the Bitcoin network based on the following paper: https://ieeexplore.ieee.org/document/6688704/. From the green line in Fig 1, we can approximate the function as: Network latency (sec) = 19/300 sec/KB * KB + 1 sec If we assume a transaction is 500 bytes or 1/2 KB, we...
class Spam(object): ''' The Spam object contains lots of spam Args: arg (str): The arg is used for ... *args: The variable arguments are used for ... **kwargs: The keyword arguments are used for ... Attributes: arg (str): This is where we store arg, ''' def __...
class Spam(object): """ The Spam object contains lots of spam Args: arg (str): The arg is used for ... *args: The variable arguments are used for ... **kwargs: The keyword arguments are used for ... Attributes: arg (str): This is where we store arg, """ def __i...
''' Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, [3,6,2,7] is a subsequence of the array [0,3,1,6,2,2,7]. ...
""" Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, [3,6,2,7] is a subsequence of the array [0,3,1,6,2,2,7]. ...
# Time: O(m * n) # Space: O(m * n) class Solution(object): def numDistinctIslands(self, grid): """ :type grid: List[List[int]] :rtype: int """ directions = {'l':[-1, 0], 'r':[ 1, 0], \ 'u':[ 0, 1], 'd':[ 0, -1]} def dfs(i, j, grid, island):...
class Solution(object): def num_distinct_islands(self, grid): """ :type grid: List[List[int]] :rtype: int """ directions = {'l': [-1, 0], 'r': [1, 0], 'u': [0, 1], 'd': [0, -1]} def dfs(i, j, grid, island): if not (0 <= i < len(grid) and 0 <= j < len(gri...
""" Given three integer arrays arr1, arr2 and arr3 sorted in strictly increasing order, return a sorted array of only the integers that appeared in all three arrays. Example 1: Input: arr1 = [1,2,3,4,5], arr2 = [1,2,5,7,9], arr3 = [1,3,4,5,8] Output: [1,5] Explanation: Only 1 and 5 appeared in the three arrays. ...
""" Given three integer arrays arr1, arr2 and arr3 sorted in strictly increasing order, return a sorted array of only the integers that appeared in all three arrays. Example 1: Input: arr1 = [1,2,3,4,5], arr2 = [1,2,5,7,9], arr3 = [1,3,4,5,8] Output: [1,5] Explanation: Only 1 and 5 appeared in the three arrays. ...
# -*- coding: utf-8 -*- """ Created on Sat Apr 6 19:42:18 2019 @author: rounak """ num = int (input("Enter a number: ")) #if the elements in the range(2, num) evenly divides the num, #then it is included in the divisors list divisor = [x for x in range(2, num) if num % x == 0] for x in divisor: p...
""" Created on Sat Apr 6 19:42:18 2019 @author: rounak """ num = int(input('Enter a number: ')) divisor = [x for x in range(2, num) if num % x == 0] for x in divisor: print(x)
class Solution(object): @staticmethod def min_steps(candy, n, m): min_step = float("inf") def dfs(curr, i, j, num_candy, steps): nonlocal min_step if num_candy == m: min_step = min(steps, min_step) if steps > min_step: return...
class Solution(object): @staticmethod def min_steps(candy, n, m): min_step = float('inf') def dfs(curr, i, j, num_candy, steps): nonlocal min_step if num_candy == m: min_step = min(steps, min_step) if steps > min_step: return ...
class Employee: # Constructor untuk Employee def __init__(self, first_name, last_name, monthly_salary): self._first_name = first_name self._last_name = last_name self._monthly_salary = monthly_salary if monthly_salary < 0: self._monthly_salary = 0 # Getter dan setter first_name @property def...
class Employee: def __init__(self, first_name, last_name, monthly_salary): self._first_name = first_name self._last_name = last_name self._monthly_salary = monthly_salary if monthly_salary < 0: self._monthly_salary = 0 @property def first_name(self): ret...
def test_Feeds(flamingo_env): flamingo_env.settings.PLUGINS = ['flamingo.plugins.Feeds'] flamingo_env.settings.FEEDS_DOMAIN = 'www.example.org' flamingo_env.settings.FEEDS = [ { 'id': 'www.example.org', 'title': 'Example.org', 'type': 'atom', 'output'...
def test__feeds(flamingo_env): flamingo_env.settings.PLUGINS = ['flamingo.plugins.Feeds'] flamingo_env.settings.FEEDS_DOMAIN = 'www.example.org' flamingo_env.settings.FEEDS = [{'id': 'www.example.org', 'title': 'Example.org', 'type': 'atom', 'output': 'en/feed.atom.xml', 'lang': 'en', 'contents': lambda ctx...
class Solution: def minFallingPathSum(self, arr: List[List[int]]) -> int: min1 = min2 = -1 for j in range(len(arr[0])): if min1 == -1 or arr[0][j] < arr[0][min1]: min2 = min1 min1 = j elif min2 == -1 or arr[0][j] < arr[0][min2]: ...
class Solution: def min_falling_path_sum(self, arr: List[List[int]]) -> int: min1 = min2 = -1 for j in range(len(arr[0])): if min1 == -1 or arr[0][j] < arr[0][min1]: min2 = min1 min1 = j elif min2 == -1 or arr[0][j] < arr[0][min2]: ...
GENERAL_HELP = ''' Usage: vt <command> [options] Commands: lists Get all lists list Return items of a specific list item Return a specific item show Alias for item done Mark an item done complete Alias for done undone Mark an item undone unc...
general_help = '\nUsage:\n vt <command> [options]\n\nCommands:\n lists Get all lists\n list Return items of a specific list\n item Return a specific item\n show Alias for item\n done Mark an item done\n complete Alias for done\n undone Mark an item undon...
# -*- coding: utf-8 -*- """ @author: ashutosh A simple program to add two numbers. """ def main(): """ The main function to execute upon call. Returns ------- int returns integer 0 for safe executions. """ print("Program to add two numbers.\n") # two...
""" @author: ashutosh A simple program to add two numbers. """ def main(): """ The main function to execute upon call. Returns ------- int returns integer 0 for safe executions. """ print('Program to add two numbers.\n') num1 = 1.5 num2 = 4.5 sum_val = float(num1) + ...
# slicing lab def swap(seq): return seq[-1:]+seq[1:-1]+seq[:1] assert swap('something') == 'gomethins' assert swap(tuple(range(10))) == (9,1,2,3,4,5,6,7,8,0) def rem(seq): return seq[::2] assert rem('a word') == 'awr' def rem4(seq): return seq[4:-4:2] print(rem4( (1,2,3,4,5,6,7,8,9,10,11), ) ) def ...
def swap(seq): return seq[-1:] + seq[1:-1] + seq[:1] assert swap('something') == 'gomethins' assert swap(tuple(range(10))) == (9, 1, 2, 3, 4, 5, 6, 7, 8, 0) def rem(seq): return seq[::2] assert rem('a word') == 'awr' def rem4(seq): return seq[4:-4:2] print(rem4((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))) def r...
def minkowski(a, b, p) : summ = 0 n = len(a) for i in range(n) : summ += (b[i]-a[i])**p summ = summ ** (1/p) return summ a = [0, 3, 4, 5] b = [7, 6, 3, -1] p=3 print(minkowski(a, b, p))
def minkowski(a, b, p): summ = 0 n = len(a) for i in range(n): summ += (b[i] - a[i]) ** p summ = summ ** (1 / p) return summ a = [0, 3, 4, 5] b = [7, 6, 3, -1] p = 3 print(minkowski(a, b, p))
inp = input() points = inp.split(" ") for i in range(len(points)): points[i] = int(points[i]) points.sort() result = points[len(points) - 1] - points[0] print(result)
inp = input() points = inp.split(' ') for i in range(len(points)): points[i] = int(points[i]) points.sort() result = points[len(points) - 1] - points[0] print(result)
# Created by MechAviv # ID :: [4000013] # Maple Road : Inside the Small Forest sm.showFieldEffect("maplemap/enter/40000", 0)
sm.showFieldEffect('maplemap/enter/40000', 0)
# Define time, time constant t = np.arange(0, 10, .1) tau = 0.5 # Compute alpha function f = t * np.exp(-t/tau) # Define u(t), v(t) u_t = t v_t = np.exp(-t/tau) # Define du/dt, dv/dt du_dt = 1 dv_dt = -1/tau * np.exp(-t/tau) # Define full derivative df_dt = u_t * dv_dt + v_t * du_dt # Uncomment below to visualize...
t = np.arange(0, 10, 0.1) tau = 0.5 f = t * np.exp(-t / tau) u_t = t v_t = np.exp(-t / tau) du_dt = 1 dv_dt = -1 / tau * np.exp(-t / tau) df_dt = u_t * dv_dt + v_t * du_dt with plt.xkcd(): plot_alpha_func(t, f, df_dt)
al = 0 ga = 0 di = 0 x = 0 while x != 4: x = int(input()) if x == 1: al = al + 1 if x == 2: ga = ga + 1 if x == 3: di = di + 1 print('MUITO OBRIGADO') print('Alcool: {}'.format(al)) print('Gasolina: {}'.format(ga)) print('Diesel: {}'.format(di))
al = 0 ga = 0 di = 0 x = 0 while x != 4: x = int(input()) if x == 1: al = al + 1 if x == 2: ga = ga + 1 if x == 3: di = di + 1 print('MUITO OBRIGADO') print('Alcool: {}'.format(al)) print('Gasolina: {}'.format(ga)) print('Diesel: {}'.format(di))
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def countNodes(self, root: TreeNode) -> int: maxDepth = self.findLeftMaxDepth(root) if maxDe...
class Solution: def count_nodes(self, root: TreeNode) -> int: max_depth = self.findLeftMaxDepth(root) if maxDepth <= 1: return maxDepth else: cur_root = root cur_depth = 1 total_num = 0 while True: if curRoot.left =...
''' A library to speed up physics data analysis. Contains functions for error analysis and calculations for various physics mechanics values. '''
""" A library to speed up physics data analysis. Contains functions for error analysis and calculations for various physics mechanics values. """
# Creating variables dynamically. # To be able to pass arguments to variable file, we must define # and use "get_variables" in a similar manner as follows: def get_variables(server_uri, start_port): # Note that the order in which the libraries are listed here must match # that in 'server.py'. port ...
def get_variables(server_uri, start_port): port = int(start_port) target_uri = '%s:%d' % (server_uri, port) port += 1 common_uri = '%s:%d' % (server_uri, port) port += 1 security_uri = '%s:%d' % (server_uri, port) return {'target_uri': target_uri, 'common_uri': common_uri, 'security_uri': se...
class StageOutputs: execute_outputs = { # Outputs from public Cisco docs: # https://www.cisco.com/c/en/us/td/docs/routers/asr1000/release/notes/asr1k_rn_rel_notes/asr1k_rn_sys_req.html 'copy running-config startup-config': '''\ PE1#copy running-config startup-config ...
class Stageoutputs: execute_outputs = {'copy running-config startup-config': ' PE1#copy running-config startup-config\n Destination filename [startup-config]?\n %Error opening bootflash:running-config (Permission denied)\n ', 'show boot': ' starfleet-1#show boot\n ...
class UnknownCommand(Exception): pass class ModuleNotFound(Exception): pass class VariableError(Exception): pass class ModuleError: error = "" def __init__(self, error): self.error = error
class Unknowncommand(Exception): pass class Modulenotfound(Exception): pass class Variableerror(Exception): pass class Moduleerror: error = '' def __init__(self, error): self.error = error
# Copyright 2017 Bloomberg Finance L.P. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writ...
"""This package provides Python interfaces to Comdb2 databases. Two different Python submodules are provided for interacting with Comdb2 databases. Both submodules work from Python 2.7+ and from Python 3.5+. `comdb2.dbapi2` provides an interface that conforms to `the Python Database API Specification v2.0 <https://w...
class Node: def __init__(self,tag,valid_bit = 1,next = None,previous = None): self.tag = tag self.valid_bit = valid_bit self.next = next self.previous = previous def set_next_pointer(self,next): self.next = next def set_previous_pointer(self,previous):...
class Node: def __init__(self, tag, valid_bit=1, next=None, previous=None): self.tag = tag self.valid_bit = valid_bit self.next = next self.previous = previous def set_next_pointer(self, next): self.next = next def set_previous_pointer(self, previous): self...
# Do not hard code credentials client = boto3.client( 's3', # Hard coded strings as credentials, not recommended. aws_access_key_id='AKIAIO5FODNN7EXAMPLE', aws_secret_access_key='ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE' ) # adding another line
client = boto3.client('s3', aws_access_key_id='AKIAIO5FODNN7EXAMPLE', aws_secret_access_key='ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE')
#!/usr/bin/env python3 # ## @file # checkout_humble.py # # Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # NO_COMBO = 'A combination named: {} does not exist in the workspace manifest'
no_combo = 'A combination named: {} does not exist in the workspace manifest'
cuda_code = ''' extern "C" __global__ void my_kernel(float* input_domain, int input_domain_n, int* layer_sizes, int layer_number, float* full_weights, float* full_biases, float* results_cuda, int max_layer_size, int* activations) { // Calculate all the bounds, node by node, for each layer. 'new_layer_values' is ...
cuda_code = '\n\nextern "C" __global__ void my_kernel(float* input_domain, int input_domain_n, int* layer_sizes, int layer_number, float* full_weights, \n\t\t\tfloat* full_biases, float* results_cuda, int max_layer_size, int* activations) {\n\n\t// Calculate all the bounds, node by node, for each layer. \'new_layer_val...
class Point: def __init__(self, x, y): self.x = float(x) self.y = float(y) def __str__(self): return "(" + str(round(self.x, 1)) + ', ' + str(round(self.y, 1)) + ")" class Triangle: def __init__(self, points): self.points = points def get_centroid(self): sum...
class Point: def __init__(self, x, y): self.x = float(x) self.y = float(y) def __str__(self): return '(' + str(round(self.x, 1)) + ', ' + str(round(self.y, 1)) + ')' class Triangle: def __init__(self, points): self.points = points def get_centroid(self): sum_...
class TrackableObject: def __init__(self, objectID, centroid_frame_timestamp, detection_class_id, centroid, boxoid, bbox_rw_coords): # store the object ID, then initialize a list of centroids # using the current centroid self.objectID = objectID # initialize instance variable, 'oids...
class Trackableobject: def __init__(self, objectID, centroid_frame_timestamp, detection_class_id, centroid, boxoid, bbox_rw_coords): self.objectID = objectID self.oids = [] self.centroids = [] self.boxoids = [] self.bbox_rw_coords = [] self.detection_class_id = detec...
""" STATEMENT Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. CLARIFICATIONS - The root is not leaf for trees with levels more than one? Yes. EXAMPLES (needs to be drawn) COMMENTS - A recursive solution ch...
""" STATEMENT Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. CLARIFICATIONS - The root is not leaf for trees with levels more than one? Yes. EXAMPLES (needs to be drawn) COMMENTS - A recursive solution ch...
#--------------------------------------- # Selection Sort #--------------------------------------- def selection_sort(A): for i in range (0, len(A) - 1): minIndex = i for j in range (i+1, len(A)): if A[j] < A[minIndex]: minIndex = j if minIndex != i: A[i], A[minIndex] = A[minIndex], A[i] A = [5,...
def selection_sort(A): for i in range(0, len(A) - 1): min_index = i for j in range(i + 1, len(A)): if A[j] < A[minIndex]: min_index = j if minIndex != i: (A[i], A[minIndex]) = (A[minIndex], A[i]) a = [5, 9, 1, 2, 4, 8, 6, 3, 7] print(A) selection_sort(...
games = ["chess", "soccer", "tennis"] foods = ["chicken", "milk", "fruits"] favorites = games + foods print(favorites)
games = ['chess', 'soccer', 'tennis'] foods = ['chicken', 'milk', 'fruits'] favorites = games + foods print(favorites)
# Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. # For example, # Given the following matrix: # [ # [ 1, 2, 3 ], # [ 4, 5, 6 ], # [ 7, 8, 9 ] # ] # You should return [1,2,3,6,9,8,7,4,5]. class Solution: # @param {integer[][]} matrix # @return {i...
class Solution: def spiral_order(self, matrix): if not matrix or not matrix[0]: return [] total = len(matrix) * len(matrix[0]) spiral = [] (l, r, u, d) = (-1, len(matrix[0]), 0, len(matrix)) (s, i, j) = (0, 0, 0) for c in range(total): spiral....
""" [2016-05-04] Challenge #265 [Hard] Permutations with repeat https://www.reddit.com/r/dailyprogrammer/comments/4i3xrm/20160504_challenge_265_hard_permutations_with/ The number of permutations of a list that includes repeats is `(factorial of list length) / (product of factorials of each items repeat frequency) for...
""" [2016-05-04] Challenge #265 [Hard] Permutations with repeat https://www.reddit.com/r/dailyprogrammer/comments/4i3xrm/20160504_challenge_265_hard_permutations_with/ The number of permutations of a list that includes repeats is `(factorial of list length) / (product of factorials of each items repeat frequency) for...
def Sequential_Search(elements): for i in range (len(elements)): #outer loop for comparison for j in range (len(elements)):#inner loop to compare against outer loop pos = 0 found = False while pos < len(elements) and not found: if j == i: ...
def sequential__search(elements): for i in range(len(elements)): for j in range(len(elements)): pos = 0 found = False while pos < len(elements) and (not found): if j == i: continue else: pos = pos + 1...
def palcheck(s): ns="" for i in s: ns=i+ns if s==ns: return True return False def cod(s): l=len(s) for i in range(2,l): if palcheck(s[:i]): t1=s[:i] k=s[i:] break t=len(k) for j in range(2...
def palcheck(s): ns = '' for i in s: ns = i + ns if s == ns: return True return False def cod(s): l = len(s) for i in range(2, l): if palcheck(s[:i]): t1 = s[:i] k = s[i:] break t = len(k) for j in range(2, t): if palch...
# pylint: skip-file # pylint: disable=too-many-instance-attributes class Subnetwork(GCPResource): '''Object to represent a gcp subnetwork''' resource_type = "compute.v1.subnetwork" # pylint: disable=too-many-arguments def __init__(self, rname, project, ...
class Subnetwork(GCPResource): """Object to represent a gcp subnetwork""" resource_type = 'compute.v1.subnetwork' def __init__(self, rname, project, zone, ip_cidr_range, region, network): """constructor for gcp resource""" super(Subnetwork, self).__init__(rname, Subnetwork.resource_type, pr...
class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: strs = [] tmp = '' for s in paragraph: if s in '!? \';.,': if tmp: strs.append(tmp) tmp = '' else: tmp += s.lowe...
class Solution: def most_common_word(self, paragraph: str, banned: List[str]) -> str: strs = [] tmp = '' for s in paragraph: if s in "!? ';.,": if tmp: strs.append(tmp) tmp = '' else: tmp += s.lo...
""" ShellSort is a variation of insertion sort. Sometimes called as "diminishing increment sort". How ShelSort improves insertion sort algorithm? By breaking the original list into a number of sub-lists, each sublist is sorted using the insertion sort. It will move the items nearer to its original index. Algo...
""" ShellSort is a variation of insertion sort. Sometimes called as "diminishing increment sort". How ShelSort improves insertion sort algorithm? By breaking the original list into a number of sub-lists, each sublist is sorted using the insertion sort. It will move the items nearer to its original index. Algo...
class Solution: def rob(self, nums: List[int]) -> int: if len(nums) == 0: return 0 if len(nums) == 1: return nums[0] dp = [] dp.append(nums[0]) dp.append(max(nums[0], nums[1])) for i in range(2, len(nums)): dp.append(max(nums[i] + d...
class Solution: def rob(self, nums: List[int]) -> int: if len(nums) == 0: return 0 if len(nums) == 1: return nums[0] dp = [] dp.append(nums[0]) dp.append(max(nums[0], nums[1])) for i in range(2, len(nums)): dp.append(max(nums[i] + ...
def foo(x, y): s = x + y if s > 10: print("s>10") elif s > 5: print("s>5") else: print("less") print("over") def bar(): s = 1 + 2 if s > 10: print("s>10") elif s > 5: print("s>5") else: print("less") print("over")
def foo(x, y): s = x + y if s > 10: print('s>10') elif s > 5: print('s>5') else: print('less') print('over') def bar(): s = 1 + 2 if s > 10: print('s>10') elif s > 5: print('s>5') else: print('less') print('over')
#coding:utf-8 ''' filename:arabic2roman.py chap:6 subject:6 conditions:translate Arabic numerals to Roman numerals solution:class Arabic2Roman ''' class Arabic2Roman: trans = {1:'I',5:'V',10:'X',50:'L',100:'C',500:'D',1000:'M'} # 'I(a)X(b)V(c)I(d)' trans_unit = {1:(0,0,0,1),2:...
""" filename:arabic2roman.py chap:6 subject:6 conditions:translate Arabic numerals to Roman numerals solution:class Arabic2Roman """ class Arabic2Roman: trans = {1: 'I', 5: 'V', 10: 'X', 50: 'L', 100: 'C', 500: 'D', 1000: 'M'} trans_unit = {1: (0, 0, 0, 1), 2: (0, 0, 0, 2), 3: (0, 0, 0,...
# AARD: function: __main__ # AARD: #1:1 -> #1:2 :: defs: %1 / uses: [@1 5:4-5:10] { call } # AARD: #1:2 -> #1:3, #1:4 :: defs: / uses: %1 [@1 5:4-5:10] if test(): # AARD: #1:3 -> #1:4 :: defs: %2 / uses: [@1 7:5-7:12] foo = 3 # AARD: #1:4 -> :: defs: %3 / uses: [@1 10:1-10:8] { call } print() ...
if test(): foo = 3 print()
class Node: def __init__(self, value): self._value = value self._parent = None self._children = [] @property def value(self): return self._value @property def children(self): return self._children @property def parent(self): return self._par...
class Node: def __init__(self, value): self._value = value self._parent = None self._children = [] @property def value(self): return self._value @property def children(self): return self._children @property def parent(self): return self._pa...
class Env: def __init__(self): self.played = False def getTime(self): pass def playWavFile(self, file): pass def wavWasPlayed(self): self.played = True def resetWav(self): self.played = False
class Env: def __init__(self): self.played = False def get_time(self): pass def play_wav_file(self, file): pass def wav_was_played(self): self.played = True def reset_wav(self): self.played = False
algorithm_parameter = { 'type': 'object', 'required': ['name', 'value'], 'properties': { 'name': { 'description': 'Name of algorithm parameter', 'type': 'string', }, 'value': { 'description': 'Value of algorithm parameter', 'oneOf': [ ...
algorithm_parameter = {'type': 'object', 'required': ['name', 'value'], 'properties': {'name': {'description': 'Name of algorithm parameter', 'type': 'string'}, 'value': {'description': 'Value of algorithm parameter', 'oneOf': [{'type': 'number'}, {'type': 'string'}]}}} algorithm_launch_spec = {'type': 'object', 'requi...
class solve_day(object): with open('inputs/day02.txt', 'r') as f: data = f.readlines() def part1(self): grid = [[1,2,3], [4,5,6], [7,8,9]] code = [] ## locations # 1 - grid[0][0] # 2 - grid[0][1] # 3 - grid[0][2] ...
class Solve_Day(object): with open('inputs/day02.txt', 'r') as f: data = f.readlines() def part1(self): grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] code = [] position = [0, 0] for (i, d) in enumerate(self.data): d = d.strip() if i == 0: ...
class IntegerStack(list): def __init__(self): stack = [] * 128 self.extend(stack) def depth(self): return len(self) def tos(self): return self[-1] def push(self, v): self.append(v) def dup(self): self.append(self[-1]) def drop(self): s...
class Integerstack(list): def __init__(self): stack = [] * 128 self.extend(stack) def depth(self): return len(self) def tos(self): return self[-1] def push(self, v): self.append(v) def dup(self): self.append(self[-1]) def drop(self): ...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Collaborative Pads', 'version': '2.0', 'category': 'Extra Tools', 'description': """ Adds enhanced support for (Ether)Pad attachments in the web client. ========================================...
{'name': 'Collaborative Pads', 'version': '2.0', 'category': 'Extra Tools', 'description': '\nAdds enhanced support for (Ether)Pad attachments in the web client.\n===================================================================\n\nLets the company customize which Pad installation should be used to link to new\npads ...
# Copyright 2019 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
""" # Rollup rules for Bazel The Rollup rules run the [rollup.js](https://rollupjs.org/) bundler with Bazel. ## Installation Add the `@bazel/rollup` npm package to your `devDependencies` in `package.json`. (`rollup` itself should also be included in `devDependencies`, unless you plan on providing it via a custom tar...
digit_mapping = { '2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'] } def get_letter_strings(number_string): if not number_string: return if len(number_string) == 1: return digit_mapping[number_string[0]] possible_strings = list() current_letters = digit_mapping[number_string[0]] ...
digit_mapping = {'2': ['a', 'b', 'c'], '3': ['d', 'e', 'f']} def get_letter_strings(number_string): if not number_string: return if len(number_string) == 1: return digit_mapping[number_string[0]] possible_strings = list() current_letters = digit_mapping[number_string[0]] strings_of_...
class Solution: def minTaps(self, n: int, A: List[int]) -> int: dp = [math.inf] * (n + 1) for i in range(0, n + 1): left = max(0, i - A[i]) use = (dp[left] + 1) if i - A[i] > 0 else 1 dp[i] = min(dp[i], use) for j in range(i, min(i + A[i] + 1, n + 1)):...
class Solution: def min_taps(self, n: int, A: List[int]) -> int: dp = [math.inf] * (n + 1) for i in range(0, n + 1): left = max(0, i - A[i]) use = dp[left] + 1 if i - A[i] > 0 else 1 dp[i] = min(dp[i], use) for j in range(i, min(i + A[i] + 1, n + 1)):...
def fibo_recur(n): if n == 0: return 0 if n == 1: return 1 if n == 2: return 1 return fibo_recur(n-1) + fibo_recur(n-2) def fibo_dp(n, dp=dict()): if n == 0: return 0 if n == 1 or n == 2: return 1 if n in dp: return dp[n] dp[n...
def fibo_recur(n): if n == 0: return 0 if n == 1: return 1 if n == 2: return 1 return fibo_recur(n - 1) + fibo_recur(n - 2) def fibo_dp(n, dp=dict()): if n == 0: return 0 if n == 1 or n == 2: return 1 if n in dp: return dp[n] dp[n] = fibo_...
class Square: def __init__(self, sideLength = 0): self.sideLength = sideLength def area_square(self): return self.sideLength ** 2 def perimeter_square(self): return self.sideLength * 4 class Triangle: def __init__(self, base : float, height : float): self.base = b...
class Square: def __init__(self, sideLength=0): self.sideLength = sideLength def area_square(self): return self.sideLength ** 2 def perimeter_square(self): return self.sideLength * 4 class Triangle: def __init__(self, base: float, height: float): self.base = base ...
#! /usr/bin/python3 def parse(): prev_data_S = "-1,-1,-1,-1,-1" prev_none_vga_data = "0" while(1): f_read = open("temp.txt","r") data = f_read.read() f_read.close() data_S = data.split('S') if(len(data_S)>2): none_vga_data = data_S[2].split('T') ...
def parse(): prev_data_s = '-1,-1,-1,-1,-1' prev_none_vga_data = '0' while 1: f_read = open('temp.txt', 'r') data = f_read.read() f_read.close() data_s = data.split('S') if len(data_S) > 2: none_vga_data = data_S[2].split('T') while len(data_S)...
class ResultKey: """ Key for storing and searching Metrics. """ def __init__(self, data_set_date, tags): self.data_set_date = data_set_date self.tags = tags def __str__(self): return "DataSetDate: {}\nTags: {}".format(self.data_set_date, self.tags) def __eq__(self, othe...
class Resultkey: """ Key for storing and searching Metrics. """ def __init__(self, data_set_date, tags): self.data_set_date = data_set_date self.tags = tags def __str__(self): return 'DataSetDate: {}\nTags: {}'.format(self.data_set_date, self.tags) def __eq__(self, oth...
class color: PURPLE = '\033[95m' CYAN = '\033[96m' DARKCYAN = '\033[36m' BLUE = '\033[94m' GREEN = '\033[92m' YELLOW = '\033[93m' RED = '\033[91m' BOLD = '\033[1m' UNDERLINE = '\033[4m' END = '\033[0m' class DictList(dict): def __setitem__(self, key, value): try: ...
class Color: purple = '\x1b[95m' cyan = '\x1b[96m' darkcyan = '\x1b[36m' blue = '\x1b[94m' green = '\x1b[92m' yellow = '\x1b[93m' red = '\x1b[91m' bold = '\x1b[1m' underline = '\x1b[4m' end = '\x1b[0m' class Dictlist(dict): def __setitem__(self, key, value): try: ...
""" For strings S and T, we say "T divides S" if and only if S = T + ... + T (T concatenated with itself 1 or more times) Return the largest string X such that X divides str1 and X divides str2. Example 1: Input: str1 = "ABCABC", str2 = "ABC" Output: "ABC" Example 2: Input: str1 = "ABABAB", str2 = "ABAB" Output...
""" For strings S and T, we say "T divides S" if and only if S = T + ... + T (T concatenated with itself 1 or more times) Return the largest string X such that X divides str1 and X divides str2. Example 1: Input: str1 = "ABCABC", str2 = "ABC" Output: "ABC" Example 2: Input: str1 = "ABABAB", str2 = "ABAB" Output...
### Do something - what - print ### Data source? - what data is being printed? ### Output device? - where the data is being printed? ### I think these are rather good questions, it would be cool ### to specify these in the code print("Hello, World!\nI'm Ante")
print("Hello, World!\nI'm Ante")
# -*- coding: utf-8 -*- """ dbmanage Library ~~~~~~~~~~~~~~~~ """
""" dbmanage Library ~~~~~~~~~~~~~~~~ """
input_size = 512 model = dict( type='SingleStageDetector', backbone=dict( type='SSDVGG', depth=16, with_last_pool=False, ceil_mode=True, out_indices=(3, 4), out_feature_indices=(22, 34), init_cfg=dict( type='Pretrained', checkpoint='open-mmlab:...
input_size = 512 model = dict(type='SingleStageDetector', backbone=dict(type='SSDVGG', depth=16, with_last_pool=False, ceil_mode=True, out_indices=(3, 4), out_feature_indices=(22, 34), init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://vgg16_caffe')), neck=dict(type='SSDNeck', in_channels=(512, 1024), out_channe...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
class Nosuchtableerror(Exception): """Raised when a referenced table is not found""" class Nosuchnamespaceerror(Exception): """Raised when a referenced name-space is not found""" class Namespacenotemptyerror(Exception): """Raised when a name-space being dropped is not empty""" class Alreadyexistserror(Ex...
def operation(): """ :return: Returns a number between 1 and 5 that represents the four fundamental mathematical operations and exit. """ print("Choose an option:") print("[1] Addition (+)") print("[2] Subtraction (-)") print("[3] Multiplication (*)") print("[4] Division (/)") ...
def operation(): """ :return: Returns a number between 1 and 5 that represents the four fundamental mathematical operations and exit. """ print('Choose an option:') print('[1] Addition (+)') print('[2] Subtraction (-)') print('[3] Multiplication (*)') print('[4] Division (/)') print(...
''' LEADERS OF AN ARRAY The task is to find all leaders in an array, where a leader is an array element which is greater than all the elements on its right side ''' print("Enter the size of array : ") num = int(input()) a = [] print("Enter array elements") for i in range(0, num): a.append(int(...
""" LEADERS OF AN ARRAY The task is to find all leaders in an array, where a leader is an array element which is greater than all the elements on its right side """ print('Enter the size of array : ') num = int(input()) a = [] print('Enter array elements') for i in range(0, num): a.append(int(input...
# |---------------------| # <module> | | # |---------------------| # # |---------------------| # print_n | s--->'Hello' n--->2 | | # |---------------------| # # |---------------------| # print_n | s--->'Hello' n--->1 ...
def print_n(s, n): if n <= 0: return print(s) print_n(s, n - 1) print_n('Hello', 2)
num_waves = 3 num_eqn = 3 # Conserved quantities pressure = 0 x_velocity = 1 y_velocity = 2
num_waves = 3 num_eqn = 3 pressure = 0 x_velocity = 1 y_velocity = 2
class RangeQuery: def __init__(self, data, func=min): self.func = func self._data = _data = [list(data)] i, n = 1, len(_data[0]) while 2 * i <= n: prev = _data[-1] _data.append([func(prev[j], prev[j + i]) for j in range(n - 2 * i + 1)]) i <<= 1 ...
class Rangequery: def __init__(self, data, func=min): self.func = func self._data = _data = [list(data)] (i, n) = (1, len(_data[0])) while 2 * i <= n: prev = _data[-1] _data.append([func(prev[j], prev[j + i]) for j in range(n - 2 * i + 1)]) i <<= ...
# Source and destination file names. test_source = "compact_lists.txt" test_destination = "compact_lists.html" # Keyword parameters passed to publish_file. reader_name = "standalone" parser_name = "rst" writer_name = "html" # Settings # local copy of stylesheets: # (Test runs in ``docutils/test/``, we need relative p...
test_source = 'compact_lists.txt' test_destination = 'compact_lists.html' reader_name = 'standalone' parser_name = 'rst' writer_name = 'html' settings_overrides['stylesheet_dirs'] = ('.', 'functional/input/data')
#!/usr/bin/env python dic = {'nome': 'Shirley Manson', 'banda': 'Garbage'} print(dic['nome']) del dic dic = {'Yes': ['Close To The Edge', 'Fragile'], 'Genesis': ['Foxtrot', 'The Nursery Crime'], 'ELP': ['Brain Salad Surgery']} print(dic['Yes'])
dic = {'nome': 'Shirley Manson', 'banda': 'Garbage'} print(dic['nome']) del dic dic = {'Yes': ['Close To The Edge', 'Fragile'], 'Genesis': ['Foxtrot', 'The Nursery Crime'], 'ELP': ['Brain Salad Surgery']} print(dic['Yes'])
#!/usr/bin/env python3 """Configuration of builddataset.""" buildcfg = {} # === Selection requirements === # # Minimum clear pixel coverage in the constructed Source Mask # Note: Due to water vapour, most rivers and lakes will be marked as not clear buildcfg['min_clearance'] = 0.75 # Minimum number of LR images per ...
"""Configuration of builddataset.""" buildcfg = {} buildcfg['min_clearance'] = 0.75 buildcfg['nmin'] = 12 buildcfg['normfilename'] = 'norm' buildcfg['HRname'] = 'HR' buildcfg['scoremaskname'] = 'SM' buildcfg['sources'] = 'sources.txt' buildcfg['dirvalidate'] = 'validate' buildcfg['dirsubtest'] = 'submission-test' build...
class DictHelper: @staticmethod def split_path(path): if isinstance(path, str): path = path.split(" ") elif isinstance(path, int): path = str(path) filename, *rpath = path return (filename, rpath) @staticmethod def get_dict_by_path(dict_var, pa...
class Dicthelper: @staticmethod def split_path(path): if isinstance(path, str): path = path.split(' ') elif isinstance(path, int): path = str(path) (filename, *rpath) = path return (filename, rpath) @staticmethod def get_dict_by_path(dict_var, pa...
"""Support ODT formatting. Part of the PyWriter project. Copyright (c) 2020 Peter Triesberger For further information see https://github.com/peter88213/PyWriter Published under the MIT License (https://opensource.org/licenses/mit-license.php) """ def to_odt(text): """Convert yw7 raw markup to odt. Retu...
"""Support ODT formatting. Part of the PyWriter project. Copyright (c) 2020 Peter Triesberger For further information see https://github.com/peter88213/PyWriter Published under the MIT License (https://opensource.org/licenses/mit-license.php) """ def to_odt(text): """Convert yw7 raw markup to odt. Return an xml s...
''' A program for warshall algorithm.It is a shortest path algorithm which is used to find the distance from source node,which is the first node,to all the other nodes. If there is no direct distance between two vertices then it is considered as -1 ''' def warshall(g,ver): dist = list(map(lambda i: list(map(...
""" A program for warshall algorithm.It is a shortest path algorithm which is used to find the distance from source node,which is the first node,to all the other nodes. If there is no direct distance between two vertices then it is considered as -1 """ def warshall(g, ver): dist = list(map(lambda i: list(map(lamb...
class Solution: """ @param S: A set of numbers. @return: A list of lists. All valid subsets. """ def subsetsWithDup(self, S): # write your code here # Revursive if (not S): return [[]] S = sorted(S) tmp = self.subsetsWithDup(S[:-1]) locked...
class Solution: """ @param S: A set of numbers. @return: A list of lists. All valid subsets. """ def subsets_with_dup(self, S): if not S: return [[]] s = sorted(S) tmp = self.subsetsWithDup(S[:-1]) locked = True res = [] + tmp count = 0 ...
#------------------------------------------------------------------------------- # importation #------------------------------------------------------------------------------- # Main class Ml_tools class ml_tools: def __init__(self): pass
class Ml_Tools: def __init__(self): pass
text = " I love apples very much " # The number of characters in the text text_size = len(text) # Initialize a pointer to the position of the first character of 'text' pos = 0 # This is a flag to indicate whether the character we are comparing # to is a white space or not is_space = text[0].isspace() # Start toke...
text = ' I love apples very much ' text_size = len(text) pos = 0 is_space = text[0].isspace() for (i, char) in enumerate(text): is_current_space = char.isspace() if is_current_space != is_space: print(text[pos:i]) if is_current_space: pos = i + 1 else: pos = i ...
"""Issue. """ class Issue: """Issue. Issue must not contain subelements and attributes. @see RPCBase._parse_issue(element) :param creator: element.attrib["creator"] :param value: element.text """ def __init__(self, creator=None, value=None): self.creator = creator self...
"""Issue. """ class Issue: """Issue. Issue must not contain subelements and attributes. @see RPCBase._parse_issue(element) :param creator: element.attrib["creator"] :param value: element.text """ def __init__(self, creator=None, value=None): self.creator = creator self....
# PyJS does not support weak references, # so this module provides stubs with usual references typecls = __builtins__.TypeClass class ReferenceType(typecls): pass class CallableProxyType(typecls): pass class ProxyType(typecls): pass ProxyTypes = (ProxyType, CallableProxyType) WeakValueDictionary = dict ...
typecls = __builtins__.TypeClass class Referencetype(typecls): pass class Callableproxytype(typecls): pass class Proxytype(typecls): pass proxy_types = (ProxyType, CallableProxyType) weak_value_dictionary = dict weak_key_dictionary = dict
# # PySNMP MIB module TCP-ESTATS-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/TCP-ESTATS-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:31:06 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
def solve(arr: list) -> int: """ This function returns the difference between the count of even numbers and the count of odd numbers. """ even = [] odd = [] for item in arr: if str(item).isdigit(): if item % 2 == 0: even.append(item) else: ...
def solve(arr: list) -> int: """ This function returns the difference between the count of even numbers and the count of odd numbers. """ even = [] odd = [] for item in arr: if str(item).isdigit(): if item % 2 == 0: even.append(item) else: ...
class Client: def __init__(self, client_id): self.client_id = client_id self.available = 0 self.held = 0 self.total = 0 self.locked = False def get_client_id(self): return self.client_id def get_available(self): return self.available def lock...
class Client: def __init__(self, client_id): self.client_id = client_id self.available = 0 self.held = 0 self.total = 0 self.locked = False def get_client_id(self): return self.client_id def get_available(self): return self.available def lock_c...