content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class urls : def __init__(self) : self.base_info_url = 'https://infoapi.webull.com/api' self.base_options_url = 'https://quoteapi.webullbroker.com/api' self.base_options_gw_url = 'https://quotes-gw.webullbroker.com/api' self.base_paper_url = 'https://act.webullbroker.com/webull-paper...
class Urls: def __init__(self): self.base_info_url = 'https://infoapi.webull.com/api' self.base_options_url = 'https://quoteapi.webullbroker.com/api' self.base_options_gw_url = 'https://quotes-gw.webullbroker.com/api' self.base_paper_url = 'https://act.webullbroker.com/webull-paper-...
CANVAS_WIDTH = 50 CANVAS_HEIGHT = 50 LV_COLOR_CHROMA_KEY = lv.color_hex(0x00ff00) def LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h): return int(((w / 8) + 1) * h) def LV_IMG_BUF_SIZE_INDEXED_1BIT(w, h): return LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2 def LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h): return LV_IMG_BUF_SI...
canvas_width = 50 canvas_height = 50 lv_color_chroma_key = lv.color_hex(65280) def lv_img_buf_size_alpha_1_bit(w, h): return int((w / 8 + 1) * h) def lv_img_buf_size_indexed_1_bit(w, h): return lv_img_buf_size_alpha_1_bit(w, h) + 4 * 2 def lv_canvas_buf_size_indexed_1_bit(w, h): return lv_img_buf_size_in...
# Copyright 2017 The Forseti Security Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
"""Fake projects data. TODO: consolidate with other fake project test data. """ fake_projects_db_rows = [{'project_number': 1111111111, 'project_id': 'project-1', 'project_name': 'Project 1', 'lifecycle_state': 'ACTIVE', 'parent_type': None, 'parent_id': None}, {'project_number': 2222222222, 'project_id': 'project-2',...
class Node: def __init__(self, data): self.data = data self.next = None class Solution: def insert(self, head, data): p = Node(data) if head == None: head = p elif head.next == None: head.next = p else: start = head ...
class Node: def __init__(self, data): self.data = data self.next = None class Solution: def insert(self, head, data): p = node(data) if head == None: head = p elif head.next == None: head.next = p else: start = head ...
# The name of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'overview_project' # The name of the dashboard the PANEL associated with. Required. PANEL_DASHBOARD = 'conveyor' # The slug of the panel group the PANEL is associated with. PANEL_GROUP = 'overview' # Python panel class of the PANEL to be added....
panel = 'overview_project' panel_dashboard = 'conveyor' panel_group = 'overview' add_panel = 'conveyordashboard.overview_project.panel.ProjectLevelOverview'
class Canvas(): def __init__(self, cell_size, speed=0.6, shift=3.7, divide=4, spread1=0.05, spread2=0.5): self.cell_size = cell_size self.cells = [] self.n_cell_x = int(width * 1.0 / self.cell_size) self.n_cell_y...
class Canvas: def __init__(self, cell_size, speed=0.6, shift=3.7, divide=4, spread1=0.05, spread2=0.5): self.cell_size = cell_size self.cells = [] self.n_cell_x = int(width * 1.0 / self.cell_size) self.n_cell_y = int(height * 1.0 / self.cell_size) self.speed = speed ...
''' There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolling up, down, left or right, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction. Given the ball's start position, the destination and the maze, determine whether t...
""" There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolling up, down, left or right, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction. Given the ball's start position, the destination and the maze, determine whether t...
def binary_search(item_list,item): first = 0 last = len(item_list)-1 flag = False while( first<=last and not flag): temp = (first + last)//2 if item_list[temp] == item : flag = True else: if item < item_list[temp]: last = temp - 1 else: first = temp + 1 return flag message = binary_search...
def binary_search(item_list, item): first = 0 last = len(item_list) - 1 flag = False while first <= last and (not flag): temp = (first + last) // 2 if item_list[temp] == item: flag = True elif item < item_list[temp]: last = temp - 1 else: ...
# Source : https://leetcode.com/problems/divide-two-integers/ # Author : zheyuuu # Date : 2020-07-27 ##################################################################################################### # # Given two integers dividend and divisor, divide two integers without using multiplication, division # and mo...
class Solution: def divide(self, dividend: int, divisor: int) -> int: if dividend == -2 ** 31 and divisor == -1: return 2 ** 31 - 1 sign = -1 if (dividend < 0) ^ (divisor < 0) else 1 q = 0 divisor = abs(divisor) dividend = abs(dividend) while divisor <= d...
""" Test module for napoleon PEP 526 compatibility with google style """ module_level_var: int = 99 """This is an example module level variable""" class PEP526GoogleClass: """Sample class with PEP 526 annotations and google docstring Attributes: attr1: Attr1 description. attr2: Attr2 descrip...
""" Test module for napoleon PEP 526 compatibility with google style """ module_level_var: int = 99 'This is an example module level variable' class Pep526Googleclass: """Sample class with PEP 526 annotations and google docstring Attributes: attr1: Attr1 description. attr2: Attr2 description. ...
dataset_type = 'CocoDataset' img_size = (864, 864) img_norm_cfg = dict(mean=[0, 0, 0], std=[255, 255, 255], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile', to_float32=True), dict(type='LoadAnnotations', with_bbox=True), dict( type='PhotoMetricDistortion', brightness_delta=32,...
dataset_type = 'CocoDataset' img_size = (864, 864) img_norm_cfg = dict(mean=[0, 0, 0], std=[255, 255, 255], to_rgb=True) train_pipeline = [dict(type='LoadImageFromFile', to_float32=True), dict(type='LoadAnnotations', with_bbox=True), dict(type='PhotoMetricDistortion', brightness_delta=32, contrast_range=(0.5, 1.5), sat...
## # Copyright (c) 2007-2013 Cyrus Daboo. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
class Outputfilter(object): def __init__(self, type): self.mType = type self.mAllSubComponents = False self.mSubComponents = None self.mAllProperties = False self.mProperties = None def get_type(self): return self.mType def test_component(self, oftype): ...
"""Internal payload handling library - Detects. _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1...
"""Internal payload handling library - Detects. _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1...
class Solution: def generate(self, numRows: int) -> List[List[int]]: if numRows==1: return [[1]] else: output=[[1], [1,1]] for i in range(numRows-2): dp=[1] for idx in range(len(output[-1])-1): dp.append(output[-...
class Solution: def generate(self, numRows: int) -> List[List[int]]: if numRows == 1: return [[1]] else: output = [[1], [1, 1]] for i in range(numRows - 2): dp = [1] for idx in range(len(output[-1]) - 1): dp.app...
LAUNCHER_ERROR = 0 LAUNCHER_VERSION_UPDATE = 1 LAUNCHER_REQUEST_TFA = 2 LAUNCHER_STATUS = 3 LAUNCHER_PROGRESS = 4 LAUNCHER_PLAY_RETRY = 5 LAUNCHER_ENABLE_CONTROLS = 6 LAUNCHER_CLEAR_PASSWORD = 7 LAUNCHER_HIDE = 997 LAUNCHER_SHOW = 998 LAUNCHER_EXIT = 999
launcher_error = 0 launcher_version_update = 1 launcher_request_tfa = 2 launcher_status = 3 launcher_progress = 4 launcher_play_retry = 5 launcher_enable_controls = 6 launcher_clear_password = 7 launcher_hide = 997 launcher_show = 998 launcher_exit = 999
# message parameters GLOBAL_ID = 'global_id' LOCAL_ID = 'local_id' DEV_TYPE = 'type' DEV_HW_ADDRESS = 'dev_hw_addr' DEV_IP = 'dev_ip' TYPE = 'type' CONN_TYPE = 'conn_type' PING_MSG = 'ping_msg' HOST = 'host' ERROR = 'error' # adapter parameter ADAPTER_CONF = 'adapter_conf' TIMEOUT = 'timeout' PINSET = 'pinset' # Conn...
global_id = 'global_id' local_id = 'local_id' dev_type = 'type' dev_hw_address = 'dev_hw_addr' dev_ip = 'dev_ip' type = 'type' conn_type = 'conn_type' ping_msg = 'ping_msg' host = 'host' error = 'error' adapter_conf = 'adapter_conf' timeout = 'timeout' pinset = 'pinset' conn_hello = 'hello' conn_conf = 'conf' conn_valu...
# Created by MechAviv # ID :: [865020001] # Commerci Republic : Canal 1 sm.forcedInput(0) sm.setSpeakerID(0) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(8) sm.sendNext("You, there! Stop!") sm.setSpeakerID(9390223) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(8) sm.sendSay...
sm.forcedInput(0) sm.setSpeakerID(0) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(8) sm.sendNext('You, there! Stop!') sm.setSpeakerID(9390223) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(8) sm.sendSay('Hmm? Is something the matter?') sm.setSpeakerID(0) sm.removeEscapeButton...
def setup(): size(300, 300) smooth() strokeWeight(3) background(0) i = 0 k = 1 flug = 1 def upDate(): global i, k, flug i +=k if i == 255: k=-1 if i == 0: k=1 def draw(): global i, k, flug stroke(i,20) if flug == 1: line(...
def setup(): size(300, 300) smooth() stroke_weight(3) background(0) i = 0 k = 1 flug = 1 def up_date(): global i, k, flug i += k if i == 255: k = -1 if i == 0: k = 1 def draw(): global i, k, flug stroke(i, 20) if flug == 1: line(mouseX, mouseY, rando...
# Question 1 # Greatest common divisor of 2 positive integers num1 = int(input("Enter 1st integer: ")) num2 = int(input("Enter 2nd integer: ")) if num1 > num2: if num1 % num2 == 0: gcd1 = num2 a = num2 elif num2 > num1: if num2 % num1 == 0: gcd1 = num1 a = num1 gcd2 = 1 for i in range(2, a+1): if num1 % i =...
num1 = int(input('Enter 1st integer: ')) num2 = int(input('Enter 2nd integer: ')) if num1 > num2: if num1 % num2 == 0: gcd1 = num2 a = num2 elif num2 > num1: if num2 % num1 == 0: gcd1 = num1 a = num1 gcd2 = 1 for i in range(2, a + 1): if num1 % i == 0 and num2 % i == 0: gcd2 ...
# File name: car.py # Author: Steve Hommy # Description: Create a Car Class class Car: def __init__(self, brand, model, boot_size): self.__brand = brand self.__model = model self.__boot_size = boot_size self.__owner = None def set_brand(self): self.__brand = input("Wha...
class Car: def __init__(self, brand, model, boot_size): self.__brand = brand self.__model = model self.__boot_size = boot_size self.__owner = None def set_brand(self): self.__brand = input('What brand is the car? ') def get_brand(self): return self.__brand ...
class VigenereCipher: def __init__(self) -> None: pass @staticmethod def encrypt(msg: str, key: str) -> str: msg, key = msg.upper(), key.upper() if len(msg) > len(key): # Generates the key in a cyclic manner until it's length equal to the length of text for...
class Vigenerecipher: def __init__(self) -> None: pass @staticmethod def encrypt(msg: str, key: str) -> str: (msg, key) = (msg.upper(), key.upper()) if len(msg) > len(key): for i in range(len(msg) - len(key)): key += key[i % len(key)] encrypted_w...
S = input().strip() try: n = int(S) print(n) except ValueError: print("Bad String")
s = input().strip() try: n = int(S) print(n) except ValueError: print('Bad String')
# 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) """ defines class that will keep results of different calculations. """ class declaration_algs_cache_t( object ): def __i...
""" defines class that will keep results of different calculations. """ class Declaration_Algs_Cache_T(object): def __init__(self): object.__init__(self) self._enabled = True self._full_name = None self._full_partial_name = None self._access_type = None self._demang...
class Target(object): """ Target that Ion Impacts Parameters ---------- layers : list list of :class:`srim.core.layer.Layer` to construct Target Examples -------- Lets construct a SiC target. While only one layer is shown an arbitrary number of them can be used. >>> Target...
class Target(object): """ Target that Ion Impacts Parameters ---------- layers : list list of :class:`srim.core.layer.Layer` to construct Target Examples -------- Lets construct a SiC target. While only one layer is shown an arbitrary number of them can be used. >>> Target...
# find one idx for the matched sequence def find_index(all_array, element): all_array = all_array.tolist() element = element.tolist() if element in all_array: return all_array.index(element)
def find_index(all_array, element): all_array = all_array.tolist() element = element.tolist() if element in all_array: return all_array.index(element)
"""Constants for the homekit_controller component.""" DOMAIN = "homekit_controller" KNOWN_DEVICES = "{}-devices".format(DOMAIN) CONTROLLER = "{}-controller".format(DOMAIN) ENTITY_MAP = "{}-entity-map".format(DOMAIN) HOMEKIT_DIR = ".homekit" PAIRING_FILE = "pairing.json" # Mapping from Homekit type to component. HOME...
"""Constants for the homekit_controller component.""" domain = 'homekit_controller' known_devices = '{}-devices'.format(DOMAIN) controller = '{}-controller'.format(DOMAIN) entity_map = '{}-entity-map'.format(DOMAIN) homekit_dir = '.homekit' pairing_file = 'pairing.json' homekit_accessory_dispatch = {'lightbulb': 'light...
SUPPORTED_RECORDS = [ '$ORIGIN', '$TTL', 'SOA', 'NS', 'A', 'AAAA', 'CNAME', 'ALIAS', 'MX', 'PTR', 'TXT', 'SRV', 'SPF', 'URI', ] DEFAULT_TEMPLATE = """ {$origin}\n\ {$ttl}\n\ \n\ {soa} \n\ {ns}\n\ \n\ {mx}\n\ \n\ {a}\n\ \n\ {aaaa}\n\ \n\ {cname}\n\ \n\ {alias}\n\ \n\ {ptr}\n\ \n\ {txt}\n\ \n\ {srv}\n\ \n\ {spf}...
supported_records = ['$ORIGIN', '$TTL', 'SOA', 'NS', 'A', 'AAAA', 'CNAME', 'ALIAS', 'MX', 'PTR', 'TXT', 'SRV', 'SPF', 'URI'] default_template = '\n{$origin}\n{$ttl}\n\n{soa}\n\n{ns}\n\n{mx}\n\n{a}\n\n{aaaa}\n\n{cname}\n\n{alias}\n\n{ptr}\n\n{txt}\n\n{srv}\n\n{spf}\n\n{uri}\n'
"""Assignment 12""" #Here we are observing the addresses of variable x and y x = 10 y = x print("Address of x is: ",id(x)) print("Address of y is: ",id(y))
"""Assignment 12""" x = 10 y = x print('Address of x is: ', id(x)) print('Address of y is: ', id(y))
class Error(Exception): "Base class for KoL Exceptions." def __init__(self, message): self.message = message def __str__(self): return self.message ################ # Login Errors # ################ class LoginError(Error): "A generic exception raised during login." def __init__(self, message, timeToWait=60...
class Error(Exception): """Base class for KoL Exceptions.""" def __init__(self, message): self.message = message def __str__(self): return self.message class Loginerror(Error): """A generic exception raised during login.""" def __init__(self, message, timeToWait=60): self...
n = int(input()) even_set = set() odd_set = set() for row in range(1, n + 1): name = input() number = 0 for ch in name: number += ord(ch) number //= row if number % 2 == 0: even_set.add(number) else: odd_set.add(number) if sum(even_set) == sum(odd_set): print('...
n = int(input()) even_set = set() odd_set = set() for row in range(1, n + 1): name = input() number = 0 for ch in name: number += ord(ch) number //= row if number % 2 == 0: even_set.add(number) else: odd_set.add(number) if sum(even_set) == sum(odd_set): print(', '.joi...
class Stack(object): def __init__(self): """Initialize an empty stack""" self.items = [] def push(self, item): """Push a new item onto the stack""" self.items.append(item) def pop(self): """Remove and return the last item""" # If the stack is empty, return ...
class Stack(object): def __init__(self): """Initialize an empty stack""" self.items = [] def push(self, item): """Push a new item onto the stack""" self.items.append(item) def pop(self): """Remove and return the last item""" if not self.items: r...
items = ['sss', 'sss', 'asda', 'asdasd', 'sfsdf'] prefix = 's' filteredlist = list(filter(lambda x: x.startswith(prefix), items)) print(filteredlist)
items = ['sss', 'sss', 'asda', 'asdasd', 'sfsdf'] prefix = 's' filteredlist = list(filter(lambda x: x.startswith(prefix), items)) print(filteredlist)
load("@rules_proto//proto:defs.bzl", "ProtoInfo") load("//scala/private:common.bzl", "write_manifest_file") load("//scala/private:dependency.bzl", "legacy_unclear_dependency_info_for_protobuf_scrooge") load("//scala/private:rule_impls.bzl", "compile_scala") load("//scala/private/toolchain_deps:toolchain_deps.bzl", "fin...
load('@rules_proto//proto:defs.bzl', 'ProtoInfo') load('//scala/private:common.bzl', 'write_manifest_file') load('//scala/private:dependency.bzl', 'legacy_unclear_dependency_info_for_protobuf_scrooge') load('//scala/private:rule_impls.bzl', 'compile_scala') load('//scala/private/toolchain_deps:toolchain_deps.bzl', 'fin...
class Solution: def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]: new1 = l1 = ListNode() new2 = l2 = ListNode() while head : l1.next = head l2.next = head.next l1 = l1.next l2 = l2.next ...
class Solution: def odd_even_list(self, head: Optional[ListNode]) -> Optional[ListNode]: new1 = l1 = list_node() new2 = l2 = list_node() while head: l1.next = head l2.next = head.next l1 = l1.next l2 = l2.next head = head.next.next...
rooms = ['hallway','kitchen', 'living room', 'bedroom','bathroom'] areas = [14.35, 15.0, 19.0, 12.5, 8.75] # Code the for loop for room, area in ___(_____, _____): print(___(____) + ' area is ' + ___(____) + 'm')
rooms = ['hallway', 'kitchen', 'living room', 'bedroom', 'bathroom'] areas = [14.35, 15.0, 19.0, 12.5, 8.75] for (room, area) in ___(_____, _____): print(___(____) + ' area is ' + ___(____) + 'm')
def source1(env, factory): yield env.timeout(1) yield 1 def function1(env, item, machine, factory): yield env.timeout(1) def function2(env, item, machine, factory): yield env.timeout(1)
def source1(env, factory): yield env.timeout(1) yield 1 def function1(env, item, machine, factory): yield env.timeout(1) def function2(env, item, machine, factory): yield env.timeout(1)
""" character.py by lcordell a blue print of things like weaknesses, skills, traits etc, that are used within the game and offered as an option on character creation. """ resistances = { "cold" : 0, "thirst" : 0, "heat" : 0, "hunger" : 0, "pain" : 0, "fear" ...
""" character.py by lcordell a blue print of things like weaknesses, skills, traits etc, that are used within the game and offered as an option on character creation. """ resistances = {'cold': 0, 'thirst': 0, 'heat': 0, 'hunger': 0, 'pain': 0, 'fear': 0, 'seduction': 0, 'manipulation': 0, 'intimidation': 0, 'poison':...
journey_cost = float(input()) months_count = int(input()) saved_money = 0 for m in range(1, months_count + 1): if m > 1 and m % 2 != 0: saved_money -= saved_money * 0.16 if m % 4 == 0: saved_money += saved_money * 0.25 saved_money += 0.25 * journey_cost if saved_money >= journey_cost: ...
journey_cost = float(input()) months_count = int(input()) saved_money = 0 for m in range(1, months_count + 1): if m > 1 and m % 2 != 0: saved_money -= saved_money * 0.16 if m % 4 == 0: saved_money += saved_money * 0.25 saved_money += 0.25 * journey_cost if saved_money >= journey_cost: pr...
# ------------------------------------------------------------------------------- # Copyright 2006-2021 UT-Battelle, LLC. See LICENSE for more information. # ------------------------------------------------------------------------------- """ Node structures for RM are implemented here for convenience. """ # local vers...
""" Node structures for RM are implemented here for convenience. """ class Node: """ Models a node in the allocation. * *name*: name of node, typically actual name from resource detection phase. * *task_ids*, *owners*: identifiers for the tasks and components that are currently using the node. ...
# -*- coding: utf-8 -*- class Solution: def firstMissingPositive(self, nums): i = 0 while i < len(nums): if 0 <= nums[i] - 1 < len(nums) and nums[i] != nums[nums[i] - 1]: nums[nums[i] - 1], nums[i] = nums[i], nums[nums[i] - 1] else: i += 1 ...
class Solution: def first_missing_positive(self, nums): i = 0 while i < len(nums): if 0 <= nums[i] - 1 < len(nums) and nums[i] != nums[nums[i] - 1]: (nums[nums[i] - 1], nums[i]) = (nums[i], nums[nums[i] - 1]) else: i += 1 for (i, num) ...
# Python program to encode a word to a Pig Latin. def isVowel(c): return (c == 'A' or c == 'E' or c == 'I' or c == 'O' or c == 'U' or c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u'); def pigLatin(s): # the index of the first vowel is stored. length = len(s); index = -1; for i i...
def is_vowel(c): return c == 'A' or c == 'E' or c == 'I' or (c == 'O') or (c == 'U') or (c == 'a') or (c == 'e') or (c == 'i') or (c == 'o') or (c == 'u') def pig_latin(s): length = len(s) index = -1 for i in range(length): if is_vowel(s[i]): index = i break if index...
description = 'The mini-chopper for YMIR' pv_root = 'Utg-Ymir:Chop-Drv-0101:' devices = dict( mini_chopper_status=device( 'nicos.devices.epics.EpicsStringReadable', description='The chopper status.', readpv='{}Chop_Stat'.format(pv_root), lowlevel=True, ), mini_chopper_contr...
description = 'The mini-chopper for YMIR' pv_root = 'Utg-Ymir:Chop-Drv-0101:' devices = dict(mini_chopper_status=device('nicos.devices.epics.EpicsStringReadable', description='The chopper status.', readpv='{}Chop_Stat'.format(pv_root), lowlevel=True), mini_chopper_control=device('nicos_ess.devices.epics.extensions.Epic...
""" ============== Binary Search ============== Time Complexity Worst Case : O(log(n)) Average Case : O(log(n)) Best Case : O(1) Space Complexity : O(1) Binary Search is a sorting algorithm in which we select the middle sample and compare key to the middle sample if key is smaller then we search before midd...
""" ============== Binary Search ============== Time Complexity Worst Case : O(log(n)) Average Case : O(log(n)) Best Case : O(1) Space Complexity : O(1) Binary Search is a sorting algorithm in which we select the middle sample and compare key to the middle sample if key is smaller then we search before midd...
def is_valid_bound(row, col): if 0 <= row < n and 0 <= col < n: return True return False def calculate_kills(matrix, row, col): kills = 0 rows = [-2, -2, 2, 2, 1, 1, -1, -1] cols = [-1, 1, -1, 1, -2, 2, -2, 2] for index in range(len(rows)): potential_row = row+rows[index] ...
def is_valid_bound(row, col): if 0 <= row < n and 0 <= col < n: return True return False def calculate_kills(matrix, row, col): kills = 0 rows = [-2, -2, 2, 2, 1, 1, -1, -1] cols = [-1, 1, -1, 1, -2, 2, -2, 2] for index in range(len(rows)): potential_row = row + rows[index] ...
class A: def __init__(self): print("At A init") def feature1(self): print("Feature 1 working") def feature2(self): print("Feature 2 working") class B(A): def feature3(self): print("Feature 3 working") def feature4(self): print("Feature 4 working") b1 = ...
class A: def __init__(self): print('At A init') def feature1(self): print('Feature 1 working') def feature2(self): print('Feature 2 working') class B(A): def feature3(self): print('Feature 3 working') def feature4(self): print('Feature 4 working') b1 = b...
class Solution: # u2takey2 def validateStackSequences(self, pushed, popped): """ :type pushed: List[int] :type popped: List[int] :rtype: bool """ s, i = [], 0 for a in pushed: s.append(a) while s and s[-1] == popped[i]: ...
class Solution: def validate_stack_sequences(self, pushed, popped): """ :type pushed: List[int] :type popped: List[int] :rtype: bool """ (s, i) = ([], 0) for a in pushed: s.append(a) while s and s[-1] == popped[i]: s.po...
""" Control Apache Traffic Server ============================= .. versionadded:: 2015.8.0 """ def __virtual__(): """ Only load if the Traffic Server module is available in __salt__ """ if "trafficserver.set_config" in __salt__: return "trafficserver" return (False, "trafficserver module ...
""" Control Apache Traffic Server ============================= .. versionadded:: 2015.8.0 """ def __virtual__(): """ Only load if the Traffic Server module is available in __salt__ """ if 'trafficserver.set_config' in __salt__: return 'trafficserver' return (False, 'trafficserver module c...
"""Constants for sms Component.""" DOMAIN = "sms" SMS_GATEWAY = "SMS_GATEWAY" SMS_STATE_UNREAD = "UnRead" CONF_BAUD_SPEED = "baud_speed" DEFAULT_BAUD_SPEED = "0" DEFAULT_BAUD_SPEEDS = [ {"value": DEFAULT_BAUD_SPEED, "label": "Auto"}, {"value": "50", "label": "50"}, {"value": "75", "label": "75"}, {"val...
"""Constants for sms Component.""" domain = 'sms' sms_gateway = 'SMS_GATEWAY' sms_state_unread = 'UnRead' conf_baud_speed = 'baud_speed' default_baud_speed = '0' default_baud_speeds = [{'value': DEFAULT_BAUD_SPEED, 'label': 'Auto'}, {'value': '50', 'label': '50'}, {'value': '75', 'label': '75'}, {'value': '110', 'label...
test = { 'name': 'Question 3', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> take_turn(2, 0, make_test_dice(4, 6, 1)) 70e71b420a966665c548a3bb2cb30d7d # locked """, 'hidden': False, 'locked': True }, ...
test = {'name': 'Question 3', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> take_turn(2, 0, make_test_dice(4, 6, 1))\n 70e71b420a966665c548a3bb2cb30d7d\n # locked\n ', 'hidden': False, 'locked': True}, {'code': '\n >>> take_turn(3, 0, make_test_dice(4, 6, 1))\n ...
class Solution: # Greedy Two Pointers (Accepted), O(n) time, O(1) space def canThreePartsEqualSum(self, arr: List[int]) -> bool: if len(arr) < 3: return False total = sum(arr) target = total / 3 a, b = 0, len(arr)-1 a_tot = b_tot = 0 while a_tot != tar...
class Solution: def can_three_parts_equal_sum(self, arr: List[int]) -> bool: if len(arr) < 3: return False total = sum(arr) target = total / 3 (a, b) = (0, len(arr) - 1) a_tot = b_tot = 0 while a_tot != target or a == 0: if a >= len(arr): ...
load("@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", "APPLE") load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native") load( "//tools/build_defs/oss:rn_defs.bzl", "react_native_xplat_target", "rn_xplat_cxx_library", ) def rn_codegen_test( fixture_name = ""): ge...
load('@fbsource//tools/build_defs:default_platform_defs.bzl', 'ANDROID', 'APPLE') load('@fbsource//tools/build_defs:fb_native_wrapper.bzl', 'fb_native') load('//tools/build_defs/oss:rn_defs.bzl', 'react_native_xplat_target', 'rn_xplat_cxx_library') def rn_codegen_test(fixture_name=''): generate_fixtures_rule_name ...
{ "targets": [ { "target_name": "shm-buffer", "sources": [ "src/shm-buffer.cc" ], "include_dirs": [ "<!(node -e \"require('nan')\")" ] } ] }
{'targets': [{'target_name': 'shm-buffer', 'sources': ['src/shm-buffer.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}]}
# from sqlalchemy import create_engine class DB(object): """ DB connection helper class like standard flask 3-rd party libraries """ def __init__(self, app=None): if app is not None: self.init_app(app) def init_app(self, app): pass
class Db(object): """ DB connection helper class like standard flask 3-rd party libraries """ def __init__(self, app=None): if app is not None: self.init_app(app) def init_app(self, app): pass
class Solution: def exist(self, board, word): # write your code here m, n = len(board), len(board[0]) for i in range(m): for j in range(n): if board[i][j] == word[0]: if self.helper(board, i, j, 1, word, set()): return T...
class Solution: def exist(self, board, word): (m, n) = (len(board), len(board[0])) for i in range(m): for j in range(n): if board[i][j] == word[0]: if self.helper(board, i, j, 1, word, set()): return True return False ...
user_inp = str(input("Enter a Phrase: ")) text = user_inp.split() a = " " for i in text: a = a+str(i[0]).upper() print(a)
user_inp = str(input('Enter a Phrase: ')) text = user_inp.split() a = ' ' for i in text: a = a + str(i[0]).upper() print(a)
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def hasPathSum(self, root, targetSum): """ :type root: TreeNode :typ...
class Solution(object): def has_path_sum(self, root, targetSum): """ :type root: TreeNode :type targetSum: int :rtype: bool """ def dfs(node, rem): if not node: return False if not node.right: if not node.left:...
# Python Program for n-th Fibonacci number def fibonacci(n): f = [0,1] if n <= 0: return "Enter a valid number" elif n == 1 or n == 2: return n-1 else: for i in range(n-2): fn = f[0] + f[1] f[0] = f[1] f[1] = fn return fn if __name__ ...
def fibonacci(n): f = [0, 1] if n <= 0: return 'Enter a valid number' elif n == 1 or n == 2: return n - 1 else: for i in range(n - 2): fn = f[0] + f[1] f[0] = f[1] f[1] = fn return fn if __name__ == '__main__': n = int(input('Enter ...
DATE_TIME = 'M j, g:i' DATE_AT_TIME = 'F j, Y \\a\\t g:i A T' TIME = 'g:i A T' WEEKDATE = 'l, F j, Y' WEEKDATE_AT_TIME = 'l, F j, Y \\a\\t g:i A T'
date_time = 'M j, g:i' date_at_time = 'F j, Y \\a\\t g:i A T' time = 'g:i A T' weekdate = 'l, F j, Y' weekdate_at_time = 'l, F j, Y \\a\\t g:i A T'
def metade(n): return n / 2 def dobro(n): return n * 2 def aumentar(n, p): r = 1 + (p / 100) return n * r def diminuir(n, p): r = 1 - (p / 100) return n * r def moeda(p): res = str(p).replace('.', ',') + '0' return res
def metade(n): return n / 2 def dobro(n): return n * 2 def aumentar(n, p): r = 1 + p / 100 return n * r def diminuir(n, p): r = 1 - p / 100 return n * r def moeda(p): res = str(p).replace('.', ',') + '0' return res
""" A string is said to be a special string if either of two conditions is met: - All of the characters are the same, e.g. aaa. - All characters except the middle one are the same, e.g. aadaa. A special substring is any substring of a string which meets one of those criteria. Given a string, determ...
""" A string is said to be a special string if either of two conditions is met: - All of the characters are the same, e.g. aaa. - All characters except the middle one are the same, e.g. aadaa. A special substring is any substring of a string which meets one of those criteria. Given a string, determ...
#-*- coding:utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # mga@openerp.com # # This program is free software: you can redistribute it and/or mo...
{'name': 'Email Gateway', 'version': '1.0', 'depends': ['mail'], 'author': 'OpenERP SA', 'category': 'Tools', 'description': "\nRetrieve incoming email on POP/IMAP servers.\n============================================\n\nEnter the parameters of your POP/IMAP account(s), and any incoming emails on\nthese accounts will ...
# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at # the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights # reserved. See files LICENSE and NOTICE for details. # # This file is part of CEED, a collection of benchmarks, miniapps, software # libraries and APIs for efficient h...
execfile('postprocess-base.py') hpc = {'s': 'std', 'h': 'hpc'} mf = {'a': 'A', 'm': 'PA'} set1 = sorted([(run['order'], run['quadrature-pts'], mf[run['action-type'][0]], hpc[run['std | hpc'][0]], run['compiler'], run['num-procs'], run['assembly-dps'] / 1000000.0, run['cg-iteration-dps'] / 1000000.0, 1.0 * run['num-elem...
# # PySNMP MIB module NBS-OTNPM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBS-OTNPM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:07:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ...
test = { 'name': 'Question 5', 'points': 2, 'suites': [ { 'cases': [ { 'answer': 'While score0 and score1 are both less than goal', 'choices': [ 'While score0 and score1 are both less than goal', 'While at least one of score0 or score1 is less than goa...
test = {'name': 'Question 5', 'points': 2, 'suites': [{'cases': [{'answer': 'While score0 and score1 are both less than goal', 'choices': ['While score0 and score1 are both less than goal', 'While at least one of score0 or score1 is less than goal', 'While score0 is less than goal', 'While score1 is less than goal'], '...
# # CSCS ReFrame CI settings # class ReframeSettings: job_poll_intervals = [1, 2, 3] job_submit_timeout = 60 checks_path = ['checks/'] checks_path_recurse = True site_configuration = { 'systems': { 'daint': { 'descr': 'Piz Daint CI nodes', 'hostn...
class Reframesettings: job_poll_intervals = [1, 2, 3] job_submit_timeout = 60 checks_path = ['checks/'] checks_path_recurse = True site_configuration = {'systems': {'daint': {'descr': 'Piz Daint CI nodes', 'hostnames': ['daint'], 'modules_system': 'tmod', 'resourcesdir': '/apps/common/UES/reframe/re...
class TwelveMonthCycle(QCAlgorithm): def Initialize(self): self.SetStartDate(2013, 1, 1) self.SetEndDate(2018, 8, 1) self.SetCash(100000) self.AddEquity("SPY", Resolution.Daily) self.Schedule.On(self.DateRules.MonthStart("SPY"), self.TimeRules.AfterMarketOpen("SPY"), s...
class Twelvemonthcycle(QCAlgorithm): def initialize(self): self.SetStartDate(2013, 1, 1) self.SetEndDate(2018, 8, 1) self.SetCash(100000) self.AddEquity('SPY', Resolution.Daily) self.Schedule.On(self.DateRules.MonthStart('SPY'), self.TimeRules.AfterMarketOpen('SPY'), self.Re...
# Obtem o arquivo de saida de um teste e o exibe. percentages = [] with open('test_out', 'r') as out: for line in out: if line.startswith('Percentage of NIC rate:'): percentages.append(line.split()[-1]) experiment_order = ['| Jellyfish | TCP 1 Flow | ECMP |', '| Jellyfish | T...
percentages = [] with open('test_out', 'r') as out: for line in out: if line.startswith('Percentage of NIC rate:'): percentages.append(line.split()[-1]) experiment_order = ['| Jellyfish | TCP 1 Flow | ECMP |', '| Jellyfish | TCP 8 Flows | ECMP |', '| Jellyfish | TCP 1 Flow | 8KSHORT|', '| ...
#!/bin/python3 def lg(x): return x.bit_length()-1 if __name__=="__main__": raise RuntimeError("This file is importable, but not executable")
def lg(x): return x.bit_length() - 1 if __name__ == '__main__': raise runtime_error('This file is importable, but not executable')
""" Convert soft selection to skin weights. .. figure:: _images/soft-selection-to-weights-example.png :align: center `Link to Video <https://vimeo.com/121190357>`_ Installation ============ * Extract the content of the .rar file anywhere on disk. * Drag the skinning-tools.mel file in Maya to permanently install t...
""" Convert soft selection to skin weights. .. figure:: _images/soft-selection-to-weights-example.png :align: center `Link to Video <https://vimeo.com/121190357>`_ Installation ============ * Extract the content of the .rar file anywhere on disk. * Drag the skinning-tools.mel file in Maya to permanently install t...
inputRow = int(input("Masukkan Angka : ")) for x in range(1, inputRow+1): for y in range(1, x + 1): print(x * y, end=" ") print()
input_row = int(input('Masukkan Angka : ')) for x in range(1, inputRow + 1): for y in range(1, x + 1): print(x * y, end=' ') print()
GIFTS = ['twelve Drummers Drumming', 'eleven Pipers Piping', 'ten Lords-a-Leaping', 'nine Ladies Dancing', 'eight Maids-a-Milking', 'seven Swans-a-Swimming', 'six Geese-a-Laying', 'five Gold Rings', 'four Calling Birds', 'three French Hens...
gifts = ['twelve Drummers Drumming', 'eleven Pipers Piping', 'ten Lords-a-Leaping', 'nine Ladies Dancing', 'eight Maids-a-Milking', 'seven Swans-a-Swimming', 'six Geese-a-Laying', 'five Gold Rings', 'four Calling Birds', 'three French Hens', 'two Turtle Doves', 'a Partridge in a Pear Tree'] ordinal = [None, 'first', 's...
# Given as solution.. subsetspecies = survey_data[survey_data["name"].isin(['Dipodomys merriami', 'Dipodomys ordii', 'Reithrodontomys megalotis', 'Chaetodipus baileyi'])] month_evolution = subsetspecies.groupby("name").resample('M', on='eventDate').size().rename("co...
subsetspecies = survey_data[survey_data['name'].isin(['Dipodomys merriami', 'Dipodomys ordii', 'Reithrodontomys megalotis', 'Chaetodipus baileyi'])] month_evolution = subsetspecies.groupby('name').resample('M', on='eventDate').size().rename('counts') month_evolution = month_evolution.reset_index() month_evolution.head(...
class ClassComparator: def __init__(self, user=None, business=None): self.user = user self.business = business def wifi(self): factor = 0.0 for data in self.user.wifi: if self.business.wifi == data[0]: factor = data[1] break re...
class Classcomparator: def __init__(self, user=None, business=None): self.user = user self.business = business def wifi(self): factor = 0.0 for data in self.user.wifi: if self.business.wifi == data[0]: factor = data[1] break r...
headers = [ 'Export.hpp', 'Keys.hpp', 'Salts.hpp', 'RobTopCipher.hpp', 'DataCipher.hpp', 'CheckGenerator.hpp' ] includes = [ 'vector', 'string', 'iostream' ] #Helpers def findHeaderBegin(lines): for i in range(len(lines)): if lines[i].startswith('namespace gdcrypto'): ...
headers = ['Export.hpp', 'Keys.hpp', 'Salts.hpp', 'RobTopCipher.hpp', 'DataCipher.hpp', 'CheckGenerator.hpp'] includes = ['vector', 'string', 'iostream'] def find_header_begin(lines): for i in range(len(lines)): if lines[i].startswith('namespace gdcrypto'): return i + 2 return 0 def find_h...
a, b = 0, 1 while a < 10: print(a) a, b = b, a + b print() for ch in "string": if ch == "i": break print(ch) for ch in "string": if ch == "i": continue print(ch)
(a, b) = (0, 1) while a < 10: print(a) (a, b) = (b, a + b) print() for ch in 'string': if ch == 'i': break print(ch) for ch in 'string': if ch == 'i': continue print(ch)
ax = opcsim.plots.histplot( opc.evaluate(d, weight='volume'), opc.bins) ax.set_ylabel("$dV/dlogD_p$") sns.despine()
ax = opcsim.plots.histplot(opc.evaluate(d, weight='volume'), opc.bins) ax.set_ylabel('$dV/dlogD_p$') sns.despine()
#Tuples #data structure, can store any type of data #Tuples are immutable #data inside tuple String = ('word1','word2','word3')#we not use[] #Tuples not perform method append,insert,pop,remove #Tuples Methods #count,Index, Len Function,Slicing([:2]) days = ('monday','tuesday')#like that data not be change #tuples are ...
string = ('word1', 'word2', 'word3') days = ('monday', 'tuesday') print(f'Length of the string: {len(String)}') print(f'Length of the string: {String[:4]}')
#Create a calculator that asks the user for two numbers m = "multiplication" d = "division" a = "addition" s = "subtraction" #function for multiplication def multiplication(): num1 = input("Okay, enter a number: ") num2 = input("Okay enter another number: ") print(float(num1) * float(num2)) #function f...
m = 'multiplication' d = 'division' a = 'addition' s = 'subtraction' def multiplication(): num1 = input('Okay, enter a number: ') num2 = input('Okay enter another number: ') print(float(num1) * float(num2)) def division(): num1 = input('Okay, enter a number: ') num2 = input('Okay enter another num...
COMPUTE_SLA_TEMPLATE = { "type": "Compute", "templateId": "", "name": "dataAssetComputeExecutionAgreement", "description": "", "creator": "", "serviceAgreementTemplate": { "contractName": "EscrowComputeExecutionTemplate", "events": [ { "name": "AgreementCreated", "actorType": "...
compute_sla_template = {'type': 'Compute', 'templateId': '', 'name': 'dataAssetComputeExecutionAgreement', 'description': '', 'creator': '', 'serviceAgreementTemplate': {'contractName': 'EscrowComputeExecutionTemplate', 'events': [{'name': 'AgreementCreated', 'actorType': 'consumer', 'handler': {'moduleName': 'EscrowCo...
## 1. Probability basics ## # Print the first two rows of the data. print(flags[:2]) most_bars_country = flags['name'][flags['bars'].idxmax()] highest_population_country = flags['name'][flags['population'].idxmax()] ## 2. Calculating probability ## total_countries = flags.shape[0] orange_probability = len(flags[flag...
print(flags[:2]) most_bars_country = flags['name'][flags['bars'].idxmax()] highest_population_country = flags['name'][flags['population'].idxmax()] total_countries = flags.shape[0] orange_probability = len(flags[flags['orange'] == 1]) / total_countries stripe_probability = len(flags[flags['stripes'] > 1]) / total_count...
""" PASSENGERS """ numPassengers = 3607 passenger_arriving = ( (5, 9, 8, 5, 2, 0, 4, 11, 3, 3, 2, 0), # 0 (4, 14, 9, 5, 2, 0, 10, 8, 1, 6, 3, 0), # 1 (4, 6, 10, 5, 5, 0, 8, 7, 6, 8, 3, 0), # 2 (9, 11, 12, 0, 4, 0, 5, 14, 6, 4, 1, 0), # 3 (4, 9, 13, 4, 1, 0, 2, 10, 7, 8, 1, 0), # 4 (1, 10, 4, 1, 0, 0, 9, 9...
""" PASSENGERS """ num_passengers = 3607 passenger_arriving = ((5, 9, 8, 5, 2, 0, 4, 11, 3, 3, 2, 0), (4, 14, 9, 5, 2, 0, 10, 8, 1, 6, 3, 0), (4, 6, 10, 5, 5, 0, 8, 7, 6, 8, 3, 0), (9, 11, 12, 0, 4, 0, 5, 14, 6, 4, 1, 0), (4, 9, 13, 4, 1, 0, 2, 10, 7, 8, 1, 0), (1, 10, 4, 1, 0, 0, 9, 9, 4, 7, 0, 0), (7, 4, 5, 3, 3, 0, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/20 2:48 PM # @Author : Insomnia # @Desc : TODO # @File : ListNode.py # @Software: PyCharm class Node(object): def __init__(self, val, p = None): self.val = val self.next = p def generateListNode(arr): if len(arr) == 0: ...
class Node(object): def __init__(self, val, p=None): self.val = val self.next = p def generate_list_node(arr): if len(arr) == 0: return None tmp = node(-1) ptr = tmp for val in arr: ptr.next = node(val) ptr = ptr.next return tmp.next def print_list_node...
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-SourceRouteEndStationMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-SourceRouteEndStationMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:21:56 2019 # On host DAVWANG4-M-1475 platform Darwin v...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_union, value_size_constraint, constraints_intersection) ...
def resolve(): ''' code here ''' N, M = [int(item) for item in input().split()] bridges = [[int(item) for item in input().split()] for _ in range(M)] bridges = sorted(bridges, key=lambda x:x[1]) res = 1 prev = bridges[0][1] for a, b in bridges: if a >= prev: re...
def resolve(): """ code here """ (n, m) = [int(item) for item in input().split()] bridges = [[int(item) for item in input().split()] for _ in range(M)] bridges = sorted(bridges, key=lambda x: x[1]) res = 1 prev = bridges[0][1] for (a, b) in bridges: if a >= prev: ...
HOST = 'localhost' PORT = 8000 TIMEOUT = 500 DEBUG = True BATCHER_PRIVATE_KEY_FILE_NAME = 'clientWEB'
host = 'localhost' port = 8000 timeout = 500 debug = True batcher_private_key_file_name = 'clientWEB'
""" SleekXMPP: The Sleek XMPP Library Copyright (C) 2011 Nathanael C. Fritz This file is part of SleekXMPP. See the file LICENSE for copying permission. """ __all__ = [ 'feature_starttls', 'feature_mechanisms', 'feature_bind', 'feature_session', 'feature_rosterver', 'feature_p...
""" SleekXMPP: The Sleek XMPP Library Copyright (C) 2011 Nathanael C. Fritz This file is part of SleekXMPP. See the file LICENSE for copying permission. """ __all__ = ['feature_starttls', 'feature_mechanisms', 'feature_bind', 'feature_session', 'feature_rosterver', 'feature_preapproval']
def hcfnaive(a,b): if(b==0): return a else: return hcfnaive(b,a%b) a = 60 b= 48 # prints 12 print ("The gcd of 60 and 48 is : ",end="") print (hcfnaive(60,48))
def hcfnaive(a, b): if b == 0: return a else: return hcfnaive(b, a % b) a = 60 b = 48 print('The gcd of 60 and 48 is : ', end='') print(hcfnaive(60, 48))
n, m = [int(i) for i in input().split(" ")] lines = n nodes = n nodes -= m lines -= (m*2) # 7 - 2*2 = 3 # nodes: 5 ans = -1 if m == 0 or m == 1: if n == 0: ans = 0 else: ans = 1 elif lines <= 0: ans = n - m else: ans = nodes - lines print(ans)
(n, m) = [int(i) for i in input().split(' ')] lines = n nodes = n nodes -= m lines -= m * 2 ans = -1 if m == 0 or m == 1: if n == 0: ans = 0 else: ans = 1 elif lines <= 0: ans = n - m else: ans = nodes - lines print(ans)
score = input("Enter Score: ") s = float(score) if s < 0.0: print("Error! score less 0.0") quit() if s > 1.0: print("Error! score grater 1.0") quit() if s >= 0.9: print("A") elif s >= 0.8: print("B") elif s >= 0.7: print("C") elif s >= 0.6: print("D") elif s < 0.6: print("F")
score = input('Enter Score: ') s = float(score) if s < 0.0: print('Error! score less 0.0') quit() if s > 1.0: print('Error! score grater 1.0') quit() if s >= 0.9: print('A') elif s >= 0.8: print('B') elif s >= 0.7: print('C') elif s >= 0.6: print('D') elif s < 0.6: print('F')
def templateEntity(template) -> dict: return{ "_id": str(template['_id']), "name": template['name'], "subject": template["subject"], "content": template["content"], } def templateEntities(templates) -> list: return [templateEntity(template) for template in templates]
def template_entity(template) -> dict: return {'_id': str(template['_id']), 'name': template['name'], 'subject': template['subject'], 'content': template['content']} def template_entities(templates) -> list: return [template_entity(template) for template in templates]
# Copyright 2018 Xanadu Quantum Technologies 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 agre...
""" .. _backends: Backend API =================================================== **Module name:** :mod:`strawberryfields.backends.base` .. currentmodule:: strawberryfields.backends.base This module implements the backend API. It contains the classes * :class:`BaseBackend` * :class:`BaseFock` * :class:`BaseGaussia...
''' There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all co...
""" There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all co...
def validate_password_for_count(input_string): rng_string, letter, password = input_string.split(' ') letter = letter[:-1] least, most = rng_string.split('-') count = password.count(letter) if int(least) <= count <= int(most): return True else: return False def validate_password...
def validate_password_for_count(input_string): (rng_string, letter, password) = input_string.split(' ') letter = letter[:-1] (least, most) = rng_string.split('-') count = password.count(letter) if int(least) <= count <= int(most): return True else: return False def validate_pass...
""" """ def get_remote_address(request): """ :param: request: request object of sanic :return: the ip address of given request (or 127.0.0.1 if none found) """ # Check if request object has remote_addr attribute set # Seems to break on sanic 19.6.3 if hasattr(request, 'remote_addr'): ...
""" """ def get_remote_address(request): """ :param: request: request object of sanic :return: the ip address of given request (or 127.0.0.1 if none found) """ if hasattr(request, 'remote_addr'): return request.remote_addr else: return request.ip
def generate_attributes(num_replications, num_global_memory_banks=32): """ Generates the kernel attributes for the global memory. They specify in which global memory the buffer is located. The buffers will be placed using a round robin scheme using the available global memory banks and the number of ...
def generate_attributes(num_replications, num_global_memory_banks=32): """ Generates the kernel attributes for the global memory. They specify in which global memory the buffer is located. The buffers will be placed using a round robin scheme using the available global memory banks and the number of ...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class UploadJARRequest(object): """Implementation of the 'Upload JAR Request.' model. UploadMRJarViewPathWrapper contains jar name and local mount path where the Jars will be uploaded. Attributes: jar_name (string): JarName is the n...
class Uploadjarrequest(object): """Implementation of the 'Upload JAR Request.' model. UploadMRJarViewPathWrapper contains jar name and local mount path where the Jars will be uploaded. Attributes: jar_name (string): JarName is the name of the uploaded jar. jar_path (string): JarPat...
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def audioFile(): http_archive( name="AudioFile" , build_file="//bazel/deps/AudioFile:build.BUILD" , sha256="aa893a...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def audio_file(): http_archive(name='AudioFile', build_file='//bazel/deps/AudioFile:build.BUILD', sha256='aa893a464546b686dd4d2555eafe2a0e9f4a96713328cf6e37603d7e9af02348', strip_prefix='AudioFile-1c77de76f4f396f1019088f3cd9da5141148ee76', urls=[...
#!/usr/bin/env python3 # Self powers #Problem 48 #The series, 11 + 22 + 33 + ... + 1010 = 10405071317. #Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000 result = 0 for num in range(1,1001): result+= num**num print(result % 10000000000) # 9110846700 YAY
result = 0 for num in range(1, 1001): result += num ** num print(result % 10000000000)
class Persona(): def __init__(self, edad, nombre, sexo, nivel): self.edad = edad self.nombre = nombre self.sexo = sexo self.nivel = nivel def imprimir(self): print(self.edad // self.nivel) def nombrar(self): if self.nombre == "Jesus": print("Nad...
class Persona: def __init__(self, edad, nombre, sexo, nivel): self.edad = edad self.nombre = nombre self.sexo = sexo self.nivel = nivel def imprimir(self): print(self.edad // self.nivel) def nombrar(self): if self.nombre == 'Jesus': print('Nada'...
ON_KAGGLE = False ON_SERVER = True DATA_ROOT = '/kaggle/input/3d-object-detection-for-autonomous-vehicles/' if ON_KAGGLE else '../input/' DATA_DIR = '../../input/' OUTPUT_ROOT = "../../../output/" PROJECT_ROOT = "/home/tanya/lyft/progs/kaggle-lyft" if ON_SERVER else 'C:/Users/New/Documents/Challenges/lyft/progs'...
on_kaggle = False on_server = True data_root = '/kaggle/input/3d-object-detection-for-autonomous-vehicles/' if ON_KAGGLE else '../input/' data_dir = '../../input/' output_root = '../../../output/' project_root = '/home/tanya/lyft/progs/kaggle-lyft' if ON_SERVER else 'C:/Users/New/Documents/Challenges/lyft/progs' img_si...