content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" Distributed optimal power flow for DC networks. """
""" Distributed optimal power flow for DC networks. """
""" PASSENGERS """ numPassengers = 11416 passenger_arriving = ( (2, 4, 1, 3, 2, 0, 2, 2, 1, 1, 1, 0, 0, 1, 2, 2, 1, 3, 2, 2, 0, 2, 1, 1, 1, 0), # 0 (4, 1, 4, 4, 1, 1, 1, 2, 1, 1, 1, 0, 0, 4, 4, 3, 3, 6, 0, 1, 1, 0, 1, 0, 1, 0), # 1 (2, 3, 3, 0, 2, 0, 2, 1, 1, 0, 0, 0, 0, 1, 7, 3, 5, 1, 2, 3, 0, 2, 0, 0, 0, 0), ...
""" PASSENGERS """ num_passengers = 11416 passenger_arriving = ((2, 4, 1, 3, 2, 0, 2, 2, 1, 1, 1, 0, 0, 1, 2, 2, 1, 3, 2, 2, 0, 2, 1, 1, 1, 0), (4, 1, 4, 4, 1, 1, 1, 2, 1, 1, 1, 0, 0, 4, 4, 3, 3, 6, 0, 1, 1, 0, 1, 0, 1, 0), (2, 3, 3, 0, 2, 0, 2, 1, 1, 0, 0, 0, 0, 1, 7, 3, 5, 1, 2, 3, 0, 2, 0, 0, 0, 0), (2, 4, 2, 4, 2, ...
def findReplaceString(s, indexes, sources, targets): dupe_s = s[:] for i in range(len(indexes)): curr = s[indexes[i]] if curr == sources[i][0]: print(curr) dupe_s = dupe_s.replace(sources[i], targets[i]) print(dupe_s) return dupe_s
def find_replace_string(s, indexes, sources, targets): dupe_s = s[:] for i in range(len(indexes)): curr = s[indexes[i]] if curr == sources[i][0]: print(curr) dupe_s = dupe_s.replace(sources[i], targets[i]) print(dupe_s) return dupe_s
# # Copyright (C) 2020 The Android Open Source Project # # 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...
layout = bool_scalar('layout', False) i1 = input('op1', 'TENSOR_FLOAT32', '{1, 3, 3, 2}') f1 = parameter('op2', 'TENSOR_FLOAT32', '{2, 2, 2, 4}', [0.0] * (2 * 2 * 2 * 4)) b1 = parameter('op3', 'TENSOR_FLOAT32', '{4}', [0.0] * 4) o1 = output('op4', 'TENSOR_FLOAT32', '{1, 2, 2, 4}') model().Operation('DEPTHWISE_CONV_2D',...
class twitter_nlp_toolkit: def __init__(self): print("twitter_nlp_toolkit initialized")
class Twitter_Nlp_Toolkit: def __init__(self): print('twitter_nlp_toolkit initialized')
#difference between a given number and 17, if the number is greater than 17 return double the absolute difference. x = int(input('Enter the number:')) y = 17 n = y-x if x > 17: print(abs(n)*2) else: print(n)
x = int(input('Enter the number:')) y = 17 n = y - x if x > 17: print(abs(n) * 2) else: print(n)
def compare(physical_inventory, digital_inventory): if physical_inventory == digital_inventory: return {} discrepencies = {} for item, quantity in digital_inventory.items(): if item not in physical_inventory: discrepencies[item] = {"physical":None,"digital":quantity} for item, quantity in physical_inventory....
def compare(physical_inventory, digital_inventory): if physical_inventory == digital_inventory: return {} discrepencies = {} for (item, quantity) in digital_inventory.items(): if item not in physical_inventory: discrepencies[item] = {'physical': None, 'digital': quantity} for...
print(type(1)) print(type(1.1)) print(type('texto')) print(type(False)) print(type(True))
print(type(1)) print(type(1.1)) print(type('texto')) print(type(False)) print(type(True))
app_host = '127.0.0.1' app_port = 9090 app_desc = 'Local Server' app_title = 'API Template' app_key = 'AWEREG#Q$^#!%^QEH$##%' admin_id = 'admin' admin_pw = 'w4b35ya253vu5e6n' db_type = 'mysql+pymysql' db_host = 'localhost' db_port = '33066' db_name = 'hrms' db_user = 'root' db_pass = 'fnxm1qazXSW@'
app_host = '127.0.0.1' app_port = 9090 app_desc = 'Local Server' app_title = 'API Template' app_key = 'AWEREG#Q$^#!%^QEH$##%' admin_id = 'admin' admin_pw = 'w4b35ya253vu5e6n' db_type = 'mysql+pymysql' db_host = 'localhost' db_port = '33066' db_name = 'hrms' db_user = 'root' db_pass = 'fnxm1qazXSW@'
s = float(input('digite o salario do funcionario? R$')) if s <= 1250.0: c1 = (s * 15 / 100) + s print('agora o funcionario vai ter o reajuste de 15%\nentao o salario dele que era R${:.2f}, passa a ser de R${:.2f}'.format(s, c1)) else: c2 = (s * 10 / 100) + s print('agora o fucionario vai ter o reajuste...
s = float(input('digite o salario do funcionario? R$')) if s <= 1250.0: c1 = s * 15 / 100 + s print('agora o funcionario vai ter o reajuste de 15%\nentao o salario dele que era R${:.2f}, passa a ser de R${:.2f}'.format(s, c1)) else: c2 = s * 10 / 100 + s print('agora o fucionario vai ter o reajuste de 1...
def name(firstname,lastname): return f"My name is {firstname} {lastname}" print(name("Atherv", "Patil"))
def name(firstname, lastname): return f'My name is {firstname} {lastname}' print(name('Atherv', 'Patil'))
# -*- coding: utf-8 -*- def view_grid(grid_space): for row in range(len(grid_space)): for column in range(len(grid_space[0])): print (grid_space[row][column],end = ' '), if column == 2 or column == 5: print('|', end=' ') if row == 2 or row == 5:...
def view_grid(grid_space): for row in range(len(grid_space)): for column in range(len(grid_space[0])): (print(grid_space[row][column], end=' '),) if column == 2 or column == 5: print('|', end=' ') if row == 2 or row == 5: print('') prin...
""" dp[i][k] := minimum difficulty of a k days job schedule, D[:i]. maxInRange[i][j] := max(D[i:j+1]) """ class Solution(object): def minDifficulty(self, D, K): if not D or not K or K>len(D): return -1 N = len(D) maxInRange = [[0 for _ in xrange(N)] for _ in xrange(N)] for i in xra...
""" dp[i][k] := minimum difficulty of a k days job schedule, D[:i]. maxInRange[i][j] := max(D[i:j+1]) """ class Solution(object): def min_difficulty(self, D, K): if not D or not K or K > len(D): return -1 n = len(D) max_in_range = [[0 for _ in xrange(N)] for _ in xrange(N)] ...
# -*- coding: utf-8 -*- """ Created on Wed Oct 23 17:32:12 2019 @author: giles """ ''' Question 1 Can you remember how to check if a key exists in a dictionary? Using the capitals dictionary below write some code to ask the user to input a country, then check to see if that country is in the dictionary and...
""" Created on Wed Oct 23 17:32:12 2019 @author: giles """ "\nQuestion 1\nCan you remember how to check if a key exists in a dictionary?\nUsing the capitals dictionary below write some code to ask the user to input\na country, then check to see if that country is in the dictionary and if it is\nprint the capital. If n...
n = int(input()) sl = {} for i in range(n): s = input() if not(s in sl): sl[s] = 0 else: sl[s] += 1 ans = [] s_max = max(sl.values()) for key in sl: if sl[key] == s_max: ans.append(key) ans.sort() for a in ans: print(a)
n = int(input()) sl = {} for i in range(n): s = input() if not s in sl: sl[s] = 0 else: sl[s] += 1 ans = [] s_max = max(sl.values()) for key in sl: if sl[key] == s_max: ans.append(key) ans.sort() for a in ans: print(a)
#!/usr/bin/env python # -*- coding: utf-8 -*- __title__ = 'lasotuvi' __version__ = '1.0.1' __author__ = 'doanguyen' __author_email__ = 'dungnv2410 at gmail.com' __license__ = 'MIT License'
__title__ = 'lasotuvi' __version__ = '1.0.1' __author__ = 'doanguyen' __author_email__ = 'dungnv2410 at gmail.com' __license__ = 'MIT License'
#Robot in a grid. Imagine a robot sitting in the upper left corner of a grid #with r rows and c columns. The robot can only move in two directions, #right and down, but certain cells are "off limits" such that the robot #cannot step on them. Design an algorithm to find a path for the robot #from the top left to the bot...
def has_path(n, m, clear): if n < 0 or n >= len(clear) or m < 0 or (m >= len(clear[0])): return False if n == 0 and m == 0 and clear[n][m]: return True return clear[n, m] and (has_path(n, m - 1, clear) or has_path(n - 1, m, clear))
#!/usr/bin/env python3.7 # -*- coding: utf-8 -*- class Connection: """ A representation for the connection between the camera and the host """ def __init__(self, api, api_requests): self._api = api self._requests = api_requests def get_connection_info(self) -> str: """ ...
class Connection: """ A representation for the connection between the camera and the host """ def __init__(self, api, api_requests): self._api = api self._requests = api_requests def get_connection_info(self) -> str: """ Obtain information about the connection ...
''' Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from left to right, level by level from leaf to root). ''' # RECURSION # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val ...
""" Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from left to right, level by level from leaf to root). """ class Solution(object): def driver(self, node, res, level): if not node: return res if len(res) == level: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Exception classes used by filters.""" class ImageErrors(Exception): """The base class for filter errors.""" pass class NotSquareImage(ImageErrors): """The image not have NxN dimension""" pass class DimensionNotIsPowerTwo(ImageErrors): """"The ...
"""Exception classes used by filters.""" class Imageerrors(Exception): """The base class for filter errors.""" pass class Notsquareimage(ImageErrors): """The image not have NxN dimension""" pass class Dimensionnotispowertwo(ImageErrors): """"The dimension n not is power two""" pass class Dep...
# Print out numbers from 1 to 100 (including 100). # But, instead of printing multiples of 3, print "Fizz" # Instead of printing multiples of 5, print "Buzz" # Instead of printing multiples of both 3 and 5, print "FizzBuzz". for number in range(1, 101): if number % 3 == 0 and number % 5 == 0: print("FizzBu...
for number in range(1, 101): if number % 3 == 0 and number % 5 == 0: print('FizzBuzz') elif number % 3 == 0: print('Fizz') elif number % 5 == 0: print('Buzz') else: print(number) counter = 1 while counter < 101: if counter % 3 == 0 and counter % 5 == 0: print(...
# Stackmaps don't get emitted for code that's dead even if it exists in IR: class C(object): pass c = C() if 1 == 0: c.x = 1
class C(object): pass c = c() if 1 == 0: c.x = 1
class FlipFlop: GATE_LVL = False def __init__(self, clock, input, name="FlipFlop"): self.clock = clock self.input = input self.output = None self.outputp = None self.output_star = None self.name = name self.build() def logic(self): pass ...
class Flipflop: gate_lvl = False def __init__(self, clock, input, name='FlipFlop'): self.clock = clock self.input = input self.output = None self.outputp = None self.output_star = None self.name = name self.build() def logic(self): pass ...
def SelectionSort(array): # Traverse through all array elements for i in range(len(array)): # Find the minimum element in remaining # unsorted array min_idx = i for j in range(i+1, len(array)): if array[min_idx] > array[j]: min_idx = j # Swap the found minimum element with # the first eleme...
def selection_sort(array): for i in range(len(array)): min_idx = i for j in range(i + 1, len(array)): if array[min_idx] > array[j]: min_idx = j (array[i], array[min_idx]) = (array[min_idx], array[i]) return array array = [24, 6, 2, 9, 0, 7] print(selection_sor...
def yes_no_bool(val): if val.lower() == 'yes': return True elif val.lower() == 'no': return False else: raise ValueError( 'Cannot translate "{}" to bool'.format(val))
def yes_no_bool(val): if val.lower() == 'yes': return True elif val.lower() == 'no': return False else: raise value_error('Cannot translate "{}" to bool'.format(val))
# Calculate distance of 1056 feet in yard and miles. # 1 mile = 1760 yards and 1 yard = 3 feet. feet = 1056 yard = feet / 3 print("1056 feet is",yard,"yards") mile = yard / 1760 print("1056 feet is",mile,"miles")
feet = 1056 yard = feet / 3 print('1056 feet is', yard, 'yards') mile = yard / 1760 print('1056 feet is', mile, 'miles')
# ----- model_path_asr= 'models/asr/' processor_path_asr='models/asr/' device_asr = 'cuda' min_len_sec=100 max_len_sec=150 # ----- model_path_punctuation='models/v1_4lang_q.pt' step_punctuation=30 # ----- model_path_summarization= 'models/sum/' tokenizer_path_summarization='models/sum/' max_length_sum=50 step_sum=450 d...
model_path_asr = 'models/asr/' processor_path_asr = 'models/asr/' device_asr = 'cuda' min_len_sec = 100 max_len_sec = 150 model_path_punctuation = 'models/v1_4lang_q.pt' step_punctuation = 30 model_path_summarization = 'models/sum/' tokenizer_path_summarization = 'models/sum/' max_length_sum = 50 step_sum = 450 device_...
# detection params detector_path = 'retina_r50/' box_score_thresh = 0.8 img_target_size = 480 img_max_size = 640 nms_thresh = 0.4
detector_path = 'retina_r50/' box_score_thresh = 0.8 img_target_size = 480 img_max_size = 640 nms_thresh = 0.4
def main(): n = int(input()) player_hp = [11 + i for i in range(n)] i = 0 out = 0 out_indexes = [] while out < len(player_hp) - 1: if player_hp[i] == 0: i += 1 if i == len(player_hp): i = 0 continue hp = player_hp[target(play...
def main(): n = int(input()) player_hp = [11 + i for i in range(n)] i = 0 out = 0 out_indexes = [] while out < len(player_hp) - 1: if player_hp[i] == 0: i += 1 if i == len(player_hp): i = 0 continue hp = player_hp[target(player_...
#TODOS LOS METODOS QUE EXISTEN PARA HACER COMENTARIOS EN PYTHON #ESTE ES UN EJEMPLO DE COMENTARIO print('COMETARIOS EN EL CODIGO') "ESTE ES OTRO EJEMPLO DE COMO HACER COMENTARIOS" '''HOLA ESTO ES EJEMPLO DE COMO HACER COMENTARIOS MULTILINEA '''
print('COMETARIOS EN EL CODIGO') 'ESTE ES OTRO EJEMPLO DE COMO HACER COMENTARIOS' 'HOLA\nESTO ES EJEMPLO DE COMO HACER\nCOMENTARIOS MULTILINEA\n'
#-*-coding:utf-8-*- # Create dummy secrey key so we can use sessions SECRET_KEY = '123456790' # Create in-memory database DATABASE_FILE = '../hhlyDevops_db.sqlite' SQLALCHEMY_DATABASE_URI = 'sqlite:///' + DATABASE_FILE SQLALCHEMY_ECHO = True SQLALCHEMY_TRACK_MODIFICATIONS = True SQLALCHEMY_COMMIT_ON_TEARDOWN = True #...
secret_key = '123456790' database_file = '../hhlyDevops_db.sqlite' sqlalchemy_database_uri = 'sqlite:///' + DATABASE_FILE sqlalchemy_echo = True sqlalchemy_track_modifications = True sqlalchemy_commit_on_teardown = True bootstrap_use_minified = True bootstrap_serve_local = True bootstrap_cdn_force_ssl = True bootstrap_...
num1 = 10 print("Global variable num1=",num1) def func(num2): print("In function num2 = " ,num2) num3 = 30 print("In function num3 = " ,num3) func(20) print("num1 again=",num1) print("num3 outside function =",num3) # it will throw error since is local variable.
num1 = 10 print('Global variable num1=', num1) def func(num2): print('In function num2 = ', num2) num3 = 30 print('In function num3 = ', num3) func(20) print('num1 again=', num1) print('num3 outside function =', num3)
red='\033[1;31m' aqua = '\033[1;36m' blink = "\033[5m" reset = reset="\033[0m" b = f""" {red} ____ _ ____ _ _ | _ \ ___ __| |/ ___(_)_ __ | |__ ___ _ __ | |_) / _ \/ _` | | | | '_ \| '_ \ / _ \ '__| | _ < __/ (_| | |___| | |_) | | | | __/ | |_| \_\___|\__,_|\____|_| ...
red = '\x1b[1;31m' aqua = '\x1b[1;36m' blink = '\x1b[5m' reset = reset = '\x1b[0m' b = f"\n{red} ____ _ ____ _ _ \n | _ \\ ___ __| |/ ___(_)_ __ | |__ ___ _ __ \n | |_) / _ \\/ _` | | | | '_ \\| '_ \\ / _ \\ '__|\n | _ < __/ (_| | |___| | |_) | | | | __/ | \n |_| \\_\\___|\\__,...
class Solution: def removeElement(self, nums: List[int], val: int) -> int: size = len(nums) if (size == 0): return 0 j = 0 k = size - 1 while (j < k) : while (j < k and nums[j] != val): j += 1 while (j < k and nums[k] == va...
class Solution: def remove_element(self, nums: List[int], val: int) -> int: size = len(nums) if size == 0: return 0 j = 0 k = size - 1 while j < k: while j < k and nums[j] != val: j += 1 while j < k and nums[k] == val: ...
controlNum = list(map(int, input().split())) controlArr = list(map(int, input().split())) tvChannelCost = [] for i in range(10): tvChannelCost.extend(list(map(int, input().split()))) origin, destination = input().split() origin = int(origin) destination = int(destination) results = [] # check can go directly to ...
control_num = list(map(int, input().split())) control_arr = list(map(int, input().split())) tv_channel_cost = [] for i in range(10): tvChannelCost.extend(list(map(int, input().split()))) (origin, destination) = input().split() origin = int(origin) destination = int(destination) results = [] if destination > 9: ...
size(200, 200) path = BezierPath() path.rect(50, 50, 100, 100) path.reverse() path.rect(75, 75, 50, 50) drawPath(path)
size(200, 200) path = bezier_path() path.rect(50, 50, 100, 100) path.reverse() path.rect(75, 75, 50, 50) draw_path(path)
class vowels: __VOWELS = ["A", "a", "E", "e", "I", "i", "O", "o", "U", "u", "Y", "y"] def __init__(self, text): self.text = text self.start = 0 @staticmethod def is_vowel(char): return char in vowels.__VOWELS def __iter__(self): return s...
class Vowels: __vowels = ['A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u', 'Y', 'y'] def __init__(self, text): self.text = text self.start = 0 @staticmethod def is_vowel(char): return char in vowels.__VOWELS def __iter__(self): return self def __next__(self):...
@xbot.xfunction @bot.command(name='add') async def add(ctx): """__GENERATED__ cross platform generated function""" try: message = ctx.message.content (_, left, right) = message.split(' ') result = (int(left) + int(right)) await ctx.send(result) except (IndexError, ValueError)...
@xbot.xfunction @bot.command(name='add') async def add(ctx): """__GENERATED__ cross platform generated function""" try: message = ctx.message.content (_, left, right) = message.split(' ') result = int(left) + int(right) await ctx.send(result) except (IndexError, ValueError): ...
""" Stworz prosty symulator gry karcianej wojna. Zadaniem Twojej funkcji jest wskazanie, ktora karta zwyciezy. Parametrami sa znaki card1 oraz card2. Moga one przyjmowac wartosci: <"1", "2", "3", ..., "10", "J", "D", "K", "A"> - wielkosc liter bedzie miala znaczenie (choc mozna przedstawic...
""" Stworz prosty symulator gry karcianej wojna. Zadaniem Twojej funkcji jest wskazanie, ktora karta zwyciezy. Parametrami sa znaki card1 oraz card2. Moga one przyjmowac wartosci: <"1", "2", "3", ..., "10", "J", "D", "K", "A"> - wielkosc liter bedzie miala znaczenie (choc mozna przedstawic rozwi...
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ if len(nums1) > len(nums2): return self.intersect(nums2, nums1) freq = {} for ele in nums1: ...
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ if len(nums1) > len(nums2): return self.intersect(nums2, nums1) freq = {} for ele in nums1: if e...
print(len("Python")) print(len("programming")) print(len(" ")) print("Maciej" + "Zurek") print("Maciej " + "Zurek") print("Maciej" + " Zurek") print("Maciej" + " " + "Zurek") print("a" "b" "c") print("---" * 10)
print(len('Python')) print(len('programming')) print(len(' ')) print('Maciej' + 'Zurek') print('Maciej ' + 'Zurek') print('Maciej' + ' Zurek') print('Maciej' + ' ' + 'Zurek') print('abc') print('---' * 10)
# Find the IP address in the following line using a regex group and the # re.search function. Print the IP address using the match object group # method, as well as the index of where the grouping starts and ends. log = '208.115.111.73 - - [01/Apr/2013:06:30:26 -0700] "GET /nanowiki/index.php/1_November_2007_-_Day_1 HT...
log = '208.115.111.73 - - [01/Apr/2013:06:30:26 -0700] "GET /nanowiki/index.php/1_November_2007_-_Day_1 HTTP/1.1" 404 36 "-" "Mozilla/5.0 (compatible; Ezooms/1.0; ezooms.bot@gmail.com)"'
__author__ = 'ivan.arar@gmail.com' class Paging(object): def __init__(self, paging_data): self.paging_data = paging_data def has_next(self): if int(self.paging_data['page']) == int(self.paging_data['pages']): return False else: return True def has_previou...
__author__ = 'ivan.arar@gmail.com' class Paging(object): def __init__(self, paging_data): self.paging_data = paging_data def has_next(self): if int(self.paging_data['page']) == int(self.paging_data['pages']): return False else: return True def has_previous...
f = open("01.txt", "r") past = 150 # using this as base case since first number on file is 150 (prevent dec or inc count from chaning) dec = 0 inc = 0 for i in f.read().splitlines(): if i > past: inc += 1 elif i < past: dec += 1 past = i print(inc)
f = open('01.txt', 'r') past = 150 dec = 0 inc = 0 for i in f.read().splitlines(): if i > past: inc += 1 elif i < past: dec += 1 past = i print(inc)
mapping = { "files": [ ("site-example.conf", "/etc/nginx/sites-available/site-example.conf") ], "templates": [ ("index.html.tmpl", "/var/www/html/index.html") ] }
mapping = {'files': [('site-example.conf', '/etc/nginx/sites-available/site-example.conf')], 'templates': [('index.html.tmpl', '/var/www/html/index.html')]}
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class CacheTypes(object): """Cache Types ENUM """ UNDEFINED = None MEMCACHED_CACHE = 'Memcached' @staticmethod def validate(cache_type): return cache_type in [ CacheTypes.MEMCACHED_CACHE, ]
class Cachetypes(object): """Cache Types ENUM """ undefined = None memcached_cache = 'Memcached' @staticmethod def validate(cache_type): return cache_type in [CacheTypes.MEMCACHED_CACHE]
# - helloworld.py *- coding: utf-8 -*- """ This program simply prints the phrase "Hello, World!" @author: wboyd """ print("Hello, World!")
""" This program simply prints the phrase "Hello, World!" @author: wboyd """ print('Hello, World!')
#---------------------------------------------------------------------------------------------------------- # # AUTOMATICALLY GENERATED FILE TO BE USED BY W_HOTBOX # # NAME: Toggle Adjust Points # COLOR: #3a97bd # #---------------------------------------------------------------------------------------------------------...
ns = nuke.selectedNodes() for n in ns: n.knob('toggleAdjustKnobs').execute()
#!/usr/bin/env python3 # ## Algorithm: # # - Initialize an empty set to store the already visited elements # - Iterate through the list # - If the current element is in the set, return True # - Otherwise, add the element to the set # # ## Time Complexity: # # - O(n) to run through the entire list # - O(1) to add an...
class Solution: def contains_duplicate(self, nums: List[int]) -> bool: seen = set() for x in nums: if x in seen: return True else: seen.add(x) return False
#============================================================================================== #Multiples of 3 and 5 #=============================================================================================== #Problem 1 #If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and...
rezultat = [i for i in range(1000) if i % 3 == 0 or i % 5 == 0] print(sum(rezultat))
# -*- coding: utf-8 -*- __author__ = "Paul Schifferer <dm@sweetrpg.com>" """ """ __title__ = 'PACKAGE_NAME' __description__ = 'PACKAGE_DESC' __url__ = 'PACKAGE_URL' __version__ = '0.0.0' __build__ = 0x000000 __author__ = 'PACKAGE_AUTHOR' __author_email__ = 'PACKAGE_AUTHOR_EMAIL' __license__ = 'MIT' __copyright__ = 'Co...
__author__ = 'Paul Schifferer <dm@sweetrpg.com>' '\n' __title__ = 'PACKAGE_NAME' __description__ = 'PACKAGE_DESC' __url__ = 'PACKAGE_URL' __version__ = '0.0.0' __build__ = 0 __author__ = 'PACKAGE_AUTHOR' __author_email__ = 'PACKAGE_AUTHOR_EMAIL' __license__ = 'MIT' __copyright__ = 'Copyright 2021 SweetRPG' __cake__ = u...
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def pthreadpool(): http_archive( name = "pthreadpool", bu...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_file') def pthreadpool(): http_archive(name='pthreadpool', build_file='//bazel/deps/pthreadpool:build.BUILD', sha256='7a523b439a996e2f4376169279409059101f2f71eed4fcc915971368990504a0', st...
class Message(object): def __init__(self, text, user_agent, message_date, email=None, referer=None, device=None): """Message :param text: text of the message :param user_agent: User-Agent from the query :param message_date: date of the message :param email: email address of t...
class Message(object): def __init__(self, text, user_agent, message_date, email=None, referer=None, device=None): """Message :param text: text of the message :param user_agent: User-Agent from the query :param message_date: date of the message :param email: email address of ...
# # PySNMP MIB module HPICF-SAVI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPICF-SAVI-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:33:53 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint) ...
__title__ = 'db_cache' __description__ = 'DB Cache' __url__ = 'https://github.com/dskrypa/db_cache' __version__ = '2020.09.19-1' __author__ = 'Doug Skrypa' __author_email__ = 'dskrypa@gmail.com' __copyright__ = 'Copyright 2020 Doug Skrypa'
__title__ = 'db_cache' __description__ = 'DB Cache' __url__ = 'https://github.com/dskrypa/db_cache' __version__ = '2020.09.19-1' __author__ = 'Doug Skrypa' __author_email__ = 'dskrypa@gmail.com' __copyright__ = 'Copyright 2020 Doug Skrypa'
''' Created on 29 Oct 2009 @author: charanpal An abstract class which reads graphs from files. ''' class GraphReader(object): def __init__(self): pass def readFromFile(self, fileName): pass
""" Created on 29 Oct 2009 @author: charanpal An abstract class which reads graphs from files. """ class Graphreader(object): def __init__(self): pass def read_from_file(self, fileName): pass
class FPS: sum_e=(911660635, 509520358, 369330050, 332049552, 983190778, 123842337, 238493703, 975955924, 603855026, 856644456, 131300601, 842657263, 730768835, 942482514, 806263778, 151565301, 510815449, 503497456, 743006876, 741047443, 56250497) sum_ie=(86583718, 372528824, 373294451, 645684063, 112220581, 69...
class Fps: sum_e = (911660635, 509520358, 369330050, 332049552, 983190778, 123842337, 238493703, 975955924, 603855026, 856644456, 131300601, 842657263, 730768835, 942482514, 806263778, 151565301, 510815449, 503497456, 743006876, 741047443, 56250497) sum_ie = (86583718, 372528824, 373294451, 645684063, 112220581...
def build_shopkeeper_dialog(scene, buyer, seller): class ItemDisplay(gui.BorderedControl): def __init__(self, item, depreciate=True, **kwargs): gui.BorderedControl.__init__(self, **kwargs) self.item = item self.depreciate = depreciate self._initComponents() ...
def build_shopkeeper_dialog(scene, buyer, seller): class Itemdisplay(gui.BorderedControl): def __init__(self, item, depreciate=True, **kwargs): gui.BorderedControl.__init__(self, **kwargs) self.item = item self.depreciate = depreciate self._initComponents() ...
input_file = 'input.txt' def process_input(): with open(input_file) as f: content = f.readlines() # stripping whitespace stripped = [x.strip() for x in content] return stripped def build_rules(raw): # converts the line-by-line representation # into a dictionary, keyed by the bag (e.g. "mirrored bla...
input_file = 'input.txt' def process_input(): with open(input_file) as f: content = f.readlines() stripped = [x.strip() for x in content] return stripped def build_rules(raw): rules = {} for line in raw: spl = line.split(' bags contain') current = spl[0] buffer = []...
# Enter your code here. Read input from STDIN. Print output to STDOUT n_input = input() int_input = input().split() print(all([int(i) > 0 for i in int_input]) and any([j == j[::-1] for j in int_input]))
n_input = input() int_input = input().split() print(all([int(i) > 0 for i in int_input]) and any([j == j[::-1] for j in int_input]))
# Class Method class sample: x = 10 @classmethod def modify(cls): cls.x += 1 s1 = Sample() s2 = Sample() print(s1.x, s2.x) s1.modify() print(s1.x, s2.x) s1.x += 1 print(s1.x, s2.x)
class Sample: x = 10 @classmethod def modify(cls): cls.x += 1 s1 = sample() s2 = sample() print(s1.x, s2.x) s1.modify() print(s1.x, s2.x) s1.x += 1 print(s1.x, s2.x)
# Settings for finals # Foreign language classes for finals logic FOREIGN_LANGUAGES = { 'ARABIC': ['100A', '100B', '1A', '1B', '20A', '20B'], 'ARMENI': ['101A', '101B', '1A', '1B'], 'BANGLA': ['101A', '101B', '1A', '1B'], 'BERMESE': ['1A', '1B'], 'BOSCRSR': ['117A', '117B', '27A', '27B'], 'BULGA...
foreign_languages = {'ARABIC': ['100A', '100B', '1A', '1B', '20A', '20B'], 'ARMENI': ['101A', '101B', '1A', '1B'], 'BANGLA': ['101A', '101B', '1A', '1B'], 'BERMESE': ['1A', '1B'], 'BOSCRSR': ['117A', '117B', '27A', '27B'], 'BULGARI': ['118A', '118B', '28A', '28B'], 'CATALAN': ['101', '102'], 'CELTIC': ['16', '85', '86'...
#%% file = open("../dataset/novel.txt") # %% characters = [] file2 = open("../dataset/character.txt") for line in file2: if line != '\n': line = line.strip('\n') characters.append(line) # %% relationship = [[0 for column in range(len(characters))] for row in range(len(characters))] lines = file.re...
file = open('../dataset/novel.txt') characters = [] file2 = open('../dataset/character.txt') for line in file2: if line != '\n': line = line.strip('\n') characters.append(line) relationship = [[0 for column in range(len(characters))] for row in range(len(characters))] lines = file.readlines() for li...
with open("sample.txt",'r+') as f: for line in f: for letter in line: print(letter)
with open('sample.txt', 'r+') as f: for line in f: for letter in line: print(letter)
class Solution: def numUniqueEmails(self, emails): _dict = {} for email in emails: at_idx = email.index('@') if email[:at_idx].count('+') == 0: if email[:at_idx].count('.') == 0: new_mail_address = email else: ...
class Solution: def num_unique_emails(self, emails): _dict = {} for email in emails: at_idx = email.index('@') if email[:at_idx].count('+') == 0: if email[:at_idx].count('.') == 0: new_mail_address = email else: ...
search_fruit = 'apple' fruit_box = ['banana', 'mango', 'apple', 'pineapple'] for fruit in fruit_box: if fruit == search_fruit: print('Found fruit : {}'.format(search_fruit)) break else: print('{} fruit not found'.format(search_fruit))
search_fruit = 'apple' fruit_box = ['banana', 'mango', 'apple', 'pineapple'] for fruit in fruit_box: if fruit == search_fruit: print('Found fruit : {}'.format(search_fruit)) break else: print('{} fruit not found'.format(search_fruit))
#!/usr/bin/env python3 # encoding: UTF-8 """ This file is part of IPGeoLocation tool. Copyright (C) 2015-2016 @maldevel https://github.com/maldevel/IPGeoLocation IPGeoLocation - Retrieve IP Geolocation information Powered by http://ip-api.com This program is free software: you can re...
""" This file is part of IPGeoLocation tool. Copyright (C) 2015-2016 @maldevel https://github.com/maldevel/IPGeoLocation IPGeoLocation - Retrieve IP Geolocation information Powered by http://ip-api.com This program is free software: you can redistribute it and/or modify it under t...
apps = ["admin", "AjaxSpreadsheet", "AppointmentManager", "ArXivInterface", "BingApi", "BitcoinExample", "CarSales", "CeleryIntegrationExample", "CookbookExample", "CssDesigner", "CustomerRelationshipManagement", "DnaAnalysisNeedlemanWunsh", "eCardsOnMap", "EmailContactForm", "EStoreExample", "FacebookClone", "Facebook...
apps = ['admin', 'AjaxSpreadsheet', 'AppointmentManager', 'ArXivInterface', 'BingApi', 'BitcoinExample', 'CarSales', 'CeleryIntegrationExample', 'CookbookExample', 'CssDesigner', 'CustomerRelationshipManagement', 'DnaAnalysisNeedlemanWunsh', 'eCardsOnMap', 'EmailContactForm', 'EStoreExample', 'FacebookClone', 'Facebook...
# Approach 1 class Solution: def maxProfit(self, prices: List[int]) -> int: i = 0 maxprofit = 0 v = prices[0] p = prices[0] while i < len(prices) - 1: while i < len(prices) - 1 and prices[i] > prices[i + 1]: i += 1 v = prices[i] ...
class Solution: def max_profit(self, prices: List[int]) -> int: i = 0 maxprofit = 0 v = prices[0] p = prices[0] while i < len(prices) - 1: while i < len(prices) - 1 and prices[i] > prices[i + 1]: i += 1 v = prices[i] i += 1...
class Parameters: course_number_per_program = {"min":3,"max":6} remote_learning_start_year = 2018 professor_number = 3000 student_enrollment_year = {"start":2015,"end":2016} student_number = 20000 before_remote_learning_drop_off = {"rate":10,"remote":20} after_remote_learning_drop_off = {"ra...
class Parameters: course_number_per_program = {'min': 3, 'max': 6} remote_learning_start_year = 2018 professor_number = 3000 student_enrollment_year = {'start': 2015, 'end': 2016} student_number = 20000 before_remote_learning_drop_off = {'rate': 10, 'remote': 20} after_remote_learning_drop_o...
''' ##################################### # 300. Longest Increasing Subsequence ##################################### class Solution: def lengthOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ tail = [0] * len(nums) size = 0 for num in nums: ...
''' ##################################### # 300. Longest Increasing Subsequence ##################################### class Solution: def lengthOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ tail = [0] * len(nums) size = 0 for num in nums: ...
#!/usr/bin/env python # coding=UTF-8 """ @Author: WEN Hao @LastEditors: WEN Hao @Description: @Date: 2021-07-22 @LastEditTime: 2021-09-01 """ # from .attack import Attack # from .attack_args import AttackArgs # from .attack_generator import AttackGenerator # from .attack_eval import AttackEval # from .attack_result im...
""" @Author: WEN Hao @LastEditors: WEN Hao @Description: @Date: 2021-07-22 @LastEditTime: 2021-09-01 """
# Introduction fo Computation and Programming Using Python (2021) # Chapter 3, Finger Exercise 1 """ Change the code in Figure 3-2 so that it returns the largest rather than the smallest divisor. Hint: if y*z = x and y is the smallest divisor of x, z is the largest divisor of x. Code in Figure 3-2: # Test if an in...
""" Change the code in Figure 3-2 so that it returns the largest rather than the smallest divisor. Hint: if y*z = x and y is the smallest divisor of x, z is the largest divisor of x. Code in Figure 3-2: # Test if an int > 2 is prime. If not, print smallest divisor x = int(input('Enter an integer greater than 2...
word_size = 27 num_words = 512 words_per_row = 4 local_array_size = 60 output_extended_config = True output_datasheet_info = True netlist_only = True nominal_corner_only = True
word_size = 27 num_words = 512 words_per_row = 4 local_array_size = 60 output_extended_config = True output_datasheet_info = True netlist_only = True nominal_corner_only = True
"""Utilities for tracking progress of runs, including time taken per generation, fitness plots, fitness caches, etc.""" cache = {} # This dict stores the cache for an evolutionary run. The key for each entry # is the phenotype of the individual, the value is its fitness. runtime_error_cache = [] # This list stores a ...
"""Utilities for tracking progress of runs, including time taken per generation, fitness plots, fitness caches, etc.""" cache = {} runtime_error_cache = [] best_fitness_list = [] first_pareto_list = [] time_list = [] stats_list = [] best_ever = None
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ Tests for components for Flocker documentation. """
""" Tests for components for Flocker documentation. """
"""Nevermore is a multiple task learning benckmark.""" __version__ = '0.0.1' __author__ = ''
"""Nevermore is a multiple task learning benckmark.""" __version__ = '0.0.1' __author__ = ''
""" TODO: - does the last plane fit the first plane? """ def is_periodic(wire) -> bool: return wire.planes[0].fits(wire.planes[-1])
""" TODO: - does the last plane fit the first plane? """ def is_periodic(wire) -> bool: return wire.planes[0].fits(wire.planes[-1])
''' Created on Dec 19, 2013 @author: kyle ''' def convert_array_to_YxZ(val, z): out_list_list = [] for i in xrange(len(val)/z + 1): out_list_list.append([]) for j in xrange(z): if i*z+j < len(val): out_list_list[i].append( val[i*z+j] ) return out_list_list
""" Created on Dec 19, 2013 @author: kyle """ def convert_array_to__yx_z(val, z): out_list_list = [] for i in xrange(len(val) / z + 1): out_list_list.append([]) for j in xrange(z): if i * z + j < len(val): out_list_list[i].append(val[i * z + j]) return out_list_...
class Metric(object): def reset(self): raise NotImplementedError def update(self, x, y): raise NotImplementedError def score(self): raise NotImplementedError def mean(self): raise NotImplementedError
class Metric(object): def reset(self): raise NotImplementedError def update(self, x, y): raise NotImplementedError def score(self): raise NotImplementedError def mean(self): raise NotImplementedError
def get_php_bp_obd(): return """ $dir=pos(glob("./*", GLOB_ONLYDIR)); $cwd=getcwd(); $ndir="./%s"; if($dir === false){ $r=mkdir($ndir); if($r === true){$dir=$ndir;}} chdir($dir); if(function_exists("ini_set")){ ini_set("open_basedir","..")...
def get_php_bp_obd(): return '\n $dir=pos(glob("./*", GLOB_ONLYDIR));\n $cwd=getcwd();\n $ndir="./%s";\n if($dir === false){\n $r=mkdir($ndir);\n if($r === true){$dir=$ndir;}}\n chdir($dir);\n if(function_exists("ini_set")){\n ini_set("open_basedir"...
def gcd(a,b): return gcd(b,a%b) if b else a def lcm3(a,b,c): return a*b*c*gcd(gcd(a,b),c)//gcd(a,b)//gcd(b,c)//gcd(a,c) x=[*map(int,input().split())] r=100**5 for i in range(5): for j in range(i+1,5): for k in range(j+1,5): n=lcm3(x[i],x[j],x[k]) r=min(n,r) print(r)
def gcd(a, b): return gcd(b, a % b) if b else a def lcm3(a, b, c): return a * b * c * gcd(gcd(a, b), c) // gcd(a, b) // gcd(b, c) // gcd(a, c) x = [*map(int, input().split())] r = 100 ** 5 for i in range(5): for j in range(i + 1, 5): for k in range(j + 1, 5): n = lcm3(x[i], x[j], x[k]) ...
for _ in range(int(input())): v,e=input().split() v=float(v) if e=="kg":print("%.4f"%(v*2.2046),"lb") if e=="lb":print("%.4f"%(v*0.4536),"kg") if e=="l":print("%.4f"%(v*0.2642),"g") if e=="g":print("%.4f"%(v*3.7854),"l")
for _ in range(int(input())): (v, e) = input().split() v = float(v) if e == 'kg': print('%.4f' % (v * 2.2046), 'lb') if e == 'lb': print('%.4f' % (v * 0.4536), 'kg') if e == 'l': print('%.4f' % (v * 0.2642), 'g') if e == 'g': print('%.4f' % (v * 3.7854), 'l')
coordinates_E0E1E1 = ((126, 108), (127, 80), (127, 81), (127, 100), (127, 108), (127, 120), (128, 78), (128, 79), (128, 81), (128, 89), (128, 99), (128, 100), (128, 108), (128, 109), (128, 120), (129, 75), (129, 81), (129, 87), (129, 89), (129, 98), (129, 101), (129, 108), (129, 109), (129, 120), (130, 75), (130, 77)...
coordinates_e0_e1_e1 = ((126, 108), (127, 80), (127, 81), (127, 100), (127, 108), (127, 120), (128, 78), (128, 79), (128, 81), (128, 89), (128, 99), (128, 100), (128, 108), (128, 109), (128, 120), (129, 75), (129, 81), (129, 87), (129, 89), (129, 98), (129, 101), (129, 108), (129, 109), (129, 120), (130, 75), (130, 77)...
P4_PLUGIN = 'q-p4-plugin' P4_AGENT = 'q-p4-agent' P4MODULE = 'p4-module' CONFIGURATION = 'p4-config'
p4_plugin = 'q-p4-plugin' p4_agent = 'q-p4-agent' p4_module = 'p4-module' configuration = 'p4-config'
# -*- coding: utf-8 -*- """ Big Bucket o' Exceptions """ class PacketException(ValueError): """There was an error encoding or decoding your packet.""" class ChannelException(ValueError): """Channel woes"""
""" Big Bucket o' Exceptions """ class Packetexception(ValueError): """There was an error encoding or decoding your packet.""" class Channelexception(ValueError): """Channel woes"""
def isPalindrome(s): return s == ''.join(list(reversed(s))) nums = sorted([x*y for x in range(1000) for y in range(x+1)], reverse=True) for x in nums: if isPalindrome(str(x)): print(x) break
def is_palindrome(s): return s == ''.join(list(reversed(s))) nums = sorted([x * y for x in range(1000) for y in range(x + 1)], reverse=True) for x in nums: if is_palindrome(str(x)): print(x) break
vendas = [ [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]] maior = marca = media = contador = maior1 = maior2 = maior3 = maior4 = maior5 = maior6 = maiorN = anoo = 0 for l in range(0, 4): for c in range(0, 6): vendas[l][c] = int(input("Digite os dados para a tabela: ")) for l...
vendas = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]] maior = marca = media = contador = maior1 = maior2 = maior3 = maior4 = maior5 = maior6 = maior_n = anoo = 0 for l in range(0, 4): for c in range(0, 6): vendas[l][c] = int(input('Digite os dados para a tabela: ')) for l...
class Solution: def maxAbsValExpr(self, arr1: List[int], arr2: List[int]) -> int: result = 0 n = len(arr1) dirs = [[1, 1], [1, -1], [-1, 1], [-1, -1]] for x, y in dirs: right = x * arr1[0] + y * arr2[0] + 0 for i in range(n): left = x * arr1[i]...
class Solution: def max_abs_val_expr(self, arr1: List[int], arr2: List[int]) -> int: result = 0 n = len(arr1) dirs = [[1, 1], [1, -1], [-1, 1], [-1, -1]] for (x, y) in dirs: right = x * arr1[0] + y * arr2[0] + 0 for i in range(n): left = x * a...
#Create a range from 0 to 50, excluding 50. rng = range(0, 50) print(list(rng)) #=============================== #Create a range from 0 to 10 with steps of 2. rng = range(0, 10, 2) print(list(rng)) #========================== #Create a range from 100 to 160 with steps of 10. Then print it as a list. rng = range(10...
rng = range(0, 50) print(list(rng)) rng = range(0, 10, 2) print(list(rng)) rng = range(100, 160, 10) print(list(rng)) rng = range(800, 1400, 100) rng = list(rng) rng.sort(reverse=True) print(rng)
# # PySNMP MIB module Wellfleet-LAPB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-LAPB-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:40:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
# https://leetcode.com/problems/coin-change-2/ class Solution: def change(self, amount: int, coins: list[int]) -> int: dp = [0 for _ in range(amount + 1)] dp[0] = 1 for coin in coins: for amount_idx in range(coin, len(dp)): dp[amount_idx] += dp[amount_idx - coin]...
class Solution: def change(self, amount: int, coins: list[int]) -> int: dp = [0 for _ in range(amount + 1)] dp[0] = 1 for coin in coins: for amount_idx in range(coin, len(dp)): dp[amount_idx] += dp[amount_idx - coin] return dp[-1]
# Map # Looping without a loop # Basic usage - count len people = ['Matt', 'Bryan', 'Nicole', 'Tammy'] # OLD way '''count = [] for x in people: count.append(len(x)) print(f'Old way:\n{count}')''' # MODERN way print(f'Map function:\n{list(map(len,people))}') # COMBINE ELEMENTS # Notice different lengs, we are...
people = ['Matt', 'Bryan', 'Nicole', 'Tammy'] "count = []\nfor x in people:\n count.append(len(x))\nprint(f'Old way:\n{count}')" print(f'Map function:\n{list(map(len, people))}') base = ('Pie', 'Cake', 'Brownies') toppings = ('Apple', 'Chocolate', 'Fudge', 'Pizza') def merg(a, b): return a + ' ' + b x = map(mer...
# returns minimum value from list of bms data parameter def bms_param_min(bms_param_data): if len(bms_param_data) !=0: return round(min(bms_param_data),3) return "Data not available" # returns maximum value from list of bms data parameter def bms_param_max(bms_param_data): if len(bms_param_data) !=...
def bms_param_min(bms_param_data): if len(bms_param_data) != 0: return round(min(bms_param_data), 3) return 'Data not available' def bms_param_max(bms_param_data): if len(bms_param_data) != 0: return round(max(bms_param_data), 3) return 'Data not available' def display_output(bms_data)...
# # PySNMP MIB module STN-SYSTEM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-SYSTEM-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:11:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, value_range_constraint, single_value_constraint, constraints_intersection) ...
stuff = [] x = True while x is True: y = input("") if y.lower() != 'done': stuff.append(y) else: print(stuff) print(len(stuff)) break
stuff = [] x = True while x is True: y = input('') if y.lower() != 'done': stuff.append(y) else: print(stuff) print(len(stuff)) break
# Define the path to the DNSMasq Lease file dnsmasq_lease_file = '/var/lib/misc/dnsmasq.leases' # Read list of hosts to ping from csv file ping_hosts ping_hosts = 'ping_hosts'
dnsmasq_lease_file = '/var/lib/misc/dnsmasq.leases' ping_hosts = 'ping_hosts'
def main(): l,mn,ma = list(map(int, input().split())) if mn>l : mn = l if ma>l : ma = l mn_sum = l-mn+1 c = 1 for i in range(mn-1): c *= 2 mn_sum += c c = 1 mx_sum = 1 for i in range(1,ma): c *= 2 mx_sum += c mx_sum += (l-ma)*c ...
def main(): (l, mn, ma) = list(map(int, input().split())) if mn > l: mn = l if ma > l: ma = l mn_sum = l - mn + 1 c = 1 for i in range(mn - 1): c *= 2 mn_sum += c c = 1 mx_sum = 1 for i in range(1, ma): c *= 2 mx_sum += c mx_sum += ...
class Solution: """ @param S: a string @return: return a list of strings """ def letterCasePermutation(self, S): # write your code here upper = sum(c.isalpha() for c in S) result = [] for i in range(1 << upper): b = 0 word = [] for ...
class Solution: """ @param S: a string @return: return a list of strings """ def letter_case_permutation(self, S): upper = sum((c.isalpha() for c in S)) result = [] for i in range(1 << upper): b = 0 word = [] for c in S: if...
# Collection.find() function with hardcoded values myColl = db.get_collection('my_collection') myRes1 = myColl.find('age = 15').execute() # Using the .bind() function to bind parameters myRes2 = myColl.find('name = :param1 AND age = :param2').bind('param1','jack').bind('param2', 17).execute() # Using named p...
my_coll = db.get_collection('my_collection') my_res1 = myColl.find('age = 15').execute() my_res2 = myColl.find('name = :param1 AND age = :param2').bind('param1', 'jack').bind('param2', 17).execute() myColl.modify('name = :param').set('age', 37).bind('param', 'clare').execute() my_res3 = myColl.find('name like :param')....