content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
frogs = input().split(' ') while True: token = input().split(' ') length = len(frogs) - 1 command = token[0] if command == 'Join': name = token[1] frogs.append(name) elif command == 'Jump': name = token[1] index = int(token[2]) if length >= index: ...
frogs = input().split(' ') while True: token = input().split(' ') length = len(frogs) - 1 command = token[0] if command == 'Join': name = token[1] frogs.append(name) elif command == 'Jump': name = token[1] index = int(token[2]) if length >= index: ...
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '...
databases = {'default': {'ENGINE': 'django.db.backends.', 'NAME': '', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': ''}} mediasync = {'BACKEND': 'mediasync.backends.s3', 'AWS_KEY': '', 'AWS_SECRET': '', 'AWS_BUCKET': '', 'JOINED': {'style/production.css': ('yui/reset-fonts-grids.css', 'yui/yahoo-min.js', 'yui/dom-min...
# 02. Count substring occurrences text, key = input(), input() counter = 0 for index in range(0, len(text) - len(key) + 1): if key.lower() == text[index:index + len(key)].lower(): counter += 1 print(counter)
(text, key) = (input(), input()) counter = 0 for index in range(0, len(text) - len(key) + 1): if key.lower() == text[index:index + len(key)].lower(): counter += 1 print(counter)
# def func(a): # return a + 5 func = lambda a: a+5 square = lambda s: s*s sum = lambda x,y,z: x+y+z x = 10 print (func(x)) print (square(x)) print (sum(x,4,5))
func = lambda a: a + 5 square = lambda s: s * s sum = lambda x, y, z: x + y + z x = 10 print(func(x)) print(square(x)) print(sum(x, 4, 5))
class ServiceTypes(): MachineLearning = "ml" Vision = "vision" ChatBot = "bot" Speech = "speech" LangIntent = "intent" LangEntity = "entity"
class Servicetypes: machine_learning = 'ml' vision = 'vision' chat_bot = 'bot' speech = 'speech' lang_intent = 'intent' lang_entity = 'entity'
class Solution(object): def maxSubArray(self, nums): idx, sumVal = 0, 0 ans = -float('INF') while idx < len(nums): sumVal += nums[idx] ans = max(ans, sumVal) if sumVal < 0: sumVal = 0 idx += 1 return ans
class Solution(object): def max_sub_array(self, nums): (idx, sum_val) = (0, 0) ans = -float('INF') while idx < len(nums): sum_val += nums[idx] ans = max(ans, sumVal) if sumVal < 0: sum_val = 0 idx += 1 return ans
class Document: def __init__(self, docID, docTitle, docContent, docAll): self.docID = docID self.docTitle = docTitle self.docContent = docContent self.docAll = docAll def get_docID(self): return self.docID def get_docTitle(self): return self.docTitle def get_docContent(self): return self.docConten...
class Document: def __init__(self, docID, docTitle, docContent, docAll): self.docID = docID self.docTitle = docTitle self.docContent = docContent self.docAll = docAll def get_doc_id(self): return self.docID def get_doc_title(self): return self.docTitle ...
class Solution: def findTilt(self, root: TreeNode) -> int: def traverse(node, res): if not node: return 0 left_sum = traverse(node.left, res) right_sum = traverse(node.right, res) res[0] += abs(left_sum-right_sum) ...
class Solution: def find_tilt(self, root: TreeNode) -> int: def traverse(node, res): if not node: return 0 left_sum = traverse(node.left, res) right_sum = traverse(node.right, res) res[0] += abs(left_sum - right_sum) return left_s...
x = 9 y = 3 #integers #arithmetic operators print(x+y) #addition print(x-y) #subtraction print(x*y) #multiplication print(x/y) #division print(x%y) #modulus print(x**y) #exponentiation x = 9.1918123 print(x//y) #floor division # Assignment operators x = 9 #sets x to equal 9 x += 3 # x = x +3 print(x) x = 9 x -=...
x = 9 y = 3 print(x + y) print(x - y) print(x * y) print(x / y) print(x % y) print(x ** y) x = 9.1918123 print(x // y) x = 9 x += 3 print(x) x = 9 x -= 3 print(x) x *= 3 print(x) x /= 3 print(x) x **= 3 print(x) x = 9 y = 3 print(x == y) print(x != y) print(x > y) print(x < y) print(x >= y) print(x <= y)
class Terminal(object): check = u'\u2714' error = u'\u2715' broken = u'\u2718' arrow = u'\u21D2' broken_arrow = u'\u21CF' under_arrow = u'\u21AA' class tcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '...
class Terminal(object): check = u'✔' error = u'✕' broken = u'✘' arrow = u'⇒' broken_arrow = u'⇏' under_arrow = u'↪' class Tcolors: header = '\x1b[95m' okblue = '\x1b[94m' okgreen = '\x1b[92m' warning = '\x1b[93m' fail = '\x1b[91m' endc = '\x1b[0m' bold = '\x1b[1m' ...
expected_output = { "instance": { "master": { "areas": { "0.0.0.1": { "interfaces": { "ge-0/0/2.0": { "state": "BDR", "dr_id": "10.16.2.2", "bdr_id": "1...
expected_output = {'instance': {'master': {'areas': {'0.0.0.1': {'interfaces': {'ge-0/0/2.0': {'state': 'BDR', 'dr_id': '10.16.2.2', 'bdr_id': '10.64.4.4', 'nbrs_count': 5}}}}}}}
full_dataset = [ {'name': 'Peach', 'items': ['green shell', 'banana', 'green shell',], 'finish': 3}, {'name': 'Peach', 'items': ['green shell', 'banana', 'green shell',], 'finish': 1}, {'name': 'Bowser', 'items': ['green shell',], 'finish': 1}, {'name': None, 'items': ['green shell',], 'finish': 2}, ...
full_dataset = [{'name': 'Peach', 'items': ['green shell', 'banana', 'green shell'], 'finish': 3}, {'name': 'Peach', 'items': ['green shell', 'banana', 'green shell'], 'finish': 1}, {'name': 'Bowser', 'items': ['green shell'], 'finish': 1}, {'name': None, 'items': ['green shell'], 'finish': 2}, {'name': 'Bowser', 'item...
def Contract_scalar_1x5(\ t0_6,t1_6,t2_6,\ t0_5,t1_5,t2_5,\ t0_4,t1_4,t2_4,\ t0_3,t1_3,t2_3,\ t0_2,t1_2,t2_2,\ t0_1,t1_1,t2_1,\ t0_0,t1_0,t2_0,\ o1_5,\ o1_4,\ o1_3,\ o1_2,\ o1_1\ ): ############################## # ./input/input_Lx1Ly5.dat ################...
def contract_scalar_1x5(t0_6, t1_6, t2_6, t0_5, t1_5, t2_5, t0_4, t1_4, t2_4, t0_3, t1_3, t2_3, t0_2, t1_2, t2_2, t0_1, t1_1, t2_1, t0_0, t1_0, t2_0, o1_5, o1_4, o1_3, o1_2, o1_1): return np.tensordot(o1_2, np.tensordot(t1_2.conj(), np.tensordot(np.tensordot(t0_2, np.tensordot(t0_1, np.tensordot(t1_1.conj(), np.ten...
def read_matrix_lines(): return [int(x) for x in input().split(", ")] def create_matrix(size): result = [read_matrix_lines() for _ in range(size)] return result def get_first_diagonal(matrix, size): return [matrix[i][i]for i in range(size)] def get_second_diagonal(matrix, size): result = [] f...
def read_matrix_lines(): return [int(x) for x in input().split(', ')] def create_matrix(size): result = [read_matrix_lines() for _ in range(size)] return result def get_first_diagonal(matrix, size): return [matrix[i][i] for i in range(size)] def get_second_diagonal(matrix, size): result = [] ...
#!/usr/bin/python def param_gui(self): param_gui = [ self.K1, self.P1, self.e1, self.om1, self.ma1, self.incl1, self.Omega1, self.K2, self.P2, self.e2, self.om2, self.ma2, self.incl2, self.Omega2, self.K3, self.P3, self.e3, self.om3, self.ma3, self.incl3, self.Omega3, ...
def param_gui(self): param_gui = [self.K1, self.P1, self.e1, self.om1, self.ma1, self.incl1, self.Omega1, self.K2, self.P2, self.e2, self.om2, self.ma2, self.incl2, self.Omega2, self.K3, self.P3, self.e3, self.om3, self.ma3, self.incl3, self.Omega3, self.K4, self.P4, self.e4, self.om4, self.ma4, self.incl4, self.Om...
class HaltListener: def stream_read_halted(self, chunk: int, _time: int) -> None: pass def stream_read_resumed(self, chunk: int, _time: int): pass
class Haltlistener: def stream_read_halted(self, chunk: int, _time: int) -> None: pass def stream_read_resumed(self, chunk: int, _time: int): pass
class Solution: def solve(self, words): bitmasks = [] for j,word in enumerate(words): bitmask = [0]*26 distincts = 0 for char in word: i = ord(char) - ord('a') if bitmask[i] == 0: distincts += 1 bitmask[i] = 1 ...
class Solution: def solve(self, words): bitmasks = [] for (j, word) in enumerate(words): bitmask = [0] * 26 distincts = 0 for char in word: i = ord(char) - ord('a') if bitmask[i] == 0: distincts += 1 ...
# print(range(5)) # a = range(1,10,5) # for x in a: # print(x) # num =1 # rem = num%2 # if rem==0: # print('The number is even') # else: # print('The number is odd') # print("I am not inside if statement") # num = -2 # if num>0: # print("Number is positive") # if (num % 2) == 0: # prin...
var = 100 if var == 100: print('This is 100')
def entrada_notas(): notas = input().split(' ') nota1 = float(notas[0]) nota2 = float(notas[1]) nota3 = float(notas[2]) nota4 = float(notas[3]) return nota1, nota2, nota3, nota4 def media(n1, n2, n3, n4): med = (2 * n1 + 3 * n2 + 4 * n3 + n4)/10 print(f'Media: {med:.1f}') if med >=...
def entrada_notas(): notas = input().split(' ') nota1 = float(notas[0]) nota2 = float(notas[1]) nota3 = float(notas[2]) nota4 = float(notas[3]) return (nota1, nota2, nota3, nota4) def media(n1, n2, n3, n4): med = (2 * n1 + 3 * n2 + 4 * n3 + n4) / 10 print(f'Media: {med:.1f}') if med...
#! /usr/bin/env python ''' (This question is super complicated and artificial.) (Refer Sumita Arora: Strings Q5) ''' A = int(input("Enter the integer: ")) S = input("Enter the string: ") # extract digits D = int(''.join( e for e in S if e.isdigit() )) R = A + D print("{} + {} = {}".format(A, D, R))
""" (This question is super complicated and artificial.) (Refer Sumita Arora: Strings Q5) """ a = int(input('Enter the integer: ')) s = input('Enter the string: ') d = int(''.join((e for e in S if e.isdigit()))) r = A + D print('{} + {} = {}'.format(A, D, R))
#!/usr/bin/env python population = input("Please enter population value: ") print("You have entered: ", population)
population = input('Please enter population value: ') print('You have entered: ', population)
op_str = 'acc +7' def parse_operation(operation_str): op_list = operation_str.strip().split() operation = op_list[0] op_sign = op_list[1][0] steps = op_list[1][1:] return {'operation': operation, 'sign': op_sign, 'steps': int(steps), 'visited': False} #print(parse_operation(op_str)) #operations_...
op_str = 'acc +7' def parse_operation(operation_str): op_list = operation_str.strip().split() operation = op_list[0] op_sign = op_list[1][0] steps = op_list[1][1:] return {'operation': operation, 'sign': op_sign, 'steps': int(steps), 'visited': False} operations_file = open('data/operations.txt') o...
SOC_IRAM_LOW = 0x40020000 SOC_IRAM_HIGH = 0x40070000 SOC_DRAM_LOW = 0x3ffb0000 SOC_DRAM_HIGH = 0x40000000 SOC_RTC_DRAM_LOW = 0x3ff9e000 SOC_RTC_DRAM_HIGH = 0x3ffa0000 SOC_RTC_DATA_LOW = 0x50000000 SOC_RTC_DATA_HIGH = 0x50002000
soc_iram_low = 1073872896 soc_iram_high = 1074200576 soc_dram_low = 1073414144 soc_dram_high = 1073741824 soc_rtc_dram_low = 1073340416 soc_rtc_dram_high = 1073348608 soc_rtc_data_low = 1342177280 soc_rtc_data_high = 1342185472
ies = [] ies.append({ "ie_type" : "Node ID", "ie_value" : "Node ID", "presence" : "M", "instance" : "0", "comment" : "This IE shall contain the unique identifier of the sending Node."}) ies.append({ "ie_type" : "Cause", "ie_value" : "Cause", "presence" : "M", "instance" : "0", "comment" : "This IE shall indicate the ac...
ies = [] ies.append({'ie_type': 'Node ID', 'ie_value': 'Node ID', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall contain the unique identifier of the sending Node.'}) ies.append({'ie_type': 'Cause', 'ie_value': 'Cause', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall indicate the acceptance or ...
''' This is a sample input, you can change it of course but you have to follow rules of the questions ''' compressed_string = "2[1[b]10[c]]a" def decompress(str=compressed_string): string = "" number_stack = [] replace_index_stack = [] bracket_index_stack = [] i = 0 while i < len(str): ...
""" This is a sample input, you can change it of course but you have to follow rules of the questions """ compressed_string = '2[1[b]10[c]]a' def decompress(str=compressed_string): string = '' number_stack = [] replace_index_stack = [] bracket_index_stack = [] i = 0 while i < len(str): ...
def add(a,b): return a+b def sub(a,b): return a-b def multiply(a,b): return a*b def div(a,b): return a/b
def add(a, b): return a + b def sub(a, b): return a - b def multiply(a, b): return a * b def div(a, b): return a / b
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def add(self, data): if self.head is None: self.head = Node(data) else: temp = self.head self.head = N...
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def add(self, data): if self.head is None: self.head = node(data) else: temp = self.head self.head = ...
#!/usr/bin/python x = int(raw_input("Ingrese el input1: ")) print(not x)
x = int(raw_input('Ingrese el input1: ')) print(not x)
''' Visit the link : https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json ''' def turn_right(): turn_left() turn_left() turn_left() def complete(): move() turn_left() move() turn_right() ...
""" Visit the link : https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json """ def turn_right(): turn_left() turn_left() turn_left() def complete(): move() turn_left() move() turn_right() ...
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'bisect_tester_staging', 'chromium', 'chromium_tests', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/step...
deps = ['bisect_tester_staging', 'chromium', 'chromium_tests', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/step'] def run_steps(api): api.path.c.dynamic_paths['bisect_results'] = api.path['start_dir'].join('bisect_results') api.chromium.set_config('chromium') test = api.chromium_tests....
def longestCommonSubsequence(str1, str2): if not str1 or not str2: return [] dp = [[0 for _ in range(len(str2))] for __ in range(len(str1))] commons = [] inc = 0 for i in range(len(str1)): if str1[i] == str2[0]: inc = 1 dp[i][0] = inc inc = 0 for j in ra...
def longest_common_subsequence(str1, str2): if not str1 or not str2: return [] dp = [[0 for _ in range(len(str2))] for __ in range(len(str1))] commons = [] inc = 0 for i in range(len(str1)): if str1[i] == str2[0]: inc = 1 dp[i][0] = inc inc = 0 for j in ra...
# -*- coding: utf-8 -*- class Node: def __init__(self, node_type): self.type = node_type self.node_problems = [] @property def name(self): return "" @property def problems(self): return self.node_problems class ValueNode(Node): def __init__(self, node_type, va...
class Node: def __init__(self, node_type): self.type = node_type self.node_problems = [] @property def name(self): return '' @property def problems(self): return self.node_problems class Valuenode(Node): def __init__(self, node_type, value): super()._...
''' https://leetcode.com/problems/maximum-subarray/ ''' class Solution(object): def maxSubArray(self, nums): if len(nums) == 1: return nums[0] m = nums[0] h = {0:nums[0]} for i in range(1, len(nums)): # we loop through the array and store the longest suba...
""" https://leetcode.com/problems/maximum-subarray/ """ class Solution(object): def max_sub_array(self, nums): if len(nums) == 1: return nums[0] m = nums[0] h = {0: nums[0]} for i in range(1, len(nums)): h[i] = max(nums[i], nums[i] + h[i - 1]) ...
input = open('input.txt', 'r').read().split("\n") # Part 1 x = 0 depth = 0 for line in input: line_elements = line.split(' ') cmd = line_elements[0] distance = int(line_elements[1]) if cmd == 'forward': x += distance elif cmd == 'down': depth += distance else: depth += -distance print('X: ' + str(x)) p...
input = open('input.txt', 'r').read().split('\n') x = 0 depth = 0 for line in input: line_elements = line.split(' ') cmd = line_elements[0] distance = int(line_elements[1]) if cmd == 'forward': x += distance elif cmd == 'down': depth += distance else: depth += -distance p...
_base_ = [ '../../_base_/models/swav/r50.py', '../../_base_/datasets/imagenet/swav_mcrop-2-6_sz224_96_bs32.py', '../../_base_/default_runtime.py', ] # model settings model = dict( type='SwAV', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3,), #...
_base_ = ['../../_base_/models/swav/r50.py', '../../_base_/datasets/imagenet/swav_mcrop-2-6_sz224_96_bs32.py', '../../_base_/default_runtime.py'] model = dict(type='SwAV', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict(type='SwAVNeck', in...
# File: vmray_consts.py # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) VMRAY_JSON_SERVER = "vmray_server" VMRAY_JSON_API_KEY = "vmray_api_key" VMRAY_JSON_DISABLE_CERT = "disable_cert_verification" VMRAY_ERR_SERVER_CONNECTION = "Could not connect to server. {}" VMRAY_ERR_CONNECTIVITY_TES...
vmray_json_server = 'vmray_server' vmray_json_api_key = 'vmray_api_key' vmray_json_disable_cert = 'disable_cert_verification' vmray_err_server_connection = 'Could not connect to server. {}' vmray_err_connectivity_test = 'Connectivity test failed' vmray_succ_connectivity_test = 'Connectivity test passed' vmray_err_unsup...
IDENTIFIER = 'everything' NEWSPAPER_DIR = 'newspapers_everything' RESULTS_DIR = 'results_everything' MIN_FREQUENCY = 50 EPOCHS = 40 MODEL_OPTIONS = { 'vector_size': 100, 'alpha': 0.1, 'window': 8, 'sample': 0.00001, 'workers': 8 } VOCABULARY = f'{IDENTIFIER}.dict'
identifier = 'everything' newspaper_dir = 'newspapers_everything' results_dir = 'results_everything' min_frequency = 50 epochs = 40 model_options = {'vector_size': 100, 'alpha': 0.1, 'window': 8, 'sample': 1e-05, 'workers': 8} vocabulary = f'{IDENTIFIER}.dict'
a, b, c = map(int, input().split()) x = max(a, b, c) total = a + b + c if x % 2 != total % 2: x += 1 print((3 * x - total) // 2)
(a, b, c) = map(int, input().split()) x = max(a, b, c) total = a + b + c if x % 2 != total % 2: x += 1 print((3 * x - total) // 2)
count = 0 sum = 0 while True: X = float(input('')) if X >= 0 and X <= 10: count += 1 sum += X if count == 2: average = sum / count print('media = %0.2f' %average) break else: print('nota invalida')
count = 0 sum = 0 while True: x = float(input('')) if X >= 0 and X <= 10: count += 1 sum += X if count == 2: average = sum / count print('media = %0.2f' % average) break else: print('nota invalida')
commands = [] while True: try: line = input() except: break if not line: break commands.append(line.split()) for starting_a in range(155, 160): d = {'a': starting_a, 'b': 0, 'c': 0, 'd': 0} i = 0 out = [] while len(out) < 100: if commands[i][0] == 'inc' and commands[i+1][0] == ...
commands = [] while True: try: line = input() except: break if not line: break commands.append(line.split()) for starting_a in range(155, 160): d = {'a': starting_a, 'b': 0, 'c': 0, 'd': 0} i = 0 out = [] while len(out) < 100: if commands[i][0] == 'inc' an...
tiles = [ (17, 20946, 50678), # https://www.openstreetmap.org/way/215472849 (17, 20959, 50673), # https://www.openstreetmap.org/node/1713279804 (17, 20961, 50675), # https://www.openstreetmap.org/node/3188857553 (17, 20969, 50656), # https://www.openstreetmap.org/node/3396659022 (17, 21013, 50637), ...
tiles = [(17, 20946, 50678), (17, 20959, 50673), (17, 20961, 50675), (17, 20969, 50656), (17, 21013, 50637), (17, 21019, 50617), (17, 21028, 50645), (17, 38597, 49266), (17, 38598, 49259), (17, 38600, 49261), (17, 38601, 49258)] for (z, x, y) in tiles: assert_has_feature(z, x, y, 'pois', {'kind': 'toys'})
''' Given two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays. Input: nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7] Output: 3 Explanation: The repeated subarray with maximum length is [3,2,1]. Input: num1 = [3], nums2 = [3] Output: 1 Input: [1,2], [4,6] Output: 0 Input...
""" Given two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays. Input: nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7] Output: 3 Explanation: The repeated subarray with maximum length is [3,2,1]. Input: num1 = [3], nums2 = [3] Output: 1 Input: [1,2], [4,6] Output: 0 Input...
def data_generator_enabled(request): return {'DATA_GENERATOR_ENABLED': True}
def data_generator_enabled(request): return {'DATA_GENERATOR_ENABLED': True}
class Encoders: def __init__(self, aStar): self.aStar = aStar self.countLeft = 0 self.countRight = 0 self.lastCountLeft = 0 self.lastCountRight = 0 self.countSignLeft = 1 self.countSignRight = -1 self.aStar.reset_encoders() def readCounts(self): ...
class Encoders: def __init__(self, aStar): self.aStar = aStar self.countLeft = 0 self.countRight = 0 self.lastCountLeft = 0 self.lastCountRight = 0 self.countSignLeft = 1 self.countSignRight = -1 self.aStar.reset_encoders() def read_counts(self):...
def DectoHex(n): if isinstance(n,int) == True: hexnum = hex(n)[2:] return hexnum.upper() else: intnum = int(n) hexnum = hex(intnum)[2:] return hexnum.upper()
def decto_hex(n): if isinstance(n, int) == True: hexnum = hex(n)[2:] return hexnum.upper() else: intnum = int(n) hexnum = hex(intnum)[2:] return hexnum.upper()
params = [ { 'dronename': 'drone', 'stateofhealth': 100.0, 'startstateofcharge': 100.0, 'altitude': 100.0, 'temperaturesealevel': 15.0, 'rain': False, 'dropsize': 0.0, 'liquidwatercontent': 1.0, 'temperature': 15.0, 'wind': False, 'windspeed': 0.0, 'winddirection': 0.0, 'relativehumidity': 85.0, 'icing': False, 'timest...
params = [{'dronename': 'drone', 'stateofhealth': 100.0, 'startstateofcharge': 100.0, 'altitude': 100.0, 'temperaturesealevel': 15.0, 'rain': False, 'dropsize': 0.0, 'liquidwatercontent': 1.0, 'temperature': 15.0, 'wind': False, 'windspeed': 0.0, 'winddirection': 0.0, 'relativehumidity': 85.0, 'icing': False, 'timestep...
skip_files = ["Fleece+CoreFoundation.h"] excluded = ["FLStr","operatorslice","operatorFLSlice","FLMutableArray_Retain","FLMutableArray_Release","FLMutableDict_Retain","FLMutableDict_Release","FLEncoder_NewWritingToFile","FLSliceResult_Free"] default_param_name = {"FLValue":"value","FLSliceResult":"slice","FLSlice":"sli...
skip_files = ['Fleece+CoreFoundation.h'] excluded = ['FLStr', 'operatorslice', 'operatorFLSlice', 'FLMutableArray_Retain', 'FLMutableArray_Release', 'FLMutableDict_Retain', 'FLMutableDict_Release', 'FLEncoder_NewWritingToFile', 'FLSliceResult_Free'] default_param_name = {'FLValue': 'value', 'FLSliceResult': 'slice', 'F...
''' Created on 27 Aug 2010 @author: dev solr configurations ''' solr_base_url = "http://solr:8983/solr/" solr_urls = { 'all' : solr_base_url + 'all', 'locations' : solr_base_url + 'locations', 'comments' : solr_base_url + 'comments', 'images' : solr_base_url + 'images', 'works' : solr_base_url +...
""" Created on 27 Aug 2010 @author: dev solr configurations """ solr_base_url = 'http://solr:8983/solr/' solr_urls = {'all': solr_base_url + 'all', 'locations': solr_base_url + 'locations', 'comments': solr_base_url + 'comments', 'images': solr_base_url + 'images', 'works': solr_base_url + 'works', 'people': solr_bas...
def clean_version( version: str, *, build: bool = False, patch: bool = False, commit: bool = False, drop_v: bool = False, flat: bool = False, ): "Clean up and transform the many flavours of versions" # 'v1.13.0-103-gb137d064e' --> 'v1.13-103' if version in ["", "-"]: re...
def clean_version(version: str, *, build: bool=False, patch: bool=False, commit: bool=False, drop_v: bool=False, flat: bool=False): """Clean up and transform the many flavours of versions""" if version in ['', '-']: return version nibbles = version.split('-') if not patch: if nibbles[0] ...
print("Insert an in integer") n = input() nn = n + n nnn = nn + n result = int(n) + int(nn) + int(nnn) print(result)
print('Insert an in integer') n = input() nn = n + n nnn = nn + n result = int(n) + int(nn) + int(nnn) print(result)
# ______________________________________________________________________________ # The Wumpus World class Gold(Thing): def __eq__(self, rhs): '''All Gold are equal''' return rhs.__class__ == Gold pass class Bump(Thing): pass class Glitter(Thing): pass class Pit(Thing): pass cl...
class Gold(Thing): def __eq__(self, rhs): """All Gold are equal""" return rhs.__class__ == Gold pass class Bump(Thing): pass class Glitter(Thing): pass class Pit(Thing): pass class Breeze(Thing): pass class Arrow(Thing): pass class Scream(Thing): pass class Wumpus...
print(divmod(100, 7)) print(7 > 2 and 1 > 6) print(7 > 2 or 1 > 6) number_list = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] print(number_list[2:8]) print(number_list[0:9:3]) print(number_list[0:10:3])
print(divmod(100, 7)) print(7 > 2 and 1 > 6) print(7 > 2 or 1 > 6) number_list = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] print(number_list[2:8]) print(number_list[0:9:3]) print(number_list[0:10:3])
# https://docs.python.org/3/library/functions.html#built-in-functions my_results = [True, True, 2*2==4, True] print(all(my_results)) # all statements in the sequence should be truthy to get True else we get False my_results.append(False) print(my_results) print(all(my_results)) #In logic this is called universal quanto...
my_results = [True, True, 2 * 2 == 4, True] print(all(my_results)) my_results.append(False) print(my_results) print(all(my_results)) print(any(my_results)) print(len(my_results)) my_results.append(9000) print('max', max(my_results)) my_results.append(-30) print(my_results) print('min', min(my_results)) print('summa', s...
#!/usr/bin/env pyrate build_output = ['makefile'] ex_d = executable('exampleM2_debug.bin', 'test.cpp foo.cpp', compiler_opts = '-O0') ex_r = executable('exampleM2_release.bin', 'test.cpp foo.cpp', compiler_opts = '-O3') default_targets = ex_r
build_output = ['makefile'] ex_d = executable('exampleM2_debug.bin', 'test.cpp foo.cpp', compiler_opts='-O0') ex_r = executable('exampleM2_release.bin', 'test.cpp foo.cpp', compiler_opts='-O3') default_targets = ex_r
class DescriptionError(Exception): pass class ParseError(DescriptionError): pass class GettingError(DescriptionError): pass
class Descriptionerror(Exception): pass class Parseerror(DescriptionError): pass class Gettingerror(DescriptionError): pass
MyAttr = 'eval:1' My_Attr = 'eval:foo=1;bar=2;foo+bar' attr_1 = 'tango:a/b/c/d' attr_2 = 'a/b/c/d' attr1 = 'eval:"Hello_World!!"' foo = 'eval:/@Foo/True' # 1foo = 'eval:2' Foo = 'eval:False' res_attr = 'res:attr1' dev1 = 'tango:a/b/c' # invalid for attribute dev2 = 'eval:@foo' # invalid for attribute
my_attr = 'eval:1' my__attr = 'eval:foo=1;bar=2;foo+bar' attr_1 = 'tango:a/b/c/d' attr_2 = 'a/b/c/d' attr1 = 'eval:"Hello_World!!"' foo = 'eval:/@Foo/True' foo = 'eval:False' res_attr = 'res:attr1' dev1 = 'tango:a/b/c' dev2 = 'eval:@foo'
# Program to input a number and find it's sum of digits n = int(input("Enter the number: ")) tot = 0 while(n>0): d = n%10 tot = tot+d n=n//10 print("Sum of Digits is:",tot)
n = int(input('Enter the number: ')) tot = 0 while n > 0: d = n % 10 tot = tot + d n = n // 10 print('Sum of Digits is:', tot)
def func(): print("func() in one.py") print("TOP LEVEL ONE.PY") if __name__ == "__main__": print("one.py is being run directly") else: print("one.py has been imported")
def func(): print('func() in one.py') print('TOP LEVEL ONE.PY') if __name__ == '__main__': print('one.py is being run directly') else: print('one.py has been imported')
class NessusObject(object): def __init__(self, server): self._id = None self._server = server def save(self): if self._id is None: return getattr(self._server, "create_%s" % self.__class__.__name__.lower())(self) else: return getattr(self._server, "updat...
class Nessusobject(object): def __init__(self, server): self._id = None self._server = server def save(self): if self._id is None: return getattr(self._server, 'create_%s' % self.__class__.__name__.lower())(self) else: return getattr(self._server, 'updat...
#Find structs by field type. #@author Rena #@category Struct #@keybinding #@menupath #@toolbar StringColumnDisplay = ghidra.app.tablechooser.StringColumnDisplay AddressableRowObject = ghidra.app.tablechooser.AddressableRowObject TableChooserExecutor = ghidra.app.tablechooser.TableChooserExecutor DTM = state.tool.getS...
string_column_display = ghidra.app.tablechooser.StringColumnDisplay addressable_row_object = ghidra.app.tablechooser.AddressableRowObject table_chooser_executor = ghidra.app.tablechooser.TableChooserExecutor dtm = state.tool.getService(ghidra.app.services.DataTypeManagerService) af = currentProgram.getAddressFactory() ...
expected_output = { "interface": { "GigabitEthernet1/0/1": { "out": { "mcast_pkts": 188396, "bcast_pkts": 0, "ucast_pkts": 124435064, "name": "GigabitEthernet1/0/1", "octets": 24884341205, }, ...
expected_output = {'interface': {'GigabitEthernet1/0/1': {'out': {'mcast_pkts': 188396, 'bcast_pkts': 0, 'ucast_pkts': 124435064, 'name': 'GigabitEthernet1/0/1', 'octets': 24884341205}, 'in': {'mcast_pkts': 214513, 'bcast_pkts': 0, 'ucast_pkts': 15716712, 'name': 'GigabitEthernet1/0/1', 'octets': 3161931167}}}}
DOMAIN = "echonet_lite" MANUFACTURER = { 0x0B: "Panasonic", 0x69: "Toshiba", 0x2f: "AIPHONE", } CONF_STATE_CLASS = "state_class"
domain = 'echonet_lite' manufacturer = {11: 'Panasonic', 105: 'Toshiba', 47: 'AIPHONE'} conf_state_class = 'state_class'
files = ['avalon_mm_bfm_pkg.vhd', 'avalon_st_bfm_pkg.vhd', 'axilite_bfm_pkg.vhd', 'axistream_bfm_pkg.vhd', 'gmii_bfm_pkg.vhd', 'gpio_bfm_pkg.vhd', 'i2c_bfm_pkg.vhd', 'rgmii_bfm_pkg.vhd', 'sbi_bfm_pkg.vhd', 'spi_bfm_pkg.vhd', 'uart...
files = ['avalon_mm_bfm_pkg.vhd', 'avalon_st_bfm_pkg.vhd', 'axilite_bfm_pkg.vhd', 'axistream_bfm_pkg.vhd', 'gmii_bfm_pkg.vhd', 'gpio_bfm_pkg.vhd', 'i2c_bfm_pkg.vhd', 'rgmii_bfm_pkg.vhd', 'sbi_bfm_pkg.vhd', 'spi_bfm_pkg.vhd', 'uart_bfm_pkg.vhd']
#pragma repy restrictions.loose # create a junk.py file myfo = open("junk.py","w") print >> myfo, "print 'Hello world'" myfo.close() removefile("junk.py") # should be removed...
myfo = open('junk.py', 'w') (print >> myfo, "print 'Hello world'") myfo.close() removefile('junk.py')
a = ['a','b','c'] b = ['1','2','3','4','5','6'] c = list(zip(*b)) print(a) print(c) for d,e in zip(c,a): print(d) print(e)
a = ['a', 'b', 'c'] b = ['1', '2', '3', '4', '5', '6'] c = list(zip(*b)) print(a) print(c) for (d, e) in zip(c, a): print(d) print(e)
#!/usr/bin/env python # coding: utf-8 # # Mendel's First Law # ## Problem # # Probability is the mathematical study of randomly occurring phenomena. We will model such a phenomenon with a random variable, which is simply a variable that can take a number of different distinct outcomes depending on the result of an un...
def mendel(x, y, z): total = x + y + z two_recess = z / total * ((z - 1) / (total - 1)) two_hetero = y / total * ((y - 1) / (total - 1)) hetero_recess = z / total * (y / (total - 1)) + y / total * (z / (total - 1)) recess_prob = twoRecess + twoHetero * 1 / 4 + heteroRecess * 1 / 2 print(1 - rece...
# examples on set and dict comprehensions # EXAMPLES OF SET COMPREHENSION # making a set comprehension is actually really easy # instead of a list, we'll just use a set notation as follows: my_list = [char for char in 'hello'] my_set = {char for char in 'hello'} print(my_list) print(my_set) my_list1 = [num for num i...
my_list = [char for char in 'hello'] my_set = {char for char in 'hello'} print(my_list) print(my_set) my_list1 = [num for num in range(10)] my_set1 = {num for num in range(10)} print(my_list1) print(my_set1) my_list2 = [num ** 2 for num in range(50) if num % 2 == 0] my_set2 = {num ** 2 for num in range(50) if num % 2 =...
class HtmlReportException(Exception): pass class HtmlReport: def __init__(self): self.path = None self.file = None self.header = None self.start_time = None self.is_initialized = False def __del__(self): if self.is_initialized and self.file: sel...
class Htmlreportexception(Exception): pass class Htmlreport: def __init__(self): self.path = None self.file = None self.header = None self.start_time = None self.is_initialized = False def __del__(self): if self.is_initialized and self.file: sel...
SIZE = 9 INPUT_LEVEL_DIR = "File.txt" INPUT_CONSTRAINTS_DIR = "Constraints.txt" OUTPUT_SOLUTION_DIR = "Solution.txt" ASSIGNED_VALUE_NUM = 0
size = 9 input_level_dir = 'File.txt' input_constraints_dir = 'Constraints.txt' output_solution_dir = 'Solution.txt' assigned_value_num = 0
class Mother: @staticmethod def take_screenshot(): print('I can make a screenshot') @staticmethod def receive_email(): print('I can receive email') class Father: @staticmethod def drive_car(): print('I can drive a car ') @staticmethod def play_music(): ...
class Mother: @staticmethod def take_screenshot(): print('I can make a screenshot') @staticmethod def receive_email(): print('I can receive email') class Father: @staticmethod def drive_car(): print('I can drive a car ') @staticmethod def play_music(): ...
class NewsModule: def __init__(self): pass def update(self): pass
class Newsmodule: def __init__(self): pass def update(self): pass
# AUTOGENERATED! DO NOT EDIT! File to edit: 01_Virtual_data_setup.ipynb (unless otherwise specified). __all__ = ['Get_sub_watersheds'] # Cell def Get_sub_watersheds(watershed, order_max, order_min = 4): '''Obtains the sub-watersheds a different orders starting from the order_max and ending on the order_min, t...
__all__ = ['Get_sub_watersheds'] def get_sub_watersheds(watershed, order_max, order_min=4): """Obtains the sub-watersheds a different orders starting from the order_max and ending on the order_min, there is no return, it only updates the watershed.Table""" orders = np.arange(order_max, order_min, -1).tolis...
class Slot: def __init__(self, name="", description = ""): self.type = type # categorical, verbatim self.name = name self.description = description self.values = ["not-present"] self.values_descriptions = ["Ignore me, I'm used for programming."] def len (self): ...
class Slot: def __init__(self, name='', description=''): self.type = type self.name = name self.description = description self.values = ['not-present'] self.values_descriptions = ["Ignore me, I'm used for programming."] def len(self): return len(self.values) ...
# Check if removing an edge of a binary tree can divide # the tree in two equal halves # Count the number of nodes, say n. Then traverse the tree # in bottom up manner and check if n - s = s class Node: def __init__(self, val): self.val = val self.left = None self.right = None def coun...
class Node: def __init__(self, val): self.val = val self.left = None self.right = None def count(root): if not root: return 0 return count(root.left) + count(root.right) + 1 def check_util(root, n): if root == None: return False if count(root) == n - count(...
class Cipher: def __init__(self, codestring): # Hints: # Does the capitalization of the words or letter matter here? # Is hello the same as Hello or even hElLo in terms of definition? Yes # Maybe we should convert everything to uppercase # Add your code here self.a...
class Cipher: def __init__(self, codestring): self.alphabet = None self.codestring = '' for letter in 'ZYXWVUTSRQPONMLKJIHGFEDCBA': if None not in codestring: self.codestring += None self.codestring = codestring + self.codestring self.code = {} ...
description = 'FRM II FAK40 information (cooling water system)' group = 'lowlevel' tango_base = 'tango://ictrlfs.ictrl.frm2:10000/frm2/' devices = dict( FAK40_Cap = device('nicos.devices.entangle.AnalogInput', tangodevice = tango_base +'fak40/CF001', description = 'The capacity of the cooling wat...
description = 'FRM II FAK40 information (cooling water system)' group = 'lowlevel' tango_base = 'tango://ictrlfs.ictrl.frm2:10000/frm2/' devices = dict(FAK40_Cap=device('nicos.devices.entangle.AnalogInput', tangodevice=tango_base + 'fak40/CF001', description='The capacity of the cooling water system', pollinterval=60, ...
# # PySNMP MIB module DHCP-SERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///home/tin/Dev/mibs.snmplabs.com/asn1/DHCP-SERVER-MIB # Produced by pysmi-0.3.4 at Fri Jan 31 21:33:35 2020 # On host bier platform Linux version 5.4.0-3-amd64 by user tin # Using Python version 3.7.6 (default, Jan 19 2020, 22:34:52)...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) ...
#!/usr/bin/python3 # https://practice.geeksforgeeks.org/problems/max-level-sum-in-binary-tree/1 def maxLevelSum(root): # Code here h = {} level = 0 getLevelSum(root, level, h) return max(h.values()) def getLevelSum(root, level, h): if root == None: return if level not in h...
def max_level_sum(root): h = {} level = 0 get_level_sum(root, level, h) return max(h.values()) def get_level_sum(root, level, h): if root == None: return if level not in h: h[level] = 0 h[level] += root.data get_level_sum(root.left, level + 1, h) get_level_sum(root.r...
A = [10,13,7] B = [1,2,3,4,5,6] def sum_all(A, B): ASum = sum(A) #print(ASum) BSum = sum(B) #print(BSum) TSum = ASum+BSum #print(TSum) return ASum, BSum, TSum ASum, BSum, TSum = sum_all(A,B) print('The sum of list 1 is '+str(ASum)) print('The sum of list 2 is '+str(BSum)) print('The sum of both lists is '+str...
a = [10, 13, 7] b = [1, 2, 3, 4, 5, 6] def sum_all(A, B): a_sum = sum(A) b_sum = sum(B) t_sum = ASum + BSum return (ASum, BSum, TSum) (a_sum, b_sum, t_sum) = sum_all(A, B) print('The sum of list 1 is ' + str(ASum)) print('The sum of list 2 is ' + str(BSum)) print('The sum of both lists is ' + str(TSum)...
class ScriptBase(type): def __init__(cls, name, bases, attrs): if cls is None: return if not hasattr(cls, "plugins"): cls.plugins = [] else: cls.plugins.append(cls) class ServerBase: __metaclass__ = ScriptBase def __init__(self): su...
class Scriptbase(type): def __init__(cls, name, bases, attrs): if cls is None: return if not hasattr(cls, 'plugins'): cls.plugins = [] else: cls.plugins.append(cls) class Serverbase: __metaclass__ = ScriptBase def __init__(self): super(S...
class BuildProducts(object): '''A class to help keep track of build products in the build. Really this is just a wrapper around a dict stored at the key 'BUILD_TOOL' in an environment. This class doesn't worry about what stored in that dict, though it's generally things like SharedLib configurators...
class Buildproducts(object): """A class to help keep track of build products in the build. Really this is just a wrapper around a dict stored at the key 'BUILD_TOOL' in an environment. This class doesn't worry about what stored in that dict, though it's generally things like SharedLib configurators...
class ResourceObject: def __init__(self, resource_type, resource_name, mem_limit_threshold, mem_request_threshold, cpu_limit_threshold, cpu_request_threshold, max_hit): self.resource_type ...
class Resourceobject: def __init__(self, resource_type, resource_name, mem_limit_threshold, mem_request_threshold, cpu_limit_threshold, cpu_request_threshold, max_hit): self.resource_type = resource_type self.resource_name = resource_name self.cpu_limit = 0 self.mem_limit = 0 ...
M = [] size1 = int(input()) for i in range(size1): row = [] for j in range(size1): row.append(int(input())) M.append(row) M2 = [] for i in range(size1): row = [] for j in range(size1): row.append(int(input())) M2.append(row) result = [ [ 0 for i in range(size1) ] for j in r...
m = [] size1 = int(input()) for i in range(size1): row = [] for j in range(size1): row.append(int(input())) M.append(row) m2 = [] for i in range(size1): row = [] for j in range(size1): row.append(int(input())) M2.append(row) result = [[0 for i in range(size1)] for j in range(size...
MYSQL_HOST = 'localhost' MYSQL_DBNAME = 'spider' MYSQL_USER = 'root' MYSQL_PASSWD = '123456' MYSQL_PORT = 3306 MYSQL_CHARSET = 'utf8' MYSQL_UNICODE = True
mysql_host = 'localhost' mysql_dbname = 'spider' mysql_user = 'root' mysql_passwd = '123456' mysql_port = 3306 mysql_charset = 'utf8' mysql_unicode = True
squares = [1, 4, 9, 16, 25] i = 0 while i < len(squares): print(i, squares[i]) i = i + 1 words = ['cat', 'window', 'defenestrate'] for w in words: print(w, len(w)) for i in range(len(words)): print(i, words[i], len(words[i]))
squares = [1, 4, 9, 16, 25] i = 0 while i < len(squares): print(i, squares[i]) i = i + 1 words = ['cat', 'window', 'defenestrate'] for w in words: print(w, len(w)) for i in range(len(words)): print(i, words[i], len(words[i]))
def ov_range(a_1,a_2,b_1,b_2): big_a=a_1 small_a=a_2 big_b=b_1 small_b=b_1 if a_1<a_2: big_a=a_2 small_a=a_1 elif a_1>a_2: big_a=a_1 small_a=a_2 if b_1>b_2: big_b=b_1 small_b=b_2 elif b_1<b_2: big_b=b_2 small_b=b_1 #print(big_a, '\n', small_a, '\n', big_b, '\n', small_b) interval_1=b...
def ov_range(a_1, a_2, b_1, b_2): big_a = a_1 small_a = a_2 big_b = b_1 small_b = b_1 if a_1 < a_2: big_a = a_2 small_a = a_1 elif a_1 > a_2: big_a = a_1 small_a = a_2 if b_1 > b_2: big_b = b_1 small_b = b_2 elif b_1 < b_2: big_b = ...
class ContactInformation(object): def __init__(self, name, weight=100, *args, **kwargs): self.name = name self.weight = weight def __str__(self): return "Unusable Contact: {:s} ({:d})".format(self.name, self.weight) class EmailAddress(ContactInformation): def __init__(self, name, ...
class Contactinformation(object): def __init__(self, name, weight=100, *args, **kwargs): self.name = name self.weight = weight def __str__(self): return 'Unusable Contact: {:s} ({:d})'.format(self.name, self.weight) class Emailaddress(ContactInformation): def __init__(self, name,...
MODELS = { "pwc": ( 'configs/pwcnet/pwcnet_ft_4x1_300k_sintel_final_384x768.py', 'checkpoints/pwcnet_ft_4x1_300k_sintel_final_384x768.pth' ), "flownetc": ( 'configs/flownet/flownetc_8x1_sfine_sintel_384x448.py', 'checkpoints/flownetc_8x1_sfine_sintel_384x448.pth' ), ...
models = {'pwc': ('configs/pwcnet/pwcnet_ft_4x1_300k_sintel_final_384x768.py', 'checkpoints/pwcnet_ft_4x1_300k_sintel_final_384x768.pth'), 'flownetc': ('configs/flownet/flownetc_8x1_sfine_sintel_384x448.py', 'checkpoints/flownetc_8x1_sfine_sintel_384x448.pth'), 'raft': ('configs/raft/raft_8x2_100k_mixed_368x768.py', 'c...
''' Implementation of exponential search Time Complexity: O(logn) Space Complexity: Depends on implementation of binary_search {O(logn): recursive, O(1):iterative} Used for unbounded search, when the length of array is infinite or not known ''' #iterative implementation of binary search def binary_search(arr, s, e, x...
""" Implementation of exponential search Time Complexity: O(logn) Space Complexity: Depends on implementation of binary_search {O(logn): recursive, O(1):iterative} Used for unbounded search, when the length of array is infinite or not known """ def binary_search(arr, s, e, x): """ #arr: the array in which we ...
class VaderStreamsConstants(object): __slots__ = [] BASE_URL = 'http://vapi.vaders.tv/' CATEGORIES_JSON_FILE_NAME = 'categories.json' CATEGORIES_PATH = 'epg/categories' CHANNELS_JSON_FILE_NAME = 'channels.json' CHANNELS_PATH = 'epg/channels' DB_FILE_NAME = 'vaderstreams.db' DEFAULT_EPG_...
class Vaderstreamsconstants(object): __slots__ = [] base_url = 'http://vapi.vaders.tv/' categories_json_file_name = 'categories.json' categories_path = 'epg/categories' channels_json_file_name = 'channels.json' channels_path = 'epg/channels' db_file_name = 'vaderstreams.db' default_epg_s...
class Vector: def __init__(self, inputs: list): self.inputs = inputs def dot(self, weigths): dot_product = 0 for index in range(len(self.inputs)): dot_product = dot_product + (self.inputs[index] * weigths.inputs[index]) return dot_product
class Vector: def __init__(self, inputs: list): self.inputs = inputs def dot(self, weigths): dot_product = 0 for index in range(len(self.inputs)): dot_product = dot_product + self.inputs[index] * weigths.inputs[index] return dot_product
dependency_matcher_patterns = { "pattern_parameter_adverbial_clause": [ {"RIGHT_ID": "action_head", "RIGHT_ATTRS": {"POS": "VERB"}}, { "LEFT_ID": "action_head", "REL_OP": ">", "RIGHT_ID": "condition_head", "RIGHT_ATTRS": {"DEP": "advcl"}, }, ...
dependency_matcher_patterns = {'pattern_parameter_adverbial_clause': [{'RIGHT_ID': 'action_head', 'RIGHT_ATTRS': {'POS': 'VERB'}}, {'LEFT_ID': 'action_head', 'REL_OP': '>', 'RIGHT_ID': 'condition_head', 'RIGHT_ATTRS': {'DEP': 'advcl'}}, {'LEFT_ID': 'condition_head', 'REL_OP': '>', 'RIGHT_ID': 'dependee_param', 'RIGHT_A...
PAGE_ITEM_LIMIT = 10 RSS_ITEM_LIMIT = 10 OUTPUT_DIRECTORY = ""
page_item_limit = 10 rss_item_limit = 10 output_directory = ''
''' EASY 203. Remove Linked List Elements You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes. Given a number K, we would want to reformat the strings such that each group contains exactly K characters, exce...
""" EASY 203. Remove Linked List Elements You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes. Given a number K, we would want to reformat the strings such that each group contains exactly K characters, exce...
cities = [ 'Vilnius', 'Kaunas', 'Klaipeda', 'Siauliai', 'Panevezys', 'Alytus', 'Dainava (Kaunas)', 'Eiguliai', 'Marijampole', 'Mazeikiai', 'Silainiai', 'Fabijoniskes', 'Jonava', 'Utena', 'Pasilaiciai', 'Kedainiai', 'Seskine', 'Lazdynai', 'Telsi...
cities = ['Vilnius', 'Kaunas', 'Klaipeda', 'Siauliai', 'Panevezys', 'Alytus', 'Dainava (Kaunas)', 'Eiguliai', 'Marijampole', 'Mazeikiai', 'Silainiai', 'Fabijoniskes', 'Jonava', 'Utena', 'Pasilaiciai', 'Kedainiai', 'Seskine', 'Lazdynai', 'Telsiai', 'Visaginas', 'Taurage', 'Justiniskes', 'Ukmerge', 'Aleksotas', 'Plunge',...
def add_numbers(num1, num2): return num1 + num2 def subtract_numbers(num1, num2): return num1 - num2 def multiply_numbers(num1, num2): return num1 * num2 def divide_numbers(num1, num2): return num1 / num2
def add_numbers(num1, num2): return num1 + num2 def subtract_numbers(num1, num2): return num1 - num2 def multiply_numbers(num1, num2): return num1 * num2 def divide_numbers(num1, num2): return num1 / num2
REQUEST_DELETE_CONTENT_RANGE = 'deleteContentRange' REQUEST_DELETE_TABLE_ROW = 'deleteTableRow' REQUEST_INSERT_TABLE = 'insertTable' REQUEST_INSERT_TABLE_ROW = 'insertTableRow' REQUEST_INSERT_TEXT = 'insertText' REQUEST_MERGE_TABLE_CELLS = 'mergeTableCells' REQUEST_UPDATE_TEXT_STYLE = 'updateTextStyle' BODY = 'body' ...
request_delete_content_range = 'deleteContentRange' request_delete_table_row = 'deleteTableRow' request_insert_table = 'insertTable' request_insert_table_row = 'insertTableRow' request_insert_text = 'insertText' request_merge_table_cells = 'mergeTableCells' request_update_text_style = 'updateTextStyle' body = 'body' bo...
sum = lambda a,b : a + b print("suma: "+ str(sum(1,2))) # Map lambdas names = ["Christian", "yamile", "Anddy", "Lucero", "Evelyn"] names = map(lambda name:name.upper(),names) print(list(names)) def decrement_list (*vargs): return list(map(lambda number: number - 1,vargs)) print(decrement_list(1,2,3)) #all ...
sum = lambda a, b: a + b print('suma: ' + str(sum(1, 2))) names = ['Christian', 'yamile', 'Anddy', 'Lucero', 'Evelyn'] names = map(lambda name: name.upper(), names) print(list(names)) def decrement_list(*vargs): return list(map(lambda number: number - 1, vargs)) print(decrement_list(1, 2, 3)) def is_all_strings(l...
# python3 theory/conditionals.py def plus(a, b): if type(a) is int or type(a) is float: if type(b) is int or type(b) is float: return a + b else: return None else: return None print(plus(1, '10')) def can_drink(age): print(f"You are {age} years old.") if age < 18: print("You ca...
def plus(a, b): if type(a) is int or type(a) is float: if type(b) is int or type(b) is float: return a + b else: return None else: return None print(plus(1, '10')) def can_drink(age): print(f'You are {age} years old.') if age < 18: print("You can'...
def os_return(distro): if distro == 'rhel': return_value = { 'distribution': 'centos', 'version': '7.5', 'dist_name': 'CentOS Linux', 'based_on': 'rhel' } elif distro == 'ubuntu': return_value = { 'distribution': 'ec2', ...
def os_return(distro): if distro == 'rhel': return_value = {'distribution': 'centos', 'version': '7.5', 'dist_name': 'CentOS Linux', 'based_on': 'rhel'} elif distro == 'ubuntu': return_value = {'distribution': 'ec2', 'version': '16.04', 'dist_name': 'Ubuntu', 'based_on': 'debian'} elif distr...