content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
''' Prompt: Developers and Testers Integration n: # of people in the meeting d: max # of developers that can sit consecutively t: max # of testers that can sit consecutively Goal is to find how many ways you can rearrange the meeting. Example: n=5 d=2 t=2 DTDTD DTTDT TTDTD TDTDT ''' # Time: O(2^n), Space: O(n) de...
""" Prompt: Developers and Testers Integration n: # of people in the meeting d: max # of developers that can sit consecutively t: max # of testers that can sit consecutively Goal is to find how many ways you can rearrange the meeting. Example: n=5 d=2 t=2 DTDTD DTTDT TTDTD TDTDT """ def helper_team(d, t, n, initi...
def example1(): # Not using explicit unpacking # elems = [4, 7, 18] # # elem0 = elems[0] # elem1 = elems[1] # elem2 = elems[2] # print(elem0, elem1, elem2) # Use unpacking elems = [4, 7, 18] elem0, elem1, elem2 = elems print(elem0, elem1, elem2) tuple_data = (0, 1, 2) ...
def example1(): elems = [4, 7, 18] (elem0, elem1, elem2) = elems print(elem0, elem1, elem2) tuple_data = (0, 1, 2) (tuple0, tuple1, tuple2) = tuple_data print(tuple0, tuple1, tuple2) def example2(): (*c,) = (1, 2) print('c', c) (a, *b) = (1, 2, 3) print('a', a) print('b', b)...
#!/usr/bin/env python # -*- coding: utf-8 -*- t = int(input()) for i in range(t): n, k = map(int, input().split()) ans = '' for i in range(k): ans += chr(97+i)*(n//k) if n%k: ans += chr(97+k-1)*(n%k) print(ans)
t = int(input()) for i in range(t): (n, k) = map(int, input().split()) ans = '' for i in range(k): ans += chr(97 + i) * (n // k) if n % k: ans += chr(97 + k - 1) * (n % k) print(ans)
""" Patternfly user interface module. This module contains models and pages classess for UI elements from patternfly library, see: https://www.patternfly.org/ """
""" Patternfly user interface module. This module contains models and pages classess for UI elements from patternfly library, see: https://www.patternfly.org/ """
weights = [(0, 1, 9), (0, 2, 10), (1, 3, 10), (1, 4, 5), (1, 6, 3), (2, 3, 9), (2, 4, 7), (2, 5, 2), (3, 5, 4), (3, 6, 8), (4, 6, 1), (5, 6, 6)] weights.sort(key = lambda t: t[2]) mst = [] N = 7 p = [] for i in range(N): p.append(i) def find(u): if u != p[u]: p[u] = find(p[u]) return p[...
weights = [(0, 1, 9), (0, 2, 10), (1, 3, 10), (1, 4, 5), (1, 6, 3), (2, 3, 9), (2, 4, 7), (2, 5, 2), (3, 5, 4), (3, 6, 8), (4, 6, 1), (5, 6, 6)] weights.sort(key=lambda t: t[2]) mst = [] n = 7 p = [] for i in range(N): p.append(i) def find(u): if u != p[u]: p[u] = find(p[u]) return p[u] def union(...
# genes lo uso solo como parametro para determinar la longitud # de los arreglos que hacen de lista de genes, en caso de aumentar la cantidad de rectangulos # se debe aumentar el arrelgo, el orden es indistinto solo es necesario que tenga la longitud adecuada # ej: num de rectangulos = 3 [1,2,3] o [3,2,1] o [3,1,2]. ...
rectangles_number = 20 results_folder = 'results' tournament_size = 2 population_size = 50 max_generations = 500 mutation_probability = 0.1 cross_over_probability = 0.65 max_width = 100 instances = {'spp9a': 'spp9a.txt'}
def fibonacci(n): f0 = 0 f1 = 1 fib = [] f = f0 + f1 while f <= n: fib.append(f) f0, f1 = f1, f f= f0 + f1 return fib def solution(A): # write your code in Python 3.6 if not A: return 1 fib = fibonacci(len(A)+1) A.append(1) jumps = [-1] * ...
def fibonacci(n): f0 = 0 f1 = 1 fib = [] f = f0 + f1 while f <= n: fib.append(f) (f0, f1) = (f1, f) f = f0 + f1 return fib def solution(A): if not A: return 1 fib = fibonacci(len(A) + 1) A.append(1) jumps = [-1] * len(A) for f in fib: ...
stack = [int(x) for x in input().split()] stack.sort() print(stack[0] * stack[2])
stack = [int(x) for x in input().split()] stack.sort() print(stack[0] * stack[2])
weight=1 def run(): @_spawn def _(): rfliper(2) lfliper(2) @_spawn def _(): sleep(40) _goto('done', ref='main') with _while(1): col1 = levi.color() col2 = desni.color() @_do def _(): print( col1.val, col2.val ) sleep(0.1) _label('done') _print('warning zatvaranje flipera :)') sleep(10)...
weight = 1 def run(): @_spawn def _(): rfliper(2) lfliper(2) @_spawn def _(): sleep(40) _goto('done', ref='main') with _while(1): col1 = levi.color() col2 = desni.color() @_do def _(): print(col1.val, col2.val) sleep...
class YoloModel: def __init__(self): self.yolo_output_shapes = None self.tf_model = None self.anchors = [] self.yolo_out_preds = [] self.yolo_output_shapes = [] self.input_shape = None self.batch_size = None
class Yolomodel: def __init__(self): self.yolo_output_shapes = None self.tf_model = None self.anchors = [] self.yolo_out_preds = [] self.yolo_output_shapes = [] self.input_shape = None self.batch_size = None
def add(a, b): print(f'ADDING {a!r} {b!r}') return a + b def subtract(a, b): print(f'SUBSTRACTING {a!r} {b!r}') return a - b def multiply(a, b): print(f'multiplying {a!r} {b!r}') return a * b def divide(a, b): print(f'divide {a!r} {b!r}') return a / b print(f'Let\'s do some math'...
def add(a, b): print(f'ADDING {a!r} {b!r}') return a + b def subtract(a, b): print(f'SUBSTRACTING {a!r} {b!r}') return a - b def multiply(a, b): print(f'multiplying {a!r} {b!r}') return a * b def divide(a, b): print(f'divide {a!r} {b!r}') return a / b print(f"Let's do some math") age ...
model = dict( type='FastRCNN', backbone=dict( type='ResNet3dSlowFast', pretrained=None, resample_rate=4, speed_ratio=4, channel_ratio=8, slow_pathway=dict( type='resnet3d', depth=50, pretrained=None, lateral=True, ...
model = dict(type='FastRCNN', backbone=dict(type='ResNet3dSlowFast', pretrained=None, resample_rate=4, speed_ratio=4, channel_ratio=8, slow_pathway=dict(type='resnet3d', depth=50, pretrained=None, lateral=True, conv1_kernel=(1, 7, 7), dilations=(1, 1, 1, 1), conv1_stride_t=1, pool1_stride_t=1, inflate=(0, 0, 1, 1), spa...
{ 'targets': [ { 'target_name': 'strings', 'type': 'static_library', 'standalone_static_library': 1, 'includes': [ '../config/config.gypi' ], 'defines': [ 'DISABLE_MYSQL_THREAD_H', ], 'sources': [ 'bchange.c', 'bmove_upp.c', 'ctype-big5.c',...
{'targets': [{'target_name': 'strings', 'type': 'static_library', 'standalone_static_library': 1, 'includes': ['../config/config.gypi'], 'defines': ['DISABLE_MYSQL_THREAD_H'], 'sources': ['bchange.c', 'bmove_upp.c', 'ctype-big5.c', 'ctype-bin.c', 'ctype-cp932.c', 'ctype-czech.c', 'ctype-eucjpms.c', 'ctype-euc_kr.c', 'c...
# https://edabit.com/challenge/ecSZ5kDBwCD3ctjE6 # Create a function that takes a list of numbers and returns the smallest number in the list. def smallest_number(number_list: list) -> float: while len(number_list) != 1: if number_list[0] > number_list[1]: del number_list[0] elif n...
def smallest_number(number_list: list) -> float: while len(number_list) != 1: if number_list[0] > number_list[1]: del number_list[0] elif number_list[0] < number_list[1]: del number_list[1] elif number_list[0] == number_list[1]: del number_list[0] if l...
filename = 'test.txt' # filename = 'input.txt' rules={} puzzleInput = [] strings= [] with open(filename) as file: for line in file: halves = line.strip().split(':') if len(halves) == 2: rules[halves[0]] = halves[1].strip() elif line != "\n": strings.append(line.strip()) print(rules) print(str...
filename = 'test.txt' rules = {} puzzle_input = [] strings = [] with open(filename) as file: for line in file: halves = line.strip().split(':') if len(halves) == 2: rules[halves[0]] = halves[1].strip() elif line != '\n': strings.append(line.strip()) print(rules) print...
class FPSResponse(object): def __init__(self, connection=None): self.connection = connection def startElement(self, name, attrs, connection): return None def endElement(self, name, value, connection): if not name == "ResponseMetadata": setattr(self, name, value)
class Fpsresponse(object): def __init__(self, connection=None): self.connection = connection def start_element(self, name, attrs, connection): return None def end_element(self, name, value, connection): if not name == 'ResponseMetadata': setattr(self, name, value)
"""Define common errors in the library.""" UNEXPECTED_HTTP_ERROR = RuntimeError('API Request returned an unexpected HTTP status') UNDEFINED_STREAM_ID_ERROR = ValueError('Undefined stream id') INVALID_SUBSCRIPTION_ID_ERROR = ValueError('Invalid subscription id') UNDEFINED_SUBSCRIPTION_ERROR = ValueError('No subscription...
"""Define common errors in the library.""" unexpected_http_error = runtime_error('API Request returned an unexpected HTTP status') undefined_stream_id_error = value_error('Undefined stream id') invalid_subscription_id_error = value_error('Invalid subscription id') undefined_subscription_error = value_error('No subscrip...
async def application_201(scope, receive, send): assert scope['type'] == 'http' await send( { 'type': 'http.response.start', 'status': 201, 'headers': [(b'content-length', b'0')], } ) async def application_200(scope, receive, send): assert scope['ty...
async def application_201(scope, receive, send): assert scope['type'] == 'http' await send({'type': 'http.response.start', 'status': 201, 'headers': [(b'content-length', b'0')]}) async def application_200(scope, receive, send): assert scope['type'] == 'http' await send({'type': 'http.response.start', '...
{ "targets": [ { "target_name": "pgg", "sources": [ "src/pgg.cc", "src/pgg_obj.cc", "src/pgg_gpg.cc" ], "include_dirs": [ "src", "<!(node -e \"require('nan')\")" ], "link_settings": { "libraries": [ "-lgpgme", "-lgpg-error"...
{'targets': [{'target_name': 'pgg', 'sources': ['src/pgg.cc', 'src/pgg_obj.cc', 'src/pgg_gpg.cc'], 'include_dirs': ['src', '<!(node -e "require(\'nan\')")'], 'link_settings': {'libraries': ['-lgpgme', '-lgpg-error']}}]}
#### Solution class_dict = {0: "horse", 1: "zebra"} # Define a function here to replace "sigmoid" of the final dense layer with "linear" # as we want the class scores, not the class def prepare_image(img): img_expanded_dims = tf.expand_dims(img, axis=0) return img_expanded_dims def model_modifier(m): m...
class_dict = {0: 'horse', 1: 'zebra'} def prepare_image(img): img_expanded_dims = tf.expand_dims(img, axis=0) return img_expanded_dims def model_modifier(m): m.layers[-1].activation = tf.keras.activations.linear return m def saliency_graphs(model, img, n_classes=2, positive_gradients=False): """ ...
pc_param = dict() #Conductances for all the channels with the same order as in the template #SOMA pc_param['eleak'] = -63 pc_param['LeakSoma'] = 1.1E-3 pc_param['Cav3.1Soma'] = 7e-6 pc_param['Cav2.1Soma'] = 2.2e-4 pc_param['HCNSoma'] = 0.0004 pc_param['Nav1.6Soma'] = 0.214 pc_param['Kv3.4Soma'] = 0.05 pc_param['Kv1....
pc_param = dict() pc_param['eleak'] = -63 pc_param['LeakSoma'] = 0.0011 pc_param['Cav3.1Soma'] = 7e-06 pc_param['Cav2.1Soma'] = 0.00022 pc_param['HCNSoma'] = 0.0004 pc_param['Nav1.6Soma'] = 0.214 pc_param['Kv3.4Soma'] = 0.05 pc_param['Kv1.1Soma'] = 0.002 pc_param['Cav3.2Soma'] = 0.0008 pc_param['Kca3.1Soma'] = 0.01 pc_...
""" Created on Jan 31, 2011 @author: Jason """ class FlashCards(object): """ This is a state machine that takes a series of 2x2 matrices on initialization and a number of steps to display each matrix. After the pause (number of steps of dataGenerator calls), FlashCards will update the matrix argument w...
""" Created on Jan 31, 2011 @author: Jason """ class Flashcards(object): """ This is a state machine that takes a series of 2x2 matrices on initialization and a number of steps to display each matrix. After the pause (number of steps of dataGenerator calls), FlashCards will update the matrix argume...
class Stack: def __init__(self): self.items = [] def top(self): if self.is_empty(): return None else: return self.items[-1] def pop(self, i=0): val = self.items[-1-i] self.items.pop(-1-i) return val def popn(self, n): ...
class Stack: def __init__(self): self.items = [] def top(self): if self.is_empty(): return None else: return self.items[-1] def pop(self, i=0): val = self.items[-1 - i] self.items.pop(-1 - i) return val def popn(self, n): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- class NaptListenerEventArgs(object): def __init__(self, accepted, accepter): self.accepted = accepted self.accepter = accepter
class Naptlistenereventargs(object): def __init__(self, accepted, accepter): self.accepted = accepted self.accepter = accepter
""" # CREATE BINARY TREE FROM SORTED LIST Given the head of a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more tha...
""" # CREATE BINARY TREE FROM SORTED LIST Given the head of a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more tha...
a = [1,2,3] x, y, z = a print(x) print(y) print(z) print("------------------------------") a = ["Hello", "World"] print(" ".join(a)) print("------------------------------") list1 = ["a", "b", "c"] list2 = ["1", "2", "3"] for x,y in zip(list1, list2): print(x,y) print("------------------------------") a = 8 b ...
a = [1, 2, 3] (x, y, z) = a print(x) print(y) print(z) print('------------------------------') a = ['Hello', 'World'] print(' '.join(a)) print('------------------------------') list1 = ['a', 'b', 'c'] list2 = ['1', '2', '3'] for (x, y) in zip(list1, list2): print(x, y) print('------------------------------') a = 8 ...
sa = list(input()) sb = list(input()) sc = list(input()) next_turn = "a" ans = "" while True: if next_turn == "a": if len(sa) == 0: ans = "A" break next_turn = sa[0] del sa[0] elif next_turn == "b": if len(sb) == 0: ans = "B" break...
sa = list(input()) sb = list(input()) sc = list(input()) next_turn = 'a' ans = '' while True: if next_turn == 'a': if len(sa) == 0: ans = 'A' break next_turn = sa[0] del sa[0] elif next_turn == 'b': if len(sb) == 0: ans = 'B' break ...
# You are given an array of integers arr. Your task is to count the number of contiguous subarrays, such that each element of the subarray appears at least twice. # Example # For arr = [0, 0, 0], the output should be duplicatesOnSegment(arr) = 3. # There are 3 subarrays that satisfy the criteria of containing ...
def duplicates_on_segment(a): if not a or len(a) == 0: return 0 counter = 0 for s in range(len(a) - 1): for e in range(s + 1, len(a)): sub = a[s:e + 1] unique = 0 dict = {} for v in sub: if v in dict: dict[v]...
# flake8: noqa: E501 class DictionaryUpdateSequence: def title(self): return "Updating a dictionary with a set. " def description(self): return ( "Looks like you are trying to update a dictionary but are actually using a set. " "Double check what you are passing into t...
class Dictionaryupdatesequence: def title(self): return 'Updating a dictionary with a set. ' def description(self): return 'Looks like you are trying to update a dictionary but are actually using a set. Double check what you are passing into the update method' def regex(self): ret...
def calc_largest_rect_in_hist(heights): heights.append(0) stack = [] left = [0] * len(heights) ans = 0 for i, height in enumerate(heights): while stack and heights[stack[-1]] >= height: idx = stack.pop() ans = max(ans, (i - left[idx] - 1) * heights[idx]) left[...
def calc_largest_rect_in_hist(heights): heights.append(0) stack = [] left = [0] * len(heights) ans = 0 for (i, height) in enumerate(heights): while stack and heights[stack[-1]] >= height: idx = stack.pop() ans = max(ans, (i - left[idx] - 1) * heights[idx]) lef...
num = 370 if num > 100: print(num, 'is greater than', 100) elif num==0: print(num, 'is zero') print('done')
num = 370 if num > 100: print(num, 'is greater than', 100) elif num == 0: print(num, 'is zero') print('done')
"""Generate Excel from JSON input file Import the `Generator` to generate the Excel: >>> from excel_generator.generator import Generator >>> json_file = "results.json" >>> excel_file = "Results.xls" >>> generator = Generator(json_file=json_file, excel_file=excel_file) >>> generator.generate() See ht...
"""Generate Excel from JSON input file Import the `Generator` to generate the Excel: >>> from excel_generator.generator import Generator >>> json_file = "results.json" >>> excel_file = "Results.xls" >>> generator = Generator(json_file=json_file, excel_file=excel_file) >>> generator.generate() See ht...
numero = int(input("Digite el numero: ")) acumulado = 1 for i in range(1, numero+1, 1): acumulado *= i print(acumulado)
numero = int(input('Digite el numero: ')) acumulado = 1 for i in range(1, numero + 1, 1): acumulado *= i print(acumulado)
"""37. Sudoku Solver""" class Solution(object): def solveSudoku(self, board): """ :type board: List[List[str]] :rtype: None Do not return anything, modify board in-place instead. """ ############ super slow but it works char = ["1", "2", "3", "4", "5", "6", "7", "8"...
"""37. Sudoku Solver""" class Solution(object): def solve_sudoku(self, board): """ :type board: List[List[str]] :rtype: None Do not return anything, modify board in-place instead. """ char = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] self.backtrack(char, board, 0...
class Duck: def quack(self): print('Quack') def fly(self): print('Flap') class Human: def quack(self): print('Trying to Quack like a duck') def fly(self, a=1, b=2): print('Spreading my arm to flap like a duck') # c = a + b c = int.__add__(a,b) p...
class Duck: def quack(self): print('Quack') def fly(self): print('Flap') class Human: def quack(self): print('Trying to Quack like a duck') def fly(self, a=1, b=2): print('Spreading my arm to flap like a duck') c = int.__add__(a, b) print('Add-C:', c)...
''' logmon.config ------------- Flask configuration. ''' class Config(object): SITE_NAME = 'Logmon' SITE_DOMAIN = 'localhost' # indicates the file to watch LOG_FILE = '/var/log/nginx/access.log'
""" logmon.config ------------- Flask configuration. """ class Config(object): site_name = 'Logmon' site_domain = 'localhost' log_file = '/var/log/nginx/access.log'
Alunos = [] def GravaAlunos(): Alunos.append({"RA":"11111", "NOME":"LUCAS"}) Alunos.append({"RA":"2222", "NOME":"ALINE"}) Alunos.append({"RA":"333", "NOME":"PAULA"}) Alunos.append({"RA":"444", "NOME":"CAIO"}) Alunos.append({"RA":"555", "NOME":"FERNANDO"}) Alunos.append({"RA":"1166111", "NOME":"...
alunos = [] def grava_alunos(): Alunos.append({'RA': '11111', 'NOME': 'LUCAS'}) Alunos.append({'RA': '2222', 'NOME': 'ALINE'}) Alunos.append({'RA': '333', 'NOME': 'PAULA'}) Alunos.append({'RA': '444', 'NOME': 'CAIO'}) Alunos.append({'RA': '555', 'NOME': 'FERNANDO'}) Alunos.append({'RA': '116611...
def fizzbuzz(): for n in range(1, 101): if n % 15 == 0: yield "FizzBuzz" elif n % 3 == 0: yield "Fizz" elif n % 5 == 0: yield "Buzz" else: yield str(n) for s in fizzbuzz(): print(s)
def fizzbuzz(): for n in range(1, 101): if n % 15 == 0: yield 'FizzBuzz' elif n % 3 == 0: yield 'Fizz' elif n % 5 == 0: yield 'Buzz' else: yield str(n) for s in fizzbuzz(): print(s)
with open("input.txt") as f: lines = f.readlines() def is_valid(line: str): positions, letter, password = line.split(" ", 3) letter = letter[0] p1, p2 = [int(x)-1 for x in positions.split("-")] return (password[p1] == letter) ^ (password[p2] == letter) print(sum([is_valid(line) for line in lines...
with open('input.txt') as f: lines = f.readlines() def is_valid(line: str): (positions, letter, password) = line.split(' ', 3) letter = letter[0] (p1, p2) = [int(x) - 1 for x in positions.split('-')] return (password[p1] == letter) ^ (password[p2] == letter) print(sum([is_valid(line) for line in li...
a={'player1':'', 'player2':''} n='Y' while(n=='Y'): a['player1']=input('Play Player1 !') a['player2']=input('Play player 2!') if a['player1']==a['player2']: print('Nobody wins') elif a['player1']=='rock' and a['player2']=='scissors': print('Congrats player1') elif a['player1']=='rock' and a['player2']=='paper...
a = {'player1': '', 'player2': ''} n = 'Y' while n == 'Y': a['player1'] = input('Play Player1 !') a['player2'] = input('Play player 2!') if a['player1'] == a['player2']: print('Nobody wins') elif a['player1'] == 'rock' and a['player2'] == 'scissors': print('Congrats player1') elif a[...
print("I have information for the following planets:\n") print(" 1. Venus 2. Mars 3. Jupiter") print(" 4. Saturn 5. Uranus 6. Neptune\n") weight = 185 planet = 2 # Write an if statement below: if planet == 1: print('Your weight on Venus is: ' + str(weight * 0.91)) elif planet == 2: pri...
print('I have information for the following planets:\n') print(' 1. Venus 2. Mars 3. Jupiter') print(' 4. Saturn 5. Uranus 6. Neptune\n') weight = 185 planet = 2 if planet == 1: print('Your weight on Venus is: ' + str(weight * 0.91)) elif planet == 2: print('Your weight on Mars is: ' + str(weight * 0...
# Problem 2 # Even Fibonacci numbers # Each new term in the Fibonacci sequence is generated by adding the previous two terms. # By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, # fin...
(count, x, y) = (0, 1, 2) while x <= 4000000: (x, y) = (y, x + y) if not x % 2: count += x print(count)
def biggerIsGreater(w): arr = list(w) l = "" # Find non-increasing suffix i = len(arr) - 1 while i > 0 and arr[i - 1] >= arr[i]: i -= 1 if i <= 0: return "no answer" # Find successor to pivot j = len(arr) - 1 while arr[j] <= arr[i - 1]: j -= 1 arr[i - 1],...
def bigger_is_greater(w): arr = list(w) l = '' i = len(arr) - 1 while i > 0 and arr[i - 1] >= arr[i]: i -= 1 if i <= 0: return 'no answer' j = len(arr) - 1 while arr[j] <= arr[i - 1]: j -= 1 (arr[i - 1], arr[j]) = (arr[j], arr[i - 1]) arr[i:] = arr[len(arr) - ...
class ValidateStateOptions: ''' Validates state options data and checks for any problems or inconsistencies. ''' def __init__(self, state_options_data) -> None: self.state_options_data = state_options_data def validate_state_data(self, state_abbreviation, state_data): ''' R...
class Validatestateoptions: """ Validates state options data and checks for any problems or inconsistencies. """ def __init__(self, state_options_data) -> None: self.state_options_data = state_options_data def validate_state_data(self, state_abbreviation, state_data): """ R...
"""Merge sort Algorithm in python""" def merge(a: list, b: list, arr: list): """merge two sorted lists in place Args: a (list): first sorted list b (list): second sorted list arr (list): orignal list to store sorted elements """ len_a = len(a) len_b = len(b) i = j = k...
"""Merge sort Algorithm in python""" def merge(a: list, b: list, arr: list): """merge two sorted lists in place Args: a (list): first sorted list b (list): second sorted list arr (list): orignal list to store sorted elements """ len_a = len(a) len_b = len(b) i = j = k ...
set_name(0x8014B488, "EA_cd_seek", SN_NOWARN) set_name(0x8014B490, "MY_CdGetSector", SN_NOWARN) set_name(0x8014B4C4, "init_cdstream", SN_NOWARN) set_name(0x8014B4D4, "flush_cdstream", SN_NOWARN) set_name(0x8014B4F8, "check_complete_frame", SN_NOWARN) set_name(0x8014B578, "reset_cdstream", SN_NOWARN) set_name(0x8014B5A0...
set_name(2148840584, 'EA_cd_seek', SN_NOWARN) set_name(2148840592, 'MY_CdGetSector', SN_NOWARN) set_name(2148840644, 'init_cdstream', SN_NOWARN) set_name(2148840660, 'flush_cdstream', SN_NOWARN) set_name(2148840696, 'check_complete_frame', SN_NOWARN) set_name(2148840824, 'reset_cdstream', SN_NOWARN) set_name(2148840864...
#a variable is container for storing data values # name = "Ben" first_name = "Ben" print(first_name ) # LAST_NAME = "CARSON" """ fuluig;iigiugoiuhi;uugiugigujiuggiuiufguuguiiguuggigiugii """ ''' yfljgih;ihliii ''' #there are two (mainly) things you cant start variable with in python # $name = "carson" # stri...
first_name = 'Ben' print(first_name) ' \nfuluig;iigiugoiuhi;uugiugigujiuggiuiufguuguiiguuggigiugii\n\n' ' \nyfljgih;ihliii\n' number = 4 * 5 print(number) print(type(number)) full_name = ' ben carson stone ' number_converted_into_string = str(number) print(type(number_converted_into_string)) print(number_converted_in...
a,b,c=map(int,input().split()) print((a+b)%c) print((a%c+b%c)%c) print((a*b)%c) print((a%c*b%c)%c)
(a, b, c) = map(int, input().split()) print((a + b) % c) print((a % c + b % c) % c) print(a * b % c) print(a % c * b % c % c)
n = int(input()) quantityRabbits: int = 0 quantityMouses: int = 0 quantityFrogs: int = 0 for i in range(0, n, 1): quantity = int(input()) type = input() if type == 'C' or type == 'c': quantityRabbits += quantity elif type == 'R' or type == 'r': quantityMouses += quantity elif type ...
n = int(input()) quantity_rabbits: int = 0 quantity_mouses: int = 0 quantity_frogs: int = 0 for i in range(0, n, 1): quantity = int(input()) type = input() if type == 'C' or type == 'c': quantity_rabbits += quantity elif type == 'R' or type == 'r': quantity_mouses += quantity elif ty...
#from http://rosettacode.org/wiki/Remove_duplicate_elements#Python #pythran export unique(int list) #runas unique([1, 2, 3, 2, 3, 4]) def unique(items): return list(set(items))
def unique(items): return list(set(items))
''' Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. For example, [2,3,4], the median is 3 [2,3], the median is (2 + 3) / 2 = 2.5 Design a data structure that supports the following two operations: ...
""" Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. For example, [2,3,4], the median is 3 [2,3], the median is (2 + 3) / 2 = 2.5 Design a data structure that supports the following two operations: ...
""" .. module:: predict_model.py :synopsis: """
""" .. module:: predict_model.py :synopsis: """
# Challenge 5 : Write a function named combine_sort that has two parameters named lst1 and lst2. # The function should combine these two lists into one new list and sort the result. # Return the new sorted list. # Date : Fri 05 Jun 2020 05:56:34 AM IST def combine_sort(lst1, lst2): ...
def combine_sort(lst1, lst2): new_list = lst1 new_list += lst2 newList.sort() return newList print(combine_sort([4, 10, 2, 5], [-10, 2, 5, 10]))
class GraphicsInfo: """The GraphicsInfo object stores information about the graphics adapter installed in your system. The GraphicsInfo object has no constructor or methods; Abaqus creates the *GraphicsInfo* member when a session is started. If you execute Abaqus/CAE on a remote system and display t...
class Graphicsinfo: """The GraphicsInfo object stores information about the graphics adapter installed in your system. The GraphicsInfo object has no constructor or methods; Abaqus creates the *GraphicsInfo* member when a session is started. If you execute Abaqus/CAE on a remote system and display the...
# # PySNMP MIB module SW-VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SW-VLAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:05:03 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, 0...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) ...
__author__ = 'gkour' class AbstractBrain: def __init__(self, reward_discount): self.reward_discount = reward_discount def think(self, obs, agent): '''Given an observation should return a distribution over the action set''' raise NotImplementedError() def consolidate(self, memory...
__author__ = 'gkour' class Abstractbrain: def __init__(self, reward_discount): self.reward_discount = reward_discount def think(self, obs, agent): """Given an observation should return a distribution over the action set""" raise not_implemented_error() def consolidate(self, memor...
class CommandError(Exception): def __init__(self, msg: str = "") -> None: super(CommandError, self).__init__() self.msg = msg def __str__(self) -> str: return self.msg class CommandArgumentError(CommandError): pass class CommandNotFoundError(CommandError): pass class Comm...
class Commanderror(Exception): def __init__(self, msg: str='') -> None: super(CommandError, self).__init__() self.msg = msg def __str__(self) -> str: return self.msg class Commandargumenterror(CommandError): pass class Commandnotfounderror(CommandError): pass class Commandde...
# print(1) # print(2) # print(3) # print(4) # print(5) # contador = 1 # print(contador) # while contador < 1000: # contador += 1 # print(contador) # for contador in range (1,10001): # print(contador) for i in range(10): print(11 * i)
for i in range(10): print(11 * i)
S0 = 10; a=-0.1; b=0.2; r=0.1; N=5; p=(b-r)/(b-a); k = 15; Ct = 0; def call(n,S,a,b,r,N,k): if n==N: return max(0,S-k) else: return (1/(1+r))*( p*call((n+1),(S*(1+a)),a,b,r,N,k) + (1-p)*call((n+1),(S*(1+b)),a,b,r,N,k) ) call(0,S0,a,b,r,N,k)
s0 = 10 a = -0.1 b = 0.2 r = 0.1 n = 5 p = (b - r) / (b - a) k = 15 ct = 0 def call(n, S, a, b, r, N, k): if n == N: return max(0, S - k) else: return 1 / (1 + r) * (p * call(n + 1, S * (1 + a), a, b, r, N, k) + (1 - p) * call(n + 1, S * (1 + b), a, b, r, N, k)) call(0, S0, a, b, r, N, k)
# Step 1: Rename the `hour` attribute in `Talk` to `start_hour`. Run Pyre and # fix all the errors that it shows. # (Note that if there is more than one error of the same kind in a function, # Pyre only shows the first one.) # NOTE: Go to the PyCon class for step 2. class Talk: """ >>> str(Talk("Python Typing Tut...
class Talk: """ >>> str(Talk("Python Typing Tutorial", 13)) '1 PM - Python Typing Tutorial' """ def __init__(self, title: str, hour: int) -> None: self.title = title self.hour = hour def __str__(self) -> str: am_pm_string = 'AM' if self.hour < 12 else 'PM' return f'{s...
class Solution: def maxProfit(self, prices): # action = 1 for buy, 0 for sell, enum would be better. profit, action, price = 0, 1, 0 for i in range(1, len(prices)): first, second = prices[i-1], prices[i] # buying case if action == 1: if fir...
class Solution: def max_profit(self, prices): (profit, action, price) = (0, 1, 0) for i in range(1, len(prices)): (first, second) = (prices[i - 1], prices[i]) if action == 1: if first < second: price = first action = 0 ...
x,y=map(int,input().split()) if x==0 and y==0: print(0) elif y<x and y<=1-x: print(-4*y) elif y>1-x and y<=x: print(4*(x-1)+1) elif y>x and y>=-x: print(4*(y-1)+2) else: print(4*(-x-1)+3)
(x, y) = map(int, input().split()) if x == 0 and y == 0: print(0) elif y < x and y <= 1 - x: print(-4 * y) elif y > 1 - x and y <= x: print(4 * (x - 1) + 1) elif y > x and y >= -x: print(4 * (y - 1) + 2) else: print(4 * (-x - 1) + 3)
"""import os import uuid from ..tools import row2dict, xls_reader from datetime import datetime from sqlalchemy import not_, func from pyramid.view import ( view_config, ) from pyramid.httpexceptions import ( HTTPFound, ) import colander from deform import ( Form, widget, ValidationFailure, ...
"""import os import uuid from ..tools import row2dict, xls_reader from datetime import datetime from sqlalchemy import not_, func from pyramid.view import ( view_config, ) from pyramid.httpexceptions import ( HTTPFound, ) import colander from deform import ( Form, widget, ValidationFailure, ...
def masking_string(a=None, b=None): return_value = None if a is None or b is None: return return_value if not isinstance(a, str) or not isinstance(b, str): return return_value if len(a) != len(b): return return_value masked_string = [] for i, j in zip(a, b): if i...
def masking_string(a=None, b=None): return_value = None if a is None or b is None: return return_value if not isinstance(a, str) or not isinstance(b, str): return return_value if len(a) != len(b): return return_value masked_string = [] for (i, j) in zip(a, b): if ...
sum = 0 T = int(input('')) A, B, C, D, E = map(int, input().split()) Numbers = [A, B, C, D, E] for i in Numbers: if i == T: sum += 1 print(sum)
sum = 0 t = int(input('')) (a, b, c, d, e) = map(int, input().split()) numbers = [A, B, C, D, E] for i in Numbers: if i == T: sum += 1 print(sum)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 22 00:30:08 2018 @author: misskeisha """ moves = [] def towers(orig, dest, aux, n): if n == 1: moves.append((orig,dest)) else: towers(orig, aux, dest, n-1) towers(orig, dest, aux,1) towers(aux, dest, orig, n-1...
""" Created on Mon Oct 22 00:30:08 2018 @author: misskeisha """ moves = [] def towers(orig, dest, aux, n): if n == 1: moves.append((orig, dest)) else: towers(orig, aux, dest, n - 1) towers(orig, dest, aux, 1) towers(aux, dest, orig, n - 1) towers('A', 'B', 'C', 3) print(moves)
# -*- coding: utf-8 -*- """ Created on Tue Jun 2 08:13:19 2020 @author: Shivadhar SIngh """ #def reverse_string(input_string): # s = "" # for e in input_string: # s = e + s # print(s) #x = [2,3,7,11,33,4,0.5] #def find_max(x, y): # c = [] # for i in x: # for j in y: # c.appen...
""" Created on Tue Jun 2 08:13:19 2020 @author: Shivadhar SIngh """ def fun_y(x): i = 0 while i < len(x): i = i + x[i] % len(x) return i print(fun_y((2, 2, 3)))
N, X, Y = [int(_) for _ in input().split()] for k in range(1, N): cnt = 0 ss = "" for s in range(1, N - 1): g = s + k print("s = %d, g = %d" % (s, g)) if (s <= X and Y <= g): ss += "!" pass elif (s <= X and g < Y): cnt += 1 elif (X < s): cnt += 1 else: cnt +=...
(n, x, y) = [int(_) for _ in input().split()] for k in range(1, N): cnt = 0 ss = '' for s in range(1, N - 1): g = s + k print('s = %d, g = %d' % (s, g)) if s <= X and Y <= g: ss += '!' pass elif s <= X and g < Y: cnt += 1 elif X < s...
algorithm='hc' env_class='Gym' model_class='SingleLayerPerceptron' environment = { 'name': 'MountainCar-v0', 'max_steps': 1000 } model = { 'state_size': 2, 'action_size': 3 } agent = { 'action_size': 3, 'policy': 'stochastic' } train = { 'n_episodes': 4000, 'max_t': 1000, 'solve_...
algorithm = 'hc' env_class = 'Gym' model_class = 'SingleLayerPerceptron' environment = {'name': 'MountainCar-v0', 'max_steps': 1000} model = {'state_size': 2, 'action_size': 3} agent = {'action_size': 3, 'policy': 'stochastic'} train = {'n_episodes': 4000, 'max_t': 1000, 'solve_score': -110.0, 'npop': 4}
class ListNode(object): def __init__(self, number_of_nodes=2): self._links = [None for x in range(number_of_nodes)] @property def next(self): return self._links[0] @property def prev(self): return self._links[1] @next.setter def next(self, nextNode ): ...
class Listnode(object): def __init__(self, number_of_nodes=2): self._links = [None for x in range(number_of_nodes)] @property def next(self): return self._links[0] @property def prev(self): return self._links[1] @next.setter def next(self, nextNode): if ne...
stuff={'rope':1,'torch':6,'gold coin':42,'dagger':1,'arrow':12} #print key from the dictonary for k in stuff.keys(): print(k) #Print value from the dictonary for v in stuff.values(): print(v) # print items from the dictonary for i in stuff.items(): print(i) #seperate value and key for k, v in stuff.ite...
stuff = {'rope': 1, 'torch': 6, 'gold coin': 42, 'dagger': 1, 'arrow': 12} for k in stuff.keys(): print(k) for v in stuff.values(): print(v) for i in stuff.items(): print(i) for (k, v) in stuff.items(): print('Key: ' + k + ' value:' + str(v))
#!usr/bin/env python3 # -*- coding: utf-8 -*- """ Builder module. """ __author__ = 'Ziang Lu' class Phone: """ My own modular phone class. This class is complex, and thus can be instantiated using Builder Pattern. """ __slots__ = ['_os', '_processor', '_ram', '_screen_size', '_battery'] def...
""" Builder module. """ __author__ = 'Ziang Lu' class Phone: """ My own modular phone class. This class is complex, and thus can be instantiated using Builder Pattern. """ __slots__ = ['_os', '_processor', '_ram', '_screen_size', '_battery'] def __init__(self, builder): """ Con...
__all__ = [ 'q2_camelcase', 'q3_strong_password', 'q6_mars_exploration', 'q7_hackerrank_in_a_string', 'q11_funny_string', 'q18_anagram', 'q21_two_strings' ]
__all__ = ['q2_camelcase', 'q3_strong_password', 'q6_mars_exploration', 'q7_hackerrank_in_a_string', 'q11_funny_string', 'q18_anagram', 'q21_two_strings']
basic=" Hello World " #print(basic.upper()) #print(basic.lower()) #print(basic.split()) #print(basic.split('l')) print(basic.isalpha()) print(basic.strip()) print(basic.find('h')) print(basic.index('h'))
basic = ' Hello World ' print(basic.isalpha()) print(basic.strip()) print(basic.find('h')) print(basic.index('h'))
# Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
{'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'grinder_lib', 'type': 'static_library', 'sources': ['basic_block_util.cc', 'basic_block_util.h', 'cache_grind_writer.cc', 'cache_grind_writer.h', 'coverage_data.cc', 'coverage_data.h', 'find.cc', 'find.h', 'grinder_app.cc', 'grinder_app.h', 'grinder_util....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 16 17:15:32 2019 @author: kyle """ class State: """ Stores attributes of the initial ion state, before recombination/ionization. """ nuclear_charge = 2 configuration = "" ionized = True def __init__(self, spe...
""" Created on Wed Oct 16 17:15:32 2019 @author: kyle """ class State: """ Stores attributes of the initial ion state, before recombination/ionization. """ nuclear_charge = 2 configuration = '' ionized = True def __init__(self, species='c', isoelec_seq='li', shell='2-2'): sel...
class GatewayError(Exception): """ Base class for all gateway errors. """ def __init__(self, message: str) -> None: self.message: str = message """The message of the error.""" super().__init__(message)
class Gatewayerror(Exception): """ Base class for all gateway errors. """ def __init__(self, message: str) -> None: self.message: str = message 'The message of the error.' super().__init__(message)
# Test file for BA experiments # Uses PI control and Distribution Ramps, TLB 0 # Perturbances mirror.sysPerturbances = [ 'load 9 : step P 5 75 rel', ] # Power Plants mirror.sysPowerPlants ={'pp1': ["gen 2 1: 0.75 : rampA", "gen 2 2 : 0.25: rampA"], 'pp2': ["gen 3 : 0.75: rampA", "gen 4...
mirror.sysPerturbances = ['load 9 : step P 5 75 rel'] mirror.sysPowerPlants = {'pp1': ['gen 2 1: 0.75 : rampA', 'gen 2 2 : 0.25: rampA'], 'pp2': ['gen 3 : 0.75: rampA', 'gen 4 : 0.25: rampA']} mirror.sysBA = {'BA1': {'Area': 1, 'B': ' 1.0 : p', 'ActionTime': 5.0, 'Type': 'TLB : 0', 'Filtering': 'PI : 0.1 0.0001', 'Dead...
def args(): pass def kwargs(): pass def not_a_test_function(*args, **kwargs): # invalid test case... assert True
def args(): pass def kwargs(): pass def not_a_test_function(*args, **kwargs): assert True
n = int(input()) hearthstone = 0 fornite = 0 overwatch = 0 others = 0 for games in range(1, n + 1): game = input() if game == "Hearthstone": hearthstone += 1 elif game == "Fornite": fornite += 1 elif game == "Overwatch": overwatch += 1 else: others += 1 print(f"He...
n = int(input()) hearthstone = 0 fornite = 0 overwatch = 0 others = 0 for games in range(1, n + 1): game = input() if game == 'Hearthstone': hearthstone += 1 elif game == 'Fornite': fornite += 1 elif game == 'Overwatch': overwatch += 1 else: others += 1 print(f'Hearth...
class ClassLib: def keyword_in_mylibdir_subpackage_classlib(self): pass
class Classlib: def keyword_in_mylibdir_subpackage_classlib(self): pass
class Solution: def mostCompetitive(self, nums: List[int], k: int) -> List[int]: dequeue, extraSlots, result = deque([]), len(nums) - k, [0] * k for num in nums: while len(dequeue) > 0 and dequeue[-1] > num and extraSlots > 0: dequeue.pop() extraSlots -= 1...
class Solution: def most_competitive(self, nums: List[int], k: int) -> List[int]: (dequeue, extra_slots, result) = (deque([]), len(nums) - k, [0] * k) for num in nums: while len(dequeue) > 0 and dequeue[-1] > num and (extraSlots > 0): dequeue.pop() extra_...
# Slow tft class MyPlayer: def __init__(self, payoff_matrix, number_of_iterations): self.payoff_matrix = payoff_matrix self.number_of_iterations = number_of_iterations self.arr = [False, False] self.iteration = 0 self.mov = False return def move(self): ...
class Myplayer: def __init__(self, payoff_matrix, number_of_iterations): self.payoff_matrix = payoff_matrix self.number_of_iterations = number_of_iterations self.arr = [False, False] self.iteration = 0 self.mov = False return def move(self): if self.arr....
# ------------------------------- # Linked Lists # ------------------------------- class Node(): '''A self-referentail node object for use in a singly linked list. Stores data + a pointer to next node. ''' data = None next_node = None # previous_node = None def __init__(self, data): self.data = d...
class Node: """A self-referentail node object for use in a singly linked list. Stores data + a pointer to next node. """ data = None next_node = None def __init__(self, data): self.data = data def __repr__(self): return '<Node data: %s>' % self.data class Linkedlist: ""...
MAJOR_VERSION = 4 MINOR_VERSION = 1 PATCH_VERSION = "0.dev0" __version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}"
major_version = 4 minor_version = 1 patch_version = '0.dev0' __version__ = f'{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}'
wiktionary_fp = 'outputs/WiktionaryOutput_old.csv' def create_data_dict(word, lang, src_lang, src_word='', src_rom='', pos='', relation='', citation=''): return word, lang, src_lang, src_word, src_rom, pos, relation, citation data = [] count = 0 with open(wiktionary_fp, 'r', encoding='utf-8') as f:...
wiktionary_fp = 'outputs/WiktionaryOutput_old.csv' def create_data_dict(word, lang, src_lang, src_word='', src_rom='', pos='', relation='', citation=''): return (word, lang, src_lang, src_word, src_rom, pos, relation, citation) data = [] count = 0 with open(wiktionary_fp, 'r', encoding='utf-8') as f: for line ...
# -*- coding: utf-8 -*- # # Tencent is pleased to support the open source community by making QT4C available. # Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. # QT4C is licensed under the BSD 3-Clause License, except for the third-party components listed below. # A copy of the BSD ...
"""QT4C(Client Driver for QTA) """
width = 7 for x in range(1, width+1): for y in range(1, x+1): print('T', end='') print()
width = 7 for x in range(1, width + 1): for y in range(1, x + 1): print('T', end='') print()
input = {} with open('inputs/day13.input','r') as f: for line in f: line = line.strip().split(": ") input[int(line[0])] = int(line[1]) size = 99 severity = 0 firewall = [] for x in range(size): firewall.append([]) if(x not in input): input[x] = 0 firewall[x].append(0) fo...
input = {} with open('inputs/day13.input', 'r') as f: for line in f: line = line.strip().split(': ') input[int(line[0])] = int(line[1]) size = 99 severity = 0 firewall = [] for x in range(size): firewall.append([]) if x not in input: input[x] = 0 firewall[x].append(0) for...
def ficha(jog='<Desconhecido>', gol=0): print(f'Jogador {jog} fez {gol} gols no campeonato.') # Programa Principal n = str(input('Nome: ')) g = str(input('Gols: ')) if g.isnumeric(): g = int(g) else: g = 0 if n.strip() == '': ficha(gol=g) else: ficha(n, g)
def ficha(jog='<Desconhecido>', gol=0): print(f'Jogador {jog} fez {gol} gols no campeonato.') n = str(input('Nome: ')) g = str(input('Gols: ')) if g.isnumeric(): g = int(g) else: g = 0 if n.strip() == '': ficha(gol=g) else: ficha(n, g)
for i in range(1, 35000): counter = 0 for j in range(1, int(i ** (1 / 3)) + 2): for k in range(1, int(i ** (1 / 3)) + 2): if j ** 3 + k ** 3 == i: counter += 1 if counter > 2: print(i) counter = 0
for i in range(1, 35000): counter = 0 for j in range(1, int(i ** (1 / 3)) + 2): for k in range(1, int(i ** (1 / 3)) + 2): if j ** 3 + k ** 3 == i: counter += 1 if counter > 2: print(i) counter = 0
""" CAR CONFIG This file is read by your car application's manage.py script to change the car performance. EXAMPLE ----------- import dk cfg = dk.load_config(config_path='~/mycar/config.py') print(cfg.CAMERA_RESOLUTION) """ #VEHICLE DRIVE_LOOP_HZ = 20 MAX_LOOPS = 100000 #CAMERA CAMERA_RESOLUTION = (120, 160) #(hei...
""" CAR CONFIG This file is read by your car application's manage.py script to change the car performance. EXAMPLE ----------- import dk cfg = dk.load_config(config_path='~/mycar/config.py') print(cfg.CAMERA_RESOLUTION) """ drive_loop_hz = 20 max_loops = 100000 camera_resolution = (120, 160) camera_framerate = DRIVE...
# Learnlets module init # from . import learned_wavelet # from . import learnlet_layers # from . import learnlet_model # from . import wav_utils # from . import keras_utils __all__ = [] # List of submodules __all__ += ['learned_wavelet'] __all__ += ['learnlet_layers'] __all__ += ['learnlet_model'] __all__ += ['wav_ut...
__all__ = [] __all__ += ['learned_wavelet'] __all__ += ['learnlet_layers'] __all__ += ['learnlet_model'] __all__ += ['wav_utils'] __all__ += ['keras_utils']
# saving year as astronomical year # calculated as 365.25*24*60*60 SECONDS_PER_ASTRONOMICAL_YEAR = 31557600 SECONDS_PER_DAY = 60*60*24
seconds_per_astronomical_year = 31557600 seconds_per_day = 60 * 60 * 24
def earn(buy, sell): return ((sell-buy)/buy)*100 if __name__ == '__main__': print(earn(1556,1583))
def earn(buy, sell): return (sell - buy) / buy * 100 if __name__ == '__main__': print(earn(1556, 1583))
# Time: O(1) # Space: O(1) class Solution(object): def complexNumberMultiply(self, a, b): """ :type a: str :type b: str :rtype: str """ ra, ia = map(int, a[:-1].split('+')) rb, ib = map(int, b[:-1].split('+')) return '%d+%di' % (ra * rb - ia * ib, ra...
class Solution(object): def complex_number_multiply(self, a, b): """ :type a: str :type b: str :rtype: str """ (ra, ia) = map(int, a[:-1].split('+')) (rb, ib) = map(int, b[:-1].split('+')) return '%d+%di' % (ra * rb - ia * ib, ra * ib + ia * rb)
class qrelRecord: def __init__(self, topicId, subtopicId, docId, relevance): self._topicId = topicId self._subtopicId = subtopicId self._docId = docId self._relevance = relevance def to_string(self): return "{} {} {} {}".format(self._topicId, self._subtopicId, self._doc...
class Qrelrecord: def __init__(self, topicId, subtopicId, docId, relevance): self._topicId = topicId self._subtopicId = subtopicId self._docId = docId self._relevance = relevance def to_string(self): return '{} {} {} {}'.format(self._topicId, self._subtopicId, self._doc...
""" Product Write a function that takes a list of numbers as input and returns the product of all the numbers in the list. Use it to print the products of the following sets of numbers: -1, 5, 3, 2, 8 2.5, 3, 0 4, 3, 7, 10 """ # Insert your code here.
""" Product Write a function that takes a list of numbers as input and returns the product of all the numbers in the list. Use it to print the products of the following sets of numbers: -1, 5, 3, 2, 8 2.5, 3, 0 4, 3, 7, 10 """
# Given a list which contains K linked lists to merge them into one sorted linked list the simplest idea seems to be to transfer all the elements in the list of linked lists into a single linked list # The transfer all the elements of the single linked list into a simple array, sort the array, then make a new linked l...
class Solution(object): def merge_k_lists(lists): head = list2 = list_node(0) for i in lists: current = i while current: list2.next = current current = current.next list2 = list2.next curr = head.next sorted_arr...
"""Provide some tag/watermarking choices for plots.""" def ild_preliminary(ax): """ILD preliminary watermark.""" ax.text( 0.99, 0.99, "ILD preliminary", horizontalalignment="right", verticalalignment="top", transform=ax.transAxes, color="gray", w...
"""Provide some tag/watermarking choices for plots.""" def ild_preliminary(ax): """ILD preliminary watermark.""" ax.text(0.99, 0.99, 'ILD preliminary', horizontalalignment='right', verticalalignment='top', transform=ax.transAxes, color='gray', weight='bold', alpha=0.6, fontsize=16) provided_experiment_tags = {...