content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def rob(self, A: List[int]) -> int: if not A: return 0 n = len(A) dp = [0]*n for i in range(n): dp[i] = max( dp[i-1] if i-1>=0 else 0, (dp[i-2] if i-2>=0 else 0) + A[i] ) return dp[n-1]
class Solution: def rob(self, A: List[int]) -> int: if not A: return 0 n = len(A) dp = [0] * n for i in range(n): dp[i] = max(dp[i - 1] if i - 1 >= 0 else 0, (dp[i - 2] if i - 2 >= 0 else 0) + A[i]) return dp[n - 1]
n = int(input()) list_of_ints = [] for i in range(n): list_of_ints.append(int(input())) print(min(list_of_ints))
n = int(input()) list_of_ints = [] for i in range(n): list_of_ints.append(int(input())) print(min(list_of_ints))
def run_is_valid(serializer_class, data): instance = serializer_class(data=data) instance.is_valid() return instance
def run_is_valid(serializer_class, data): instance = serializer_class(data=data) instance.is_valid() return instance
# s = 'Monty Python' # print(s[0:4]) # print(s[6:7]) # print(s[6:20]) # print(s[:]) # a = 'hello' # b = a + ' There' # print(b) # String Comparison # word = 'banana' # if word == 'banana': # print('All right, bananas') # if word < 'banana': # print('Your word,' + word + ', comes before banana') # elif word > 'b...
word = 'banana' print(word.count('a')) camels = 42 print('In %d years, I have spotted %g %s.' % (3, 0.1, 'camels'))
def return_one(): return 1 def return_two(): return 2
def return_one(): return 1 def return_two(): return 2
plt.close('all') fig = plt.figure(figsize=(4, 4)) im = plt.imshow(arr, interpolation="none") plt.colorbar(im, use_gridspec=True) plt.tight_layout()
plt.close('all') fig = plt.figure(figsize=(4, 4)) im = plt.imshow(arr, interpolation='none') plt.colorbar(im, use_gridspec=True) plt.tight_layout()
description = 'FRM II neutron guide line 4b shutter' group = 'lowlevel' includes = ['guidehall'] devices = dict( NL1 = device('nicos.devices.generic.ManualSwitch', description = 'NL1 shutter status', states = ('open', 'closed'), pollinterval = 60, maxage = 120, ), )
description = 'FRM II neutron guide line 4b shutter' group = 'lowlevel' includes = ['guidehall'] devices = dict(NL1=device('nicos.devices.generic.ManualSwitch', description='NL1 shutter status', states=('open', 'closed'), pollinterval=60, maxage=120))
# # PySNMP MIB module XSWITCH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XSWITCH-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:58:51 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...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
CHARACTERS = { 0 : ("akari", ["akari"]), 1 : ("kyoko", ["kyoko"]), 2 : ("tinatsu", ["tinatsu"]), 3 : ("yui", ["yui"]), 4 : ("titose", ["titose"]), 5 : ("ayano", ["ayano"]), 6 : ("sakurako", ["sakurako"]), 7 : ("himawari", ["himawari"]), 8 : ("tomok...
characters = {0: ('akari', ['akari']), 1: ('kyoko', ['kyoko']), 2: ('tinatsu', ['tinatsu']), 3: ('yui', ['yui']), 4: ('titose', ['titose']), 5: ('ayano', ['ayano']), 6: ('sakurako', ['sakurako']), 7: ('himawari', ['himawari']), 8: ('tomoko', ['tomoko']), 9: ('rise', ['rise']), 10: ('mari', ['mari']), 11: ('hanako', ['h...
# Write a code to generate a aplhabet half pyramid pattern. # Sample Input : # 5 # Sample Output : # EEEEE # DDDD # CCC # BB # A N = int(input('')) for row in range(0, N): for column in range(0, N): if(column < row): print(' ', end='') else: print(chr(65+N-row-1), e...
n = int(input('')) for row in range(0, N): for column in range(0, N): if column < row: print(' ', end='') else: print(chr(65 + N - row - 1), end='') print('')
# Darren Keenan 2018-02-10 # Exercise 3 - Collatz n = 17 while n != 1: if n % 2 == 0: n = n // 2 print(n) elif n % 2 == 1: n = n * 3 + 1 print(n)
n = 17 while n != 1: if n % 2 == 0: n = n // 2 print(n) elif n % 2 == 1: n = n * 3 + 1 print(n)
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def wave(): http_archive( name = "wave", build_file = "//...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_file') def wave(): http_archive(name='wave', build_file='//bazel/deps/wave:build.BUILD', sha256='ac7be574beaef4e08a1c050f46ebcc7c185722d6d8d0d75bfeaf952221500afb', strip_prefix='wave-a782...
l=[1,2,3,4,5]; i=2; j=3; k=4; l[4]=i*j-k;
l = [1, 2, 3, 4, 5] i = 2 j = 3 k = 4 l[4] = i * j - k
order = 2 pair = (('<START>',), 'a') context, token = (('<START>',), 'a') same = True for ind in range(order-1): if context[ind] != pair[0][ind]: same *= False same*= pair[1]==token print(same) if same: print("wtf")
order = 2 pair = (('<START>',), 'a') (context, token) = (('<START>',), 'a') same = True for ind in range(order - 1): if context[ind] != pair[0][ind]: same *= False same *= pair[1] == token print(same) if same: print('wtf')
a={'1':2,'2':5,'3':5,'4':4,'5':5,'6':6,'7':3,'8':7,'9':6,'0':6} for _ in range(int(input())): led=0 x=input() for i in range(len(x)): led+=(a.get(x[i])) print(f"{led} leds")
a = {'1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6, '0': 6} for _ in range(int(input())): led = 0 x = input() for i in range(len(x)): led += a.get(x[i]) print(f'{led} leds')
# https://www.hackerrank.com/challenges/balanced-brackets def is_balanced(s): pair_of = {')':'(', ']':'[', '}':'{'} stack = [s[0]] for ch in s[1:]: if ch in ['(', '[', '{']: stack.append(ch) elif len(stack) == 0 or stack.pop() != pair_of[ch]: return 'NO' return ...
def is_balanced(s): pair_of = {')': '(', ']': '[', '}': '{'} stack = [s[0]] for ch in s[1:]: if ch in ['(', '[', '{']: stack.append(ch) elif len(stack) == 0 or stack.pop() != pair_of[ch]: return 'NO' return 'YES' if len(stack) == 0 else 'NO' t = int(input().strip(...
# Find the greatest common denominator of two numbers # using Eculid's algorithms def get_gcd(a, b): while b != 0: temp = a a = b b = temp % b return a if __name__ == "__main__": print("Greatest Common Denominator: ", get_gcd(20, 8)) print("Greatest Common Denominator: ",...
def get_gcd(a, b): while b != 0: temp = a a = b b = temp % b return a if __name__ == '__main__': print('Greatest Common Denominator: ', get_gcd(20, 8)) print('Greatest Common Denominator: ', get_gcd(60, 96))
# # PySNMP MIB module SNMP-PROXY-MIB (http://pysnmp.sf.net) # ASN.1 source file:///usr/share/snmp/mibs/SNMP-PROXY-MIB.txt # Produced by pysmi-0.0.5 at Sat Sep 19 23:02:14 2015 # On host grommit.local platform Darwin version 14.4.0 by user ilya # Using Python version 2.7.6 (default, Sep 9 2014, 15:04:36) # ( Integer, ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ...
INSERT_QUERY = "INSERT INTO employees(emp_id, first_name, last_name, salary, address) VALUES(%s,%s,%s,%s,%s)" SELECT_QUERY = "SELECT * FROM employees" UPDATE_QUERY = "UPDATE employees SET address=%s WHERE emp_id=%s" DELETE_QUERY = "DELETE FROM employees WHERE id=%s"
insert_query = 'INSERT INTO employees(emp_id, first_name, last_name, salary, address) VALUES(%s,%s,%s,%s,%s)' select_query = 'SELECT * FROM employees' update_query = 'UPDATE employees SET address=%s WHERE emp_id=%s' delete_query = 'DELETE FROM employees WHERE id=%s'
# sort matrix. snail def sort_matrix_clockwise(size_x, size_y): result = list() input_array = [list(zip(range(size_x), [i] * size_x)) for i in range(size_y)] while len(input_array) > 0 and len(input_array[0]) > 0: for el in input_array: print(el) print('-----') if len(inp...
def sort_matrix_clockwise(size_x, size_y): result = list() input_array = [list(zip(range(size_x), [i] * size_x)) for i in range(size_y)] while len(input_array) > 0 and len(input_array[0]) > 0: for el in input_array: print(el) print('-----') if len(input_array[0]) > 1: ...
def terbesar(a, b, c): nilai_max = a for nilai in [b, c]: if nilai > nilai_max: nilai_max = nilai return nilai_max
def terbesar(a, b, c): nilai_max = a for nilai in [b, c]: if nilai > nilai_max: nilai_max = nilai return nilai_max
OUTCOMES = ("1", "X", "2") RANKS = ("min", "med", "max") RATIO_DELTA = 0.01 WINNING_RATIOS = [1.9, 2.20, 2.62, 2.87, 3.10, 3.30, 3.40, 6.00] LOSING_RATIOS = [4.33, 2.15, 2.25, 1.66, 1.55]
outcomes = ('1', 'X', '2') ranks = ('min', 'med', 'max') ratio_delta = 0.01 winning_ratios = [1.9, 2.2, 2.62, 2.87, 3.1, 3.3, 3.4, 6.0] losing_ratios = [4.33, 2.15, 2.25, 1.66, 1.55]
class YourClass: def __init__(self): self.value = 2 def getValue(self): return self.value
class Yourclass: def __init__(self): self.value = 2 def get_value(self): return self.value
# # PySNMP MIB module Nortel-Magellan-Passport-IpVrrpMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-IpVrrpMIB # Produced by pysmi-0.3.4 at Wed May 1 14:27:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ...
# # Django Settings (https://docs.celeryproject.org/en/stable/userguide/configuration.html) # # Many of the configuration items in Metamapper are centralized to the Django settings.py # files. You can use this file to override those settings. # # This file is referenced by default, but you can also reference a differen...
env = 'production'
def binaryPower(n, k): MOD = 10 ** 7 + 7 if k == 0: return 1 if k % 2 == 0: return binaryPower((n * n) % MOD, k / 2) return (binaryPower(n, k - 1) * n) % MOD
def binary_power(n, k): mod = 10 ** 7 + 7 if k == 0: return 1 if k % 2 == 0: return binary_power(n * n % MOD, k / 2) return binary_power(n, k - 1) * n % MOD
# Using dictionary and list comprehension ip_str = 'Hello, have you tried our tutorial section yet?' # make it suitable for caseless comparisions ip_str = ip_str.casefold() # count the vowels count = {x: sum([1 for char in ip_str if char == x]) for x in 'aeiou'} print(count)
ip_str = 'Hello, have you tried our tutorial section yet?' ip_str = ip_str.casefold() count = {x: sum([1 for char in ip_str if char == x]) for x in 'aeiou'} print(count)
#!/usr/bin/env python3 # Copyright 2019 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
x = 0 while x < 5: print('Not there yet, x=' + str(x)) x = x + 1 def attempts(n): x = 1 while x <= n: print('Attempt ' + str(x)) x += 1 print('Done') x = 1 sum = 0 while x < 10: sum += x x += 1 product = 1 while x < 10: product = product * x x += 1 def to_celsius(x)...
class ClassLesson: def __init__(self, ClassId, LessonId, TeacherId): self.ClassId = ClassId self.LessonId = LessonId self.TeacherId = TeacherId
class Classlesson: def __init__(self, ClassId, LessonId, TeacherId): self.ClassId = ClassId self.LessonId = LessonId self.TeacherId = TeacherId
class CompositorNodeMask: mask = None motion_blur_samples = None motion_blur_shutter = None size_source = None size_x = None size_y = None use_antialiasing = None use_feather = None use_motion_blur = None def update(self): pass
class Compositornodemask: mask = None motion_blur_samples = None motion_blur_shutter = None size_source = None size_x = None size_y = None use_antialiasing = None use_feather = None use_motion_blur = None def update(self): pass
def kidsWithCandies(candies, extraCandies): temp_array=[] max_element=max(candies) for i in candies: temp=i+extraCandies if max_element<=temp: temp_array.append(True) else: temp_array.append(False) return temp_array candies = [2,3,5,1...
def kids_with_candies(candies, extraCandies): temp_array = [] max_element = max(candies) for i in candies: temp = i + extraCandies if max_element <= temp: temp_array.append(True) else: temp_array.append(False) return temp_array candies = [2, 3, 5, 1, 3] ex...
def Comb(a,b): if b>a//2: b=a-b ans=1 i,j=a,1 for k in range(b): ans=ans*i//j i-=1 j+=1 return ans while 1: a,b=map(int,input().split()) if a==b==0: break print(Comb(a,b))
def comb(a, b): if b > a // 2: b = a - b ans = 1 (i, j) = (a, 1) for k in range(b): ans = ans * i // j i -= 1 j += 1 return ans while 1: (a, b) = map(int, input().split()) if a == b == 0: break print(comb(a, b))
#!/usr/bin/python TABLEAU_20 = (( 31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), ( 44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), (227, 119, 194), (247, 182, 210), (127, 1...
tableau_20 = ((31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), (227, 119, 194), (247, 182, 210), (127, 127, 127), (199, 199, 199), (188, 189, 34), (219, 219, 141), (23, 190,...
class MockMetaMachine(object): def __init__(self, meta_business_unit_id_set, tag_id_set, platform, type, serial_number="YO"): self.meta_business_unit_id_set = set(meta_business_unit_id_set) self.tag_id_set = set(tag_id_set) self.platform = platform self.type = type self.seria...
class Mockmetamachine(object): def __init__(self, meta_business_unit_id_set, tag_id_set, platform, type, serial_number='YO'): self.meta_business_unit_id_set = set(meta_business_unit_id_set) self.tag_id_set = set(tag_id_set) self.platform = platform self.type = type self.seri...
SOURCES = { "vogue_india": { "NAME": "vogue_india", "ALLOWED_DOMAINS": "http://www.vogue.in/", "START_URLS": [ "http://www.vogue.in/fashion/fashion-trends/" ], "BASE_URL": "http://www.vogue.in/", "LIST_PAGE_XPATH": "//*[@id='eight_grid_block0']/section/div...
sources = {'vogue_india': {'NAME': 'vogue_india', 'ALLOWED_DOMAINS': 'http://www.vogue.in/', 'START_URLS': ['http://www.vogue.in/fashion/fashion-trends/'], 'BASE_URL': 'http://www.vogue.in/', 'LIST_PAGE_XPATH': "//*[@id='eight_grid_block0']/section/div[1]/h3/a/@href", 'BLOG_CONTENT_XPATH': "//div[contains(@class,'descr...
def lgbm_get_params(): params = [] params.append({ 'num_iterations': 619, 'num_leaves': 789, 'max_depth': 6, 'lambda_l1': 50.0, 'lambda_l2': 45.215133554212514, 'colsample_bynode': 0.43251797168693623, 'colsample_bytree': 1.0, 'bagging_fraction':...
def lgbm_get_params(): params = [] params.append({'num_iterations': 619, 'num_leaves': 789, 'max_depth': 6, 'lambda_l1': 50.0, 'lambda_l2': 45.215133554212514, 'colsample_bynode': 0.43251797168693623, 'colsample_bytree': 1.0, 'bagging_fraction': 1.0, 'bagging_freq': 2, 'min_data_in_leaf': 545}) params.appen...
fruits = ["orange" , "banana" , "melon"] cars = ["ford" , "bmw" , "fiat"] numbers = [11,32,21] # OK i=0 while i < len(fruits): print(fruits[i],cars[i],numbers[i]) i += 1 # much better for f,c,n in zip(fruits,cars,numbers): print(f,c,n) # this is also possible for t in zip(fruits,cars,numbers): pr...
fruits = ['orange', 'banana', 'melon'] cars = ['ford', 'bmw', 'fiat'] numbers = [11, 32, 21] i = 0 while i < len(fruits): print(fruits[i], cars[i], numbers[i]) i += 1 for (f, c, n) in zip(fruits, cars, numbers): print(f, c, n) for t in zip(fruits, cars, numbers): print(t)
# Convert a tree that is a left right representation to a # down right representation class Node: def __init__(self, val): self.val = val self.left = None self.rigt = None def convert(root): if root is None: return convert(root.left) convert(root.right) if root...
class Node: def __init__(self, val): self.val = val self.left = None self.rigt = None def convert(root): if root is None: return convert(root.left) convert(root.right) if root.left == None: root.left = root.right else: root.left.right = root.righ...
def Z(): i=0 while i<7: j=0 while j<7: if i==0 or i==6 or i+j==6 : print("*",end=" ") else: print(end=" ") j+=1 i+=1 print()
def z(): i = 0 while i < 7: j = 0 while j < 7: if i == 0 or i == 6 or i + j == 6: print('*', end=' ') else: print(end=' ') j += 1 i += 1 print()
default_command_dict = { "descriptors": { "MaxEStateIndex": { "command": ["MaxEStateIndex"], "column_names": ["_feat_MaxEStateIndex"], }, "MinEStateIndex": { "command": ["MinEStateIndex"], "column_names": ["_feat_MinEStateIndex"], }, ...
default_command_dict = {'descriptors': {'MaxEStateIndex': {'command': ['MaxEStateIndex'], 'column_names': ['_feat_MaxEStateIndex']}, 'MinEStateIndex': {'command': ['MinEStateIndex'], 'column_names': ['_feat_MinEStateIndex']}, 'MaxAbsEStateIndex': {'command': ['MaxAbsEStateIndex'], 'column_names': ['_feat_MaxAbsEStateIn...
def get_status(): with open("./file/status.txt", "r") as f: try: status = f.read().strip().split(',') return status except: return 'failed' def check_status(current_status): return True if current_status == get_status() else False
def get_status(): with open('./file/status.txt', 'r') as f: try: status = f.read().strip().split(',') return status except: return 'failed' def check_status(current_status): return True if current_status == get_status() else False
a=145 z=0 x=0 for i in range(len(str(a))): z=a%10 x=x+z a=a//10 print(x)
a = 145 z = 0 x = 0 for i in range(len(str(a))): z = a % 10 x = x + z a = a // 10 print(x)
''' Write a program, whichwill find all the numbers between 1000 and 3000 (both included) such that each digit of a number is an even number. The numbers obtained should be printed in a comma separated sequence on a single line.Hint: In case of input data being supplied to the question, it should be assumed to be a co...
""" Write a program, whichwill find all the numbers between 1000 and 3000 (both included) such that each digit of a number is an even number. The numbers obtained should be printed in a comma separated sequence on a single line.Hint: In case of input data being supplied to the question, it should be assumed to be a con...
# -*- coding: utf-8 -*- __author__ = 'Femto Trader' __copyright__ = 'Copyright (c) 2015 - Femto Trader <femto.trader@gmail.com>' __license__ = 'BSD License' __version__ = '0.0.1' __email__ = 'femto.trader@gmail.com' __status__ = 'Development' __url__ = 'https://github.com/femtotrader/arctic-updater'
__author__ = 'Femto Trader' __copyright__ = 'Copyright (c) 2015 - Femto Trader <femto.trader@gmail.com>' __license__ = 'BSD License' __version__ = '0.0.1' __email__ = 'femto.trader@gmail.com' __status__ = 'Development' __url__ = 'https://github.com/femtotrader/arctic-updater'
# Notes: Use 2 pointers and scan the string after converting it to only have alphanumeric characters in it # Space Complexity: O(n) # Time Complexity: O(n) class Solution: def isPalindrome(self, s: str) -> bool: lowercaseStr = s.lower() alphanumeric = list('abcdefghijklmnopqrstuvwxyz0123456789') ...
class Solution: def is_palindrome(self, s: str) -> bool: lowercase_str = s.lower() alphanumeric = list('abcdefghijklmnopqrstuvwxyz0123456789') converted_str = '' for char in lowercaseStr: if char in alphanumeric: converted_str += char (first, last...
def target_func(): pass def func1(): def inner_func1(x=target_func): pass return inner_func1(target_func) def func2(): def inner_func2(x=target_func()): pass return inner_func2(target_func) def func3(x=target_func()): pass def func4(): def inner_func4(x=target_func)...
def target_func(): pass def func1(): def inner_func1(x=target_func): pass return inner_func1(target_func) def func2(): def inner_func2(x=target_func()): pass return inner_func2(target_func) def func3(x=target_func()): pass def func4(): def inner_func4(x=target_func): ...
r="" while True: s=input() if s=="0": break l=len(s) while l>=2: n=0 for i in range(l): n+=int(s[i]) s=str(n);l=len(s) r+=s+'\n' print(r,end="")
r = '' while True: s = input() if s == '0': break l = len(s) while l >= 2: n = 0 for i in range(l): n += int(s[i]) s = str(n) l = len(s) r += s + '\n' print(r, end='')
#CONJUNTO class no: def __init__(self,lista_arestas,vertices): self.arestas = lista_arestas self.vertices = vertices class Grafo: def __init__(self, arestas, vertices): self.arestas = arestas self.vertices = vertices self.inicio = None def busca(self,Q,vertice): ...
class No: def __init__(self, lista_arestas, vertices): self.arestas = lista_arestas self.vertices = vertices class Grafo: def __init__(self, arestas, vertices): self.arestas = arestas self.vertices = vertices self.inicio = None def busca(self, Q, vertice): ...
def max_rot(n): i = 0 list = [str(n)] while i < len(str(n)): n1 = list[i] + list[i][i] n1 = n1[:i] + n1[i+1:] list.append(n1) i += 1 list = map(int,list) return max(list) def max_rotB(n): s, arr = str(n), [n] for i in range(len(s)): s = s[:i]...
def max_rot(n): i = 0 list = [str(n)] while i < len(str(n)): n1 = list[i] + list[i][i] n1 = n1[:i] + n1[i + 1:] list.append(n1) i += 1 list = map(int, list) return max(list) def max_rot_b(n): (s, arr) = (str(n), [n]) for i in range(len(s)): s = s[:i] ...
STATUS_CODE = { 200: "Success", 201: "Created", 202: "Accepted", 301: "Moved Permanently", 304: "Not Modified", 307: "Temporary Redirect", 400: "Bad Request", 401: "Unauthorized", 403: "Forbidden", 404: "Not Found", 405: "Method Not Acceptable", 406: "Unacceptable", 413: "Payload too large", 415: "Unsupport...
status_code = {200: 'Success', 201: 'Created', 202: 'Accepted', 301: 'Moved Permanently', 304: 'Not Modified', 307: 'Temporary Redirect', 400: 'Bad Request', 401: 'Unauthorized', 403: 'Forbidden', 404: 'Not Found', 405: 'Method Not Acceptable', 406: 'Unacceptable', 413: 'Payload too large', 415: 'Unsupported Media Type...
def is_positive_number(x): if (x>0 and (isinstance(x, int) or isinstance(x, float))): return True else: return False def code_of_condition(a, b, c): if (is_positive_number(a) and is_positive_number(b) and is_positive_number(c)): list_with_sides = [a, b, c] sor...
def is_positive_number(x): if x > 0 and (isinstance(x, int) or isinstance(x, float)): return True else: return False def code_of_condition(a, b, c): if is_positive_number(a) and is_positive_number(b) and is_positive_number(c): list_with_sides = [a, b, c] sorted_list = sorted...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def __init__(self): self.max_length = 0 def diameterOfBinaryTree(self, root: TreeNode) -> int: def dfs(node): if ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def __init__(self): self.max_length = 0 def diameter_of_binary_tree(self, root: TreeNode) -> int: def dfs(node): if node is None: re...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: l2S...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: l2_str = l1_str = '' while l1.next != None: l1_str += str(l1.val) l1 = l1.next l1_str += str(...
list1 = [1] #assgining some value for checking IS opretion list2 = [7,0]#same as == opretion in python list3 = list1 if(list1 == list2): print("true") else: print("False") if(list1 is list3): #IS operations r used for checking the corresponding ture/false; print("true") else: print("fals...
list1 = [1] list2 = [7, 0] list3 = list1 if list1 == list2: print('true') else: print('False') if list1 is list3: print('true') else: print('false') if list1 is list2: print('true') else: print('false')
def field(column_name, primary_key=False): def decorator(fn): def decorated(*args, **kwargs): return fn(*args, **kwargs) return decorated return decorator
def field(column_name, primary_key=False): def decorator(fn): def decorated(*args, **kwargs): return fn(*args, **kwargs) return decorated return decorator
db.session.execute(''' alter table "person" add column removed timestamp ''') db.session.commit()
db.session.execute('\n alter table "person"\n add column removed timestamp\n') db.session.commit()
#!/usr/bin/python class Summoner: 'Common base class for all summoners(players)' def __init__(self, jsonSummoner): self.name = jsonSummoner['playerOrTeamName'] self.lp = jsonSummoner['leaguePoints'] self.new = jsonSummoner['isFreshBlood'] self.hot_streak = jsonSummoner['isHotSt...
class Summoner: """Common base class for all summoners(players)""" def __init__(self, jsonSummoner): self.name = jsonSummoner['playerOrTeamName'] self.lp = jsonSummoner['leaguePoints'] self.new = jsonSummoner['isFreshBlood'] self.hot_streak = jsonSummoner['isHotStreak'] ...
provided_modules = ['redhat_support_tool.vendors.ACMECorp.open_case'] ignored_modules = ['redhat_support_tool.plugins.get_case', 'redhat_support_tool.plugins.list_cases', 'redhat_support_tool.plugins.open_case', 'redhat_support_tool.plugins.modify_case']
provided_modules = ['redhat_support_tool.vendors.ACMECorp.open_case'] ignored_modules = ['redhat_support_tool.plugins.get_case', 'redhat_support_tool.plugins.list_cases', 'redhat_support_tool.plugins.open_case', 'redhat_support_tool.plugins.modify_case']
class Side: def __init__(self, index, name, sensor): self.index = index self.name = name self.score = 0 self.players = [] self.sensor = sensor def get_event(self): return self.sensor.read() def reset(self): self.score = 0 self.players = [] ...
class Side: def __init__(self, index, name, sensor): self.index = index self.name = name self.score = 0 self.players = [] self.sensor = sensor def get_event(self): return self.sensor.read() def reset(self): self.score = 0 self.players = [] ...
class AstNode: tree_tag = '+--- ' def __init__(self, name): self.name = name def __str__(self): return '<%s>' % (self.name) def get_prefix(self, pre_num): tag_len = len(self.tree_tag) pre = " " * tag_len * pre_num count = pre_num pre_list = list(pre) ...
class Astnode: tree_tag = '+--- ' def __init__(self, name): self.name = name def __str__(self): return '<%s>' % self.name def get_prefix(self, pre_num): tag_len = len(self.tree_tag) pre = ' ' * tag_len * pre_num count = pre_num pre_list = list(pre) ...
load("@fbcode_macros//build_defs/lib:haskell_rules.bzl", "haskell_rules") load("@fbcode_macros//build_defs/lib:label_utils.bzl", "label_utils") load("@fbcode_macros//build_defs/lib:visibility.bzl", "get_visibility") load("@fbcode_macros//build_defs:platform_utils.bzl", "platform_utils") load("@fbsource//tools/build_def...
load('@fbcode_macros//build_defs/lib:haskell_rules.bzl', 'haskell_rules') load('@fbcode_macros//build_defs/lib:label_utils.bzl', 'label_utils') load('@fbcode_macros//build_defs/lib:visibility.bzl', 'get_visibility') load('@fbcode_macros//build_defs:platform_utils.bzl', 'platform_utils') load('@fbsource//tools/build_def...
# -*- coding: utf-8 -*- def main(): r = int(input()) print(r ** 2) if __name__ == '__main__': main()
def main(): r = int(input()) print(r ** 2) if __name__ == '__main__': main()
class Task: def __init__(self, date, skill, assignee=None): self.date = date self.skill = skill self.assignee = assignee
class Task: def __init__(self, date, skill, assignee=None): self.date = date self.skill = skill self.assignee = assignee
#name=input('Please input your name: ') #print('Hello '+name+' nice to meet you') #print(name.lower()) #print(name.upper()) #print(name.title()) #name=' dk ' #print('Hello, \n'+'\t'+name.lstrip()+name.rstrip()+name.strip()+'''\nI'm your friend''' ) ss=[sss**3 for sss in range(1,10)] print(ss) print(ss[1:4]) sss=sor...
ss = [sss ** 3 for sss in range(1, 10)] print(ss) print(ss[1:4]) sss = sorted(ss, reverse=True) print(sss[:3]) print(ss[3:6]) print(ss[6:]) s = ss[:] s.append('s') ss.append('ss') print('This is s:') for q in s: print(q) print('This is ss:') for w in ss: print(w)
def find_pandigital_products(): pandigital = set(range(1,10)) for multiplicand in range(1,100): # find min/max multipliers that will produce a product of only 4 digits max_multiplier = 10**4/multiplicand min_multiplier = 1000 if multiplicand < 10 else 100 for multiplier in rang...
def find_pandigital_products(): pandigital = set(range(1, 10)) for multiplicand in range(1, 100): max_multiplier = 10 ** 4 / multiplicand min_multiplier = 1000 if multiplicand < 10 else 100 for multiplier in range(min_multiplier, max_multiplier): product = multiplicand * mult...
evals, evectors = np.linalg.eig(cov_matrix) evals, evectors = sort_evals_descending(evals,evectors) with plt.xkcd(): plot_basis_vectors(X,evectors)
(evals, evectors) = np.linalg.eig(cov_matrix) (evals, evectors) = sort_evals_descending(evals, evectors) with plt.xkcd(): plot_basis_vectors(X, evectors)
# Use 2 empty sets, get rooms as a list. If room is not in first set, add to first set. Else, add to second set. The difference will give captain's room. K = int(input()) unord_rooms = [int(i) for i in input().split(' ')] set_first = set() set_second = set() for i in unord_rooms: if i in set_first: set_se...
k = int(input()) unord_rooms = [int(i) for i in input().split(' ')] set_first = set() set_second = set() for i in unord_rooms: if i in set_first: set_second.add(i) else: set_first.add(i) print(str(set_first.difference(set_second)).strip('{}'))
# A Custom dict class that automatically calls a function if accessed class CallableDict(dict): def __getitem__(self, key): val = super().__getitem__(key) if callable(val): return val() return val
class Callabledict(dict): def __getitem__(self, key): val = super().__getitem__(key) if callable(val): return val() return val
imc = 0 masa = int(input("ingrese su masa")) estatura = float(input("ingrese su estatura en m")) imc = masa/estatura**2 print("Su IMC es: ", imc)
imc = 0 masa = int(input('ingrese su masa')) estatura = float(input('ingrese su estatura en m')) imc = masa / estatura ** 2 print('Su IMC es: ', imc)
############################################################################### # REDDIT PRAW CREDENTIALS # Register for an API in https://www.reddit.com/prefs/apps and enter credential ############################################################################### API_REDDIT_CLIENT_ID = "API_KEY_HERE" API_REDDIT_CLIEN...
api_reddit_client_id = 'API_KEY_HERE' api_reddit_client_secret = 'API_KEY_HERE' api_reddit_user_agent = 'subreddit_scraper' interval = 24 subreddits = ['wallstreetbets', 'stocks', 'options', 'pennystocks', 'shortsqueeze', 'spacs'] minimum_score = [5, 5, 5, 5, 5, 5] num_posts = [1000, 500, 500, 500, 1000, 500] minimum_v...
class MaskBinarization(): def __init__(self): self.thresholds = 0.5 def transform(self, predicted): yield predicted > self.thresholds class SimpleMaskBinarization(MaskBinarization): def __init__(self, score_thresholds): super().__init__() self.thresholds = score_threshol...
class Maskbinarization: def __init__(self): self.thresholds = 0.5 def transform(self, predicted): yield (predicted > self.thresholds) class Simplemaskbinarization(MaskBinarization): def __init__(self, score_thresholds): super().__init__() self.thresholds = score_threshold...
def gen(alist, name): ''' Return a booleen if the key of the dictionary of interest is equivalent to a certain name(ie: type of data in the attachments) ''' for dic in alist: for key, value in dic.items(): if isinstance(value, list): list_dict = value[0] ...
def gen(alist, name): """ Return a booleen if the key of the dictionary of interest is equivalent to a certain name(ie: type of data in the attachments) """ for dic in alist: for (key, value) in dic.items(): if isinstance(value, list): list_dict = value[0] ...
n = int(input()) words = [] for _ in range(n): word = input() words.append(word) for i in range(0, len(words), 2): print(words[i])
n = int(input()) words = [] for _ in range(n): word = input() words.append(word) for i in range(0, len(words), 2): print(words[i])
def test_repeat(get_contract_from_ir, assert_compile_failed): good_ir = ["repeat", 0, 0, 1, 1, ["seq"]] bad_ir_1 = ["repeat", 0, 0, 0, 0, ["seq"]] bad_ir_2 = ["repeat", 0, 0, -1, -1, ["seq"]] get_contract_from_ir(good_ir) assert_compile_failed(lambda: get_contract_from_ir(bad_ir_1), Exception) a...
def test_repeat(get_contract_from_ir, assert_compile_failed): good_ir = ['repeat', 0, 0, 1, 1, ['seq']] bad_ir_1 = ['repeat', 0, 0, 0, 0, ['seq']] bad_ir_2 = ['repeat', 0, 0, -1, -1, ['seq']] get_contract_from_ir(good_ir) assert_compile_failed(lambda : get_contract_from_ir(bad_ir_1), Exception) ...
def splice(graphhtml): f = open("indexpt1.txt", "r") firsthtml = f.read() f.close() f = open("indexpt2.txt", "r") secondhtml = f.read() f.close() graphhtml = graphhtml.split("<body>") graphhtml = graphhtml[1] graphhtml = graphhtml.split("</body>") graphhtml = graphhtml[0] ht...
def splice(graphhtml): f = open('indexpt1.txt', 'r') firsthtml = f.read() f.close() f = open('indexpt2.txt', 'r') secondhtml = f.read() f.close() graphhtml = graphhtml.split('<body>') graphhtml = graphhtml[1] graphhtml = graphhtml.split('</body>') graphhtml = graphhtml[0] htm...
#! /usr/bin/env python3 mealCost = float(input().strip()) tip = int(input().strip()) tax = int(input().strip()) totalCost = (1 + tip/100. + tax/100.) * mealCost print("The total meal cost is {} dollars.".format(int(round(totalCost))))
meal_cost = float(input().strip()) tip = int(input().strip()) tax = int(input().strip()) total_cost = (1 + tip / 100.0 + tax / 100.0) * mealCost print('The total meal cost is {} dollars.'.format(int(round(totalCost))))
def stdin(): string, substr = "", raw_input( "" ) while ( substr == "" ) or ( substr[0] != "!" ): string += ( " " + substr + "\n" ) substr = raw_input( "" ) return string
def stdin(): (string, substr) = ('', raw_input('')) while substr == '' or substr[0] != '!': string += ' ' + substr + '\n' substr = raw_input('') return string
#function definition def flow_control(k): #def a string based on the val of k if(k==0): s = "variable k = %d equals 0." % k elif(k==1): s = "variable k = %d equals 1." % k else: s = "variable k = %d does not equal 0 or 1." % k print(s) #main function definition def main(): i = 0 #try...
def flow_control(k): if k == 0: s = 'variable k = %d equals 0.' % k elif k == 1: s = 'variable k = %d equals 1.' % k else: s = 'variable k = %d does not equal 0 or 1.' % k print(s) def main(): i = 0 flow_control(i) i = 1 flow_control(i) i = 2 flow_control...
def reverse(): name = input(str("Enter Name ")) names = name.split() print ("Reversed:", names[2], ",", names[0], names[1]) reverse()
def reverse(): name = input(str('Enter Name ')) names = name.split() print('Reversed:', names[2], ',', names[0], names[1]) reverse()
def factorial(n): if not hasattr(factorial, 'mem'): factorial.mem = {1: 1} if not n in factorial.mem: factorial.mem[n] = n * factorial(n - 1) return factorial.mem[n]
def factorial(n): if not hasattr(factorial, 'mem'): factorial.mem = {1: 1} if not n in factorial.mem: factorial.mem[n] = n * factorial(n - 1) return factorial.mem[n]
# import requests # from bs4 import BeautifulSoup # import lxml def get_remarks_urls(soup): mylist = [] for url2 in soup.find_all('h2', {'class': 'briefing-statement__title'}): mylist.append(url2.find('a')) return mylist def make_file(rawlist): content = [] for url in rawlist: ...
def get_remarks_urls(soup): mylist = [] for url2 in soup.find_all('h2', {'class': 'briefing-statement__title'}): mylist.append(url2.find('a')) return mylist def make_file(rawlist): content = [] for url in rawlist: content.append(url) return content def save_to_file(mylist1): ...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( a , b ) : if a == 0 : return b return f_gold ( b % a , a ) #TOFILL if __name__ == '__main__': ...
def f_gold(a, b): if a == 0: return b return f_gold(b % a, a) if __name__ == '__main__': param = [(46, 89), (26, 82), (40, 12), (58, 4), (25, 44), (2, 87), (8, 65), (21, 87), (82, 10), (17, 61)] n_success = 0 for (i, parameters_set) in enumerate(param): if f_filled(*parameters_set) =...
def censor(text, word): l = len(word) i = 0 censored = "" while i < len(text): if(i > len(text) - len(word)): censored += text[i] i += 1 else: found_at_i = True for j in range(0, l): if(text[i + j] != word[j]): found_at_i = False if(found_at_i == T...
def censor(text, word): l = len(word) i = 0 censored = '' while i < len(text): if i > len(text) - len(word): censored += text[i] i += 1 else: found_at_i = True for j in range(0, l): if text[i + j] != word[j]: ...
class Day: def __init__(self,start_time:float,end_time:float,day:str): self.start_time:float = start_time self.end_time:float = end_time self.day:str = day self.type_day:str = self._get_type_day() self.cost_day:float = self.get_cost_day() def _get_type...
class Day: def __init__(self, start_time: float, end_time: float, day: str): self.start_time: float = start_time self.end_time: float = end_time self.day: str = day self.type_day: str = self._get_type_day() self.cost_day: float = self.get_cost_day() def _get_type_day(se...
# Bitwise operators treat operands as sequences # of binary digits and operate on them bit by bit. # list of operators... # & - AND # | - OR # ~ - NOT # ^ - XOR # >> - SHIFT_RIGHT # << - SHIFT_LEFT print('0b{:04b}'.format(0b1100 & 0b1010)) print('0b{:04b}'.format(0b1100 | 0b1010)) print('0b{:04b}'.format(0b1100 ^ 0b10...
print('0b{:04b}'.format(12 & 10)) print('0b{:04b}'.format(12 | 10)) print('0b{:04b}'.format(12 ^ 10)) print('0b{:04b}'.format(12 >> 2)) print('0b{:04b}'.format(3 << 2))
class SebflowException(Exception): pass class SebOnPurposeError(Exception): pass class SebflowConfigException(Exception): pass
class Sebflowexception(Exception): pass class Sebonpurposeerror(Exception): pass class Sebflowconfigexception(Exception): pass
# # Copyright (C) 2018 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
layout = bool_scalar('layout', False) i1 = input('op1', 'TENSOR_FLOAT32', '{1, 3, 3}') f1 = parameter('op2', 'TENSOR_FLOAT32', '{1, 2, 2}', [0.25, 0.25, 0.25, 0.25]) b1 = parameter('op3', 'TENSOR_FLOAT32', '{1}', [0]) o1 = output('op4', 'TENSOR_FLOAT32', '{1, 2, 2}') model().Operation('CONV_2D', i1, f1, b1, 0, 0, 0, 0,...
class GenericDeltaIterator: def __init__(self, api, url=None, deltalink=None, **kwargs): ''' Delta iterator. If deltalink is given, url is not used and the iterator resumes from that state. Example: url = 'https://graph.microsoft.com/v1.0/users/delta?$select=displayName...
class Genericdeltaiterator: def __init__(self, api, url=None, deltalink=None, **kwargs): """ Delta iterator. If deltalink is given, url is not used and the iterator resumes from that state. Example: url = 'https://graph.microsoft.com/v1.0/users/delta?$select=displayName...
name = str(input("What is your name: ")) age = int(input("What is your age: ")) money = float(input("How much money do you have in your bank account: ")) print(f"Your name is {name}") print(f"Your age is {age}") print(f"You have ${money} in your bank account")
name = str(input('What is your name: ')) age = int(input('What is your age: ')) money = float(input('How much money do you have in your bank account: ')) print(f'Your name is {name}') print(f'Your age is {age}') print(f'You have ${money} in your bank account')
class Solution: def isMatch(self, s: str, p: str) -> bool: dp = [[False for i in range(len(p) + 1)] for j in range(len(s) + 1)] dp[0][0] = True for i in range(1, len(p)): dp[0][i + 1] = p[i] == '*' and dp[0][i - 1] for i in range(len(s)): for j in range(len(p)...
class Solution: def is_match(self, s: str, p: str) -> bool: dp = [[False for i in range(len(p) + 1)] for j in range(len(s) + 1)] dp[0][0] = True for i in range(1, len(p)): dp[0][i + 1] = p[i] == '*' and dp[0][i - 1] for i in range(len(s)): for j in range(len(...
INDEX_TO_WEEKDAY = { 1:"Sunday", 2:"Monday", 3:"Tuesday", 4:"Wednesday", 5:"Thursday", 6:"Friday", 7:"Saturday" } def whatday(num) -> str: try: return INDEX_TO_WEEKDAY[num] except LookupError: return "Wrong, please enter a number between 1 and 7"
index_to_weekday = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'} def whatday(num) -> str: try: return INDEX_TO_WEEKDAY[num] except LookupError: return 'Wrong, please enter a number between 1 and 7'
pms_range, vtl_range, df_range, prf_range = [-10.0, 10.0], [0.6, 1.4], [0.6, 1.4], [0.1, 10] ranges = [pms_range, vtl_range, df_range, prf_range] def average(euclid1, euclid2, i): avg = (euclid1[i] + euclid2[i]) / 2 euc_avg = euclid1.copy() euc_avg[i] = avg return euc_avg def find_exemplars(point, _...
(pms_range, vtl_range, df_range, prf_range) = ([-10.0, 10.0], [0.6, 1.4], [0.6, 1.4], [0.1, 10]) ranges = [pms_range, vtl_range, df_range, prf_range] def average(euclid1, euclid2, i): avg = (euclid1[i] + euclid2[i]) / 2 euc_avg = euclid1.copy() euc_avg[i] = avg return euc_avg def find_exemplars(point,...
class dotClash_t(object): # no doc Id1=None Id2=None PenetrationDepth=None Type=None
class Dotclash_T(object): id1 = None id2 = None penetration_depth = None type = None
class Photo: def __init__(self, original): self._original = original self._cropped = [] def get_original(self): return self._original def get_cropped(self): return self._cropped def add_cropped_photo(self, photo): self._cropped.append(photo)
class Photo: def __init__(self, original): self._original = original self._cropped = [] def get_original(self): return self._original def get_cropped(self): return self._cropped def add_cropped_photo(self, photo): self._cropped.append(photo)
# WRITE YOUR SOLUTION HERE: class ExamResult: def __init__(self, name: str, grade1: int, grade2: int, grade3: int): self.name = name self.grade1 = grade1 self.grade2 = grade2 self.grade3 = grade3 def __str__(self): return (f'Name:{self.name}, grade1: {self.grade1}' + ...
class Examresult: def __init__(self, name: str, grade1: int, grade2: int, grade3: int): self.name = name self.grade1 = grade1 self.grade2 = grade2 self.grade3 = grade3 def __str__(self): return f'Name:{self.name}, grade1: {self.grade1}' + f', grade2: {self.grade2}, grad...
widget = WidgetDefault() widget.width = 20 widget.background = "Fill" commonDefaults["ScrollBarWidget"] = widget def generateScrollBarWidget(file, screen, bar, parentName): name = bar.getName() file.write(" %s = leScrollBarWidget_New();" % (name)) generateBaseWidget(file, screen, bar) orientatio...
widget = widget_default() widget.width = 20 widget.background = 'Fill' commonDefaults['ScrollBarWidget'] = widget def generate_scroll_bar_widget(file, screen, bar, parentName): name = bar.getName() file.write(' %s = leScrollBarWidget_New();' % name) generate_base_widget(file, screen, bar) orientatio...
a,b = map(int,input().split()) ans = 0 if a>b: ans += int(a//b) a = a%b while b!=0: ans += int(a//b) a,b = b,a%b print(ans)
(a, b) = map(int, input().split()) ans = 0 if a > b: ans += int(a // b) a = a % b while b != 0: ans += int(a // b) (a, b) = (b, a % b) print(ans)
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def mergeKLists(self, lists): self.ans = [] head = value = ListNode(0) for l in lists: while l: self.ans.append(l.val) l = l.n...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def merge_k_lists(self, lists): self.ans = [] head = value = list_node(0) for l in lists: while l: self.ans.append(l.val) l...
fname = '/home/dmalt/Data/cognigraph/data/Koleno.vhdr' # --------- prepare channels ------------ # ch_path = '/home/dmalt/Data/cognigraph/channel_BrainProducts_ActiCap_128.mat' ch_struct = loadmat(ch_path) kind = ch_struct['Comment'][0] chans = ch_struct['Channel'][0] ch_locs = np.empty([len(chans), 3]) ch_types = [...
fname = '/home/dmalt/Data/cognigraph/data/Koleno.vhdr' ch_path = '/home/dmalt/Data/cognigraph/channel_BrainProducts_ActiCap_128.mat' ch_struct = loadmat(ch_path) kind = ch_struct['Comment'][0] chans = ch_struct['Channel'][0] ch_locs = np.empty([len(chans), 3]) ch_types = [None] * len(chans) ch_names = [None] * len(chan...
class Node(object): def __init__(self, parent, contribution, perct): self._children = [] self._parent = parent self._contribution = contribution self._perct = perct @property def children(self): return self._children @property def parent(self): retur...
class Node(object): def __init__(self, parent, contribution, perct): self._children = [] self._parent = parent self._contribution = contribution self._perct = perct @property def children(self): return self._children @property def parent(self): retu...