content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
''' ------------------------- Counting Array Inversions ------------------------- An array inversion is defined as a single pair of elements A[i] and A[j] in the array 'A' such that i < j but A[i] > A[j]. This implementation runs in O(n log n) time, and uses a recursive approach similar to Merge Sort in order to effi...
""" ------------------------- Counting Array Inversions ------------------------- An array inversion is defined as a single pair of elements A[i] and A[j] in the array 'A' such that i < j but A[i] > A[j]. This implementation runs in O(n log n) time, and uses a recursive approach similar to Merge Sort in order to effi...
# Copyright 2020 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. """ See https://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details on the presubmit API built into depot_tools. """ USE_PYTHON...
""" See https://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details on the presubmit API built into depot_tools. """ use_python3 = True def check_change(input_api, output_api): """Checks that changes to client_variations.proto are mirrored.""" has_proto_update = False has_pars...
# model settings model = dict( type='MOCO', queue_len=65536, feat_dim=128, momentum=0.999, backbone=dict( type='ResNet', depth=18, num_stages=4, out_indices=(3,), # no conv-1, x-1: stage-x norm_cfg=dict(type='BN'), style='pytorch'), neck=dict( ...
model = dict(type='MOCO', queue_len=65536, feat_dim=128, momentum=0.999, backbone=dict(type='ResNet', depth=18, num_stages=4, out_indices=(3,), norm_cfg=dict(type='BN'), style='pytorch'), neck=dict(type='LinearNeck', in_channels=512, out_channels=128, with_avg_pool=True), head=dict(type='ContrastiveHead', temperature=0...
# -*- coding: utf-8 -*- def get_lam_by_label(self, label): """Returns the lamination by its labels. Accepted labels are 'Stator_X' and 'Rotor_X' with X the number of the lamination starting with 0. For convenience also 'Stator' or 'Rotor' are allowed here to get respective first stator or rotor lamina...
def get_lam_by_label(self, label): """Returns the lamination by its labels. Accepted labels are 'Stator_X' and 'Rotor_X' with X the number of the lamination starting with 0. For convenience also 'Stator' or 'Rotor' are allowed here to get respective first stator or rotor lamination. Parameters ...
class Model: def __init__(self): self.flask = wiz.flask def has(self, key): if key in self.flask.session: return True return False def delete(self, key): self.flask.session.pop(key) def set(self, **kwargs): for key in kwargs: ...
class Model: def __init__(self): self.flask = wiz.flask def has(self, key): if key in self.flask.session: return True return False def delete(self, key): self.flask.session.pop(key) def set(self, **kwargs): for key in kwargs: self.flask...
class Tracker(object): def update(self, detections): matches, unmatched_tracks, unmatched_detections = self._match(detections) return matches, unmatched_tracks, unmatched_detections def _match(self, detections): print("father match called") pass class Sun(Tracker): '''def...
class Tracker(object): def update(self, detections): (matches, unmatched_tracks, unmatched_detections) = self._match(detections) return (matches, unmatched_tracks, unmatched_detections) def _match(self, detections): print('father match called') pass class Sun(Tracker): """...
slice[ a.b : c.d ] slice[ d :: d + 1 ] slice[ d + 1 :: d ] slice[ d::d ] slice[ 0 ] slice[ -1 ] slice[ :-1 ] slice[ ::-1 ] slice[ :c, c - 1 ] slice[ c, c + 1, d:: ] slice[ ham[ c::d ] :: 1 ] slice[ ham[ cheese ** 2 : -1 ] : 1 : 1, ham[ 1:2 ] ] slice[ :-1: ] slice[ lambda: None : lambda: None ] slice[ lambda x, y, *args...
slice[a.b:c.d] slice[d::d + 1] slice[d + 1::d] slice[d::d] slice[0] slice[-1] slice[:-1] slice[::-1] slice[:c, c - 1] slice[c, c + 1, d:] slice[ham[c::d]::1] slice[ham[cheese ** 2:-1]:1:1, ham[1:2]] slice[:-1] slice[lambda : None:lambda : None] slice[lambda x, y, *args, really=2, **kwargs: None:, None:] slice[1 or 2:Tr...
class Solution: def maxCoins(self, nums): """ :type nums: List[int] :rtype: int """ nums = [1] + nums + [1] n = len(nums) dp = [[0] * n for i in range(n)] for j in range(2, n): for i in range(j-2, -1, -1): for k in range(i+1...
class Solution: def max_coins(self, nums): """ :type nums: List[int] :rtype: int """ nums = [1] + nums + [1] n = len(nums) dp = [[0] * n for i in range(n)] for j in range(2, n): for i in range(j - 2, -1, -1): for k in range...
"""Advent of Code 2017 Day 15.""" puzzle = [699, 124] def main(puzzle=puzzle): matching_pairs = compare_pairs(puzzle, 40_000_000) print(f'Final count for 40 million pairs: {matching_pairs}') conditions = [lambda num: is_multiply_of(num, 4), lambda num: is_multiply_of(num, 8)] matchi...
"""Advent of Code 2017 Day 15.""" puzzle = [699, 124] def main(puzzle=puzzle): matching_pairs = compare_pairs(puzzle, 40000000) print(f'Final count for 40 million pairs: {matching_pairs}') conditions = [lambda num: is_multiply_of(num, 4), lambda num: is_multiply_of(num, 8)] matching_pairs = compare_pai...
# Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ 'symroot.gypi', ], 'targets': [ { 'target_name': 'prog1', 'type': 'executable', 'dependencies': [ ...
{'includes': ['symroot.gypi'], 'targets': [{'target_name': 'prog1', 'type': 'executable', 'dependencies': ['subdir2/prog2.gyp:prog2'], 'include_dirs': ['.', 'inc1', 'subdir2/inc2', 'subdir3/inc3', 'subdir2/deeper'], 'sources': ['prog1.c']}]}
""" __init__.py: """ __author__ = "Michael J. Harms" __all__ = ["uhbd","common","pyUHBD"]
""" __init__.py: """ __author__ = 'Michael J. Harms' __all__ = ['uhbd', 'common', 'pyUHBD']
# Generation of 'magic' numbers for bitmasking to extract # values from cpuid def bitmask(mask): ''' First element in `mask` is least-significant bit, last element is most-significant. ''' result = 0 for index, x in enumerate(mask): result |= x << index return result ways = bitmask(...
def bitmask(mask): """ First element in `mask` is least-significant bit, last element is most-significant. """ result = 0 for (index, x) in enumerate(mask): result |= x << index return result ways = bitmask([0] * 22 + [1] * 10) partitions = bitmask([0] * 12 + [1] * 10) line_size = bitmas...
"""CORS Middleware A middleware for handling CORS requests. See: https://falcon.readthedocs.io/en/stable/user/faq.html#how-do-i-implement-cors-with-falcon """ class CORSComponent(object): def process_response(self, req, resp, resource, req_succeeded): resp.set_header('Access-Control-Allow-Origin', '*')...
"""CORS Middleware A middleware for handling CORS requests. See: https://falcon.readthedocs.io/en/stable/user/faq.html#how-do-i-implement-cors-with-falcon """ class Corscomponent(object): def process_response(self, req, resp, resource, req_succeeded): resp.set_header('Access-Control-Allow-Origin', '*')...
"""Contains the function for calculating the crc16 value Functions: crc16_a2a(str) :: string to string crc16_a2b(str) :: string to bytes crc16_b2b(bytestr) :: bytes to bytes """ def crc16_a2a(str): """Take in a string and calculate its correct crc16 value. Args: ...
"""Contains the function for calculating the crc16 value Functions: crc16_a2a(str) :: string to string crc16_a2b(str) :: string to bytes crc16_b2b(bytestr) :: bytes to bytes """ def crc16_a2a(str): """Take in a string and calculate its correct crc16 value. Args: ...
class Solution(object): def tribonacci(self, n, memo = dict()): if n in memo: return memo[n] if n == 0: return 0 if n == 2 or n ==1 : return 1 else: var = self.tribonacci(n-1) + self.tribonacci(n-3) + self.tribonacci(n-2) ...
class Solution(object): def tribonacci(self, n, memo=dict()): if n in memo: return memo[n] if n == 0: return 0 if n == 2 or n == 1: return 1 else: var = self.tribonacci(n - 1) + self.tribonacci(n - 3) + self.tribonacci(n - 2) ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 12 10:16:47 2018 @author: abauville """ ## Units ## ===================================== m = 1.0 s = 1.0 K = 1.0 kg = 1.0 cm = 0.01 * m km = 1000.0 * m mn = 60 * s hour = 60 ...
""" Created on Tue Jun 12 10:16:47 2018 @author: abauville """ m = 1.0 s = 1.0 k = 1.0 kg = 1.0 cm = 0.01 * m km = 1000.0 * m mn = 60 * s hour = 60 * mn day = 24 * hour yr = 365 * day kyr = 1000.0 * yr myr = 1000000.0 * yr pa = 1.0 k_pa = 1000.0 * Pa m_pa = 1000000.0 * Pa
GRAB_SPIDER_CONFIG = { 'global': { 'spider_modules': ['zzz'], }, }
grab_spider_config = {'global': {'spider_modules': ['zzz']}}
NOT_ASSINGNED = 0 MAFIA = 1 DETECTIVE = 2 JOKER = 3 ANGEL = 4 SHEELA = 5 SILENCER = 6 TERORIST = 7 CIVILIAN = 8
not_assingned = 0 mafia = 1 detective = 2 joker = 3 angel = 4 sheela = 5 silencer = 6 terorist = 7 civilian = 8
"""Keys to be used for the returned objects via API.""" # pylint: disable=too-few-public-methods SUCCESS = "success" ERRORS = "errors" FLAGS = "flags" DATA = "data" INFO = "info" RESULT = "result" REQUIRED = "required" class Common: """Common result keys.""" CREATOR_OID = "creator" CHANNEL_OID = "chann...
"""Keys to be used for the returned objects via API.""" success = 'success' errors = 'errors' flags = 'flags' data = 'data' info = 'info' result = 'result' required = 'required' class Common: """Common result keys.""" creator_oid = 'creator' channel_oid = 'channel' token = 'token' platform = 'platf...
print('hello world') i = 10 if i==10: print('true') print('i =10')
print('hello world') i = 10 if i == 10: print('true') print('i =10')
class StatementRecord: def __init__(self, s_name, r_name, e_name, s_type, e_type, which_extractor, info_from_set=None, **extra_info): if info_from_set is None: self.info_from_set = set([]) else: self.info_from_set = info_from_set self.s_name = s_name self.r_...
class Statementrecord: def __init__(self, s_name, r_name, e_name, s_type, e_type, which_extractor, info_from_set=None, **extra_info): if info_from_set is None: self.info_from_set = set([]) else: self.info_from_set = info_from_set self.s_name = s_name self.r_n...
DEFAULT_FILE_STORAGE = 'djangae.storage.CloudStorage' FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 FILE_UPLOAD_HANDLERS = ( 'djangae.storage.BlobstoreFileUploadHandler', 'django.core.files.uploadhandler.MemoryFileUploadHandler', ) DATABASES = { 'default': { 'ENGINE': 'djangae.db.backends.appengine' ...
default_file_storage = 'djangae.storage.CloudStorage' file_upload_max_memory_size = 1024 * 1024 file_upload_handlers = ('djangae.storage.BlobstoreFileUploadHandler', 'django.core.files.uploadhandler.MemoryFileUploadHandler') databases = {'default': {'ENGINE': 'djangae.db.backends.appengine'}} generate_special_indexes_d...
def fizzbuzz(n): result = [] for count in range (1, n): if count % 3 == 0 and not count % 5 == 0: result.append("Fizz") elif count % 5 == 0 and not count % 3 == 0: result.append("Buzz") elif count % 3 == 0 and count % 5 == 0: result.append("FizzBuzz") else: result.append(cou...
def fizzbuzz(n): result = [] for count in range(1, n): if count % 3 == 0 and (not count % 5 == 0): result.append('Fizz') elif count % 5 == 0 and (not count % 3 == 0): result.append('Buzz') elif count % 3 == 0 and count % 5 == 0: result.append('FizzBuzz...
""" solved wrong problem, paths can start from anywhere TODO: ask better questions degree[neigh]: 3 matrix[neigh[0]][neigh[1]]: 8 matrix[node[0]][node[1]]: 4 neigh: (1, 2) node: (0, 2) """ class Solution: def longestIncreasingPath(self, matrix: List[List[int]]) -> int: self.cnt = 0 if len(...
""" solved wrong problem, paths can start from anywhere TODO: ask better questions degree[neigh]: 3 matrix[neigh[0]][neigh[1]]: 8 matrix[node[0]][node[1]]: 4 neigh: (1, 2) node: (0, 2) """ class Solution: def longest_increasing_path(self, matrix: List[List[int]]) -> int: self.cnt = 0 if len(matri...
i = 2 print("Even numbers from 1 to 100:") while i <= 100: print(i) i += 2
i = 2 print('Even numbers from 1 to 100:') while i <= 100: print(i) i += 2
#!/usr/bin/env python3 def print_ok(msg, **kargs): """ Print the message in green. """ print(f"\033[32m{msg}\033[0m", **kargs) def print_failed(msg, **kargs): """ Print the message in red. """ print(f"\033[31m{msg}\033[0m", **kargs)
def print_ok(msg, **kargs): """ Print the message in green. """ print(f'\x1b[32m{msg}\x1b[0m', **kargs) def print_failed(msg, **kargs): """ Print the message in red. """ print(f'\x1b[31m{msg}\x1b[0m', **kargs)
""".. Ignore pydocstyle D400. ==================== Resolwe Test Helpers ==================== """
""".. Ignore pydocstyle D400. ==================== Resolwe Test Helpers ==================== """
''' lab 7 while loop ''' #3.1 i = 0 while i <=5: if i !=3: print(i) i = i +1 #3.2 i = 1 result =1 while i <=5: result = result *i i = i +1 print(result) #3.3 i = 1 result =0 while i <=5: result = result +i i = i +1 print(result) #3.4 i = 3 result =1 while i <=8...
""" lab 7 while loop """ i = 0 while i <= 5: if i != 3: print(i) i = i + 1 i = 1 result = 1 while i <= 5: result = result * i i = i + 1 print(result) i = 1 result = 0 while i <= 5: result = result + i i = i + 1 print(result) i = 3 result = 1 while i <= 8: result = result * i i = ...
class Kerror(Exception): def __init__(self, technicalMessage, guiMessage=None): self.technicalMessage = technicalMessage self.guiMessage = guiMessage
class Kerror(Exception): def __init__(self, technicalMessage, guiMessage=None): self.technicalMessage = technicalMessage self.guiMessage = guiMessage
# Copyright (c) 2012 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. { 'conditions': [ # In component mode (shared_lib), we build all of skia as a single DLL. # However, in the static mode, we need to build skia ...
{'conditions': [['component=="static_library"', {'targets': [{'target_name': 'skia_library', 'type': 'static_library', 'includes': ['skia_library.gypi', 'skia_common.gypi', '../build/android/increase_size_for_speed.gypi', '../build/android/disable_lto.gypi']}]}], ['component=="static_library"', {'targets': [{'target_na...
# 2.6.9 _strptime.py # In 2.6 bug in handling BREAK_LOOP followed by JUMP_BACK # So added rule: # break_stmt ::= BREAK_LOOP JUMP_BACK for value in __file__: if value: if (value and __name__): pass else: tz = 'a' break
for value in __file__: if value: if value and __name__: pass else: tz = 'a' break
# Time: O(1) # Space: O(1) # A rectangle is represented as a list [x1, y1, x2, y2], # where (x1, y1) are the coordinates of its bottom-left corner, # and (x2, y2) are the coordinates of its top-right corner. # # Two rectangles overlap if # the area of their intersection is positive. # To be clear, two rectangles that...
class Solution(object): def is_rectangle_overlap(self, rec1, rec2): """ :type rec1: List[int] :type rec2: List[int] :rtype: bool """ def intersect(p_left, p_right, q_left, q_right): return max(p_left, q_left) < min(p_right, q_right) return inters...
class yrange: def __init__(self, n): self.i = 0 self.n = n def __iter__(self): return self def next(self): if self.i < self.n: i = self.i self.i += 1 return i else: raise StopIteration() dias = ['lunes', 'martes', 'mi...
class Yrange: def __init__(self, n): self.i = 0 self.n = n def __iter__(self): return self def next(self): if self.i < self.n: i = self.i self.i += 1 return i else: raise stop_iteration() dias = ['lunes', 'martes', 'm...
"""Sentinel class for constants with useful reprs""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. class Sentinel(object): def __init__(self, name, module, docstring=None): self.name = name self.module = module if docstring: ...
"""Sentinel class for constants with useful reprs""" class Sentinel(object): def __init__(self, name, module, docstring=None): self.name = name self.module = module if docstring: self.__doc__ = docstring def __repr__(self): return str(self.module) + '.' + self.name...
def get_model_for_training(): return def load_model(): return def save_model(): return
def get_model_for_training(): return def load_model(): return def save_model(): return
if __name__ == "__main__": team_A = Team("A") team_B = Team("B") arena = Arena(team_A, team_B) arena.build_team_one() arena.build_team_two() arena.team_battle() arena.show_stats()
if __name__ == '__main__': team_a = team('A') team_b = team('B') arena = arena(team_A, team_B) arena.build_team_one() arena.build_team_two() arena.team_battle() arena.show_stats()
# Copyright 2018 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
""" Create configuration to deploy GKE cluster. Below code creates a GKE cluster based on input values from cluster*.yaml file Please refer to https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2 for deployment manager samples. """ def generate_config(context): """ Generates...
class User: id = 1 name = 'Test User' email = 'test@email.com' def find(self, id): return self
class User: id = 1 name = 'Test User' email = 'test@email.com' def find(self, id): return self
"""igvm - Main Module Copyright (c) 2018 InnoGames GmbH """ VERSION = (2, 1)
"""igvm - Main Module Copyright (c) 2018 InnoGames GmbH """ version = (2, 1)
# Approach 2 - DP # Time: O(N*sqrt(N)) # Space: O(N) class Solution: def winnerSquareGame(self, n: int) -> bool: dp = [False] * (n+1) for i in range(1, n+1): for k in range(1, int(i**0.5)+1): if dp[i - k*k] == False: dp[i] = True ...
class Solution: def winner_square_game(self, n: int) -> bool: dp = [False] * (n + 1) for i in range(1, n + 1): for k in range(1, int(i ** 0.5) + 1): if dp[i - k * k] == False: dp[i] = True break return dp[n]
# Implements hack/lib/version.sh's kube::version::ldflags() for Bazel. def version_x_defs(): # This should match the list of packages in kube::version::ldflag stamp_pkgs = [ "k8s.io/kubernetes/pkg/version", # In hack/lib/version.sh, this has a vendor/ prefix. That isn't needed here? "k8s.io/client...
def version_x_defs(): stamp_pkgs = ['k8s.io/kubernetes/pkg/version', 'k8s.io/client-go/pkg/version'] stamp_vars = ['buildDate', 'gitCommit', 'gitMajor', 'gitMinor', 'gitTreeState', 'gitVersion'] x_defs = {} for pkg in stamp_pkgs: for var in stamp_vars: x_defs['%s.%s' % (pkg, var)] = ...
# # @lc app=leetcode id=687 lang=python3 # # [687] Longest Univalue Path # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def longestUnivaluePath(self, root: TreeNode...
class Solution: def longest_univalue_path(self, root: TreeNode) -> int: def helper(node): if not node: return 0 a = helper(node.left) b = helper(node.right) n = 0 left = 0 right = 0 if node.left and node.va...
class Circle: def __init__(self): print("Parent constractor") class Point(Circle): def __init__(self, x, y): print("Child constractor") # self.x_point = x # self.y_point = y # circle = Circle() def draw(self): print(f"draw a point with {self.x_point} and {se...
class Circle: def __init__(self): print('Parent constractor') class Point(Circle): def __init__(self, x, y): print('Child constractor') def draw(self): print(f'draw a point with {self.x_point} and {self.y_point}') point = point(1, 8) point._draw()
# !/usr/bin/env python3 # Author: C.K # Email: theck17@163.com # DateTime:2021-06-21 19:06:23 # Description: class Solution: def summaryRanges(self, nums: List[int]) -> List[str]: ranges, r = [], [] for n in nums: if n - 1 not in r: r = [] ranges += r, ...
class Solution: def summary_ranges(self, nums: List[int]) -> List[str]: (ranges, r) = ([], []) for n in nums: if n - 1 not in r: r = [] ranges += (r,) r[1:] = (n,) return ['->'.join(map(str, r)) for r in ranges] if __name__ == '__main_...
class Solution: def findWords(self, words): """ :type words: List[str] :rtype: List[str] """ res = [] rows = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] for word in words: for row in rows: if all(letter in row for letter in word.lower()...
class Solution: def find_words(self, words): """ :type words: List[str] :rtype: List[str] """ res = [] rows = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] for word in words: for row in rows: if all((letter in row for letter in word.lower...
# # PySNMP MIB module MSTP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MSTP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:05:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint, constraints_union) ...
Name=str(input("Por favor escriba su nombre: ")) bn=float(input("Por favor ingrese su salario fijo: ")) vt=float(input("Ingrese su numero de ventas este mes: ")) qc=(vt*0.15) tl=(qc+bn) print("TOTAL = R$ ""{:.2f}".format (tl))
name = str(input('Por favor escriba su nombre: ')) bn = float(input('Por favor ingrese su salario fijo: ')) vt = float(input('Ingrese su numero de ventas este mes: ')) qc = vt * 0.15 tl = qc + bn print('TOTAL = R$ {:.2f}'.format(tl))
LOG_HANDLERS = { "mrq.logger.MongoHandler": { "mongodb_logs_size": 16 * 1024 * 1024 } }
log_handlers = {'mrq.logger.MongoHandler': {'mongodb_logs_size': 16 * 1024 * 1024}}
class Base: def __init__(self, name): self.name = name class Foo(Base): def __init__(self, name, time): Base.__init__(self, name) self.time = time class BaseA: def __init__(self): print("BaseA") class FooA(BaseA): def __init__(self): BaseA.__init__(self) ...
class Base: def __init__(self, name): self.name = name class Foo(Base): def __init__(self, name, time): Base.__init__(self, name) self.time = time class Basea: def __init__(self): print('BaseA') class Fooa(BaseA): def __init__(self): BaseA.__init__(self) ...
# coding=utf-8 MASTER_NODE_URL = 'https://api.sentinelgroup.io' KEYSTORE_FILE_PATH = '/root/.sentinel/keystore' CONFIG_DATA_PATH = '/root/.sentinel/config.json' LIMIT_1GB = (1.0 * 1024 * 1024 * 1024)
master_node_url = 'https://api.sentinelgroup.io' keystore_file_path = '/root/.sentinel/keystore' config_data_path = '/root/.sentinel/config.json' limit_1_gb = 1.0 * 1024 * 1024 * 1024
# Copyright 2021 by Sergio Valqui. All rights reserved. # Navigating Object structures def obj_struct(my_obj): for att in dir(my_obj): print(att, getattr(my_obj, att), type(getattr(my_obj, att)).__name__) # TODO: Differentiate methods, other objects, known structures # TODO: show values...
def obj_struct(my_obj): for att in dir(my_obj): print(att, getattr(my_obj, att), type(getattr(my_obj, att)).__name__)
class Person: def __init__(self, first_name, middle, last, nick, title, company, comaddr, homenr, mobile, worknr, faxnr, email_1, email_2, email_3, home_page, year_b, year_a, home_add, home_phone, note): self.first_name = first_name self.middle = middle self.last = last ...
class Person: def __init__(self, first_name, middle, last, nick, title, company, comaddr, homenr, mobile, worknr, faxnr, email_1, email_2, email_3, home_page, year_b, year_a, home_add, home_phone, note): self.first_name = first_name self.middle = middle self.last = last self.nick = ...
x = [] for i in range(6): x.append(float(input())) mn = x[0] mx = x[0] for i in range(6): if(x[i] < mn): mn = x[i] if(x[i] > mx): mx = x[i] print(mn,mx)
x = [] for i in range(6): x.append(float(input())) mn = x[0] mx = x[0] for i in range(6): if x[i] < mn: mn = x[i] if x[i] > mx: mx = x[i] print(mn, mx)
CODEDIR = '/home/antonio/Codes/bronchinet/src/' DATADIR = '/home/antonio/Data/EXACT_Testing/' BASEDIR = '/home/antonio/Results/AirwaySegmentation_EXACT/' # NAMES INPUT / OUTPUT DIR NAME_RAW_IMAGES_RELPATH = 'Images/' NAME_RAW_LABELS_RELPATH = 'Airways/' NAME_RAW_ROIMASKS_RELPATH = 'Lungs/' NAME_RAW_COARSEAIRWAYS_REL...
codedir = '/home/antonio/Codes/bronchinet/src/' datadir = '/home/antonio/Data/EXACT_Testing/' basedir = '/home/antonio/Results/AirwaySegmentation_EXACT/' name_raw_images_relpath = 'Images/' name_raw_labels_relpath = 'Airways/' name_raw_roimasks_relpath = 'Lungs/' name_raw_coarseairways_relpath = 'CoarseAirways/' name_r...
class Student: def __init__(self, name, school): self.name = name self.school = school self.marks = [] def average(self): return sum(self.marks) / len(self.marks) class WorkingStudent(Student): def __init__(self, name, school, salary): super().__init__(name, school) self.salary = salar...
class Student: def __init__(self, name, school): self.name = name self.school = school self.marks = [] def average(self): return sum(self.marks) / len(self.marks) class Workingstudent(Student): def __init__(self, name, school, salary): super().__init__(name, schoo...
def my_create_model(switch_prob=0.1,noise_level=0.5): """ Create an HMM with binary state variable and 1D Gaussian observations The probability to switch to the other state is `switch_prob`. Two observation models have mean 1.0 and -1.0 respectively. `noise_level` specifies the standard deviation of t...
def my_create_model(switch_prob=0.1, noise_level=0.5): """ Create an HMM with binary state variable and 1D Gaussian observations The probability to switch to the other state is `switch_prob`. Two observation models have mean 1.0 and -1.0 respectively. `noise_level` specifies the standard deviation of t...
#En ciertos casos usar listas y estas al ser dinamicas consumen mucha memoria y eso resulta ser ineficiente #Para solucionar ese problema es cuando entran las tuplas #Tuplas elementos de tipo estatico - no se pueden modificar #Mas eficientes en los recorridos - estructura de datos mas rapida #Inmutabilidad - no pued...
mi_lista = [1, 2, 3, 4, 5] mi_tupla = (1, 2, 3, 4, 5) for numero in mi_tupla: print(numero) my_tuple = (1,) my_tuple = (1, 2, 3) (x, y, z) = my_tuple def coordenadas(): return (5, 4) (x, y) = coordenadas()
#!/usr/bin/env python # -*- coding: utf-8 -*- def gll(N): """ Returns GLL (Gauss Lobato Legendre module with collocation points and weights) """ # Initialization of integration weights and collocation points # [xi, weights] = gll(N) # Values taken from Diploma Thesis Bernhard Schuberth ...
def gll(N): """ Returns GLL (Gauss Lobato Legendre module with collocation points and weights) """ if N == 2: xi = [-1.0, 0.0, 1.0] weights = [0.33333333, 1.33333333, 0.33333333] elif N == 1: xi = [-1.0, 1.0] weights = [0, 0] elif N == 3: xi = [-1.0, -...
class NoteBook(object): """Specifies the notebooks associated with a particular user""" def get_all_notebooks(self, note_store): """Returns all notebooks""" return note_store.listNotebooks()
class Notebook(object): """Specifies the notebooks associated with a particular user""" def get_all_notebooks(self, note_store): """Returns all notebooks""" return note_store.listNotebooks()
#!/usr/bin/env python3 def read_digits(): return map(int, input().strip()) def index_of_nonzero(items): return next(i for i, x in enumerate(items) if x != 0) def with_leading_nonzero(items): index = index_of_nonzero(items) items.insert(0, items.pop(index)) return items for _ in range(int(input()...
def read_digits(): return map(int, input().strip()) def index_of_nonzero(items): return next((i for (i, x) in enumerate(items) if x != 0)) def with_leading_nonzero(items): index = index_of_nonzero(items) items.insert(0, items.pop(index)) return items for _ in range(int(input())): digits = sort...
a = int(input()) b = int(input()) print(b % a)
a = int(input()) b = int(input()) print(b % a)
UNIT = 20 c = 0.01 t = 0.01 def setup(): fullScreen() background(200,100,155) def X(x): return width/2 + x def Y(x): return height/2 - x def draw(): background(0) global c,t noStroke() rectMode(CORNER) f = [1,1,2,3,5,8,13,21,34,55,89] e = [(1,-1),(...
unit = 20 c = 0.01 t = 0.01 def setup(): full_screen() background(200, 100, 155) def x(x): return width / 2 + x def y(x): return height / 2 - x def draw(): background(0) global c, t no_stroke() rect_mode(CORNER) f = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] e = [(1, -1), (-1, -1...
# # PySNMP MIB module SMON-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/SMON-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:28:37 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ( ObjectIden...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
matrix = [ [1, 2, 3, 4], [5, 6, 0, 8], [9, 0, 2, 4], [4, 5, 6, 7] ]
matrix = [[1, 2, 3, 4], [5, 6, 0, 8], [9, 0, 2, 4], [4, 5, 6, 7]]
# # PySNMP MIB module NET-SNMP-PERIODIC-NOTIFY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NET-SNMP-PERIODIC-NOTIFY-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:18:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python vers...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
''' Created on Sep 9, 2013 @author: akittredge '''
""" Created on Sep 9, 2013 @author: akittredge """
""" ============ Unsupervised ============ Unsupervised learning. """ # Category description for the widget registry NAME = "Unsupervised" DESCRIPTION = "Unsupervised learning." BACKGROUND = "#CAE1EF" ICON = "icons/Category-Unsupervised.svg" PRIORITY = 6
""" ============ Unsupervised ============ Unsupervised learning. """ name = 'Unsupervised' description = 'Unsupervised learning.' background = '#CAE1EF' icon = 'icons/Category-Unsupervised.svg' priority = 6
def getCookie(cookie_name): JS(""" var results = document.cookie.match ( '(^|;) ?' + @{{cookie_name}} + '=([^;]*)(;|$)' ); if ( results ) return ( decodeURIComponent ( results[2] ) ); else return null; """) # expires can be int or Date def setCookie(name, value, expires, domain=N...
def get_cookie(cookie_name): js("\n\tvar results = document.cookie.match ( '(^|;) ?' + \n @{{cookie_name}} + '=([^;]*)(;|$)' );\n\n\tif ( results )\n\t\treturn ( decodeURIComponent ( results[2] ) );\n\telse\n\t\treturn null;\n\n ") def set_cookie(name, value, expires, domain=None, path=No...
# import pyperclip class User: ''' the user class ''' user_list = [] def __init__(self, first_name, last_name, number, email, password): self.first_name = first_name self.last_name = last_name self.phone_number = number self.email = email self.password = pas...
class User: """ the user class """ user_list = [] def __init__(self, first_name, last_name, number, email, password): self.first_name = first_name self.last_name = last_name self.phone_number = number self.email = email self.password = password def save_...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") PROTOBUF_VERSION = "3.6.1.3" SHA = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2" def generate_protobuf(): http_archive( name = "com_google_protobuf", urls = ["https://github.com/protocolbuffers/protobuf/archi...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') protobuf_version = '3.6.1.3' sha = '9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2' def generate_protobuf(): http_archive(name='com_google_protobuf', urls=['https://github.com/protocolbuffers/protobuf/archive/v%s.zip' % PROTOBUF...
# # @lc app=leetcode id=69 lang=python3 # # [69] Sqrt(x) # # @lc code=start class Solution: def mySqrt(self, x: int) -> int: v = 1 result = 0 while True: if v * v > x: result = v - 1 break v = v + 1 return result # @lc code=end...
class Solution: def my_sqrt(self, x: int) -> int: v = 1 result = 0 while True: if v * v > x: result = v - 1 break v = v + 1 return result
def morris_pratt_string_matching(t, w, m, n): B = prefix_suffix(w) i = 0 while i <= n - m + 1: j = 0 while j < m and t[i + j + 1] == w[j + 1]: j = j + 1 if j == m: return True i, j = i + j - B[j], max(0, B[j]) return False
def morris_pratt_string_matching(t, w, m, n): b = prefix_suffix(w) i = 0 while i <= n - m + 1: j = 0 while j < m and t[i + j + 1] == w[j + 1]: j = j + 1 if j == m: return True (i, j) = (i + j - B[j], max(0, B[j])) return False
teste = list() teste.append('Pedro') teste.append(15) galera = list() galera.append(teste[:]) teste[0] = 'Ronaldo' teste[1] = '22' galera.append(teste[:]) print(galera)
teste = list() teste.append('Pedro') teste.append(15) galera = list() galera.append(teste[:]) teste[0] = 'Ronaldo' teste[1] = '22' galera.append(teste[:]) print(galera)
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py', '../_base_/swa.py' ] num_stages = 6 num_proposals = 512 model = dict( type='SparseRCNN', pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_base_patch4_window...
_base_ = ['../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py', '../_base_/swa.py'] num_stages = 6 num_proposals = 512 model = dict(type='SparseRCNN', pretrained='https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_base_patch4_window7_224_22k....
abi = '''[ { "inputs": [ { "internalType": "int256", "name": "bp", "type": "int256" }, { "internalType": "int256", "name": "sp", "type": "int256" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { ...
abi = '[\n\t{\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"internalType": "int256",\n\t\t\t\t"name": "bp",\n\t\t\t\t"type": "int256"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"internalType": "int256",\n\t\t\t\t"name": "sp",\n\t\t\t\t"type": "int256"\n\t\t\t}\n\t\t],\n\t\t"payable": false,\n\t\t"stateMutability": "nonpayable",\n\t\t"type": "c...
class HashEngine: def __init__(self): self.location_hash = None self.location_auth_hash = None self.request_hashes = [] def hash(self, timestamp, latitude, longitude, altitude, authticket, sessiondata, requests): raise NotImplementedError() def get_location_hash(self): ...
class Hashengine: def __init__(self): self.location_hash = None self.location_auth_hash = None self.request_hashes = [] def hash(self, timestamp, latitude, longitude, altitude, authticket, sessiondata, requests): raise not_implemented_error() def get_location_hash(self): ...
"""This function is used to verify key. If the key is valid, return a dictionary with key and answer If the key is invalid, return False """ def isvalid(Key): #Check the length of string first if len(Key) != 26: return False #Use a dictionary to store the key and value d = dict() Ch...
"""This function is used to verify key. If the key is valid, return a dictionary with key and answer If the key is invalid, return False """ def isvalid(Key): if len(Key) != 26: return False d = dict() char = 'a' for i in Key: if i in d or ord(i) < 97 or ord(i) > 122: return...
for _ in range(int(input())): n = int(input()) arr = list(map(int,input().split())) flag = 0 for i in arr: if i < 0: flag = 1 break if flag: print('NO') continue for i in range(max(arr)): if i not in arr: arr.append(i) print...
for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) flag = 0 for i in arr: if i < 0: flag = 1 break if flag: print('NO') continue for i in range(max(arr)): if i not in arr: arr.append(i) prin...
bind = '0.0.0.0:8000' # Assuming one CPU. http://docs.gunicorn.org/en/stable/design.html#how-many-workers # 2 * cores + 1 workers = 3 # You can send signals to it http://docs.gunicorn.org/en/latest/signals.html pidfile = '/run/gunicorn.pid' # Logformat including request time. access_log_format = '%(h)s %({X-Forwarded-F...
bind = '0.0.0.0:8000' workers = 3 pidfile = '/run/gunicorn.pid' access_log_format = '%(h)s %({X-Forwarded-For}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" "%(L)s seconds"' loglevel = 'info' accesslog = '-' errorlog = '-' syslog = False syslog_prefix = '[asoc_members-wsgi]' timeout = 84000
""" Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete AT MOST ONE transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit. Note that you cannot sell a stock before you buy one. Example 1: ...
""" Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete AT MOST ONE transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit. Note that you cannot sell a stock before you buy one. Example 1: ...
""" To understand what's going on: 1. The Merge Sort Recursively breaks down a list of size N to left and right, each of size N/2; 2. The new sliced lists are fed to cmp_sort that rearranges the fed total list of size N with index to be sorted in the original list. Since, Original list is Mutable - This Original list c...
""" To understand what's going on: 1. The Merge Sort Recursively breaks down a list of size N to left and right, each of size N/2; 2. The new sliced lists are fed to cmp_sort that rearranges the fed total list of size N with index to be sorted in the original list. Since, Original list is Mutable - This Original list c...
class Constants: RESPONSE_CODES_SUCCESS = [200, 201] RESPONSE_CODES_FAILURE = [400, 401, 404, 500] RESPONSE_500 = 500 URL = "https://api.coingecko.com/api/v3/coins/{}?localization=false&tickers=false&market_data=false&community_data=false&developer_data=false&sparkline=false" CONTENT_TYPE = "applica...
class Constants: response_codes_success = [200, 201] response_codes_failure = [400, 401, 404, 500] response_500 = 500 url = 'https://api.coingecko.com/api/v3/coins/{}?localization=false&tickers=false&market_data=false&community_data=false&developer_data=false&sparkline=false' content_type = 'applica...
def P_total(pressures=[]): """Returns a float of the total pressure of a gas in a container \npressure: ```list``` \n\tList of pressures in a container""" total = 0.0 for pressure in pressures: total += pressure return float(total) def partial_pressure(num_moles, ideal_gas_law, temp, volum...
def p_total(pressures=[]): """Returns a float of the total pressure of a gas in a container pressure: ```list``` List of pressures in a container""" total = 0.0 for pressure in pressures: total += pressure return float(total) def partial_pressure(num_moles, ideal_gas_law, temp, volume, i...
"""Loads the absl library""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def repo(): http_archive( name = "com_google_absl", sha256 = "f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111", strip_prefix = "abseil-cpp-20200225.2", urls = [ ...
"""Loads the absl library""" load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def repo(): http_archive(name='com_google_absl', sha256='f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111', strip_prefix='abseil-cpp-20200225.2', urls=['https://apollo-system.cdn.bcebos.com/archive/6.0...
""" Constants file for wiating backend """ AUTH0_CLIENT_ID='AUTH0_CLIENT_ID' AUTH0_DOMAIN='AUTH0_DOMAIN' AUTH0_CLIENT_SECRET='AUTH0_CLIENT_SECRET' AUTH0_CALLBACK_URL='AUTH0_CALLBACK_URL' AUTH0_AUDIENCE='AUTH0_AUDIENCE' SECRET_KEY = 'SECRET_KEY' S3_BUCKET = 'S3_BUCKET' ES_CONNECTION_STRING = 'ES_CONNECTION_STRING' INDEX...
""" Constants file for wiating backend """ auth0_client_id = 'AUTH0_CLIENT_ID' auth0_domain = 'AUTH0_DOMAIN' auth0_client_secret = 'AUTH0_CLIENT_SECRET' auth0_callback_url = 'AUTH0_CALLBACK_URL' auth0_audience = 'AUTH0_AUDIENCE' secret_key = 'SECRET_KEY' s3_bucket = 'S3_BUCKET' es_connection_string = 'ES_CONNECTION_STR...
class User(object): def __init__(self, type, mail, preferences, added, following=None, follower=None): """ Represent a zodiac user Args --- :arg type {str} type of that identify the schema :arg mail {str} user email adress...
class User(object): def __init__(self, type, mail, preferences, added, following=None, follower=None): """ Represent a zodiac user Args --- :arg type {str} type of that identify the schema :arg mail {str} user email adress ...
colddrinks = "pepsi", "cola", "sprite", "7up", 58 num = [89, 38,94,23,98,192] #num.sort() #num.reverse() print(colddrinks[:4]) print(num[:: 2])
colddrinks = ('pepsi', 'cola', 'sprite', '7up', 58) num = [89, 38, 94, 23, 98, 192] print(colddrinks[:4]) print(num[::2])
#Author: Bhumi Patel #The given function will take in an educational website and count the number #of clicks it takes for users to reach privacy policy and end-user license agreement ''' -> With the current pandemic, lives all around the world has been disturbed and changed completely. With change in lifestyle...
""" -> With the current pandemic, lives all around the world has been disturbed and changed completely. With change in lifestyle and social behaviour, learning has also been affected. Overnight schools were shutdown, universities need to close their doors and educators, students, and parents needed to figure out ways t...
# Complete the function below. def main(): conn = sqlite3.connect('SAMPLE.db') cursor = conn.cursor() cursor.execute("drop table if exists ITEMS") sql_statement = '''CREATE TABLE ITEMS (item_id integer not null, item_name varchar(300), item_description text, item_category text, quan...
def main(): conn = sqlite3.connect('SAMPLE.db') cursor = conn.cursor() cursor.execute('drop table if exists ITEMS') sql_statement = 'CREATE TABLE ITEMS\n (item_id integer not null, item_name varchar(300), \n item_description text, item_category text, \n quantity_in_stock integer)' cursor.ex...
class Solution(object): def maxProduct(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 # max_p[i] saves maximum product of subarray among nums[0...i], both inclusive # min_p[i] saves minimum product of subarray a...
class Solution(object): def max_product(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 max_p = [0] * len(nums) min_p = [0] * len(nums) result = max_p[0] = min_p[0] = nums[0] for i in range(1, len...
class LearnedEquivalence: def __init__(self, eq_class): self.equivalence_class = eq_class def __str__(self): return "LEARNED_EQCLASS_" + self.equivalence_class
class Learnedequivalence: def __init__(self, eq_class): self.equivalence_class = eq_class def __str__(self): return 'LEARNED_EQCLASS_' + self.equivalence_class
# data is [ 0 name of game, # 1 path to game saves, # 2 backups directory] ''' self.game.name self.game.saveLocation self.game.backupLocation ''' class gameInfo: def __init__( self, name, saveLocation, backupLocation ): self.name = name self.saveLocation = saveLocation self.backupLocation = backupLocatio...
""" self.game.name self.game.saveLocation self.game.backupLocation """ class Gameinfo: def __init__(self, name, saveLocation, backupLocation): self.name = name self.saveLocation = saveLocation self.backupLocation = backupLocation
"""Provides the repository macro to import LLVM.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "4b4bc1ea16dec58e828ec3a0154046b10ec69242" LLVM_SHA256 = "a744dd2d7241daf6573ef88f9bd61b9d690cbac73d1f26381054d74e1f3505e0" http_a...
"""Provides the repository macro to import LLVM.""" load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def repo(name): """Imports LLVM.""" llvm_commit = '4b4bc1ea16dec58e828ec3a0154046b10ec69242' llvm_sha256 = 'a744dd2d7241daf6573ef88f9bd61b9d690cbac73d1f26381054d74e1f3505e0' http_arc...
class Field(): def __init__(self, dictionary = {}): self.name = dictionary.get("name") self.rname = dictionary.get("rname") self.domain = dictionary.get("domain") self.description = dictionary.get("description") # Props self.input = dictionary.get("input", False) ...
class Field: def __init__(self, dictionary={}): self.name = dictionary.get('name') self.rname = dictionary.get('rname') self.domain = dictionary.get('domain') self.description = dictionary.get('description') self.input = dictionary.get('input', False) self.edit = dic...
# some helper functions def build_tree(A, i, n): """ Build a tree from level array in leetcode :param A: input array :param i: start index :param n: size of array :return: TreeNode """ if i < n: if A[i] is None: # return if null return x = TreeNode(A[...
def build_tree(A, i, n): """ Build a tree from level array in leetcode :param A: input array :param i: start index :param n: size of array :return: TreeNode """ if i < n: if A[i] is None: return x = tree_node(A[i]) x.left = build_tree(A, 2 * i + 1,...
# -*- coding: utf-8 -*- """ Created on Wed Oct 28 05:48:47 2020 @author: ucobiz """ def happy(): print("Happy Bday to you!") def sing(person): happy() happy() print("Happy Bday,", person) happy() def main(): sing("Fred") print() sing("Lucy") main()
""" Created on Wed Oct 28 05:48:47 2020 @author: ucobiz """ def happy(): print('Happy Bday to you!') def sing(person): happy() happy() print('Happy Bday,', person) happy() def main(): sing('Fred') print() sing('Lucy') main()
# QuickSort def quicksort(L,l,r): #If list has only one element, return the list as is if(r-l <=1): return L # Set pivot as the very first position in the list, upper and lower are the next element (pivot,lower,upper) = (L[l],l+1,l+1) # Loop from the item after pivot to the end for i in range(l+1,r): #If L[i]...
def quicksort(L, l, r): if r - l <= 1: return L (pivot, lower, upper) = (L[l], l + 1, l + 1) for i in range(l + 1, r): if L[i] > pivot: upper += 1 else: (L[i], L[lower]) = (L[lower], L[i]) upper += 1 lower += 1 (L[l], L[lower - 1]) ...
# import pytest class TestMessageFolder: def test_folders(self): # synced assert True def test_messages(self): # synced assert True def test_order_messages_by_date(): # synced assert True class TestAttributes: class TestChildFolderCount: pass ...
class Testmessagefolder: def test_folders(self): assert True def test_messages(self): assert True def test_order_messages_by_date(): assert True class Testattributes: class Testchildfoldercount: pass class Testtotalitemcount: pass ...
def character_xor(input_string, char): output_string = "" for c in input_string: output_string += chr(ord(c)^char) return output_string def calculate_score(input_string): frequencies = { 'a': .08167, 'b': .01492, 'c': .02782, 'd': .04253, 'e': .12702, 'f': .02228, 'g': .02015, 'h': .06094, '...
def character_xor(input_string, char): output_string = '' for c in input_string: output_string += chr(ord(c) ^ char) return output_string def calculate_score(input_string): frequencies = {'a': 0.08167, 'b': 0.01492, 'c': 0.02782, 'd': 0.04253, 'e': 0.12702, 'f': 0.02228, 'g': 0.02015, 'h': 0.06...
_base_ = './cifar10split_bs16.py' data = dict( unlabeled=dict( type='TVDatasetSplit', base='CIFAR10', train=True, data_prefix='data/torchvision/cifar10', num_images=1000, download=True ) )
_base_ = './cifar10split_bs16.py' data = dict(unlabeled=dict(type='TVDatasetSplit', base='CIFAR10', train=True, data_prefix='data/torchvision/cifar10', num_images=1000, download=True))