content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Copyright 2019,2020,2021 Sony Corporation. # # 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 agreed...
class Updater(object): """Updater Args: solver (:obj:`nnabla.solvers.Solver`): Solver object. E.g., Momentum or Adam. loss (:obj:`nnabla.Variable`): Loss variable from which the forward and the backward is called. data_feeder (callable :obj:`object`, function, or lambda): Data feeder. ...
data = pd.read_csv('/Users/djamillakhdar-hamina/Desktop/kavli_mdressel_combined_4col.csv') # Count edges to target edge_count=data.groupby('target').count() # Merge back to x using target-> target target_self_merge= pd.merge(data, edge_count, left_on='target', right_on='target') # Merge back to x using source -> tar...
data = pd.read_csv('/Users/djamillakhdar-hamina/Desktop/kavli_mdressel_combined_4col.csv') edge_count = data.groupby('target').count() target_self_merge = pd.merge(data, edge_count, left_on='target', right_on='target') source_self_merge = pd.merge(target_self_merge, edge_count, left_on='source_x', right_on='target', ho...
# -*- coding: utf-8 -*- """ Created on Tue Aug 17 15:16:50 2021 @author: 2900888 """ lengde_meter_streng = input("Skriv inn lenden til rommet i meter: ") bredde_meter_streng = input("Skriv inn bredden til rommet i meter: ") lengde_meter = float(lengde_meter_streng) bredde_meter = float(bredde_meter_streng) ...
""" Created on Tue Aug 17 15:16:50 2021 @author: 2900888 """ lengde_meter_streng = input('Skriv inn lenden til rommet i meter: ') bredde_meter_streng = input('Skriv inn bredden til rommet i meter: ') lengde_meter = float(lengde_meter_streng) bredde_meter = float(bredde_meter_streng) areal = lengde_meter * bredde_meter...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (c) 2013 ZestyBeanz Technologies Pvt. Ltd. # (http://wwww.zbeanztech.com) # contact@zbeanztech.com # # This program is free software: you can redistribute it and/or modify # it under the...
{'name': 'Web Printscreen ZB', 'version': '1.4', 'category': 'Web', 'description': '\n Module to export current active tree view in to excel report\n ', 'author': 'Zesty Beanz Technologies', 'website': 'http://www.zbeanztech.com', 'depends': ['web'], 'js': ['static/src/js/web_printscreen_export.js'], 'qweb': ...
class Solution(object): def findMinDifference1(self, timePoints): if len(timePoints) > 1440: return 0 s = sorted(map(lambda t: int(t[:2]) * 60 + int(t[3:]), timePoints)) return min(s2 - s1 for s1,s2 in zip(s, s[1:] + [1440+s[0]])) def findMinDifference2(self, timePoints): ...
class Solution(object): def find_min_difference1(self, timePoints): if len(timePoints) > 1440: return 0 s = sorted(map(lambda t: int(t[:2]) * 60 + int(t[3:]), timePoints)) return min((s2 - s1 for (s1, s2) in zip(s, s[1:] + [1440 + s[0]]))) def find_min_difference2(self, tim...
# APIs for Windows 32-bit kernel32 library. # Format: retval, rettype, callconv, exactname, arglist(type, name) # arglist type is one of ['int', 'void *'] # arglist name is one of [None, 'funcptr', 'obj', 'ptr'] api_defs = { 'kernel32.main_entry':( 'int', None, 'stdcall', 'kernel32.main_entry', ...
api_defs = {'kernel32.main_entry': ('int', None, 'stdcall', 'kernel32.main_entry', (('int', None), ('int', None), ('int', None))), 'kernel32.activateactctx': ('int', None, 'stdcall', 'kernel32.ActivateActCtx', (('int', None), ('int', None))), 'kernel32.addatoma': ('int', None, 'stdcall', 'kernel32.AddAtomA', (('int', N...
class ObjectContext: def __init__(self) -> None: self.definedTypes = {} self.definedSymbols = {} def get_type(self, typeName: str): return self.definedTypes[typeName] def type_of(self, symbol: str): if self.definedSymbols.__contains__(symbol): return self.defin...
class Objectcontext: def __init__(self) -> None: self.definedTypes = {} self.definedSymbols = {} def get_type(self, typeName: str): return self.definedTypes[typeName] def type_of(self, symbol: str): if self.definedSymbols.__contains__(symbol): return self.defin...
class Scenario: _requests = None def __init__(self, requests): self._requests = requests def get_requests(self): return self._requests
class Scenario: _requests = None def __init__(self, requests): self._requests = requests def get_requests(self): return self._requests
#Calcular y mostrar la nota final para cada materia, y el promedio general de las tres materias def calc_matematicas(examen, tarea1, tarea2, tarea3): valor_examen = examen * 0.9 total_tareas = tarea1 + tarea2 + tarea3 promedio_tareas = total_tareas / 3 valor_tareas = promedio_tareas * 0.1 final_mate...
def calc_matematicas(examen, tarea1, tarea2, tarea3): valor_examen = examen * 0.9 total_tareas = tarea1 + tarea2 + tarea3 promedio_tareas = total_tareas / 3 valor_tareas = promedio_tareas * 0.1 final_matematicas = round(valor_examen + valor_tareas, 2) return final_matematicas def calc_fisica(ex...
my_list = [20, 39, 34, 20, 24, 20, 10, 11] my_set = sorted(set(my_list)) print(my_set)
my_list = [20, 39, 34, 20, 24, 20, 10, 11] my_set = sorted(set(my_list)) print(my_set)
settings = { 'token': 'DISCORD_BOT_TOKEN', 'id': BOT_ID, 'prefix': 'PREFIX', 'embedcolor': EMBED_COLOR_(0x123456), 'author-id': YOUR_ID, 'vk-api-token': 'VK_API_TOKEN', 'bot_avatar_url': 'BOT_AVATAR_URL', 'youtube_apikey': 'YOUTUBE_DATA_API_KEY', 'weather_token': 'OPENWEATHERMAP_TOKE...
settings = {'token': 'DISCORD_BOT_TOKEN', 'id': BOT_ID, 'prefix': 'PREFIX', 'embedcolor': embed_color_(1193046), 'author-id': YOUR_ID, 'vk-api-token': 'VK_API_TOKEN', 'bot_avatar_url': 'BOT_AVATAR_URL', 'youtube_apikey': 'YOUTUBE_DATA_API_KEY', 'weather_token': 'OPENWEATHERMAP_TOKEN'}
''' *** * *** ''' n = int(input()) while n: n=n-1 num = int(input()) if num<38 or (num%5)<3: print(num) else: print(num+(5-(num%5)))
""" *** * *** """ n = int(input()) while n: n = n - 1 num = int(input()) if num < 38 or num % 5 < 3: print(num) else: print(num + (5 - num % 5))
class GlocalMerchantRequest: def __init__(self, xgl_token_external, payload): self.xgl_token_external = xgl_token_external self.payload = payload def get_payload(self): return self.payload def get_xgl_token_external(self): return self.xgl_token_external def set_xgl_tok...
class Glocalmerchantrequest: def __init__(self, xgl_token_external, payload): self.xgl_token_external = xgl_token_external self.payload = payload def get_payload(self): return self.payload def get_xgl_token_external(self): return self.xgl_token_external def set_xgl_to...
DEFAULT_SPECIAL_TOKEN_BOXES = { "[UNK]": [0, 0, 0, 0], "[PAD]": [0, 0, 0, 0], "[CLS]": [0, 0, 0, 0], "[MASK]": [0, 0, 0, 0], "[SEP]": [1000, 1000, 1000, 1000], } MAX_LINE_PER_PAGE = 200 MAX_TOKENS_PER_LINE = 25 MAX_BLOCK_PER_PAGE = 40 MAX_TOKENS_PER_BLOCK = 100 MAX_2D_POSITION_EMBEDDINGS = 1024
default_special_token_boxes = {'[UNK]': [0, 0, 0, 0], '[PAD]': [0, 0, 0, 0], '[CLS]': [0, 0, 0, 0], '[MASK]': [0, 0, 0, 0], '[SEP]': [1000, 1000, 1000, 1000]} max_line_per_page = 200 max_tokens_per_line = 25 max_block_per_page = 40 max_tokens_per_block = 100 max_2_d_position_embeddings = 1024
# Copyright 2004-2008 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) """ This file contains indexing suite v2 code """ file_name = "indexing_suite/python_iterator.hpp" code = """// -*- mode:c++ ...
""" This file contains indexing suite v2 code """ file_name = 'indexing_suite/python_iterator.hpp' code = '// -*- mode:c++ -*-\n//\n// Header file python_iterator.hpp\n//\n// Handy Python iterable iterators\n//\n// Copyright (c) 2003 Raoul M. Gough\n//\n// Use, modification and distribution is subject to the Boost Soft...
#!/usr/bin/env python3 numbers = [42, 9001] letters = "ace" try: print(numbers + letters) except TypeError as err: print(err) # can only concatenate list (not "str") to list words = ["ace", "in", "hole"] print(numbers + words) # [42, 9001, 'ace', 'in', 'hole']
numbers = [42, 9001] letters = 'ace' try: print(numbers + letters) except TypeError as err: print(err) words = ['ace', 'in', 'hole'] print(numbers + words)
once = 0 res = (0,0) def calc(): global once, res if once > 0: return with open("../stream/input15.txt", "r") as file: data = [int(y) for y in [x.strip() for x in file.read().splitlines()][0].split(',')] occurences = {data[i-1]:[i] for i in range(1, len(data)+1)} current = ...
once = 0 res = (0, 0) def calc(): global once, res if once > 0: return with open('../stream/input15.txt', 'r') as file: data = [int(y) for y in [x.strip() for x in file.read().splitlines()][0].split(',')] occurences = {data[i - 1]: [i] for i in range(1, len(data) + 1)} curre...
n = int(input()) for i in range(n): c=input() lst=list(c) l=len(c) c2=[] for i2 in range(l): if(lst[i2]=='4'): lst[i2]='3' c2.append('1') else: c2.append('0') print("".join(lst)+" "+"".join(c2))
n = int(input()) for i in range(n): c = input() lst = list(c) l = len(c) c2 = [] for i2 in range(l): if lst[i2] == '4': lst[i2] = '3' c2.append('1') else: c2.append('0') print(''.join(lst) + ' ' + ''.join(c2))
def crf_pos_features(sent, i): word = sent[i][0] postag = sent[i][1] features = [ 'bias', 'word=' + word, #current word 'word[-4:]=' + word[-4:], #last 4 characters 'word[-3:]=' + word[-3:], #last 3 characters 'word...
def crf_pos_features(sent, i): word = sent[i][0] postag = sent[i][1] features = ['bias', 'word=' + word, 'word[-4:]=' + word[-4:], 'word[-3:]=' + word[-3:], 'word[-2:]=' + word[-2:], 'word.isdigit=%s' % word.isdigit()] if len(word) > 3: features.extend(['word.short=False']) if len(word) < 3:...
nop = b'\x00\x00' brk = b'\x00\xA0' lda = b'\x6A\x02' # Load 0x02 into register VA ldb = b'\x6D\xDD' # Load 0xDD into register VD ldx = b'\x8D\xA0' # Load register VA into VD with open("ldvxvytest.bin", 'wb') as f: f.write(lda) # 0x0200 <-- Load the byte 0x02 into register VA f.write(ldb) # 0x0202 <-- ...
nop = b'\x00\x00' brk = b'\x00\xa0' lda = b'j\x02' ldb = b'm\xdd' ldx = b'\x8d\xa0' with open('ldvxvytest.bin', 'wb') as f: f.write(lda) f.write(ldb) f.write(ldx) f.write(brk)
#!/usr/bin/env python2 # # Copyright 2020 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. BUNDLE_BUCKET = '${BUNDLE_BUCKET}' NOREPLY_EMAIL = '${NOREPLY_EMAIL}' FAILURE_EMAIL = '${FAILURE_EMAIL}'
bundle_bucket = '${BUNDLE_BUCKET}' noreply_email = '${NOREPLY_EMAIL}' failure_email = '${FAILURE_EMAIL}'
# Push Bullet API Token Here # https://www.pushbullet.com/#settings/account login = { 'pushbullet_api_token' : 'ITSASECRET', 'hassio_password' : 'ITSASECRET' }
login = {'pushbullet_api_token': 'ITSASECRET', 'hassio_password': 'ITSASECRET'}
# Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set") load("//third_party/rust/crates:crates.bzl", "raze_...
load('@rules_rust//rust:repositories.bzl', 'rules_rust_dependencies', 'rust_register_toolchains', 'rust_repository_set') load('//third_party/rust/crates:crates.bzl', 'raze_fetch_remote_crates') load('@rules_rust//tools/rust_analyzer/raze:crates.bzl', 'rules_rust_tools_rust_analyzer_fetch_remote_crates') load('@safe_ftd...
'''__init__.py''' __version__ = '21.40.2dev' version = '21w40b-dev'
"""__init__.py""" __version__ = '21.40.2dev' version = '21w40b-dev'
# Comments are lines that exist in computer programs that are ignored by # compilers and interpreters. # # Including comments in programs makes code more readable # for humans as it provides some information or explanation # about what each part of a program is doing. # # In general, it is a good idea to write c...
""" hello everyone welcome to my channel kindly LIKE | SHARE | SUBSCRIBE if you like the content """ def add(a, b): """ This function adds two numbers """ return a + b print(add(5, 4)) print(add.__doc__) for x in range(10): print(x) print(x * 2) print('LAALA') if True: print('Data Science') a =...
# 9.23 def find_happy_number(num): # TODO: Write your code here fastSum, slowSum = num, num while True: # currSum = sumOfSqaures(fastSum) # nextSum = sumOfSqaures(fastSum) # if currSum == 1 or nextSum == 1: # return True fastSum = sumOfSqaures(sumOfSqaures(fastSum)) slowSum = sumOfSqaur...
def find_happy_number(num): (fast_sum, slow_sum) = (num, num) while True: fast_sum = sum_of_sqaures(sum_of_sqaures(fastSum)) slow_sum = sum_of_sqaures(slowSum) if fastSum == slowSum: break return slowSum == 1 def sum_of_sqaures(number): store_sum = 0 while number...
INFURA_PROJECT_ID = 'FILL_YOUR_KEY' # Networks # Rinkeby NETWORK = 'rinkeby' PRIVATE_KEY = 'FILL_YOUR_PRIVATE_KEY' # ETH mainnet # NETWORK = 'mainnet' PRIVATE_KEY = 'FILL_YOUR_PRIVATE_KEY'
infura_project_id = 'FILL_YOUR_KEY' network = 'rinkeby' private_key = 'FILL_YOUR_PRIVATE_KEY' private_key = 'FILL_YOUR_PRIVATE_KEY'
class UnchainedException(Exception): def __init__(self): super(UnchainedException, self).__init__(self.message) class DoesntExist(UnchainedException): message = "Attempting to get data by a key that doesn't exist"
class Unchainedexception(Exception): def __init__(self): super(UnchainedException, self).__init__(self.message) class Doesntexist(UnchainedException): message = "Attempting to get data by a key that doesn't exist"
MODELS = [ 'ConvLSTM', 'ConvLSTM_REF', 'LSTM' ] DATASETS = [ 'GeneratedSins', 'GeneratedNoise', 'Stocks', 'MovingMNIST', 'KTH', 'BAIR' ] KTH_CLASSES = [ 'boxing', 'handclapping', 'handwaving', 'jogging', 'running', 'walking' ] OPTS = { 'model': { ...
models = ['ConvLSTM', 'ConvLSTM_REF', 'LSTM'] datasets = ['GeneratedSins', 'GeneratedNoise', 'Stocks', 'MovingMNIST', 'KTH', 'BAIR'] kth_classes = ['boxing', 'handclapping', 'handwaving', 'jogging', 'running', 'walking'] opts = {'model': {'description': 'Model architecture'}, 'dataset': {'description': 'Dataset'}, 'dev...
# -*- coding: utf-8 -*- # http://stackoverflow.com/questions/106179/regular-expression-to-match-hostname-or-ip-address REGEX_IPADDR = "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])" REGEX_HOSTNAME = "(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-...
regex_ipaddr = '(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])' regex_hostname = '(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])' regex_jid = '([0-9]{20})'
# -*- coding: utf-8 -*- """ BuzzlogixTextAnalysisAPILib.Configuration This file was automatically generated for buzzlogix by APIMATIC BETA v2.0 on 12/06/2015 """ class Configuration : # The base Uri for API calls BASE_URI = "https://buzzlogix-text-analysis.p.mashape.com"
""" BuzzlogixTextAnalysisAPILib.Configuration This file was automatically generated for buzzlogix by APIMATIC BETA v2.0 on 12/06/2015 """ class Configuration: base_uri = 'https://buzzlogix-text-analysis.p.mashape.com'
'''https://leetcode.com/problems/generate-parentheses/''' #iterative solution class Solution: def generateParenthesis(self, n: int) -> List[str]: res = [] stack = [("(", 1, 0)] while stack: x, l, r = stack.pop() if r>l or l>n or r>n: continue ...
"""https://leetcode.com/problems/generate-parentheses/""" class Solution: def generate_parenthesis(self, n: int) -> List[str]: res = [] stack = [('(', 1, 0)] while stack: (x, l, r) = stack.pop() if r > l or l > n or r > n: continue if l =...
""" Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. """ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): ...
""" Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. """ class Solution(object): def merge_two_lists(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode No du...
def bumpVersion(file_loc, which="patch", dry_run = False, all_matching_lines = False, write_loc = None): if which not in ["major", "minor", "patch"]: print(f"Argument must be one of major, minor, or patch, instead was {which}") raise ValueError(which) with open(file_loc, "r") as f: lines = [] lines...
def bump_version(file_loc, which='patch', dry_run=False, all_matching_lines=False, write_loc=None): if which not in ['major', 'minor', 'patch']: print(f'Argument must be one of major, minor, or patch, instead was {which}') raise value_error(which) with open(file_loc, 'r') as f: lines = [...
# Copyright 2020 Xilinx Inc. # # 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 agreed to in writing, ...
""" Utility for topologically sorting a list of XLayer objects """ def sort_topologically(net): """ Topologically sort a list of XLayer objects in O(N^2)""" top_net = [] bottoms_cache = {X.name: X.bottoms[:] for x in net} while len(net) > len(top_net): for x in net: if X.name in b...
''' Python program to find the number of zeros at the end of a factorial of a given positive number ''' def factendzero (n): factorial = 1 x = n // 5 y = x if n < 0: print("Sorry, factorial does not exist for negative numbers") elif n == 0: print("The factorial of 0 is 1") else: ...
""" Python program to find the number of zeros at the end of a factorial of a given positive number """ def factendzero(n): factorial = 1 x = n // 5 y = x if n < 0: print('Sorry, factorial does not exist for negative numbers') elif n == 0: print('The factorial of 0 is 1') else: ...
class ReplayBuffer(object): pass
class Replaybuffer(object): pass
# Copyright 2016 Google Inc. # # 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 agreed to in writing,...
def all_tests(tests, deps, tags=[], shard_count=1, data=[]): for file in tests: relative_target = file[:-5] suffix = relative_target.replace('/', '.') pos = native.package_name().rfind('javatests/') + len('javatests/') test_class = native.package_name()[pos:].replace('/', '.') + '.' ...
"""Project Euler problem 7""" def is_prime(number): """Returns True if the specified number is prime""" if number <= 1: return False count = 2 while count ** 2 <= number: if number % count == 0: return False count += 1 return True def calculate(last_prime): ...
"""Project Euler problem 7""" def is_prime(number): """Returns True if the specified number is prime""" if number <= 1: return False count = 2 while count ** 2 <= number: if number % count == 0: return False count += 1 return True def calculate(last_prime): ...
# Description # The Hamming distance between two integers is the number of positions at which the corresponding bits are different. # Given two integers x and y, calculate the Hamming distance. # Example # Input: x = 1, y = 4 # Output: 2 class Solution: """ @param x: an integer @param y: an integer ...
class Solution: """ @param x: an integer @param y: an integer @return: return an integer, denote the Hamming Distance between two integers """ def hamming_distance(self, x, y): count = 0 while x or y: if x & 1 != y & 1: count = count + 1 x...
def init_lst(): return [i for i in range(0, 256)] class KnotTier: def __init__(self): self.pos = 0 self.skip = 0 def tie_a_knot(self, start, length, lst): if length < 2: return end = (start + length - 1) % len(lst) lst[start], lst[end] = lst[end], lst[s...
def init_lst(): return [i for i in range(0, 256)] class Knottier: def __init__(self): self.pos = 0 self.skip = 0 def tie_a_knot(self, start, length, lst): if length < 2: return end = (start + length - 1) % len(lst) (lst[start], lst[end]) = (lst[end], ls...
# # PySNMP MIB module TPT-ATA-REG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-ATA-REG-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:26:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, single_value_constraint, constraints_intersection) ...
#!/usr/bin/python3 def test_ternery1(evmtester, branch_results): evmtester.terneryBranches(1, True, False, False, False) results = branch_results() assert [2582, 2583] in results[True] assert [2610, 2611] in results[False] evmtester.terneryBranches(1, False, False, False, False) results = bra...
def test_ternery1(evmtester, branch_results): evmtester.terneryBranches(1, True, False, False, False) results = branch_results() assert [2582, 2583] in results[True] assert [2610, 2611] in results[False] evmtester.terneryBranches(1, False, False, False, False) results = branch_results() asse...
class Solution: def letterCombinations(self, digits: str) -> List[str]: answer = [] keypad = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'] def helper(prefix, idx): # reached end of this current backtrack and isn't just '' ...
class Solution: def letter_combinations(self, digits: str) -> List[str]: answer = [] keypad = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'] def helper(prefix, idx): if idx == len(digits): if prefix != '': answer.append(pr...
class baseparser: """ Parser interface. """ def parse_file(self, source): """ Parses a Graph from an OSM file. This is the preferred way for parsing when on execution mode. parse_file(source) -> graph @type source: string @param sou...
class Baseparser: """ Parser interface. """ def parse_file(self, source): """ Parses a Graph from an OSM file. This is the preferred way for parsing when on execution mode. parse_file(source) -> graph @type source: string @param source:...
def parse_page_obj(raw_obj): return { "wiki_db": raw_obj['wiki_db'], "event_entity": raw_obj['event_entity'], "event_type": raw_obj['event_type'], "event_timestamp": raw_obj['event_timestamp'], "event_comment": raw_obj['event_comment'], "event_user": { "i...
def parse_page_obj(raw_obj): return {'wiki_db': raw_obj['wiki_db'], 'event_entity': raw_obj['event_entity'], 'event_type': raw_obj['event_type'], 'event_timestamp': raw_obj['event_timestamp'], 'event_comment': raw_obj['event_comment'], 'event_user': {'id': raw_obj['event_user_id'], 'text_historical': raw_obj['event...
while True: try: user_input = int(input("Please enter a integer between 0 to 1000: ")) except: print("Please enter a numeric value") continue if user_input < 1: print("Please enter a positive integer") continue break if (user_input % 2) == 0: print("Th...
while True: try: user_input = int(input('Please enter a integer between 0 to 1000: ')) except: print('Please enter a numeric value') continue if user_input < 1: print('Please enter a positive integer') continue break if user_input % 2 == 0: print("That's an ev...
""" Tangerine Whistle Utility Functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. contents:: Table of Contents :backlinks: none :local: Introduction ------------ Utility functions used in this tangerine whistle version of specification. """
""" Tangerine Whistle Utility Functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. contents:: Table of Contents :backlinks: none :local: Introduction ------------ Utility functions used in this tangerine whistle version of specification. """
run = [''' <PhysicsModeling>: name: "physicsmodel" # canvas.before: # Color: # rgb: .2, .2, .2 # Rectangle: # size: self.size # source: '/background.png' # this below is variables in the .py file being assigned to the id's # below in the .kv file here to al...
run = ['\n<PhysicsModeling>:\n name: "physicsmodel"\n# canvas.before:\n# Color:\n# rgb: .2, .2, .2\n# Rectangle:\n# size: self.size\n# source: \'/background.png\'\n\n # this below is variables in the .py file being assigned to the id\'s\n # below in the .kv fil...
""" The dependencies for running the gen_rust_project binary. """ load("//tools/rust_analyzer/raze:crates.bzl", "rules_rust_tools_rust_analyzer_fetch_remote_crates") def rust_analyzer_deps(): rules_rust_tools_rust_analyzer_fetch_remote_crates() # For legacy support gen_rust_project_dependencies = rust_analyzer_d...
""" The dependencies for running the gen_rust_project binary. """ load('//tools/rust_analyzer/raze:crates.bzl', 'rules_rust_tools_rust_analyzer_fetch_remote_crates') def rust_analyzer_deps(): rules_rust_tools_rust_analyzer_fetch_remote_crates() gen_rust_project_dependencies = rust_analyzer_deps
class Solution: def reachingPoints(self, sx, sy, tx, ty): """ :type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool """ while tx >= sx and ty >= sy: tx, ty = tx % ty, ty % tx return sx == tx and (ty - sy) % sx == 0 or...
class Solution: def reaching_points(self, sx, sy, tx, ty): """ :type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool """ while tx >= sx and ty >= sy: (tx, ty) = (tx % ty, ty % tx) return sx == tx and (ty - sy) % sx =...
# The following function returns by recursion the length L of the longest palindromic substring of a given string s def lps(s): n = len(s) # basic cases: L = 0 if s is an empty substring, L = 1 if s has only one character if n == 0 or n == 1: L = n # the recursion goes a...
def lps(s): n = len(s) if n == 0 or n == 1: l = n elif s[0] == s[-1]: return 2 + lps(s[1:-1]) else: return max(lps(s[:-1]), lps(s[1:])) return L
"""Used to single sourcing metadata about caluma.""" __title__ = "caluma" __description__ = "Caluma Service providing GraphQL API" __version__ = "2.0.0"
"""Used to single sourcing metadata about caluma.""" __title__ = 'caluma' __description__ = 'Caluma Service providing GraphQL API' __version__ = '2.0.0'
#!/usr/bin/python def displayPathtoPrincess(n, grid): # print all the moves here counter = 1 for row in grid: if 'p' in row: px = row.index('p') + 1 py = n - counter + 1 if 'm' in row: mx = row.index('m') + 1 my = n - counter + 1 count...
def display_pathto_princess(n, grid): counter = 1 for row in grid: if 'p' in row: px = row.index('p') + 1 py = n - counter + 1 if 'm' in row: mx = row.index('m') + 1 my = n - counter + 1 counter += 1 dx = px - mx dy = py - my if...
def profile_update(request): user = request.user if request.method == 'POST': form = UpdateProfile( request.POST, request.FILES or None, instance=request.user,) if form.is_valid(): username = form.cleaned_data.get('username') obj = form.save(commit=False) ...
def profile_update(request): user = request.user if request.method == 'POST': form = update_profile(request.POST, request.FILES or None, instance=request.user) if form.is_valid(): username = form.cleaned_data.get('username') obj = form.save(commit=False) print...
try: error= open("dummy.txt","r") print(error.read())# perform file operations finally: error.close()
try: error = open('dummy.txt', 'r') print(error.read()) finally: error.close()
init_code = """ if not "Friends" in USER_GLOBAL: raise NotImplementedError("Where is 'Friends'?") Friends = USER_GLOBAL['Friends'] """ PASS_CODE = """ RET['code_result'] = True, "Ok" """ def prepare_test(middle_code, test_code, show_code, show_answer): if show_code is None: show_code = middle_code ...
init_code = '\nif not "Friends" in USER_GLOBAL:\n raise NotImplementedError("Where is \'Friends\'?")\n\nFriends = USER_GLOBAL[\'Friends\']\n' pass_code = '\nRET[\'code_result\'] = True, "Ok"\n' def prepare_test(middle_code, test_code, show_code, show_answer): if show_code is None: show_code = middle_cod...
__author__ = 'Sushant' class ClusterIndices(object): @staticmethod def calculate_EI_index(graph, cluster_nodes, standardize=True): all_edges = graph.get_edges() external_connections_strength = 0.0 internal_connections_strength = 0.0 internal_nodes = len(cluster_nodes) e...
__author__ = 'Sushant' class Clusterindices(object): @staticmethod def calculate_ei_index(graph, cluster_nodes, standardize=True): all_edges = graph.get_edges() external_connections_strength = 0.0 internal_connections_strength = 0.0 internal_nodes = len(cluster_nodes) e...
num = int(input('Enter a number: ')) x = 0 y = 1 # 0 1 1 2 3 5 7 z = x + y for i in range(num): print(z) x = y y = z z = x + y
num = int(input('Enter a number: ')) x = 0 y = 1 z = x + y for i in range(num): print(z) x = y y = z z = x + y
# This is an input class. Do not edit. class BinaryTree: def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right # Solution # O(n) time / O(h) space # n - number of nodes in the binary tree # h - height of the binary tree class TreeInfo: ...
class Binarytree: def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right class Treeinfo: def __init__(self, isBalanced, height): self.isBalanced = isBalanced self.height = height def height_balanced_binary_tree(tree): ...
''' 33. Search in Rotated Sorted Array Medium Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. You may assume no du...
""" 33. Search in Rotated Sorted Array Medium Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. You may assume no du...
load("@wix_oss_infra//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external") def dependencies(): import_external( name = "com_fasterxml_jackson_core_jackson_annotations", artifact = "com.fasterxml.jackson.core:jackson-annotations:2.9.0", artifact_sha256 = "45d32ac...
load('@wix_oss_infra//:import_external.bzl', import_external='safe_wix_scala_maven_import_external') def dependencies(): import_external(name='com_fasterxml_jackson_core_jackson_annotations', artifact='com.fasterxml.jackson.core:jackson-annotations:2.9.0', artifact_sha256='45d32ac61ef8a744b464c54c2b3414be571016dd4...
uni_cars = set() while True: command = input() if command == 'END': break else: direction, plate = command.split(', ') if direction == 'IN': uni_cars.add(plate) elif direction == 'OUT': if plate in uni_cars: uni_cars.remove(p...
uni_cars = set() while True: command = input() if command == 'END': break else: (direction, plate) = command.split(', ') if direction == 'IN': uni_cars.add(plate) elif direction == 'OUT': if plate in uni_cars: uni_cars.remove(plate) if ...
#!/usr/bin/env python # -*- coding: utf-8 -*- spinMultiplicity = 2 opticalIsomers = 1 energy = { 'CCSD(T)-F12/cc-pVTZ-F12': MolproLog('TS8c_f12.out'), #'CCSD(T)-F12/cc-pVTZ-F12': -382.9338341073141 } frequencies = GaussianLog('TSfreq.log') rotors = [HinderedRotor(scanLog=ScanLog('scan_0.log'), ...
spin_multiplicity = 2 optical_isomers = 1 energy = {'CCSD(T)-F12/cc-pVTZ-F12': molpro_log('TS8c_f12.out')} frequencies = gaussian_log('TSfreq.log') rotors = [hindered_rotor(scanLog=scan_log('scan_0.log'), pivots=[6, 7], top=[7, 16]), hindered_rotor(scanLog=scan_log('scan_1.log'), pivots=[2, 3], top=[3, 11, 12, 13], sym...
def arrayMode(sequence): count = [] answer = 0 for i in range(10): count.append(0) for i in range(len(sequence)): count[sequence[i] - 1] += 1 if count[sequence[i] - 1] > count[answer]: answer = sequence[i] - 1 return answer+1
def array_mode(sequence): count = [] answer = 0 for i in range(10): count.append(0) for i in range(len(sequence)): count[sequence[i] - 1] += 1 if count[sequence[i] - 1] > count[answer]: answer = sequence[i] - 1 return answer + 1
async def get_params(request): method = request.method if method == 'POST': params = await request.post() elif method == 'GET': params = request.rel_url.query else: raise ValueError("Unsupported HTTP method: %s" % method) return params
async def get_params(request): method = request.method if method == 'POST': params = await request.post() elif method == 'GET': params = request.rel_url.query else: raise value_error('Unsupported HTTP method: %s' % method) return params
def maybeBuildTrap(x, y): hero.moveXY(x, y) if hero.findNearestEnemy(): hero.buildXY("fire-trap", x, y) while True: maybeBuildTrap(20, 34) maybeBuildTrap(38, 20) maybeBuildTrap(68, 34)
def maybe_build_trap(x, y): hero.moveXY(x, y) if hero.findNearestEnemy(): hero.buildXY('fire-trap', x, y) while True: maybe_build_trap(20, 34) maybe_build_trap(38, 20) maybe_build_trap(68, 34)
def binary_search(array, x, low, high): while low < high: mid = low + (high - low)//2 if array[mid] == x: return mid elif array[mid] < x: low = mid + 1 else: high = mid - 1 return -1 array = [12, 15, 17, 24, 56, 89, 90] x = 24 result = bina...
def binary_search(array, x, low, high): while low < high: mid = low + (high - low) // 2 if array[mid] == x: return mid elif array[mid] < x: low = mid + 1 else: high = mid - 1 return -1 array = [12, 15, 17, 24, 56, 89, 90] x = 24 result = binary...
print ("hola word") nome = input('Nome: ') sobrenome = input() email = input () print (nome,"\n Sobrenome:",sobrenome,"\n E-mail:",email)
print('hola word') nome = input('Nome: ') sobrenome = input() email = input() print(nome, '\n Sobrenome:', sobrenome, '\n E-mail:', email)
# coding: utf-8 n = int(input()) d = [int(i) for i in input().split()] s, t = [int(i) for i in input().split()] if s > t: s, t = t, s circu = sum(d) len1 = sum(d[s-1:t-1]) len2 = circu-len1 print(min(len1,len2))
n = int(input()) d = [int(i) for i in input().split()] (s, t) = [int(i) for i in input().split()] if s > t: (s, t) = (t, s) circu = sum(d) len1 = sum(d[s - 1:t - 1]) len2 = circu - len1 print(min(len1, len2))
#makes a smaller dataset for testing n = 20000 with open("tests/data/combined_data_3.txt", "r") as f: lines = f.readlines() print(len(lines)) with open("tests/data/combined_data_3_small.txt", "w") as f: for i in range(n): f.write(lines[i])
n = 20000 with open('tests/data/combined_data_3.txt', 'r') as f: lines = f.readlines() print(len(lines)) with open('tests/data/combined_data_3_small.txt', 'w') as f: for i in range(n): f.write(lines[i])
class WorkflowCommand(object): def __init__(self, command, arguments): self._command = command self._arguments = arguments def encode(self): return {'command': self._command, 'arguments': self._arguments} class SkipPhasesUntilCommand(WorkflowCommand): COMMAND = 'skip_phases_until'...
class Workflowcommand(object): def __init__(self, command, arguments): self._command = command self._arguments = arguments def encode(self): return {'command': self._command, 'arguments': self._arguments} class Skipphasesuntilcommand(WorkflowCommand): command = 'skip_phases_until'...
#TODO move whole class to IBDT.py MOVEMENT = {'FIXATION':0, 'SACCADE':1, 'PURSUIT':2, 'NOISE':3, 'UNDEF':4 } class GazeDataEntry(): """Helper class IS a data sample with only 4 values: timestamp, eyetracking quality confidence, X and Y coordina...
movement = {'FIXATION': 0, 'SACCADE': 1, 'PURSUIT': 2, 'NOISE': 3, 'UNDEF': 4} class Gazedataentry: """Helper class IS a data sample with only 4 values: timestamp, eyetracking quality confidence, X and Y coordinates. """ def __init__(self, ts: float, confidence: float, x: float, y: float): se...
# # O(n^2) time | O(n) space # brute force class MyClass: def __init__(self, string:str) -> bool: self.string = string def isPalindrome(self): reversedString = "" for i in reversed(range(len(self.string))): reversedString += self.string[i] # creating newString -> increase...
class Myclass: def __init__(self, string: str) -> bool: self.string = string def is_palindrome(self): reversed_string = '' for i in reversed(range(len(self.string))): reversed_string += self.string[i] return self.string == reversedString def main(): string_name...
#1 def RemoveDuplicates(arr: list) -> list: if len(arr) <= 1: return arr else: i = 1 n = len(arr) while i < n : if arr[i] == arr[i-1]: arr.pop(i) n -= 1 continue i += 1 return arr print(RemoveDuplicates([1,1,1,1,1,1,1,1,1,2,3,4,5,5,5,6,6,7,8]))
def remove_duplicates(arr: list) -> list: if len(arr) <= 1: return arr else: i = 1 n = len(arr) while i < n: if arr[i] == arr[i - 1]: arr.pop(i) n -= 1 continue i += 1 return arr print(remove_duplicates([...
def potencia(func): def wrapper(voltaje, resistencia): intensidad = func(voltaje, resistencia) potencia = intensidad*voltaje print(f"La intensidad es {intensidad} A") print(f"La potencia es {potencia} W") return wrapper @potencia def corriente(voltaje, resistencia): return v...
def potencia(func): def wrapper(voltaje, resistencia): intensidad = func(voltaje, resistencia) potencia = intensidad * voltaje print(f'La intensidad es {intensidad} A') print(f'La potencia es {potencia} W') return wrapper @potencia def corriente(voltaje, resistencia): retur...
Pi1 ='10.0.0.1' Pi2 ='10.0.0.2' Pi3 ='10.0.0.3' Pi4 ='10.0.0.4' Pi5 ='10.0.0.5' Pi6 ='10.0.0.6' GW1 ='10.0.0.8' GW2 ='10.0.0.9' R1=[GW1,Pi1] R2=[GW1,Pi4] R3=[Pi1,Pi4] R4=[Pi1,Pi2] R5=[Pi4,Pi5] R6=[Pi2,Pi5] R7=[Pi3,Pi2] R8=[Pi6,Pi5] R9=[Pi3,Pi6] R10=[GW2,Pi3] R11=[GW2,Pi6] N = 10 S1=[R1] S2=[R2] S3=[R3,R9] S4=[R4] S5...
pi1 = '10.0.0.1' pi2 = '10.0.0.2' pi3 = '10.0.0.3' pi4 = '10.0.0.4' pi5 = '10.0.0.5' pi6 = '10.0.0.6' gw1 = '10.0.0.8' gw2 = '10.0.0.9' r1 = [GW1, Pi1] r2 = [GW1, Pi4] r3 = [Pi1, Pi4] r4 = [Pi1, Pi2] r5 = [Pi4, Pi5] r6 = [Pi2, Pi5] r7 = [Pi3, Pi2] r8 = [Pi6, Pi5] r9 = [Pi3, Pi6] r10 = [GW2, Pi3] r11 = [GW2, Pi6] n = 10...
def read_data(): with open ('input.txt') as f: data = f.readlines() return [d.strip() for d in data] def write_data(data): with open('output.txt','w') as f: for d in data: f.write(str(d)+'\n') # the magic function that makes it all work. # wow, it took forever to get this right. def recursive_constru...
def read_data(): with open('input.txt') as f: data = f.readlines() return [d.strip() for d in data] def write_data(data): with open('output.txt', 'w') as f: for d in data: f.write(str(d) + '\n') def recursive_construct(L): poss = [] if len(L) == 1: for ell in L:...
def should_discard_line(l): patterns = ['${PROJECT_NAME}_tests', '${PROJECT_NAME}_cli', '${PROJECT_NAME}_shared', 'CONFIGURATION_DUMMY'] for p in patterns: if p in l: return True return False f = open('botan/CMakeLists.txt', 'r') content = f.read() f.close() f = open('botan/CMakeLists.txt', 'w') for l in co...
def should_discard_line(l): patterns = ['${PROJECT_NAME}_tests', '${PROJECT_NAME}_cli', '${PROJECT_NAME}_shared', 'CONFIGURATION_DUMMY'] for p in patterns: if p in l: return True return False f = open('botan/CMakeLists.txt', 'r') content = f.read() f.close() f = open('botan/CMakeLists.tx...
"""Stores some global constants, mostly to save on a lot of repetitive arguments. These are mostly of interest for demonstrating different variants of the algorithms as discussed in the accompanying article.""" # Both marching cube and dual contouring are adaptive, i.e. they select # the vertex that best describes th...
"""Stores some global constants, mostly to save on a lot of repetitive arguments. These are mostly of interest for demonstrating different variants of the algorithms as discussed in the accompanying article.""" adaptive = True clip = False boundary = True bias = True bias_strength = 0.01 xmin = -3 xmax = 3 ymin = -3 ym...
class phase_cavity_sys: def __init__(self): """Creating all the variables that are common to all phase cavities""" self.Prog_name = [] self.Cav_Set = [] # Number of pairs of pcavs really two caviy makes up one system self.Cav_Num = [] # Number of cavities self.Cav_RF_Freq = [] # Cavity RF frequency self....
class Phase_Cavity_Sys: def __init__(self): """Creating all the variables that are common to all phase cavities""" self.Prog_name = [] self.Cav_Set = [] self.Cav_Num = [] self.Cav_RF_Freq = [] self.Cav_LO_Freq = [] self.Cav_IF_Freq = [] self.Cav_REF_F...
class Solution: # @param {integer} numRows # @return {integer[][]} def generate(self, numRows): res = [] row = [] for i in range(0,numRows): n = len(row) row =[1]+[row[j-1] + (row[j] if j<n else 0) for j in range(1,n+1)] res.append(row) ret...
class Solution: def generate(self, numRows): res = [] row = [] for i in range(0, numRows): n = len(row) row = [1] + [row[j - 1] + (row[j] if j < n else 0) for j in range(1, n + 1)] res.append(row) return res
def main(x): max_test = 2000 is_negative = False if (x < 0): is_negative = True x = abs(x) x = round(x, 16) test = int(x - 1) for i in range (test, max_test): for j in range (1, max_test): if (x == i/j): if is_negative: print('-...
def main(x): max_test = 2000 is_negative = False if x < 0: is_negative = True x = abs(x) x = round(x, 16) test = int(x - 1) for i in range(test, max_test): for j in range(1, max_test): if x == i / j: if is_negative: print('-', e...
#!/home/jepoy/anaconda3/bin/python def main(): f = open('lines.txt', 'r') # 'w' write - rewrites over the file # a append add to the end of the file for line in f: print(line.rstrip()) f.close() if __name__ == '__main__': main()
def main(): f = open('lines.txt', 'r') for line in f: print(line.rstrip()) f.close() if __name__ == '__main__': main()
class TrackingFieldsMixin: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._old_fields = {} self._set_old_fields() def save(self, force_insert=False, force_update=False, using=None, update_fields=None): result = super().save(force_insert, force_updat...
class Trackingfieldsmixin: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._old_fields = {} self._set_old_fields() def save(self, force_insert=False, force_update=False, using=None, update_fields=None): result = super().save(force_insert, force_updat...
_PAD = "_PAD" _GO = "_GO" _EOS = "_EOS" _UNK = "_UNK" _START_VOCAB = [_PAD, _GO, _EOS, _UNK] PAD_ID = 0 GO_ID = 1 EOS_ID = 2 UNK_ID = 3 OP_DICT_IDS = [PAD_ID, GO_ID, EOS_ID, UNK_ID]
_pad = '_PAD' _go = '_GO' _eos = '_EOS' _unk = '_UNK' _start_vocab = [_PAD, _GO, _EOS, _UNK] pad_id = 0 go_id = 1 eos_id = 2 unk_id = 3 op_dict_ids = [PAD_ID, GO_ID, EOS_ID, UNK_ID]
"""Subcommand won't stop complaining about jupyterlab-git.""" # Configuration file for jupyter serverextension. # ------------------------------------------------------------------------------ # Application(SingletonConfigurable) configuration # ------------------------------------------------------------------------...
"""Subcommand won't stop complaining about jupyterlab-git."""
fp = open('greetings.txt','w') fp.write("Hello, World!\n") fp.close()
fp = open('greetings.txt', 'w') fp.write('Hello, World!\n') fp.close()
def str_without_separators(sentence): #separators = ",.?;: " #str1 = "".join(char if char not in separators else "" for char in sentence) str1 = "".join(char if char.isalnum() else "" for char in sentence) return str1 def is_palindrome(sentence): str1 = str_without_separators(sentence) return...
def str_without_separators(sentence): str1 = ''.join((char if char.isalnum() else '' for char in sentence)) return str1 def is_palindrome(sentence): str1 = str_without_separators(sentence) return str1[::-1].casefold() == str1.casefold() print(is_palindrome('Was it a car, or a cat, I saw?'))
c = int(input('\nHow many rows do you want? ')) print() a = [[1]] for i in range(c): b = [1] for j in range(len(a[-1]) - 1): b.append(a[-1][j] + a[-1][j + 1]) b.append(1) a.append(b) for i in range(len(a)): for j in range(len(a[i])): a[i][j] = str(a[i][j]) d = ' '.join(a[i]) for ...
c = int(input('\nHow many rows do you want? ')) print() a = [[1]] for i in range(c): b = [1] for j in range(len(a[-1]) - 1): b.append(a[-1][j] + a[-1][j + 1]) b.append(1) a.append(b) for i in range(len(a)): for j in range(len(a[i])): a[i][j] = str(a[i][j]) d = ' '.join(a[i]) for ...
name = "pymum" version = "3" requires = ["pydad-3"]
name = 'pymum' version = '3' requires = ['pydad-3']
def proportion(a,b,c): try: a = int(a) b = int(b) c = int(c) ratio = a/b propor = c/ratio return propor except ZeroDivisionError: print("Error: Dividing by Zero is not valid!!") except ValueError: print ("Error: Only Numeric Values are valid!!"...
def proportion(a, b, c): try: a = int(a) b = int(b) c = int(c) ratio = a / b propor = c / ratio return propor except ZeroDivisionError: print('Error: Dividing by Zero is not valid!!') except ValueError: print('Error: Only Numeric Values are val...
datasets={'U1001': {'135058': 1,'135038': 3,'135032': 3,'135084': 2,'135076':2}, 'U1002': {'135058': 2,'135038': 2,'135032': 1,'135084': 1,'135076':3}, 'U1003': {'135058': 2,'135038': 1,'135032': 2,'135084': 3,'135076':3}, 'U1004': {'135058': 1,'135038': 3,'135032': 3,'135084': 3,'135076':3}, 'U1005': {'135058': 1...
datasets = {'U1001': {'135058': 1, '135038': 3, '135032': 3, '135084': 2, '135076': 2}, 'U1002': {'135058': 2, '135038': 2, '135032': 1, '135084': 1, '135076': 3}, 'U1003': {'135058': 2, '135038': 1, '135032': 2, '135084': 3, '135076': 3}, 'U1004': {'135058': 1, '135038': 3, '135032': 3, '135084': 3, '135076': 3}, 'U10...
def isolateData(selector,channel,labels,data): selected=[] for i in range(len(labels)): if labels[i]==selector: selected.append(data[str(i)+'c'+str(channel)])#epochs with class AGMSY5 return selected
def isolate_data(selector, channel, labels, data): selected = [] for i in range(len(labels)): if labels[i] == selector: selected.append(data[str(i) + 'c' + str(channel)]) return selected
#!/usr/bin/python3 class Material: def __init__(self, color): """ A material has color as basic propriety :param color: the color of the material """ self.color = color
class Material: def __init__(self, color): """ A material has color as basic propriety :param color: the color of the material """ self.color = color
# ,---------------------------------------------------------------------------, # | This module is part of the krangpower electrical distribution simulation | # | suit by Federico Rosato <federico.rosato@supsi.ch> et al. | # | Please refer to the license file published together with this code. | ...
class Associationerror(Exception): def __init__(self, association_target_type, association_target_name, association_subject_type, association_subject_name, msg=None): if msg is None: msg = 'krangpower does not know how to associate a {0}({1}) to a {2}({3})'.format(association_target_type, assoc...
factors_avro = { 'namespace': 'com.gilt.cerebro.job', 'type': 'record', 'name': 'AvroFactors', 'fields': [ {'name': 'id', 'type': 'string'}, {'name': 'factors', 'type': {'type': 'array', 'items': 'float'}}, {'name': 'bias', 'type': 'float'}, ...
factors_avro = {'namespace': 'com.gilt.cerebro.job', 'type': 'record', 'name': 'AvroFactors', 'fields': [{'name': 'id', 'type': 'string'}, {'name': 'factors', 'type': {'type': 'array', 'items': 'float'}}, {'name': 'bias', 'type': 'float'}]}
def fibonacci_number(num): f = 0 s = 1 for i in range(num + 1): if i <= 1: nxt = i else: nxt = f +s f = s s = nxt print (nxt) print(fibonacci_number(int(input("Enter the number:"))))
def fibonacci_number(num): f = 0 s = 1 for i in range(num + 1): if i <= 1: nxt = i else: nxt = f + s f = s s = nxt print(nxt) print(fibonacci_number(int(input('Enter the number:'))))
{ "cells": [ { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "ename": "ValueError", "evalue": "operands could not be broadcast together with shapes (4,) (100,) (4,) ", "output_type": "error", "traceback": [ "\u001b[0;31m--------------------------...
{'cells': [{'cell_type': 'code', 'execution_count': 13, 'metadata': {}, 'outputs': [{'ename': 'ValueError', 'evalue': 'operands could not be broadcast together with shapes (4,) (100,) (4,) ', 'output_type': 'error', 'traceback': ['\x1b[0;31m---------------------------------------------------------------------------\x1b...
''' You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2....
""" You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2....