content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
############################################################################## #copyright 2012,Hamid MEDJAHED (hmedjahed@prologue.fr) Prologue # #Licensed under the Apache License, Version 2.0 (the "License"); # #you may not use this file except in compliance with the License. # #You...
class Camazonec2: """Class to define the amazonEc2 category structure""" def __init__(self, name, flavor, image, original, profile, node, price, account, number, rootpass, reference, network, access, accessip, floating, floatingid, publicaddr, privateaddr, firewall, group, zone, hostname, workload, when, state...
# -*- coding: utf-8 -*- ''' :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. ACLS ~~~~ For more information about acls, please checkout the kazoo documentation. http://kazoo.readthedocs.io/en/latest/api/security.html#kazoo.security.make_digest_acl The following options c...
""" :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. ACLS ~~~~ For more information about acls, please checkout the kazoo documentation. http://kazoo.readthedocs.io/en/latest/api/security.html#kazoo.security.make_digest_acl The following options can be included in the ac...
def harness(p): if 'Hello world!' not in p.readline(): return False return True
def harness(p): if 'Hello world!' not in p.readline(): return False return True
x = int(input()) dict = {} for i in range(0, x): inputarray = input().split() marks = list(map(float, inputarray[1:])) dict[inputarray[0]] = sum(marks)/float(len(marks)) print("%.2f"% dict[input()])
x = int(input()) dict = {} for i in range(0, x): inputarray = input().split() marks = list(map(float, inputarray[1:])) dict[inputarray[0]] = sum(marks) / float(len(marks)) print('%.2f' % dict[input()])
print (True and True) print (False and True) print (1 == 1 and 2 == 20) print ("test" == "test") print (1 == 1 or 2 != 1) print (True and 1 == 1) print ( False and 0 != 0 ) print ( True or 1 == 1) print ( "test" == "testing") print ( 1 != 0 and 2 == 1) print ( "test" != "testing") print ( "test" == 1) print ( not (True...
print(True and True) print(False and True) print(1 == 1 and 2 == 20) print('test' == 'test') print(1 == 1 or 2 != 1) print(True and 1 == 1) print(False and 0 != 0) print(True or 1 == 1) print('test' == 'testing') print(1 != 0 and 2 == 1) print('test' != 'testing') print('test' == 1) print(not (True and False)) print(no...
TASK_STATE = {"NoPlan":1, "Planed":2, "MovingToSouce":3} class Task: def __init__(self, task_id:int) -> None: self.States = {"NoPlan":1, "Planed":2, "MovingToSouce":3} self.State = self.States["NoPlan"] self.task_id = task_id self.SourceStation_id = 0 self.TargetStation_id ...
task_state = {'NoPlan': 1, 'Planed': 2, 'MovingToSouce': 3} class Task: def __init__(self, task_id: int) -> None: self.States = {'NoPlan': 1, 'Planed': 2, 'MovingToSouce': 3} self.State = self.States['NoPlan'] self.task_id = task_id self.SourceStation_id = 0 self.TargetStat...
class Solution: def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]: n = len(buildings) if n == 0: return [] if n == 1: x_start, x_end, y = buildings[0] return [[x_start, y], [x_end, 0]] left_skyline = self.getSkyline(buildings[:n//...
class Solution: def get_skyline(self, buildings: List[List[int]]) -> List[List[int]]: n = len(buildings) if n == 0: return [] if n == 1: (x_start, x_end, y) = buildings[0] return [[x_start, y], [x_end, 0]] left_skyline = self.getSkyline(buildings[...
#!/usr/bin/env pypy t, n = map(int, raw_input().split()) [raw_input() for i in xrange(n - 1)] verdict = raw_input().strip() if verdict == 'Random': exit(-1)
(t, n) = map(int, raw_input().split()) [raw_input() for i in xrange(n - 1)] verdict = raw_input().strip() if verdict == 'Random': exit(-1)
def calculator(*args, **kwargs): result = args[0] if 'operation' in kwargs.keys(): for arg in args[1:]: if kwargs['operation'] == '+': result = result + arg elif kwargs['operation'] == '-': result = result - arg elif kwargs['operation']...
def calculator(*args, **kwargs): result = args[0] if 'operation' in kwargs.keys(): for arg in args[1:]: if kwargs['operation'] == '+': result = result + arg elif kwargs['operation'] == '-': result = result - arg elif kwargs['operation']...
""" Common global variables / functions. """ PKL_LST_EXT = '.pkl_lst' PKL_DIC_EXT = '.pkl_dic' LOG_EXT = '.log' NATIVE_COUNTRIES = {'Australia', 'England', 'Ireland', 'Scotland', 'Wales', 'UK', 'New Zealand', 'US', 'Canada'} # COUNTRIES_ORDER = ['UK', 'Scotland', 'England', 'Wales', 'Ireland', # 'Ne...
""" Common global variables / functions. """ pkl_lst_ext = '.pkl_lst' pkl_dic_ext = '.pkl_dic' log_ext = '.log' native_countries = {'Australia', 'England', 'Ireland', 'Scotland', 'Wales', 'UK', 'New Zealand', 'US', 'Canada'} countries_fam_order = ['UK', 'England', 'Scotland', 'Wales', 'Ireland', 'New Zealand', 'Austral...
""" 1. Clarification 2. Possible solutions - Backtracking v1 - Backtracking v2 3. Coding 4. Tests """ # T=O(2^n), S=O(n) class Solution: def __init__(self): self.valid_expressions = set() self.min_removed = math.inf def remaining(self, string, index, left_count, right_count, expr, rem...
""" 1. Clarification 2. Possible solutions - Backtracking v1 - Backtracking v2 3. Coding 4. Tests """ class Solution: def __init__(self): self.valid_expressions = set() self.min_removed = math.inf def remaining(self, string, index, left_count, right_count, expr, rem_count): if...
''' While Loops Used to execute a set of statements(code) continuously as long as a condition is True. The while loop needs '''
""" While Loops Used to execute a set of statements(code) continuously as long as a condition is True. The while loop needs """
class ClientsManager: SocketsList = {"Sockets": {}} def AddSocket(PlayerID, Sockets): ClientsManager.SocketsList["Sockets"][PlayerID] = Sockets def RemoveSocket(PlayerID): try: ClientsManager.SocketsList["Sockets"].pop(PlayerID) except KeyError: print(f"Can...
class Clientsmanager: sockets_list = {'Sockets': {}} def add_socket(PlayerID, Sockets): ClientsManager.SocketsList['Sockets'][PlayerID] = Sockets def remove_socket(PlayerID): try: ClientsManager.SocketsList['Sockets'].pop(PlayerID) except KeyError: print(f'C...
def heapify_node(arr, i, n): l = 2*i + 1 r = 2*i + 2 smallest = i if l < n and arr[l] < arr[smallest]: smallest = l if r < n and arr[r] < arr[smallest]: smallest = r if smallest != i: arr[smallest], arr[i] = arr[i], arr[smallest] arr = heapify_node(arr, small...
def heapify_node(arr, i, n): l = 2 * i + 1 r = 2 * i + 2 smallest = i if l < n and arr[l] < arr[smallest]: smallest = l if r < n and arr[r] < arr[smallest]: smallest = r if smallest != i: (arr[smallest], arr[i]) = (arr[i], arr[smallest]) arr = heapify_node(arr, sm...
dimensions = (200, 50) print(dimensions[0]) print(dimensions[1]) # dimensions[0] = 100 # print(dimensions) for dimension in dimensions: print(dimension) dimensions = [100, 300] for dimension in dimensions: print(dimension)
dimensions = (200, 50) print(dimensions[0]) print(dimensions[1]) for dimension in dimensions: print(dimension) dimensions = [100, 300] for dimension in dimensions: print(dimension)
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def mergeTwoLists(self, l1, l2): res = ListNode(0) cur = res while l1 and l2: if l1.val > l2.val: c = Lis...
class Listnode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def merge_two_lists(self, l1, l2): res = list_node(0) cur = res while l1 and l2: if l1.val > l2.val: c = list_node(l2.val) c...
"Shows how to enable both worker mode and use_angular_plugin to make a drop-in replacement for ng_module" load("@npm//@bazel/typescript:index.bzl", "ts_library") def ng_ts_library(**kwargs): angular_assets = kwargs.pop("assets", []) + kwargs.pop("angular_assets", []) ts_library( compiler = "//tools:ts...
"""Shows how to enable both worker mode and use_angular_plugin to make a drop-in replacement for ng_module""" load('@npm//@bazel/typescript:index.bzl', 'ts_library') def ng_ts_library(**kwargs): angular_assets = kwargs.pop('assets', []) + kwargs.pop('angular_assets', []) ts_library(compiler='//tools:tsc_wrappe...
abc = sorted([chr(ord("A") + x) for x in range(26)]) steps, amount = dict((x, set()) for x in abc), dict((x, 0) for x in abc) for line in open("inputs/day07.input"): l = line.split() before, after = l[1], l[7] steps[after].add(before) amount[after] += 1 done, order = set(), "" while abc: for idx, v...
abc = sorted([chr(ord('A') + x) for x in range(26)]) (steps, amount) = (dict(((x, set()) for x in abc)), dict(((x, 0) for x in abc))) for line in open('inputs/day07.input'): l = line.split() (before, after) = (l[1], l[7]) steps[after].add(before) amount[after] += 1 (done, order) = (set(), '') while abc:...
"""Provides methods for extending exceptions.""" class _Message(object): """ Class for storing custom error messages in exceptions. """ def __init__(self, str): self._str = str def __str__(self): return self._str def add_message(exception, message): """ Embeds an error m...
"""Provides methods for extending exceptions.""" class _Message(object): """ Class for storing custom error messages in exceptions. """ def __init__(self, str): self._str = str def __str__(self): return self._str def add_message(exception, message): """ Embeds an error me...
n = input() names = [] for i in range(n): name = raw_input() names.append(name) if(all(names[i] <= names[i+1] for i in xrange(len(names)-1))): print("INCREASING") elif(all(names[i] >= names[i+1] for i in xrange(len(names)-1))): print("DECREASING") else: print("NEITHER")
n = input() names = [] for i in range(n): name = raw_input() names.append(name) if all((names[i] <= names[i + 1] for i in xrange(len(names) - 1))): print('INCREASING') elif all((names[i] >= names[i + 1] for i in xrange(len(names) - 1))): print('DECREASING') else: print('NEITHER')
"""This module maps SWC IDs to their registry equivalents.""" DEFAULT_FUNCTION_VISIBILITY = "100" INTEGER_OVERFLOW_AND_UNDERFLOW = "101" OUTDATED_COMPILER_VERSION = "102" FLOATING_PRAGMA = "103" UNCHECKED_RET_VAL = "104" UNPROTECTED_ETHER_WITHDRAWAL = "105" UNPROTECTED_SELFDESTRUCT = "106" REENTRANCY = "107" DEFAULT_S...
"""This module maps SWC IDs to their registry equivalents.""" default_function_visibility = '100' integer_overflow_and_underflow = '101' outdated_compiler_version = '102' floating_pragma = '103' unchecked_ret_val = '104' unprotected_ether_withdrawal = '105' unprotected_selfdestruct = '106' reentrancy = '107' default_st...
def parameterized(names, params): def decorator(func): func.param_names = names func.params = params return func return decorator
def parameterized(names, params): def decorator(func): func.param_names = names func.params = params return func return decorator
# factorial(n) = n * (n-1) * (n-2) * ... * 3 * 2 * 1 def factorial(n): res = 0 for i in range(0, n): res *= i return res # Add your tests here def test_factiorial(): assert 1 == factorial(1) assert 5 == factorial(120)
def factorial(n): res = 0 for i in range(0, n): res *= i return res def test_factiorial(): assert 1 == factorial(1) assert 5 == factorial(120)
class DB_Exceptions(Exception): def __init__(self, name, value=None): self.name = name self.value = value def __str__(self): error_format = {"DB_CONNECT:": f'''Currently only the following objects are supported Oracle | mysql ->sq...
class Db_Exceptions(Exception): def __init__(self, name, value=None): self.name = name self.value = value def __str__(self): error_format = {'DB_CONNECT:': f'Currently only the following objects are supported\n Oracle | mysql ->sqlalchemy.create_engine ob...
__author__ = 'cjoakim' class Constants(object): @classmethod def uom_miles(cls): return 'm' @classmethod def uom_kilometers(cls): return 'k' @classmethod def uom_yards(cls): return 'y' @classmethod def units_of_measure(cls): return ('m', 'k', 'y') ...
__author__ = 'cjoakim' class Constants(object): @classmethod def uom_miles(cls): return 'm' @classmethod def uom_kilometers(cls): return 'k' @classmethod def uom_yards(cls): return 'y' @classmethod def units_of_measure(cls): return ('m', 'k', 'y') ...
# https://leetcode.com/problems/search-in-rotated-sorted-array/ class Solution: def search(self, nums: List[int], target: int) -> int: #if len(nums) == 1 and nums[0] == target: # return 0 left, right = 0, len(nums) - 1 while left <= right: ...
class Solution: def search(self, nums: List[int], target: int) -> int: (left, right) = (0, len(nums) - 1) while left <= right: mid = (right + left) // 2 if nums[mid] == target: return mid if nums[mid] >= nums[left]: if nums[left] <...
class Report: def __init__(self, name="", data=""): self.name=name self.data=data class LeaveRecord: def __init__(self, gradeFrom, gradeTo, weeks, data=""): self.gradeFrom=gradeFrom self.gradeTo=gradeTo self.weeks = weeks self.data=data class MainData: def ...
class Report: def __init__(self, name='', data=''): self.name = name self.data = data class Leaverecord: def __init__(self, gradeFrom, gradeTo, weeks, data=''): self.gradeFrom = gradeFrom self.gradeTo = gradeTo self.weeks = weeks self.data = data class Maindat...
# establish arg function with "you" as default. # return a customized string from func def two_fer(name='you'): # return string return f'One for {name}, one for me.'
def two_fer(name='you'): return f'One for {name}, one for me.'
# Your car is old, it breaks easily. The shock absorbers are gone and you think it can handle about 15 more bumps before it # dies totally. Unfortunately for you, your drive is very bumpy! Given a string showing either flat road ("_") or bumps ("n"), # work out if you make it home safely. 15 bumps or under, return "Woo...
def bumps(road): array_letters = [] for item in road: if item == 'n': arrayLetters.append(item) if len(arrayLetters) <= 15: return 'Woohoo!' else: return 'Car Dead' bumps('_nnnnnnn_n__n______nn__')
RIGHT = 'RIGHT' LEFT = 'LEFT' STRAIGHT = 'STRAIGHT' DIR_LINE = {'>': '-', 'v': '|', '<': '-', '^': '|'} GLOB = {'last_id': -1} CLEANED_ID = [] class Cart: def __init__(self, i, j, direction): GLOB['last_id'] += 1 self.id = GLOB['last_id'] self.i = i self.j = j self.dir = d...
right = 'RIGHT' left = 'LEFT' straight = 'STRAIGHT' dir_line = {'>': '-', 'v': '|', '<': '-', '^': '|'} glob = {'last_id': -1} cleaned_id = [] class Cart: def __init__(self, i, j, direction): GLOB['last_id'] += 1 self.id = GLOB['last_id'] self.i = i self.j = j self.dir = di...
"""This module has a __version__ that requires runtime interpretation""" __version__ = ".".join(["1", "2", "3"])
"""This module has a __version__ that requires runtime interpretation""" __version__ = '.'.join(['1', '2', '3'])
""" Rotating a matrix Anticlockwise by 90 degrees : """ """Solution: """ def rotate_anti(arr): n = len(arr) for i in range(len(arr)): for j in range(i+1, len(arr[i])): arr[i][j], arr[j][i] = arr[j][i], arr[i][j] for i in range(len(arr)//2): for j in range(len(arr[i])): ...
""" Rotating a matrix Anticlockwise by 90 degrees : """ 'Solution: ' def rotate_anti(arr): n = len(arr) for i in range(len(arr)): for j in range(i + 1, len(arr[i])): (arr[i][j], arr[j][i]) = (arr[j][i], arr[i][j]) for i in range(len(arr) // 2): for j in range(len(arr[i])): ...
mst_conversation_encounter_dummy = 0 mst_conversation_encounter = 1 mst_castle_attack_walls_molda_ram = 2 mst_castle_attack_walls_molda_ladder_belfry = 3 mst_castle_attack_walls_molda_ladder_two = 4 mst_castle_attack_walls_molda_open_gate = 5 mst_castle_attack_walls_molda_infil_river = 6 mst_castle_attack_walls_molda_u...
mst_conversation_encounter_dummy = 0 mst_conversation_encounter = 1 mst_castle_attack_walls_molda_ram = 2 mst_castle_attack_walls_molda_ladder_belfry = 3 mst_castle_attack_walls_molda_ladder_two = 4 mst_castle_attack_walls_molda_open_gate = 5 mst_castle_attack_walls_molda_infil_river = 6 mst_castle_attack_walls_molda_u...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class UserDeleteParameters(object): """Implementation of the 'UserDeleteParameters' model. Specifies the users to delete on the Cohesity Cluster. Attributes: domain (string): Specifies the domain associated with the users to del...
class Userdeleteparameters(object): """Implementation of the 'UserDeleteParameters' model. Specifies the users to delete on the Cohesity Cluster. Attributes: domain (string): Specifies the domain associated with the users to delete. Only users associated with the same domain can be del...
def Over9000(params, alpha=0.5, k=6, *args, **kwargs): ralamb = Ralamb(params, *args, **kwargs) return Lookahead(ralamb, alpha, k) RangerLars = Over9000
def over9000(params, alpha=0.5, k=6, *args, **kwargs): ralamb = ralamb(params, *args, **kwargs) return lookahead(ralamb, alpha, k) ranger_lars = Over9000
""" Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. Suppose the following input is supplied to the program: 34,67,55,33,12,98 Then, the output should be: ['34', '67', '55', '33', '12', '98'] ('34', '67', '55', '33', '12', '98...
""" Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. Suppose the following input is supplied to the program: 34,67,55,33,12,98 Then, the output should be: ['34', '67', '55', '33', '12', '98'] ('34', '67', '55', '33', '12', '98...
""" Some of the functions have a bit cumbersome behavior when we deal with positional and keyword arguments. Write a function that accept any iterable of unique values and then it behaves as range function: import string assert = custom_range(string.ascii_lowercase, 'g') == ['a', 'b', 'c', 'd', 'e', 'f'] assert = ...
""" Some of the functions have a bit cumbersome behavior when we deal with positional and keyword arguments. Write a function that accept any iterable of unique values and then it behaves as range function: import string assert = custom_range(string.ascii_lowercase, 'g') == ['a', 'b', 'c', 'd', 'e', 'f'] assert = ...
__version__ = "0.3.4" # The USGS API endpoint USGS_API_DEPRECATED = "https://earthexplorer.usgs.gov/inventory/json/v/1.4.0" USGS_API = "https://m2m.cr.usgs.gov/api/api/json/stable" # # Two catalogs are available for querying # CATALOG_NODES = ["EE", "HDDS"] # http://earthexplorer.usgs.gov/ EARTH_EXPLORER_CATALOG_N...
__version__ = '0.3.4' usgs_api_deprecated = 'https://earthexplorer.usgs.gov/inventory/json/v/1.4.0' usgs_api = 'https://m2m.cr.usgs.gov/api/api/json/stable' catalog_nodes = ['EE', 'HDDS'] earth_explorer_catalog_node = 'EE' hdds_explorer_catalog_node = 'HDDS' class Usgserror(Exception): pass class Usgsapikeyrequir...
def main(request, response): headers = [("Content-Type", "text/javascript"), ("Cache-control", "public, max-age=100")] body = "throw('fox');" return 200, headers, body
def main(request, response): headers = [('Content-Type', 'text/javascript'), ('Cache-control', 'public, max-age=100')] body = "throw('fox');" return (200, headers, body)
# Inspired by https://github.com/oceboy233/boost def boost_library( name, srcs = None, textual_hdrs = None, defines = None, linkopts = None, deps = None, sha256 = None): return { 'name': name, 'version': 'boost-1.75.0', 'srcs': srcs, 'textual_hdrs': textu...
def boost_library(name, srcs=None, textual_hdrs=None, defines=None, linkopts=None, deps=None, sha256=None): return {'name': name, 'version': 'boost-1.75.0', 'srcs': srcs, 'textual_hdrs': textual_hdrs, 'defines': (defines or []) + ['BOOST_ALL_NO_LIB'], 'linkopts': linkopts, 'deps': deps or [], 'sha256': sha256} boos...
# -*- coding: utf-8 -*- class Queue: def __init__(self): self.items = [] self._sizes = 0 def enqueue(self, item): # None can be added to queue self.items.insert(0, item) self._sizes += 1 def dequeue(self): if self.is_empty(): raise Exception("qu...
class Queue: def __init__(self): self.items = [] self._sizes = 0 def enqueue(self, item): self.items.insert(0, item) self._sizes += 1 def dequeue(self): if self.is_empty(): raise exception('queue is empty') item = self.items.pop() self._...
# -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------ WARPNet Transport ------------------------------------------------------------------------------ Authors: Chris Hunter (chunter [at] mangocomm.com) Patrick Murphy (murphpo [at] mangocomm.com) ...
""" ------------------------------------------------------------------------------ WARPNet Transport ------------------------------------------------------------------------------ Authors: Chris Hunter (chunter [at] mangocomm.com) Patrick Murphy (murphpo [at] mangocomm.com) Erik Welsh (welsh [at...
lar = input('largura: ') alt = input('altura: ') area = float(lar)*float(alt) tinta = area/2 print(tinta,' litros de tinta.')
lar = input('largura: ') alt = input('altura: ') area = float(lar) * float(alt) tinta = area / 2 print(tinta, ' litros de tinta.')
"""Event.py: stores a facebook event as a python object and calculates the latitude and longitude of the event if available.""" class Event: def __init__(self, title, timestamp, location, description): self.title = title self.timestamp = timestamp self.location = location self.latlo...
"""Event.py: stores a facebook event as a python object and calculates the latitude and longitude of the event if available.""" class Event: def __init__(self, title, timestamp, location, description): self.title = title self.timestamp = timestamp self.location = location self.latl...
'''Advent of Code - Day 7 2017''' # Part 2 children = [] parents = [] weight = {} tower = {} total_weight = {} total_parts = {} with open('day07input.txt') as f: for line in f: group = line.strip('\n').split('->') item = group[0].split(' (') key = item[0] value = item[1].strip(')...
"""Advent of Code - Day 7 2017""" children = [] parents = [] weight = {} tower = {} total_weight = {} total_parts = {} with open('day07input.txt') as f: for line in f: group = line.strip('\n').split('->') item = group[0].split(' (') key = item[0] value = item[1].strip(') ') w...
#!/usr/bin/env python3 FILE='test.txt' # sol: 26 FILE='input.txt' # sol: 504 def parse_input(file): out = []; with open(file, 'r') as f: for line in f: digits = line.rstrip().split(" | ")[1].split(' ') #print(f'line digits: {digits}') out.extend(digits) #print(f...
file = 'test.txt' file = 'input.txt' def parse_input(file): out = [] with open(file, 'r') as f: for line in f: digits = line.rstrip().split(' | ')[1].split(' ') out.extend(digits) return out entry = parse_input(FILE) count = len([digit for digit in entry if len(digit) in [2,...
class Parrot: species = 'bird' vertebrae = True def __init__(self, name, age): self.name = name self.age = age def sing(self, song): return f'{self.name} sings {song}.' def dance(self): return f'{self.name} is now dancing.' tweety = Parrot('Tweety', 2) print(tw...
class Parrot: species = 'bird' vertebrae = True def __init__(self, name, age): self.name = name self.age = age def sing(self, song): return f'{self.name} sings {song}.' def dance(self): return f'{self.name} is now dancing.' tweety = parrot('Tweety', 2) print(tweety...
''' Function to calculate the probability of getting married By Dr. Raymond Hoogendoorn Copyright 2020 ''' def calculateMarriageIntentionProbability(df_marriage2, baseyear): year = int(baseyear) df_current = df_marriage2[df_marriage2['Perioden'] == year] marriageintentionprob = list() for i in range(...
""" Function to calculate the probability of getting married By Dr. Raymond Hoogendoorn Copyright 2020 """ def calculate_marriage_intention_probability(df_marriage2, baseyear): year = int(baseyear) df_current = df_marriage2[df_marriage2['Perioden'] == year] marriageintentionprob = list() for i in rang...
# def solve(s): # digits = '' # letters = '' # other = '' # for ch in s: # if ch.isdigit(): # digits += ch # elif ch.isalpha(): # letters += ch # else: # other += ch # print(digits) # print(letters) # print(other) de...
def solve(s): print(''.join([ch for ch in s if ch.isdigit()])) print(''.join([ch for ch in s if ch.isalpha()])) print(''.join([ch for ch in s if not ch.isalnum()])) solve('Agd#53Dfg^&4F53')
def threeNumberSort(array, order): if len(array) == 0: return [] first = 0 for num in order: second = first + 1 while first < len(array): while first < len(array) and array[first] == num: first += 1 if first == len(array): retur...
def three_number_sort(array, order): if len(array) == 0: return [] first = 0 for num in order: second = first + 1 while first < len(array): while first < len(array) and array[first] == num: first += 1 if first == len(array): ret...
# File: arcsight_consts.py # Copyright (c) 2017-2021 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # # Action ID keys ACTION_ID_CREATE_TICKET = "create_ticket" ACTION_ID_UPDATE_TICKET = "update_ticket" ACTION_ID_GET_TICKET = "get_ticket" ACTION_ID_RUN_QUERY = "run_query" ...
action_id_create_ticket = 'create_ticket' action_id_update_ticket = 'update_ticket' action_id_get_ticket = 'get_ticket' action_id_run_query = 'run_query' arcsight_json_base_url = 'base_url' arcsight_json_case_name = 'name' arcsight_json_case_id = 'id' arcsight_json_parent_group = 'parent_group' arcsight_json_username =...
def partitions(cards, subtotal): m = 0 # Hit for i in range(0,10): if (cards[i]>0): total = subtotal+i+1 if (total < 21): # Stand m += 1 # Hit again cards[i] -= 1 m += partitions(cards, total) ...
def partitions(cards, subtotal): m = 0 for i in range(0, 10): if cards[i] > 0: total = subtotal + i + 1 if total < 21: m += 1 cards[i] -= 1 m += partitions(cards, total) cards[i] += 1 elif total == 21: ...
class Locus(object): def __init__(self, genome, contig, locus_from, locus_to, genes, cas8_cluster=None, strand=None): self.genome = genome self.contig = contig self.locus_from = locus_from self.locus_to = locus_to self.genes = genes self.orders = ...
class Locus(object): def __init__(self, genome, contig, locus_from, locus_to, genes, cas8_cluster=None, strand=None): self.genome = genome self.contig = contig self.locus_from = locus_from self.locus_to = locus_to self.genes = genes self.orders = set([gene.order for ...
class QueueInfo: def __init__(self, celery_app): self.control = celery_app.control self.inspect = self.control.inspect() self.channel = celery_app.connection().channel() def active_queue_names(self): """ get all active queue name. """ return set(self.acti...
class Queueinfo: def __init__(self, celery_app): self.control = celery_app.control self.inspect = self.control.inspect() self.channel = celery_app.connection().channel() def active_queue_names(self): """ get all active queue name. """ return set(self.act...
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def preorderTraversal(self, root: TreeNode) -> List[int]: if not root: return [] ...
class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def preorder_traversal(self, root: TreeNode) -> List[int]: if not root: return [] result = [] stack = [] nod...
def loss_mean_reduction_function(loss, *_): return loss.mean() def loss_sum_reduction_function(loss, *_): return loss.sum() def loss_reduce_by_weight(loss, pred, label, context): return (loss * context['sample_weight']).sum() def build_loss_reduction_function(loss_parameters: dict): if 'reduce' no...
def loss_mean_reduction_function(loss, *_): return loss.mean() def loss_sum_reduction_function(loss, *_): return loss.sum() def loss_reduce_by_weight(loss, pred, label, context): return (loss * context['sample_weight']).sum() def build_loss_reduction_function(loss_parameters: dict): if 'reduce' not i...
class CNode(object): def __init__(self): self._children = [] def add_children(self, child_node, *args): self._children.append(child_node) for node in args: self._children.append(node) def emit(self, emit_func=print): pass def children(self): ...
class Cnode(object): def __init__(self): self._children = [] def add_children(self, child_node, *args): self._children.append(child_node) for node in args: self._children.append(node) def emit(self, emit_func=print): pass def children(self): return...
# # PySNMP MIB module LIGHTSTREAM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LIGHTSTREAM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:56:32 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ...
def slab_is_valid(slab_analyzed,dft_type): if dft_type in ['Mixed DFTB', 'Mixed DFT']: first_metal_atom=slab_analyzed['slabatoms'][0] for el in slab_analyzed['slab_elements']: if el not in ['Ag','Au','Cu','H']: return (False, "Wrong slab composition") if ...
def slab_is_valid(slab_analyzed, dft_type): if dft_type in ['Mixed DFTB', 'Mixed DFT']: first_metal_atom = slab_analyzed['slabatoms'][0] for el in slab_analyzed['slab_elements']: if el not in ['Ag', 'Au', 'Cu', 'H']: return (False, 'Wrong slab composition') if len...
def rule_maker(raw_rules): rules = {} for rule in raw_rules: key, value = rule.split(': ') if value[0] == '"': rules[int(key)] = value[1:-1] else: values = value.split(' | ') temp_v = [] for v in values: temp_v.append([int(v...
def rule_maker(raw_rules): rules = {} for rule in raw_rules: (key, value) = rule.split(': ') if value[0] == '"': rules[int(key)] = value[1:-1] else: values = value.split(' | ') temp_v = [] for v in values: temp_v.append([int...
__package_name__ = "{{package_name}}" __description__ = '{{description}}' __url__ = '{{url}}' __version__ = '{{version}}' __author__ = '{{author}}' __author_email__ = '{{author_email}}' __license__ = '{{license}}' __copyright__ = '{{copyright}}'
__package_name__ = '{{package_name}}' __description__ = '{{description}}' __url__ = '{{url}}' __version__ = '{{version}}' __author__ = '{{author}}' __author_email__ = '{{author_email}}' __license__ = '{{license}}' __copyright__ = '{{copyright}}'
prefixes = { 16: "initialLetterContraction_prefix", 24: "initialLetterContraction_prefix", 40: "finalLetterGroupSign_prefix", 48: "grade1_finalLetterGroupSign_prefix", 56: "initalLetterContraction_prefix", } prefix_16 = { "(ch)": "character", "d": "day", "e": "ever", "f": "father", ...
prefixes = {16: 'initialLetterContraction_prefix', 24: 'initialLetterContraction_prefix', 40: 'finalLetterGroupSign_prefix', 48: 'grade1_finalLetterGroupSign_prefix', 56: 'initalLetterContraction_prefix'} prefix_16 = {'(ch)': 'character', 'd': 'day', 'e': 'ever', 'f': 'father', 'h': 'here', 'k': 'know', 'l': 'lord', 'm...
f''' struct {ANON_IDENTIFIER}; struct {{ ... }} struct {IDENTIFIER} {{ ... }} union {ANON_IDENTIFIER}; union {{ ... }} union {IDENTIFIER} {{ ... }} enum {ANON_IDENTIFIER}; enum {{ ... }} enum {IDENTIFIER} {{ ... }} typedef {VARTYPE} {IDENTIFIER}; typedef {IDENTIFIER}; ...
f'\n struct {ANON_IDENTIFIER};\n struct {{ ... }}\n struct {IDENTIFIER} {{ ... }}\n\n union {ANON_IDENTIFIER};\n union {{ ... }}\n union {IDENTIFIER} {{ ... }}\n\n enum {ANON_IDENTIFIER};\n enum {{ ... }}\n enum {IDENTIFIER} {{ ... }}\n\n typedef {VARTYPE} {IDENTIFIER};\n typedef {IDENT...
def bin_to_string(num): cnt = 0 res = '.' while num > 0: if (cnt >= 32): return 'ERROR' cnt += 1 digit, num = divmod(num * 2, 1) res += str(int(digit)) return res bin_to_string(0.72) bin_to_string(0.625)
def bin_to_string(num): cnt = 0 res = '.' while num > 0: if cnt >= 32: return 'ERROR' cnt += 1 (digit, num) = divmod(num * 2, 1) res += str(int(digit)) return res bin_to_string(0.72) bin_to_string(0.625)
def estCondicional01(): #Definir variables y otros print("Ejemplo estructura Condicional en Python") montoP=0 #Datos de entrada cantidadX=int(input("Ingrese la cantidad de lapices:")) #Proceso if cantidadX>=1000: montoP=cantidadX*0.80 else: montoP=cantidadX*0.90 #Datos de salida print("El mont...
def est_condicional01(): print('Ejemplo estructura Condicional en Python') monto_p = 0 cantidad_x = int(input('Ingrese la cantidad de lapices:')) if cantidadX >= 1000: monto_p = cantidadX * 0.8 else: monto_p = cantidadX * 0.9 print('El monto a pagar es:', montoP) est_condicional0...
mahasiswa_list = ["Jojo", "Naruto", "Trump"] mahasiswa_tuple = ("Jojo", "Naruto", "Trump") print(mahasiswa_list) print(mahasiswa_list[0]) print(type(mahasiswa_list)) print() print(mahasiswa_tuple) print(mahasiswa_tuple[0]) print(type(mahasiswa_tuple)) # yang membedakan tuple dengan list hanyalah hak akses # list ...
mahasiswa_list = ['Jojo', 'Naruto', 'Trump'] mahasiswa_tuple = ('Jojo', 'Naruto', 'Trump') print(mahasiswa_list) print(mahasiswa_list[0]) print(type(mahasiswa_list)) print() print(mahasiswa_tuple) print(mahasiswa_tuple[0]) print(type(mahasiswa_tuple)) print(mahasiswa_list) mahasiswa_list[0] = 'Komandan Hitsugaya' print...
#vector 1 a = [1,2,3] #vector 2 b = [2,3,4] #obtain the product dot_product = a[0]*b[0] + a[1]*b[1] + a[2]*b[2] print(dot_product)
a = [1, 2, 3] b = [2, 3, 4] dot_product = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] print(dot_product)
class Factors(object): @staticmethod def mfa_providers(): return [ { 'id': 'GoogleAuthenticator', 'prompt': 'Google Authenticator', 'factor_type': 'token:software:totp', 'provider': 'GOOGLE' }, { 'i...
class Factors(object): @staticmethod def mfa_providers(): return [{'id': 'GoogleAuthenticator', 'prompt': 'Google Authenticator', 'factor_type': 'token:software:totp', 'provider': 'GOOGLE'}, {'id': 'OktaVerify', 'prompt': 'Okta Verify', 'factor_type': 'token:software:totp', 'provider': 'OKTA'}, {'id': ...
# game setup WIDTH = 1280 HEIGTH = 720 FPS = 60 TILESIZE = 64 WORLD_MAP = [ ['x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x'], ['x',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','x'], ['x',' ','p',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',...
width = 1280 heigth = 720 fps = 60 tilesize = 64 world_map = [['x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'], ['x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'x'], ['x', ' ', 'p', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '...
def areSimilar(a, b): counter = 0 if sorted(a) != sorted(b): return False for i in range(len(a)): if a[i] != b[i]: counter += 1 if counter > 2: return False return True
def are_similar(a, b): counter = 0 if sorted(a) != sorted(b): return False for i in range(len(a)): if a[i] != b[i]: counter += 1 if counter > 2: return False return True
class AuthException(Exception): def __init__(self): # Call the base class constructor with the parameters it needs message = "Sorry, you do not have access to that app. Try passing the app name explicitly with the `-a` flag. If that doesn't work, try running `gigalixir login` or check your ~/.netrc ...
class Authexception(Exception): def __init__(self): message = "Sorry, you do not have access to that app. Try passing the app name explicitly with the `-a` flag. If that doesn't work, try running `gigalixir login` or check your ~/.netrc file." super(AuthException, self).__init__(message)
class UnionFind: def __init__(self, size): if size < 0: raise Exception("Invalid size.") self.component_size = [0] * size self.parent = [-1] * size self.component_count = size self.size = size for ind in range(size): self.parent[ind] = -1 ...
class Unionfind: def __init__(self, size): if size < 0: raise exception('Invalid size.') self.component_size = [0] * size self.parent = [-1] * size self.component_count = size self.size = size for ind in range(size): self.parent[ind] = -1 ...
def EN_DistributionEntropy(y,histOrKS = 'hist',numBins = None,olremp = 0): """ EN_DistributionEntropy Distributional entropy. Estimates of entropy from the distribution of a data vector. The distribution is estimated either using a histogram with numBins bins, or as a kernel-smoothed distrib...
def en__distribution_entropy(y, histOrKS='hist', numBins=None, olremp=0): """ EN_DistributionEntropy Distributional entropy. Estimates of entropy from the distribution of a data vector. The distribution is estimated either using a histogram with numBins bins, or as a kernel-smoothed distribu...
# encoding: utf-8 """A fancy version of Python's builtin :func:`dir` function. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, di...
"""A fancy version of Python's builtin :func:`dir` function. """ def get_class_members(cls): ret = dir(cls) if hasattr(cls, '__bases__'): try: bases = cls.__bases__ except AttributeError: pass else: for base in bases: ret.extend(get_cl...
a, b, c, d, e = map(int, input().split()) if a > b > c > d > e: print("D") elif a < b < c < d < e: print("C") else: print("N")
(a, b, c, d, e) = map(int, input().split()) if a > b > c > d > e: print('D') elif a < b < c < d < e: print('C') else: print('N')
#!/usr/bin/env python3 ############################################################################################ # # # Program purpose: Prints letter 'L' to the console. # # Program ...
def print_letter_p(): result_str = '' for row in range(0, 7): for column in range(0, 7): if column == 1 or ((row == 0 or row == 3) and 0 < column < 5) or ((column == 5 or column == 1) and (row == 1 or row == 2)): result_str = result_str + '*' else: ...
# Copyright (c) 2010-2012 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
def is_informational(status): """ Check if HTTP status code is informational. :param status: http status code :returns: True if status is successful, else False """ return 100 <= status <= 199 def is_success(status): """ Check if HTTP status code is successful. :param status: http...
strings = ['a', 'b', 'c', 'd'] print(strings[2]) # O(1) #push strings.append('e') # O(1) #pop strings.pop() #Add at first index strings.insert(0, "x") # O(n) #splice strings.insert(2, 'x') # O(n) print(strings)
strings = ['a', 'b', 'c', 'd'] print(strings[2]) strings.append('e') strings.pop() strings.insert(0, 'x') strings.insert(2, 'x') print(strings)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- APP_KEY = '66994707' APP_SECRET = '323631d3d46128ea30605a7732bb6dfd' COOKIE_SECRET = '2$onW88^G6I=dB4@EwXN1X!QGc&$$tiY' AUTHORIZE_REDIRECT = 'http://localhost.com/auth/authorize' REVOKE_REDIRECT = 'http://localhost.com/' MONGO_URL = 'localhost' MONGO_PORT = 27017 MONGO...
app_key = '66994707' app_secret = '323631d3d46128ea30605a7732bb6dfd' cookie_secret = '2$onW88^G6I=dB4@EwXN1X!QGc&$$tiY' authorize_redirect = 'http://localhost.com/auth/authorize' revoke_redirect = 'http://localhost.com/' mongo_url = 'localhost' mongo_port = 27017 mongo_db = 'noweibo' celery_broker = 'redis://localhost:...
csv = "Eric John Michael Terry Graham Terry Brian" friend_list = csv.split() friend_list2 = "-".join(friend_list) print(friend_list) print(friend_list2)
csv = 'Eric John Michael Terry Graham Terry Brian' friend_list = csv.split() friend_list2 = '-'.join(friend_list) print(friend_list) print(friend_list2)
class IncorrectParametersException(Exception): pass class APIErrorException(Exception): pass
class Incorrectparametersexception(Exception): pass class Apierrorexception(Exception): pass
overview_response = { "debug": None, "error": None, "status": "ok", "data": [ { "endpoint": "api/b2b/v3/general/contract/data/info/", "is_active": True, "is_debug_mode": False, "is_limited": True, "requests_number": 100, "se...
overview_response = {'debug': None, 'error': None, 'status': 'ok', 'data': [{'endpoint': 'api/b2b/v3/general/contract/data/info/', 'is_active': True, 'is_debug_mode': False, 'is_limited': True, 'requests_number': 100, 'seconds_number': 86400}, {'endpoint': 'api/b2b/v3/general/document/closing_documents/download/', 'is_...
# -*- coding: utf-8 -*- class Feature(object): def __init__(self, key, enabled, rollout_progress=0, rollout_target=0, include_users=[], exclude_users=[], last_sync=None): self._feature = { 'key': key, 'enabled': enabled, 'rollout_progress': rollout_progress, ...
class Feature(object): def __init__(self, key, enabled, rollout_progress=0, rollout_target=0, include_users=[], exclude_users=[], last_sync=None): self._feature = {'key': key, 'enabled': enabled, 'rollout_progress': rollout_progress, 'rollout_target': rollout_target, 'include_users': include_users, 'exclud...
# # PySNMP MIB module VMWARE-RESOURCES-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VMWARE-RESOURCES-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:34:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, constraints_union, single_value_constraint) ...
AUTOCOMPLETE_MAPPING = { "index_patterns":["*"], "settings":{ "index.mapper.dynamic": True, "analysis": { "analyzer": { "autocomplete": { "tokenizer": "edge_ngram_tokenizer", "filter": [ "lowercase" ], ...
autocomplete_mapping = {'index_patterns': ['*'], 'settings': {'index.mapper.dynamic': True, 'analysis': {'analyzer': {'autocomplete': {'tokenizer': 'edge_ngram_tokenizer', 'filter': ['lowercase'], 'autocomplete_search': {'tokenizer': 'lowercase'}}}, 'tokenizer': {'edge_ngram_tokenizer': {'type': 'edge_ngram', 'token_ch...
class MockFile(): def read(self): return False class RequestHandler(): def __init__(self): self.contentType = "" self.contents = MockFile() def getContents(self): return self.contents.read() def read(self): return self.contents def setStatus(self, status):...
class Mockfile: def read(self): return False class Requesthandler: def __init__(self): self.contentType = '' self.contents = mock_file() def get_contents(self): return self.contents.read() def read(self): return self.contents def set_status(self, status)...
""" Project information. We use this module as __init__ is a generic module that django requires to be specifically set up. """ LABELS = dict() LABELS['class'] = 'LinkedItems' LABELS['name'] = 'django_linked_items' LABELS['verbose_name'] = 'Linked Items'
""" Project information. We use this module as __init__ is a generic module that django requires to be specifically set up. """ labels = dict() LABELS['class'] = 'LinkedItems' LABELS['name'] = 'django_linked_items' LABELS['verbose_name'] = 'Linked Items'
# Time: O(n) # Space: O(h) class Solution(object): def getMinimumDifference(self, root): """ :type root: TreeNode :rtype: int """ def inorderTraversal(root, prev, result): if not root: return (result, prev) result, prev = inorderTrav...
class Solution(object): def get_minimum_difference(self, root): """ :type root: TreeNode :rtype: int """ def inorder_traversal(root, prev, result): if not root: return (result, prev) (result, prev) = inorder_traversal(root.left, prev,...
#right riemann sum #function x^3 def riemannSum(a,b,n): funct = 0 deelint = (b-a)/n for i in range(1,n): funct += ((a+(i*deelint))**3) funct += (b**3) return deelint * funct print(riemannSum(2,9,8))
def riemann_sum(a, b, n): funct = 0 deelint = (b - a) / n for i in range(1, n): funct += (a + i * deelint) ** 3 funct += b ** 3 return deelint * funct print(riemann_sum(2, 9, 8))
## # Used to hold a book in parse results after parsing class Book: def __init__(self, publisher_id, rights_id, language_id, bookshelf_id, gutenberg_book_id, date_issued, num_downloads, titles_id, subjects_id, type_id, authors_id, files_id): self.publisher_...
class Book: def __init__(self, publisher_id, rights_id, language_id, bookshelf_id, gutenberg_book_id, date_issued, num_downloads, titles_id, subjects_id, type_id, authors_id, files_id): self.publisher_id = publisher_id self.rights_id = rights_id self.language_id = language_id self.b...
# Copyright 2014 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. { 'variables': { 'chromium_code': 1, }, 'includes': [ '../build/common_untrusted.gypi', 'url_srcs.gypi', ], 'targets': [ { 't...
{'variables': {'chromium_code': 1}, 'includes': ['../build/common_untrusted.gypi', 'url_srcs.gypi'], 'targets': [{'target_name': 'url_nacl', 'type': 'none', 'variables': {'nlib_target': 'liburl_nacl.a', 'build_glibc': 0, 'build_newlib': 0, 'build_pnacl_newlib': 1}, 'dependencies': ['../third_party/icu/icu_nacl.gyp:icud...
SUCCEED_STATUS_INDEX = "3" FAILED_STATUS_INDEX = "900" LOCAL_IMAGE_REGISTRY = "localhost:31112" CLUSTER_IP = "ClusterIP" NODE_PORT = "NodePort"
succeed_status_index = '3' failed_status_index = '900' local_image_registry = 'localhost:31112' cluster_ip = 'ClusterIP' node_port = 'NodePort'
# # PySNMP MIB module CISCO-IPSEC-PROVISIONING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IPSEC-PROVISIONING-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:02:32 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python vers...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ...
""" Problem: server Link: https://open.kattis.com/problems/server Source: Rocky Mountain Regional Contest (RMRC) 2014 """ n, T = list(map(int, input().split())) A = list(map(int, input().split())) sum = 0 counter = 0 for i in range(len(A)): if sum + A[i] <= T: sum += A[i] counter += 1 ...
""" Problem: server Link: https://open.kattis.com/problems/server Source: Rocky Mountain Regional Contest (RMRC) 2014 """ (n, t) = list(map(int, input().split())) a = list(map(int, input().split())) sum = 0 counter = 0 for i in range(len(A)): if sum + A[i] <= T: sum += A[i] counter += 1 else: ...
""" Description of library ---------------------- This header is being used to auto-generate documentation """
""" Description of library ---------------------- This header is being used to auto-generate documentation """
counter_letters = lambda list: [len(x) for x in list] animals_list = ['dog', 'cat', 'elephant'] print(counter_letters(animals_list)) sum = lambda a, b: a + b print(sum(5, 10)) # dictionary calculator = { 'sum': lambda a, b: a + b, 'subtraction': lambda a, b: a - b, 'multiplication': lambda a, b: a * b, ...
counter_letters = lambda list: [len(x) for x in list] animals_list = ['dog', 'cat', 'elephant'] print(counter_letters(animals_list)) sum = lambda a, b: a + b print(sum(5, 10)) calculator = {'sum': lambda a, b: a + b, 'subtraction': lambda a, b: a - b, 'multiplication': lambda a, b: a * b, 'division': lambda a, b: a / b...
def isPrime_num(n): if n > 1: for i in range(2,n): if (n % i == 0): return False break else: return True else: return False
def is_prime_num(n): if n > 1: for i in range(2, n): if n % i == 0: return False break else: return True else: return False
class MonteCarloTreeSearchBasedPlayer(): def __init__(self, game, nnet, args): self.game = game self.nnet = nnet self.args = args self.mcts = MCTS(game, nnet, args) def play(self, canonicalBoard, temp=1): for i in range(self.args.numMCTSSims): self.mcts.search(canonicalBoard) s = sel...
class Montecarlotreesearchbasedplayer: def __init__(self, game, nnet, args): self.game = game self.nnet = nnet self.args = args self.mcts = mcts(game, nnet, args) def play(self, canonicalBoard, temp=1): for i in range(self.args.numMCTSSims): self.mcts.search...
# -*- coding: utf-8 -*- """ Created on Tue Feb 22 11:14:18 2022 @author: EIRU0001 """ def multiplication(x,y): z = x*y return z
""" Created on Tue Feb 22 11:14:18 2022 @author: EIRU0001 """ def multiplication(x, y): z = x * y return z
class Solution: def combine(self, n: int, k: int): if n < k: return [] if n == k: return [[i for i in range(1, n+1)]] def doCombine(low, high, k, combination, results): if k == 0: results.append(combination) return ...
class Solution: def combine(self, n: int, k: int): if n < k: return [] if n == k: return [[i for i in range(1, n + 1)]] def do_combine(low, high, k, combination, results): if k == 0: results.append(combination) return ...