content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Profiler(object): def __init__(self, config, paths): pass def dependencies(self): """Returns list of needed app dependencies,like com.quicinc.trepn, [] if none""" raise NotImplementedError def load(self, device): """Load (and start) the profiler process on the device...
class Profiler(object): def __init__(self, config, paths): pass def dependencies(self): """Returns list of needed app dependencies,like com.quicinc.trepn, [] if none""" raise NotImplementedError def load(self, device): """Load (and start) the profiler process on the device...
input = """ % map date to weekday (mon =1, ..., sun = 7); % The tour starts on Monday. weekday(1,1). weekday(D,W) :- D=D1+1, W=W1+1, weekday(D1,W1), W1 < 7. weekday(D,1) :- D=D1+1, weekday(D1,7). % connections with default costs (capitols of the Austrian federal states). conn(brg,ibk,2). conn(ibk,s...
input = '\n\n% map date to weekday (mon =1, ..., sun = 7);\n% The tour starts on Monday. \n\n weekday(1,1).\n weekday(D,W) :- D=D1+1, W=W1+1, weekday(D1,W1), W1 < 7.\n weekday(D,1) :- D=D1+1, weekday(D1,7).\n\n% connections with default costs (capitols of the Austrian federal states).\n\n conn(brg,ibk,2).\n conn(ibk,sb...
def lend_money(debts, person, amount): value = debts.get(person, 0) quantity = [amount] if value != 0: debts[person] = value + quantity else: debts[person] = quantity print(debts) def amount_owed_by(debts, person): value = debts.get(person, [0]) out = sum(va...
def lend_money(debts, person, amount): value = debts.get(person, 0) quantity = [amount] if value != 0: debts[person] = value + quantity else: debts[person] = quantity print(debts) def amount_owed_by(debts, person): value = debts.get(person, [0]) out = sum(value) return o...
kwh_used = 1000 out = 0 if(kwh_used < 500): out += 500 * 0.45 elif(kwh_used >= 500 and kwh_used < 1500): out += 500 * 0.45 + ((kwh_used - 500) * 0.74) elif(kwh_used >= 1500 and kwh_used < 2500): out += 500 * 0.45 + ((kwh_used - 500) * 0.74) + ((kwh_used - 1500) * 1.25) elif(kwh_used >= 2500): out += 50...
kwh_used = 1000 out = 0 if kwh_used < 500: out += 500 * 0.45 elif kwh_used >= 500 and kwh_used < 1500: out += 500 * 0.45 + (kwh_used - 500) * 0.74 elif kwh_used >= 1500 and kwh_used < 2500: out += 500 * 0.45 + (kwh_used - 500) * 0.74 + (kwh_used - 1500) * 1.25 elif kwh_used >= 2500: out += 500 * 0.45 + ...
def solution(A): list_range = len(A) difference_list = [] for p in range(1, list_range): post_sum = sum(A[p:]) behind_sum = sum(A[:p]) difference = behind_sum - post_sum if difference < 0: difference *= -1 difference_list.append(difference) retur...
def solution(A): list_range = len(A) difference_list = [] for p in range(1, list_range): post_sum = sum(A[p:]) behind_sum = sum(A[:p]) difference = behind_sum - post_sum if difference < 0: difference *= -1 difference_list.append(difference) return min(...
def heapify(heap, root): newRoot = root leftChild = 2*root+1 rightChild = 2*root+2 if leftChild < len(heap) and heap[leftChild] > heap[newRoot]: newRoot = leftChild if rightChild < len(heap) and heap[rightChild] > heap[newRoot]: newRoot = rightChild if root!=newRoot: heap[root],heap[newRoot]=heap[newRoot],h...
def heapify(heap, root): new_root = root left_child = 2 * root + 1 right_child = 2 * root + 2 if leftChild < len(heap) and heap[leftChild] > heap[newRoot]: new_root = leftChild if rightChild < len(heap) and heap[rightChild] > heap[newRoot]: new_root = rightChild if root != newRoo...
EXAMPLES1 = ( ('1122', 3), ('1111', 4), ('1234', 0), ('91212129', 9) ) EXAMPLES2 = ( ('1212', 6), ('1221', 0), ('123425', 4), ('123123', 12), ('12131415', 4) ) INPUT = '31813174349235972159811869755166343882958376474278437681632495222499211488649543755655138842553...
examples1 = (('1122', 3), ('1111', 4), ('1234', 0), ('91212129', 9)) examples2 = (('1212', 6), ('1221', 0), ('123425', 4), ('123123', 12), ('12131415', 4)) input = '31813174349235972159811869755166343882958376474278437681632495222499211488649543755655138842553867246131245462881756862736922925752647341673342756514856663...
""" Provide the class Message and its subclasses. """ class Message(object): message = '' message_args = () def __init__(self, filename, loc): self.filename = filename self.lineno = loc.lineno self.col = getattr(loc, 'col_offset', 0) def __str__(self): return '%s:%s: ...
""" Provide the class Message and its subclasses. """ class Message(object): message = '' message_args = () def __init__(self, filename, loc): self.filename = filename self.lineno = loc.lineno self.col = getattr(loc, 'col_offset', 0) def __str__(self): return '%s:%s: %...
p = np.eye(3)[y][:, None] grad_d = q - p grad_C = grad_d @ U.T grad_b = (C.T @ grad_d ) * Drelu(A@x+b) grad_A = grad_b @ x.T
p = np.eye(3)[y][:, None] grad_d = q - p grad_c = grad_d @ U.T grad_b = C.T @ grad_d * drelu(A @ x + b) grad_a = grad_b @ x.T
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file class MandatoryOptions(object): def __init__(self,options): self.options=options def __getattr__(self,name): call=getattr(self.options,name) def require(*args,**kwargs): value=call(*args,*...
class Mandatoryoptions(object): def __init__(self, options): self.options = options def __getattr__(self, name): call = getattr(self.options, name) def require(*args, **kwargs): value = call(*args, **kwargs) if not value: raise runtime_error('WT...
class Queue(): # Queue Initialization def __init__(self): self.MAX = 5 self.queue = [] # OVERFLOW CONDITION def OVERFLOW(self): if len(self.queue) == self.MAX: return True else: return False # UNDERFLOW CONDITION def UNDERFLOW(self): if len(self.queue) == 0: return True else: return Fals...
class Queue: def __init__(self): self.MAX = 5 self.queue = [] def overflow(self): if len(self.queue) == self.MAX: return True else: return False def underflow(self): if len(self.queue) == 0: return True else: ...
# input N, X, r = map(int, input().split()) MOD = pow(10, 9) # compute # output print(X * (pow(r, N, MOD) - 1) % MOD)
(n, x, r) = map(int, input().split()) mod = pow(10, 9) print(X * (pow(r, N, MOD) - 1) % MOD)
class Solution(object): def subtractProductAndSum(self, n): """ :type n: int :rtype: int """ prod = 1 n = [int(x) for x in list(str(n))] for i in n: prod *= i return prod - sum(n) if __name__ == '__main__': obj = Solution() n = 10...
class Solution(object): def subtract_product_and_sum(self, n): """ :type n: int :rtype: int """ prod = 1 n = [int(x) for x in list(str(n))] for i in n: prod *= i return prod - sum(n) if __name__ == '__main__': obj = solution() n = ...
boys = ['John', 'Jack', 'Jeremy'] girls = ['Mary', 'Nancy', 'Joyce'] names = [*boys, *girls]
boys = ['John', 'Jack', 'Jeremy'] girls = ['Mary', 'Nancy', 'Joyce'] names = [*boys, *girls]
''' @author: Sevval MEHDER Filling one cell: O(1) Filling all cells: O(2xn) = O(n) ''' def find_maximum_cost(Y): values = [[0 for _ in range(2)] for _ in range(len(Y))] # Go on with adding these 2 options i = 1 while i < len(Y): # Put these two options values[i][0] =...
""" @author: Sevval MEHDER Filling one cell: O(1) Filling all cells: O(2xn) = O(n) """ def find_maximum_cost(Y): values = [[0 for _ in range(2)] for _ in range(len(Y))] i = 1 while i < len(Y): values[i][0] = max(values[i - 1][0], values[i - 1][1] + Y[i - 1] - 1) values[i][1] =...
""" Geometry and colour info. @author Li Xiao-Tian """ class Point2d(): def __init__(self, x, y): self.x = x; self.y = y; COLOURS = { 'u': '#A9A9A9', 'w': '#F9F9F9', 'r': '#D8251A', 'b': '#0194dd', 'g': '#2EFE2E', 'o': '#F0A226', 'y': '#FFFF00', } class Col...
""" Geometry and colour info. @author Li Xiao-Tian """ class Point2D: def __init__(self, x, y): self.x = x self.y = y colours = {'u': '#A9A9A9', 'w': '#F9F9F9', 'r': '#D8251A', 'b': '#0194dd', 'g': '#2EFE2E', 'o': '#F0A226', 'y': '#FFFF00'} class Colourscheme: """ Colour of...
def can_build(plat): return (plat == "android") def configure(env): if env["platform"] == "android": # Amazon dependencies env.android_add_dependency("compile fileTree(dir: '../../../modules/godotamazon/android/lib/', include: ['*.jar'])") env.android_add_java_dir("android/src") ...
def can_build(plat): return plat == 'android' def configure(env): if env['platform'] == 'android': env.android_add_dependency("compile fileTree(dir: '../../../modules/godotamazon/android/lib/', include: ['*.jar'])") env.android_add_java_dir('android/src') env.android_add_res_dir('res') ...
"""Wrapper class for DNS actions""" class ZoneController(object): def __init__(self, zone): """Initialize zone controller given a zone""" self.zone = zone def create_zone(self, **kwargs): """Create a zone under the specific cloud""" return self.zone.cloud.ctl.dns.create_zone(...
"""Wrapper class for DNS actions""" class Zonecontroller(object): def __init__(self, zone): """Initialize zone controller given a zone""" self.zone = zone def create_zone(self, **kwargs): """Create a zone under the specific cloud""" return self.zone.cloud.ctl.dns.create_zone(s...
"""Migration for a given Submitty course database.""" def up(config, database, semester, course): """ Run up migration. :param config: Object holding configuration details about Submitty :type config: migrator.config.Config :param database: Object for interacting with given database for environme...
"""Migration for a given Submitty course database.""" def up(config, database, semester, course): """ Run up migration. :param config: Object holding configuration details about Submitty :type config: migrator.config.Config :param database: Object for interacting with given database for environmen...
# by Kami Bigdely # Inline method. # TODO: Refactor this program to improve its readability. class Person: def __init__(self, my_age): self.age = my_age self.LEGAL_DRINKING_AGE = 18 def enter_night_club(self, my_age): if older_than_18_year_old(my_age): print("Allowed to ent...
class Person: def __init__(self, my_age): self.age = my_age self.LEGAL_DRINKING_AGE = 18 def enter_night_club(self, my_age): if older_than_18_year_old(my_age): print('Allowed to enter.') else: print('Enterance of minors is denited.') def older_than_...
# Copyright (c) 2017 Dustin Doloff # Licensed under Apache License v2.0 load( "//assert:assert.bzl", "assert_equal", ) load( "//control_flow:control_flow.bzl", "while_loop", ) def run_all_tests(): test_while_loop() def incr(state): if type(state) == "dict": state["incr_calls"] = state...
load('//assert:assert.bzl', 'assert_equal') load('//control_flow:control_flow.bzl', 'while_loop') def run_all_tests(): test_while_loop() def incr(state): if type(state) == 'dict': state['incr_calls'] = state.get('incr_calls', 0) + 1 state['value'] += 1 else: state += 1 return s...
fixed_time_entries = [{'stop': '2018-03-05T18:08:21+00:00', 'at': '2018-03-05T18:08:21+00:00', 'duration': 70, 'guid': '68c5136314e9680a54d0a28508139836', 'start': '2018-03-05T18:08:15+00:00', 'id': 1, 'description': 'task-1', 'duronly': False, 'uid': 2488778, 'billable': F...
fixed_time_entries = [{'stop': '2018-03-05T18:08:21+00:00', 'at': '2018-03-05T18:08:21+00:00', 'duration': 70, 'guid': '68c5136314e9680a54d0a28508139836', 'start': '2018-03-05T18:08:15+00:00', 'id': 1, 'description': 'task-1', 'duronly': False, 'uid': 2488778, 'billable': False, 'wid': 1688309}, {'stop': '2018-03-05T18...
#!/usr/bin/env python # # Copyright 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 requir...
"""Setup args. Defines the setup arg parser that holds setup specific args. """ cmd_setup = 'setup' def get_setup_arg_parser(subparser): """Return the setup arg parser. Args: subparser: argparse.ArgumentParser that is attached to main acloud cmd. Returns: argparse.ArgumentParser with setu...
# from django.conf.urls import url, include # from rest_framework import routers # from planex.site import views # router = routers.SimpleRouter() # router.register(r'pages', views.PageViewSet, basename='pages') # router.register(r'documents', views.DocumentViewSet, basename='documents') urlpatterns = [] # url(r'^...
urlpatterns = []
def solution(phone_book): answer = True phone_book = sorted(phone_book, key=(lambda x: len(x))) for i, item in enumerate(phone_book): for j in range(0, i): if item.find(phone_book[j])==0: return False return answer
def solution(phone_book): answer = True phone_book = sorted(phone_book, key=lambda x: len(x)) for (i, item) in enumerate(phone_book): for j in range(0, i): if item.find(phone_book[j]) == 0: return False return answer
lst2 = list(map(lambda x: 2 ** x, range(5))) print(lst2) for i in list(map(lambda x: x ** 2, lst2)): print(i, end=" ") print() print(list(map(lambda x: 1 if x % 2 == 0 else 0, lst2)))
lst2 = list(map(lambda x: 2 ** x, range(5))) print(lst2) for i in list(map(lambda x: x ** 2, lst2)): print(i, end=' ') print() print(list(map(lambda x: 1 if x % 2 == 0 else 0, lst2)))
class Viewport_Mixin(object): """ Mixin to help move around the image """ def update(self): """ Call update to get fresh data. """ pass def reset(self): """ Reset the viewport """ self._position = (0, 0) def set_position(self, xy): self._position = xy def move_left(self)...
class Viewport_Mixin(object): """ Mixin to help move around the image """ def update(self): """ Call update to get fresh data. """ pass def reset(self): """ Reset the viewport """ self._position = (0, 0) def set_position(self, xy): self._position = ...
# # Copyright 2013-2022 The Foundry Visionmongers Ltd # # 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 app...
""" Fixtures for executeSuiteTests.py """ fixtures = {'identifier': 'org.openassetio.test.manager.stubManager', 'Test_executeSuite_fixtures': {'test_when_test_function_is_run_then_fixtures_are_those_for_the_test': {'aUniqueValue': 5}}, 'Test_executeSuite_with_case_fixtures': {'non_existant_test': {}}}
# -*- coding: utf-8 -*- """Top-level package for Pytropic.""" __author__ = """Will Fitzgerald""" __email__ = 'will.fitzgerald@gmail.com' __version__ = '0.1.0'
"""Top-level package for Pytropic.""" __author__ = 'Will Fitzgerald' __email__ = 'will.fitzgerald@gmail.com' __version__ = '0.1.0'
# encoding: UTF-8 LOADING_ERROR = 'Error occurred when loading the config file, please check.' CONFIG_KEY_MISSING = 'Key missing in the config file, please check.' DATA_SERVER_CONNECTED = 'Data server connected.' DATA_SERVER_DISCONNECTED = 'Data server disconnected' DATA_SERVER_LOGIN = 'Data server login compl...
loading_error = 'Error occurred when loading the config file, please check.' config_key_missing = 'Key missing in the config file, please check.' data_server_connected = 'Data server connected.' data_server_disconnected = 'Data server disconnected' data_server_login = 'Data server login completed.' data_server_logout =...
# -*- coding: utf-8 -*- """ Created on Sat Oct 3 10:06:06 2020 @author: Tarun Jaiswal """ x1=range(10) print(x1) x2=range(2,10) print(x2) x3=range(2,10,3) print(x3) print("X1=",end="") for item in x1: print(item,end=",") print("X2=") for item in x2: print(item,end=",") print("X3=",end="") for item in x3: ...
""" Created on Sat Oct 3 10:06:06 2020 @author: Tarun Jaiswal """ x1 = range(10) print(x1) x2 = range(2, 10) print(x2) x3 = range(2, 10, 3) print(x3) print('X1=', end='') for item in x1: print(item, end=',') print('X2=') for item in x2: print(item, end=',') print('X3=', end='') for item in x3: print(item,...
GPIO_BASE_PATH = "/sys/class/gpio" MOTOR_PIN = "13" PIR_PIN = "12" DONALD_TRACK = "donald_duck.mp3"
gpio_base_path = '/sys/class/gpio' motor_pin = '13' pir_pin = '12' donald_track = 'donald_duck.mp3'
# # @lc app=leetcode id=717 lang=python3 # # [717] 1-bit and 2-bit Characters # # https://leetcode.com/problems/1-bit-and-2-bit-characters/description/ # # algorithms # Easy (49.13%) # Likes: 325 # Dislikes: 844 # Total Accepted: 52.5K # Total Submissions: 107K # Testcase Example: '[1,0,0]' # # We have two speci...
class Solution: def is_one_bit_character(self, bits: List[int]) -> bool: i = 0 n = len(bits) if n <= 1: return True while i < n: if bits[i] == 0: i += 1 else: i += 2 if i == n - 1: return...
ACRONYM = "BSC" def transcription_factor_regulatory_site(**identifier_properties): unique_data_string = [ identifier_properties.get("absolutePosition", "NoAbsolutePosition"), identifier_properties.get("leftEndPosition", "NoLEND"), identifier_properties.get("rightEndPosition", "NoREND") ...
acronym = 'BSC' def transcription_factor_regulatory_site(**identifier_properties): unique_data_string = [identifier_properties.get('absolutePosition', 'NoAbsolutePosition'), identifier_properties.get('leftEndPosition', 'NoLEND'), identifier_properties.get('rightEndPosition', 'NoREND')] return unique_data_strin...
""" Bool : Whether it is True or False True / False if string, list, tuple, dictionary are empty (don't have element) it is False. also 'None' is false, too Contents Source : https://wikidocs.net/17 """
""" Bool : Whether it is True or False True / False if string, list, tuple, dictionary are empty (don't have element) it is False. also 'None' is false, too Contents Source : https://wikidocs.net/17 """
""" Example dataset fetching utility. Used in docs. """ src = 'https://raw.githubusercontent.com/ResidentMario/geoplot-data/master' def get_path(dataset_name): """ Returns the URL path to an example dataset suitable for reading into ``geopandas``. """ if dataset_name == 'usa_cities': return f...
""" Example dataset fetching utility. Used in docs. """ src = 'https://raw.githubusercontent.com/ResidentMario/geoplot-data/master' def get_path(dataset_name): """ Returns the URL path to an example dataset suitable for reading into ``geopandas``. """ if dataset_name == 'usa_cities': return f'{...
# -*- coding: utf-8 -*- # @Time : 2019/10/15 0015 16:21 # @Author : Erichym # @Email : 951523291@qq.com # @File : 520.py # @Software: PyCharm class Solution: def detectCapitalUse(self, word: str) -> bool: if 97<=ord(word[0])<=122: for i in range(1,len(word),1): if ord(wo...
class Solution: def detect_capital_use(self, word: str) -> bool: if 97 <= ord(word[0]) <= 122: for i in range(1, len(word), 1): if ord(word[i]) > 122 or ord(word[i]) < 97: return False return True elif len(word) > 1: if 65 <= o...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class RubyErubis(RubyPackage): """Erubis is a fast, secure, and very extensible implementation of eRuby. """ ...
class Rubyerubis(RubyPackage): """Erubis is a fast, secure, and very extensible implementation of eRuby. """ homepage = 'http://www.kuwata-lab.com/erubis/' git = 'https://github.com/kwatch/erubis.git' version('master', branch='master') version('2.7.0', commit='14d3eab57fbc361312c8f3af350cbf9a5ba...
def waxs_S_edge_guil(t=1): dets = [pil300KW] names = ['sample02', 'sample03', 'sample04', 'sample05', 'sample06', 'sample07', 'sample08', 'sample09', 'sample10', 'sample11', 'sample12'] x = [26500, 21500, 16000, 10500, 5000, 0, -5500, -10500, 16000, -21000, -26500]#, -34000, -41000] y = [600, 600,...
def waxs_s_edge_guil(t=1): dets = [pil300KW] names = ['sample02', 'sample03', 'sample04', 'sample05', 'sample06', 'sample07', 'sample08', 'sample09', 'sample10', 'sample11', 'sample12'] x = [26500, 21500, 16000, 10500, 5000, 0, -5500, -10500, 16000, -21000, -26500] y = [600, 600, 800, 700, 700, 600, 600...
class ThePhantomMenace: def find(self, doors, droids): greatest_min = -1 best_door = doors[0] for idx, door in enumerate(doors): greatest_distance = 9999 for droid in droids: distance = abs(droid - door) if distance < greatest_dista...
class Thephantommenace: def find(self, doors, droids): greatest_min = -1 best_door = doors[0] for (idx, door) in enumerate(doors): greatest_distance = 9999 for droid in droids: distance = abs(droid - door) if distance < greatest_distan...
def get_index_of(sequence, item): for i in range(len(sequence)): if sequence[i] == item: return i numbers = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] thirteenIndex = get_index_of(numbers, 13) print("13 is at:", thirteenIndex)
def get_index_of(sequence, item): for i in range(len(sequence)): if sequence[i] == item: return i numbers = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] thirteen_index = get_index_of(numbers, 13) print('13 is at:', thirteenIndex)
num1 =100 num2 = 200 num3 = 300 num5 =500
num1 = 100 num2 = 200 num3 = 300 num5 = 500
# pw2wannier stores the k index in 4 digits, which crashes computations on grids larger than 9999. This fixes it. f = open("silicon.amn") out = open("silicon.amn.new", "w") out.write(f.readline()) out.write(f.readline()) for line in f: line = line[0:10] + " " + line[10:] out.write(line) f = open("silicon....
f = open('silicon.amn') out = open('silicon.amn.new', 'w') out.write(f.readline()) out.write(f.readline()) for line in f: line = line[0:10] + ' ' + line[10:] out.write(line) f = open('silicon.mmn') out = open('silicon.mmn.new', 'w') out.write(f.readline()) out.write(f.readline()) i = 0 for line in f: if i %...
# Admin specfic links ADMIN_HANDLE = "@kwokyto" # Bot settings NUMBER_TO_NOTIFY = 5 NUMBER_TO_BUMP = 5 # Messages sent to the user INVALID_FORMAT_MESSAGE = "Simi? I can only read text, don't send me anything else." NO_COMMAND_MESSAGE = "What are you saying?? Send a proper command lah please." START_MESSAGE = "Harlo a...
admin_handle = '@kwokyto' number_to_notify = 5 number_to_bump = 5 invalid_format_message = "Simi? I can only read text, don't send me anything else." no_command_message = 'What are you saying?? Send a proper command lah please.' start_message = 'Harlo ah! Easy peasy, /join to join queue, or /help if you still blur.' he...
# dataset settings ann_type = 'tanz_base' # * _base or _evaluation videos_per_gpu_train = 8 if ann_type == 'tanz_base' else 4 workers_per_gpu_train = 1 num_classes = 9 if ann_type == 'tanz_base' else 42 ## * model settings model = dict( type='Recognizer3D', backbone=dict( type='ResNet3d', # p...
ann_type = 'tanz_base' videos_per_gpu_train = 8 if ann_type == 'tanz_base' else 4 workers_per_gpu_train = 1 num_classes = 9 if ann_type == 'tanz_base' else 42 model = dict(type='Recognizer3D', backbone=dict(type='ResNet3d', pretrained2d=True, pretrained='torchvision://resnet50', depth=50, conv_cfg=dict(type='Conv3d'), ...
class IFingerSetterService(Interface): def setUser(user, status): """Set the user's status to something""" # Advantages of latest version @implementer(IFingerService, IFingerSetterService) class MemoryFingerService(service.Service): def __init__(self, **kwargs): self.users = kwargs def ...
class Ifingersetterservice(Interface): def set_user(user, status): """Set the user's status to something""" @implementer(IFingerService, IFingerSetterService) class Memoryfingerservice(service.Service): def __init__(self, **kwargs): self.users = kwargs def get_user(self, user): r...
class Solution: MIN_VALUE = -(2 ** 31) MAX_VALUE = 2 ** 31 - 1 def myAtoi(self, string: str) -> int: try: return self._fit_in_range(self._parse_number(string)) except ValueError: return 0 def _parse_number(self, string: str) -> str: string = string.stri...
class Solution: min_value = -2 ** 31 max_value = 2 ** 31 - 1 def my_atoi(self, string: str) -> int: try: return self._fit_in_range(self._parse_number(string)) except ValueError: return 0 def _parse_number(self, string: str) -> str: string = string.strip(...
#Colors to be used in the plots color = ["#f94144","#f3722c","#f8961e","#f9c74f","#90be6d","#43aa8b","#577590"] sns.palplot(color)
color = ['#f94144', '#f3722c', '#f8961e', '#f9c74f', '#90be6d', '#43aa8b', '#577590'] sns.palplot(color)
class Shirt: def __init__(self, size, color): self.size = size.lower() self.color = color.lower() def __repr__(self): return str(self.size + "&" + self.color)
class Shirt: def __init__(self, size, color): self.size = size.lower() self.color = color.lower() def __repr__(self): return str(self.size + '&' + self.color)
def is_number(value): '''Checks if a string can be converted into a float (or int as a by product). Helper function for string_cols_to_numeric''' try: float(value) return True except ValueError: return False
def is_number(value): """Checks if a string can be converted into a float (or int as a by product). Helper function for string_cols_to_numeric""" try: float(value) return True except ValueError: return False
#!/usr/bin/python3 class strategyBase(object): def __init__(self): pass def _get_data(self): pass def _settle(self): pass if __name__ == "__main__": pass
class Strategybase(object): def __init__(self): pass def _get_data(self): pass def _settle(self): pass if __name__ == '__main__': pass
# by Kami Bigdely # Extract Class foods = {'butternut squash soup':[45, True, 'soup','North African',\ ['butter squash','onion','carrot', 'garlic','butter','black pepper', 'cinnamon','coconut milk']\ ,'1. Grill the butter squash, onion, carrot and garlic in the oven until' 'they get soft and g...
foods = {'butternut squash soup': [45, True, 'soup', 'North African', ['butter squash', 'onion', 'carrot', 'garlic', 'butter', 'black pepper', 'cinnamon', 'coconut milk'], '1. Grill the butter squash, onion, carrot and garlic in the oven untilthey get soft and golden on top 2. Put all in blender withbutter and coconut ...
def decimal_to_binary(num): if (num == 0): return 0 return num%2+10*decimal_to_binary(num//2) print(decimal_to_binary(2))
def decimal_to_binary(num): if num == 0: return 0 return num % 2 + 10 * decimal_to_binary(num // 2) print(decimal_to_binary(2))
# yacctab.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMODAUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EX...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMODAUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EXTERN FLOAT FOR GOTO IF INLINE INT LONG REGISTER OFFSETOF RESTRICT RET...
# -*- coding: utf-8 -*- __all__ = ['StatesSet'] class StatesSet: STATE, CAPTURED = range(2) def __init__(self): self._list = [] self._set = set() def __len__(self): return len(self._list) def __bool__(self): return bool(self._list) def __iter__(self): ...
__all__ = ['StatesSet'] class Statesset: (state, captured) = range(2) def __init__(self): self._list = [] self._set = set() def __len__(self): return len(self._list) def __bool__(self): return bool(self._list) def __iter__(self): yield from self._list ...
load("@rules_cc//cc:defs.bzl", "cc_library") # https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library cc_library( name = "cpp-utils", srcs = glob(["src/*.cpp"]), hdrs = glob(["inc/*.h"]), includes = ["inc"], visibility = ["//visibility:public"], deps = [ "@com_github_spdlog//...
load('@rules_cc//cc:defs.bzl', 'cc_library') cc_library(name='cpp-utils', srcs=glob(['src/*.cpp']), hdrs=glob(['inc/*.h']), includes=['inc'], visibility=['//visibility:public'], deps=['@com_github_spdlog//:spdlog', '@com_google_absl//absl/debugging:failure_signal_handler', '@com_google_absl//absl/debugging:stacktrace',...
#-*- coding: UTF-8 -*- class quick_sort(): a=[] def __init__(self,data): self.a=data[:] def sort(self,left,right): if left!=right: mid=left+int((right-left)/2) self.sort(left,mid) self.sort(mid+1,right) b=[] i=0 for i in...
class Quick_Sort: a = [] def __init__(self, data): self.a = data[:] def sort(self, left, right): if left != right: mid = left + int((right - left) / 2) self.sort(left, mid) self.sort(mid + 1, right) b = [] i = 0 for i ...
""" Example docstring 1 * A thing. * Another thing. or 1. Item 1. 2. Item 2. 3. Item 3. or - Some. - Thing. - Different. +------------+------------+-----------+ | Header 1 | Header 2 | Header 3 | +============+============+===========+ | body row 1 | column 2 | column 3 | +------------+------------+------...
""" Example docstring 1 * A thing. * Another thing. or 1. Item 1. 2. Item 2. 3. Item 3. or - Some. - Thing. - Different. +------------+------------+-----------+ | Header 1 | Header 2 | Header 3 | +============+============+===========+ | body row 1 | column 2 | column 3 | +------------+------------+------...
# # PySNMP MIB module CISCO-SNA-LLC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SNA-LLC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:35:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ...
OUR_APP_NAME = 'Demo' SECTION_NAME = 'Manufacturer' SECTION_ITEMS = 'Products'
our_app_name = 'Demo' section_name = 'Manufacturer' section_items = 'Products'
SSID1 = 'ap1' PASSWORD1 = 'pw1' SSID2 = 'ap2' PASSWORD2 = 'pw2' MQTT_PORT = '1883' MQTT_USER = 'useri' MQTT_PASSWORD = 'salari' MQTT_SERVER = 'ip' WEBREPL_PASSWORD = "pw" CLIENT_ID = "ESP32-aurinkopaneeli" DHCP_NAME = "ESP32-aurinkopaneeli" TOPIC_ERRORS = 'errors/home/esp32' TOPIC_TEMP = 'koti/ulko/aurinkop...
ssid1 = 'ap1' password1 = 'pw1' ssid2 = 'ap2' password2 = 'pw2' mqtt_port = '1883' mqtt_user = 'useri' mqtt_password = 'salari' mqtt_server = 'ip' webrepl_password = 'pw' client_id = 'ESP32-aurinkopaneeli' dhcp_name = 'ESP32-aurinkopaneeli' topic_errors = 'errors/home/esp32' topic_temp = 'koti/ulko/aurinkopaneeli/lampo...
n=int(input()) a=[] for i in range(0,n): ele=int(input()) a.append(ele) print(list(set(a))) lower=int(input()) upper=int(input()) b=[x for x in range(lower,upper+1) if ( int(x**0.5))**2==x and sum(list(map(int,str(x))))<10 ] a=[(x,x**2)for x in range(lower,upper+1)] print(b) n=int(input()) m=i...
n = int(input()) a = [] for i in range(0, n): ele = int(input()) a.append(ele) print(list(set(a))) lower = int(input()) upper = int(input()) b = [x for x in range(lower, upper + 1) if int(x ** 0.5) ** 2 == x and sum(list(map(int, str(x)))) < 10] a = [(x, x ** 2) for x in range(lower, upper + 1)] print(b) n = in...
def add(x, y): return x+y result = add(1, 2) print(f"This is the sum: , {result}")
def add(x, y): return x + y result = add(1, 2) print(f'This is the sum: , {result}')
ld,lm,ly = map(int,input().split()) dd,dm,dy = map(int,input().split()) if ly< dy: print('0') elif ly > dy: print('10000') elif lm > dm: print(500*(lm-dm)) elif lm < dm: print('0') elif ld > dd: print(15*(ld-dd)) else: print('0')
(ld, lm, ly) = map(int, input().split()) (dd, dm, dy) = map(int, input().split()) if ly < dy: print('0') elif ly > dy: print('10000') elif lm > dm: print(500 * (lm - dm)) elif lm < dm: print('0') elif ld > dd: print(15 * (ld - dd)) else: print('0')
""" Functions to sort variants """ CHROMOSOMES = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', 'X', 'Y', 'MT') # Maps chromosomes to integers CHROMOSOME_INTEGERS = {chrom: i+1 for i, chrom in enumerate(CHR...
""" Functions to sort variants """ chromosomes = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', 'X', 'Y', 'MT') chromosome_integers = {chrom: i + 1 for (i, chrom) in enumerate(CHROMOSOMES)} def sort_variants(variants): """ Sor...
""" Functions of the `sample_project.calculator.calc` module. """ def check_power_of_2(value: int) -> bool: """ Returns `True` if `value` is power of 2 else `False`. See code explanation in [StackOverflow ](https://stackoverflow.com/questions/57025836). """ return (value != 0) and (not value &...
""" Functions of the `sample_project.calculator.calc` module. """ def check_power_of_2(value: int) -> bool: """ Returns `True` if `value` is power of 2 else `False`. See code explanation in [StackOverflow ](https://stackoverflow.com/questions/57025836). """ return value != 0 and (not value & va...
{ "targets": [ { "target_name": "pm", "sources": [ "src/pm.cpp", "src/pm.h" ], 'conditions': [ ['OS=="win"', { 'sources': [ "src/pm_win.cpp" ] } ], ['OS=="mac"', { 'sourc...
{'targets': [{'target_name': 'pm', 'sources': ['src/pm.cpp', 'src/pm.h'], 'conditions': [['OS=="win"', {'sources': ['src/pm_win.cpp']}], ['OS=="mac"', {'sources': ['src/pm_mac.cpp']}], ['OS=="linux"', {'conditions': [["target_arch=='ia32'", {'include_dirs+': ['/usr/include/dbus-1.0/', '/usr/include/glib-2.0/', '/usr/li...
index_template = ( lambda: """from pantam import Pantam pantam = Pantam(debug=True) app = pantam.build() """ ) action_template = lambda class_name: """from pantam import PlainTextResponse class {class_name}: def fetch_all(self, request): \"\"\"Fetch all items\"\"\" return PlainTextResponse(...
index_template = lambda : 'from pantam import Pantam\n\npantam = Pantam(debug=True)\n\napp = pantam.build()\n' action_template = lambda class_name: 'from pantam import PlainTextResponse\n\nclass {class_name}:\n def fetch_all(self, request):\n """Fetch all items"""\n return PlainTextResponse("Pantam: {c...
# coding: utf-8 # input N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) # solve(TLE) """ flag = 1 for i in range(N): for j in range(N): if (flag == 1): num = a[i] + b[j] flag = 0 else: num = num ^ (a[i] + b[j]) print(num)...
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) '\nflag = 1\nfor i in range(N):\n for j in range(N):\n if (flag == 1):\n num = a[i] + b[j]\n flag = 0\n else:\n num = num ^ (a[i] + b[j])\nprint(num)\n' "\nDon't use double for\n"
def perfect_array(length): return ' '.join(['1']*length) def main(): t = int(input()) for _ in range(t): length = int(input()) print(perfect_array(length)) main()
def perfect_array(length): return ' '.join(['1'] * length) def main(): t = int(input()) for _ in range(t): length = int(input()) print(perfect_array(length)) main()
def _toolchain_configure_impl(repository_ctx): tool_path = "" if repository_ctx.attr.tool_path: tool_path = repository_ctx.attr.tool_path elif repository_ctx.which("databricks"): tool_path = repository_ctx.which("databricks") config_file = "" if repository_ctx.attr.config_file: ...
def _toolchain_configure_impl(repository_ctx): tool_path = '' if repository_ctx.attr.tool_path: tool_path = repository_ctx.attr.tool_path elif repository_ctx.which('databricks'): tool_path = repository_ctx.which('databricks') config_file = '' if repository_ctx.attr.config_file: ...
# Copyright 2019 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause # Package initialisation for Doctor. # Mightn't be necessary to declare __all__ at time of writing because it lists # everything. __all__ = ['comment_block.py', 'comment_line.py', 'doc_markdown.py', 'doctor_class.py...
__all__ = ['comment_block.py', 'comment_line.py', 'doc_markdown.py', 'doctor_class.py', 'getter.py', 'main.py', 'markdown.py', 'parser.py']
def hello(s): print("Hello, %s!!!" % s) hello('world') hello('python') hello('Sasha')
def hello(s): print('Hello, %s!!!' % s) hello('world') hello('python') hello('Sasha')
#!/usr/bin/env python # -*- coding: utf-8 -*- def score(str_in): garbage = False cnt = 1 out = 0 stack = [] garbage_cnt = 0 skip = False for i in str_in: if skip: skip = False continue if i == '!': skip = True continue ...
def score(str_in): garbage = False cnt = 1 out = 0 stack = [] garbage_cnt = 0 skip = False for i in str_in: if skip: skip = False continue if i == '!': skip = True continue if garbage and i == '>': garbage = ...
""" Codemonk link: https://www.hackerearth.com/practice/algorithms/dynamic-programming/introduction-to-dynamic-programming-1/practice-problems/algorithm/once-upon-a-time-in-time-land/ In a mystical TimeLand, a person's health and wealth is measured in terms of time(seconds) left. Suppose a person there has 24x60x60 = ...
""" Codemonk link: https://www.hackerearth.com/practice/algorithms/dynamic-programming/introduction-to-dynamic-programming-1/practice-problems/algorithm/once-upon-a-time-in-time-land/ In a mystical TimeLand, a person's health and wealth is measured in terms of time(seconds) left. Suppose a person there has 24x60x60 = ...
class TreeNode: def __init__(self, data): self.data = data self.parent = None self.children = [] self.__length = 0 def add_child(self, children): self.__length += len(children) for child in children: child.parent = self self.children.a...
class Treenode: def __init__(self, data): self.data = data self.parent = None self.children = [] self.__length = 0 def add_child(self, children): self.__length += len(children) for child in children: child.parent = self self.children.appe...
# Copyright (C) 2020-Present the hyssop authors and contributors. # # This module is part of hyssop and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php ''' File created: September 4th 2020 Modified By: hsky77 Last Updated: April 6th 2021 22:26:59 pm ''' Version = '0.0.7'
""" File created: September 4th 2020 Modified By: hsky77 Last Updated: April 6th 2021 22:26:59 pm """ version = '0.0.7'
class Extractor(object): def __init__(self, transcript): self.transcript = transcript def get_location(self): return "TBD" def get_date(self): return "TBD"
class Extractor(object): def __init__(self, transcript): self.transcript = transcript def get_location(self): return 'TBD' def get_date(self): return 'TBD'
"""fglib -- Factor Graph Library. The factor graph library (fglib) is a Python package to simulate message passing on factor graphs. Modules: inference: Module for inference algorithms. graphs: Module for factor graphs. nodes: Module for nodes of factor graphs. edges: Module for edges of factor graphs...
"""fglib -- Factor Graph Library. The factor graph library (fglib) is a Python package to simulate message passing on factor graphs. Modules: inference: Module for inference algorithms. graphs: Module for factor graphs. nodes: Module for nodes of factor graphs. edges: Module for edges of factor graphs...
def test_all_function(numeric_state): state = numeric_state state["subtracted"] = state["amount"] - state["amount"] space = state.space[1] all_events = space.all() assert len(all_events) == 3
def test_all_function(numeric_state): state = numeric_state state['subtracted'] = state['amount'] - state['amount'] space = state.space[1] all_events = space.all() assert len(all_events) == 3
#input: data from communties_data.txt #output: data useful for predictive analysis (ie: excluding first 5 attributes) in 2D Array def clean_raw_data(data): rows = (row.strip().split() for row in data) leaveLoop = 0 cleaned_data = [] for row in rows: tmp = [stat.strip() for stat in row[0].split(',')] cleaned_dat...
def clean_raw_data(data): rows = (row.strip().split() for row in data) leave_loop = 0 cleaned_data = [] for row in rows: tmp = [stat.strip() for stat in row[0].split(',')] cleaned_data.append(tmp[5:]) return cleaned_data def clean_sum_data(data): sum_rows = (row.strip().split() ...
""" entrada distancia=>int=>km salida deuda por pagar """ km=int(input("distancia recorrida ")) if (km<300): print("se cancela 50.000 ") elif(km>=300) and (km<=1000): total=(km-300)*30000+70000 print(" su deuda es de: "+str(total)) elif(km>1000): total=(km-300)*9000+150000...
""" entrada distancia=>int=>km salida deuda por pagar """ km = int(input('distancia recorrida ')) if km < 300: print('se cancela 50.000 ') elif km >= 300 and km <= 1000: total = (km - 300) * 30000 + 70000 print(' su deuda es de: ' + str(total)) elif km > 1000: total = (km - 300) * 9000 + 150000 pr...
""" Starts a game against the computer """ # TODO
""" Starts a game against the computer """
# # PySNMP MIB module Juniper-DS3-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-DS3-CONF # Produced by pysmi-0.3.4 at Mon Apr 29 19:51:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ...
def newman_conway(num): """ Returns a list of the Newman Conway numbers for the given value. Time Complexity: O(n) Space Complexity: O(n) """ if num == 0: raise ValueError if num == 1: return '1' if num == 2: return '1 1' sequence = [0, 1, 1] for i ...
def newman_conway(num): """ Returns a list of the Newman Conway numbers for the given value. Time Complexity: O(n) Space Complexity: O(n) """ if num == 0: raise ValueError if num == 1: return '1' if num == 2: return '1 1' sequence = [0, 1, 1] for i in ...
# -*- coding: utf-8 -*- # # Copyright (C) 2019 Edward Lau <elau1004@netscape.net> # Licensed under the MIT License. # __version__ = '0.1.0'
__version__ = '0.1.0'
class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if len(matrix) == 0: return False n, m = len(matrix), len(matrix[0]) start, end = 0, n * m - 1...
class Solution(object): def search_matrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if len(matrix) == 0: return False (n, m) = (len(matrix), len(matrix[0])) (start, end) = (0, n * m - 1) ...
# -*- coding: utf-8 -*- """Custom exceptions.""" # Part of StackMUD (https://github.com/whutch/stackmud) # :copyright: (c) 2020 Will Hutcheson # :license: MIT (https://github.com/whutch/stackmud/blob/master/LICENSE.txt) class AlreadyExists(Exception): """Exception for adding an item to a collection it is already ...
"""Custom exceptions.""" class Alreadyexists(Exception): """Exception for adding an item to a collection it is already in.""" def __init__(self, key, old, new=None): self.key = key self.old = old self.new = new
expected_output = { "controller_config": { "group_name": "default", "ipv4": "10.9.3.4", "mac_address": "AAAA.BBFF.8888", "multicast_ipv4": "0.0.0.0", "multicast_ipv6": "::", "pmtu": "N/A", "public_ip": "N/A", "status": "N/A", }, "mobility_summa...
expected_output = {'controller_config': {'group_name': 'default', 'ipv4': '10.9.3.4', 'mac_address': 'AAAA.BBFF.8888', 'multicast_ipv4': '0.0.0.0', 'multicast_ipv6': '::', 'pmtu': 'N/A', 'public_ip': 'N/A', 'status': 'N/A'}, 'mobility_summary': {'domain_id': '0x34ac', 'dscp_value': '48', 'group_name': 'default', 'keepa...
''' # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail ''' # Write your code here def right(a,b): r=a for...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ def right(a, b): r = a for i in range(b): r = r[-1...
ESCAPE_CODE = "\033[" COLORS = {'black': 30, 'red': 31, 'green':32, 'yellow': 33, 'blue': 34, 'purple': 35, 'cyan': 36, 'white': 37} BRIGHTS = {"bright "+color: value + 60 for color, value, in COLORS.items()} TEXT_COLOR = {'reset': 0, **COLORS, **BRIGHTS} TEXT_STYLE = {'reset': 0, 'no effect': 0, 'bold': 1, 'underline'...
escape_code = '\x1b[' colors = {'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 'purple': 35, 'cyan': 36, 'white': 37} brights = {'bright ' + color: value + 60 for (color, value) in COLORS.items()} text_color = {'reset': 0, **COLORS, **BRIGHTS} text_style = {'reset': 0, 'no effect': 0, 'bold': 1, 'underl...
# Write a function to check if the array is sorted or not arr = [1,2,3,5,9] n = len(arr) i = 0 def isSortedArray(arr,i, n): if (i==n-1): return True if arr[i] < arr[i+1] and isSortedArray(arr,i+1,n): return True else: return False print(isSortedArray(arr,i,n))
arr = [1, 2, 3, 5, 9] n = len(arr) i = 0 def is_sorted_array(arr, i, n): if i == n - 1: return True if arr[i] < arr[i + 1] and is_sorted_array(arr, i + 1, n): return True else: return False print(is_sorted_array(arr, i, n))
dict = { "__open_crash__": 'Crash save {} exists, do you want to recover it?', "__about__": "Simple route designer using BSicon", "__export_fail__": 'Failed to export {}', "__open_fail__": 'Failed to open {}', "__paste_no_valid_blocks__": "No valid blocks to paste", "__paste_filter_invalid_block...
dict = {'__open_crash__': 'Crash save {} exists, do you want to recover it?', '__about__': 'Simple route designer using BSicon', '__export_fail__': 'Failed to export {}', '__open_fail__': 'Failed to open {}', '__paste_no_valid_blocks__': 'No valid blocks to paste', '__paste_filter_invalid_blocks__': 'Invalid blocks hav...
def fact(n): ans = 1 for i in range(1,n+1): ans = ans*i return ans T = int(input()) while T: n = input() n = int(n) print(fact(n)) T = T-1
def fact(n): ans = 1 for i in range(1, n + 1): ans = ans * i return ans t = int(input()) while T: n = input() n = int(n) print(fact(n)) t = T - 1
""" Definition of Interval. class Interval(object): def __init__(self, start, end): self.start = start self.end = end """ class Solution: """ @param A: An integer list @param queries: An query list @return: The result list """ def intervalSum(self, A, queries): self....
""" Definition of Interval. class Interval(object): def __init__(self, start, end): self.start = start self.end = end """ class Solution: """ @param A: An integer list @param queries: An query list @return: The result list """ def interval_sum(self, A, queries): sel...
BOARDS = { 'arduino' : { 'digital' : tuple(x for x in range(14)), 'analog' : tuple(x for x in range(6)), 'pwm' : (3, 5, 6, 9, 10, 11), 'use_ports' : True, 'disabled' : (0, 1) # Rx, Tx, Crystal }, 'arduino_mega' : { 'digital' : tuple(x for x in range(54)), ...
boards = {'arduino': {'digital': tuple((x for x in range(14))), 'analog': tuple((x for x in range(6))), 'pwm': (3, 5, 6, 9, 10, 11), 'use_ports': True, 'disabled': (0, 1)}, 'arduino_mega': {'digital': tuple((x for x in range(54))), 'analog': tuple((x for x in range(16))), 'pwm': tuple((x for x in range(2, 14))), 'use_p...
# This code should store "codewa.rs" as a variable called name but it's not working. # Can you figure out why? a = "code" b = "wa.rs" name = a + b def test(): assert name == "codewa.rs"
a = 'code' b = 'wa.rs' name = a + b def test(): assert name == 'codewa.rs'
#brute force T= int(input()) while T!=0: T-=1 n = int(input()) if n>3: k1=0 k2=0 value1 , value2 , value3 , value4 =0,0,0,0 ''' #--------------------------------------- value1 = 14*(n-1) + 20 #---------------------------------------- k1=n//2 k2 = n % 2 if k2 ==0: #value2 = 28*(...
t = int(input()) while T != 0: t -= 1 n = int(input()) if n > 3: k1 = 0 k2 = 0 (value1, value2, value3, value4) = (0, 0, 0, 0) '\n\t\t#---------------------------------------\n\t\tvalue1 = 14*(n-1) + 20\n\t\t#----------------------------------------\n\t\tk1=n//2\n\t\tk2 = n %...
class ZebrokNotImplementedError(NotImplementedError): """ Custom exception to be thrown when a derived class fails to implement an abstract method of a base class """ pass
class Zebroknotimplementederror(NotImplementedError): """ Custom exception to be thrown when a derived class fails to implement an abstract method of a base class """ pass
''' pyatmos jb2008 subpackage This subpackage defines the following functions: JB2008_subfunc.py - subfunctions that implement the atmospheric model JB2008 jb2008.py - Input interface of JB2008 spaceweather.py download_sw_jb2008 - Download or update the space weather file for JB2008 from https://sol.spacenvi...
""" pyatmos jb2008 subpackage This subpackage defines the following functions: JB2008_subfunc.py - subfunctions that implement the atmospheric model JB2008 jb2008.py - Input interface of JB2008 spaceweather.py download_sw_jb2008 - Download or update the space weather file for JB2008 from https://sol.spacenvi...