content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def finalPrices(self, prices: List[int]) -> List[int]: res = [] for i in range(len(prices)): for j in range(i+1,len(prices)): if prices[j]<=prices[i]: res.append(prices[i]-prices[j]) break if j==len(p...
class Solution: def final_prices(self, prices: List[int]) -> List[int]: res = [] for i in range(len(prices)): for j in range(i + 1, len(prices)): if prices[j] <= prices[i]: res.append(prices[i] - prices[j]) break if...
"""Tests for the sbahn_munich integration""" line_dict = { "name": "S3", "color": "#333333", "text_color": "#444444", }
"""Tests for the sbahn_munich integration""" line_dict = {'name': 'S3', 'color': '#333333', 'text_color': '#444444'}
N, M = map(int, input().split()) for i in range(1, M + 1): if i % 2 == 1: j = (i - 1) // 2 print(1 + j, M + 1 - j) else: j = (i - 2) // 2 print(M + 2 + j, 2 * M + 1 - j)
(n, m) = map(int, input().split()) for i in range(1, M + 1): if i % 2 == 1: j = (i - 1) // 2 print(1 + j, M + 1 - j) else: j = (i - 2) // 2 print(M + 2 + j, 2 * M + 1 - j)
summary = 0 i = 0 while i < 5: summary = summary + i print(summary) i = i + 1
summary = 0 i = 0 while i < 5: summary = summary + i print(summary) i = i + 1
# Store the version here so: # 1) we don't load dependencies by storing it in __init__.py # 2) we can import it in setup.py for the same reason # 3) we can import it into your module module # https://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package __version__ = '1.6.1' release_note...
__version__ = '1.6.1' release_notes = {'1.6.1': '\n Fixed GUI crash when loading certain RLBot config files with relative paths for agents.\n Fixed agent preset loading to allow multiple agents to saved/loaded correctly if they have the same name. - ima9rd\n ', '1.6.0': '\n Add support for auto starting .NE...
input = """ c(2). p(1). a(2). d(2,2,1). okay(X):- c(X), #count{V:a(V),d(V,X,1)} = 1. ouch(X):- p(X), #count{V:a(V),d(V,X,1)} = 1. """ output = """ {a(2), c(2), d(2,2,1), okay(2), p(1)} """
input = '\nc(2).\np(1).\na(2).\nd(2,2,1).\nokay(X):- c(X), #count{V:a(V),d(V,X,1)} = 1.\nouch(X):- p(X), #count{V:a(V),d(V,X,1)} = 1.\n' output = '\n{a(2), c(2), d(2,2,1), okay(2), p(1)}\n'
# # PySNMP MIB module XXX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XXX-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:44:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, value_size_constraint, constraints_intersection) ...
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'conditions': [ ['OS!="win"', { 'variables': { 'config_h_dir': '.', # crafted for gcc/linux. }, }, { # else, ...
{'conditions': [['OS!="win"', {'variables': {'config_h_dir': '.'}}, {'variables': {'config_h_dir': 'vsprojects'}, 'target_defaults': {'msvs_disabled_warnings': [4018, 4244, 4355], 'defines!': ['WIN32_LEAN_AND_MEAN']}}]], 'targets': [{'target_name': 'protobuf_lite', 'type': '<(library)', 'toolsets': ['host', 'target'], ...
# def mul(a): # return lambda b:b*a # singler = mul(1) # addition = lambda b:b*1 # doubler = mul(2) # addition = lambda b:b*2 # tripler = mul(3) # addition = lambda b:b*3 # print(doubler(7)) # 7*2 = 14 # print(tripler(7)) # 7*3 = 21 # print(singler(7)) # 7*1 = 7 class Student: def __init__(self, fna...
class Student: def __init__(self, fname): self.fname = fname def greet(self, fname): return f'Hello, {fname}' class Batcha(Student): def __init__(self, lname): self.lname = lname super().__init__('Nikunj') def print_name(self): return f'{self.fname} {self.lna...
class MyError(Exception): pass class PropertyContainer(object): def __init__(self): self.props = {} def set_property(self, prop, value): self.props[prop] = value def get_property(self, prop): return self.props.get(prop) def has_property(self, prop...
class Myerror(Exception): pass class Propertycontainer(object): def __init__(self): self.props = {} def set_property(self, prop, value): self.props[prop] = value def get_property(self, prop): return self.props.get(prop) def has_property(self, prop): return prop i...
SCRABBLE_LETTER_VALUES = { 'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3, 'q': 10, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 4, 'w': 4, 'x': 8, 'y': 4, 'z': 10 } def getWordScore(word, n): """ Returns the score for a word. Assu...
scrabble_letter_values = {'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3, 'q': 10, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 4, 'w': 4, 'x': 8, 'y': 4, 'z': 10} def get_word_score(word, n): """ Returns the score for a word. Assumes the ...
# code.... a = 1 b = 2 c = 3 s = a+b+c r = s/3 print(r) # code.... ''' def average(): a=1 b=2 c=3 s=a+b+c r=s/3 print(r) average() ''' ''' #input #parameter #argument def average(a,b,c): s=a+b+c r=s/3 print(r) average(10,20,30) ''' def average(a, b, c): s = a+b+c r = s/3 ...
a = 1 b = 2 c = 3 s = a + b + c r = s / 3 print(r) '\ndef average():\n a=1\n b=2\n c=3\n s=a+b+c\n r=s/3\n print(r)\naverage()\n' '\n#input\n#parameter\n#argument\ndef average(a,b,c):\n s=a+b+c\n r=s/3\n print(r)\naverage(10,20,30)\n' def average(a, b, c): s = a + b + c r = s / 3 ...
""" Base settings for Proxito Some of these settings will eventually be backported into the main settings file, but currently we have them to be able to run the site with the old middleware for a staged rollout of the proxito code. """ class CommunityProxitoSettingsMixin: ROOT_URLCONF = 'readthedocs.proxito.url...
""" Base settings for Proxito Some of these settings will eventually be backported into the main settings file, but currently we have them to be able to run the site with the old middleware for a staged rollout of the proxito code. """ class Communityproxitosettingsmixin: root_urlconf = 'readthedocs.proxito.urls'...
''' This is the Settings File for the Mattermost-Octane Bridge. You can change various variables here to customize and set up the client. ''' '''----------------------Mattermost Webhook Configuration----------------------''' #URL of the webhook from mattermost. To create one go to `Main Menu -> Integrations -> Incom...
""" This is the Settings File for the Mattermost-Octane Bridge. You can change various variables here to customize and set up the client. """ '----------------------Mattermost Webhook Configuration----------------------' mm_webhook_url = 'http://localhost:8065/hooks/yuro8xrfeffj787cj1bwc4ziue' mm_channel = None mm_user...
def hello_world(request): request_json = request.get_json() name = 'World' if request_json and 'name' in request_json: name = request_json['name'] headers = { 'Access-Control-Allow-Origin': 'https://furikuri.net', 'Access-Control-Allow-Methods': 'GET, POST', 'Access-Contr...
def hello_world(request): request_json = request.get_json() name = 'World' if request_json and 'name' in request_json: name = request_json['name'] headers = {'Access-Control-Allow-Origin': 'https://furikuri.net', 'Access-Control-Allow-Methods': 'GET, POST', 'Access-Control-Allow-Headers': 'Conte...
#Copyright ReportLab Europe Ltd. 2000-2016 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/__init__.py __version__='3.3.0' __doc__='''Business charts'''
__version__ = '3.3.0' __doc__ = 'Business charts'
total_budget = 0 while True: destination = input() if destination == "End": break minimal_budget = float(input()) while True: command = input() if command == "End": break money = float(command) total_budget += money if total_budge...
total_budget = 0 while True: destination = input() if destination == 'End': break minimal_budget = float(input()) while True: command = input() if command == 'End': break money = float(command) total_budget += money if total_budget >= minimal_b...
price = float(input()) puzzles = int(input()) dolls = int(input()) bears = int(input()) minions = int(input()) trucks = int(input()) total_toys = puzzles + dolls + bears + minions + trucks price_puzzles = puzzles * 2.6 price_dolls = dolls * 3 price_bears = bears * 4.1 price_minions = minions * 8.2 pric...
price = float(input()) puzzles = int(input()) dolls = int(input()) bears = int(input()) minions = int(input()) trucks = int(input()) total_toys = puzzles + dolls + bears + minions + trucks price_puzzles = puzzles * 2.6 price_dolls = dolls * 3 price_bears = bears * 4.1 price_minions = minions * 8.2 price_trucks = trucks...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of groupthink. # https://github.com/emanuelfeld/groupthink # This project is in the public domain within the United States. # Additionally, the Government of the District of Columbia waives # copyright and related rights in the work worldwide through t...
__version__ = '1.0.0'
load("//python:compile.bzl", "py_proto_compile", "py_grpc_compile") load("@grpc_py_deps//:requirements.bzl", "all_requirements") def py_proto_library(**kwargs): name = kwargs.get("name") deps = kwargs.get("deps") verbose = kwargs.get("verbose") visibility = kwargs.get("visibility") name_pb = name ...
load('//python:compile.bzl', 'py_proto_compile', 'py_grpc_compile') load('@grpc_py_deps//:requirements.bzl', 'all_requirements') def py_proto_library(**kwargs): name = kwargs.get('name') deps = kwargs.get('deps') verbose = kwargs.get('verbose') visibility = kwargs.get('visibility') name_pb = name +...
def indexof(listofnames, value): if value in listofnames: value_index = listofnames.index(value) return(listofnames, value_index) else: return(-1)
def indexof(listofnames, value): if value in listofnames: value_index = listofnames.index(value) return (listofnames, value_index) else: return -1
""" Page object file """ class Page(): """ Page object, it contains information about the pare we are refering, index, items per page, etc. """ page_index = 0 items_per_page = 0 def __init__(self, items_per_page, page_index): """ Creates the page """ self.page_index = int(page_index) ...
""" Page object file """ class Page: """ Page object, it contains information about the pare we are refering, index, items per page, etc. """ page_index = 0 items_per_page = 0 def __init__(self, items_per_page, page_index): """ Creates the page """ self.page_index = int(page_index) ...
{ "cells": [ { "cell_type": "code", "execution_count": 64, "metadata": {}, "outputs": [], "source": [ "# Import libraries\n", "import os, csv" ] }, { "cell_type": "code", "execution_count": 65, "metadata": {}, "outputs": [], "source": [ "#variables for the script\n", ...
{'cells': [{'cell_type': 'code', 'execution_count': 64, 'metadata': {}, 'outputs': [], 'source': ['# Import libraries\n', 'import os, csv']}, {'cell_type': 'code', 'execution_count': 65, 'metadata': {}, 'outputs': [], 'source': ['#variables for the script\n', 'months = [] #list of months\n', 'pl =[] ...
#!/usr/bin/env python #-*- coding:utf-8 -*- __all__ = ["args", "colors", "libcolors", "routine"] __version__ = "0.96"
__all__ = ['args', 'colors', 'libcolors', 'routine'] __version__ = '0.96'
# -*- coding: utf-8 -*- """Module compliance_suite.exceptions.user_config_exception.py This module contains class definition for user config file exceptions. """ class UserConfigException(Exception): """Exception for user config file-related errors""" pass
"""Module compliance_suite.exceptions.user_config_exception.py This module contains class definition for user config file exceptions. """ class Userconfigexception(Exception): """Exception for user config file-related errors""" pass
"""Type stubs for _pytest._code.""" # This class actually has more functions than are specified here. # We don't use these features, so I don't think its worth including # them in our type stub. We can always change it later. class ExceptionInfo: @property def value(self) -> Exception: ...
"""Type stubs for _pytest._code.""" class Exceptioninfo: @property def value(self) -> Exception: ...
def get_primes(n): primes = [] # stores the prime numbers within the reange of the number sieve = [False] * (n + 1) # stores boolean values indicating whether a number is prime or not sieve[0] = sieve[1] = True # marking 0 and 1 as not prime for i in range(2, n + 1): # loops over all the numbers to...
def get_primes(n): primes = [] sieve = [False] * (n + 1) sieve[0] = sieve[1] = True for i in range(2, n + 1): if sieve[i]: continue primes.append(i) for j in range(i ** 2, n + 1, i): sieve[j] = True return primes def get_factorization(n): prime_fa...
""" Module: 'urequests' on esp32 1.12.0 """ # MCU: (sysname='esp32', nodename='esp32', release='1.12.0', version='v1.12 on 2019-12-20', machine='ESP32 module (spiram) with ESP32') # Stubber: 1.3.2 class Response: '' def close(): pass content = None def json(): pass text = None def...
""" Module: 'urequests' on esp32 1.12.0 """ class Response: """""" def close(): pass content = None def json(): pass text = None def delete(): pass def get(): pass def head(): pass def patch(): pass def post(): pass def put(): pass def request(): ...
s = "([}}])" stack = [] if len(s) % 2 == 1: print(False) exit() for i in s: if i == "(": stack.append("(") elif i == "[": stack.append("[") elif i == "{": stack.append("{") elif i == ")": if len(stack) < 1: print(False) exit() if...
s = '([}}])' stack = [] if len(s) % 2 == 1: print(False) exit() for i in s: if i == '(': stack.append('(') elif i == '[': stack.append('[') elif i == '{': stack.append('{') elif i == ')': if len(stack) < 1: print(False) exit() if st...
"""Day 07""" def process(filename): with open(filename) as infile: positions = [int(x) for x in infile.readline().strip().split(',')] min_x = min(positions) max_x = max(positions) costs = {x: 0 for x in range(min_x, max_x + 1)} for pos in costs.keys(): for crab in positions: ...
"""Day 07""" def process(filename): with open(filename) as infile: positions = [int(x) for x in infile.readline().strip().split(',')] min_x = min(positions) max_x = max(positions) costs = {x: 0 for x in range(min_x, max_x + 1)} for pos in costs.keys(): for crab in positions: ...
class Foo: pass class Bar(Foo): def __init__(self): super(Bar, self).__init__() # [super-with-arguments] class Baz(Foo): def __init__(self): super().__init__() class Qux(Foo): def __init__(self): super(Bar, self).__init__() class NotSuperCall(Foo): def __init__(self)...
class Foo: pass class Bar(Foo): def __init__(self): super(Bar, self).__init__() class Baz(Foo): def __init__(self): super().__init__() class Qux(Foo): def __init__(self): super(Bar, self).__init__() class Notsupercall(Foo): def __init__(self): super.test(Bar, ...
"""The Ray autoscaler uses tags/labels to associate metadata with instances.""" # Tag for the name of the node TAG_RAY_NODE_NAME = "ray-node-name" # Tag for the kind of node (e.g. Head, Worker). For legacy reasons, the tag # value says 'type' instead of 'kind'. TAG_RAY_NODE_KIND = "ray-node-type" NODE_KIND_HEAD = "he...
"""The Ray autoscaler uses tags/labels to associate metadata with instances.""" tag_ray_node_name = 'ray-node-name' tag_ray_node_kind = 'ray-node-type' node_kind_head = 'head' node_kind_worker = 'worker' node_kind_unmanaged = 'unmanaged' tag_ray_user_node_type = 'ray-user-node-type' node_type_legacy_head = 'ray-legacy-...
_base_ = [ '../retinanet_r50_fpn_1x_coco.py', '../../_base_/datasets/hdr_detection_minmax_glob_gamma.py', ] # optimizer # lr is set for a batch size of 8 optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) # dict(grad_clip=dict(max_norm=35, norm_t...
_base_ = ['../retinanet_r50_fpn_1x_coco.py', '../../_base_/datasets/hdr_detection_minmax_glob_gamma.py'] optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.001, step=[10]) ru...
# solution 1: class Solution1: def convert(self, s: str, numRows: int) -> str: if numRows == 1 or numRows >= len(s): return s L = [''] * numRows index, step = 0, 1 for x in s: L[index] += x if index == 0: step = 1 ...
class Solution1: def convert(self, s: str, numRows: int) -> str: if numRows == 1 or numRows >= len(s): return s l = [''] * numRows (index, step) = (0, 1) for x in s: L[index] += x if index == 0: step = 1 elif index == n...
MANIFEST = { "hilt": { "h1": { "offsets": {"blade": 0, "button": {"x": (8, 9), "y": (110, 111)}}, "colours": { "primary": (216, 216, 216), # d8d8d8 "secondary": (141, 141, 141), # 8d8d8d "tertiary": (180, 97, 19), # b46113 ...
manifest = {'hilt': {'h1': {'offsets': {'blade': 0, 'button': {'x': (8, 9), 'y': (110, 111)}}, 'colours': {'primary': (216, 216, 216), 'secondary': (141, 141, 141), 'tertiary': (180, 97, 19)}, 'length': 24, 'materials': 'Alloy metal/Salvaged materials'}, 'h2': {'offsets': {'blade': 20, 'button': {'x': (8, 8), 'y': (100...
# Given a string containing just the characters '(', ')', '{', '}', '[' and ']', # determine if the input string is valid. # An input string is valid if: # Open brackets must be closed by the same type of brackets. # Open brackets must be closed in the correct order. # Note that an empty string is also considered val...
class Solution(object): def is_valid(self, s): """ :type s: str :rtype: bool """ dict = {')': '(', ']': '[', '}': '{'} stack = [] for ch in s: if ch in dict.values(): stack.append(ch) elif ch in dict.keys(): ...
""" TW10: Words by Prefix Team: Tam Tamura, Andrew Nalundasan For: OMSBA 2061, Seattle University Date: 11/3/2020 """ def wordByPrefix(prefix_length, word): my_dict = {} for key in word: for letter in word: prefix_key = letter[:prefix_length] letter = word[:prefix_len...
""" TW10: Words by Prefix Team: Tam Tamura, Andrew Nalundasan For: OMSBA 2061, Seattle University Date: 11/3/2020 """ def word_by_prefix(prefix_length, word): my_dict = {} for key in word: for letter in word: prefix_key = letter[:prefix_length] letter = word[:prefix_length] ...
"""Version information.""" # The following line *must* be the last in the module, exactly as formatted: __version__ = "0.16.1"
"""Version information.""" __version__ = '0.16.1'
## @file # Standardized Error Hanlding infrastructures. # # Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text...
file_open_failure = 1 file_write_failure = 2 file_parse_failure = 3 file_read_failure = 4 file_create_failure = 5 file_checksum_failure = 6 file_compress_failure = 7 file_decompress_failure = 8 file_move_failure = 9 file_delete_failure = 10 file_copy_failure = 11 file_positioning_failure = 12 file_already_exist = 13 fi...
ELECTRUM_VERSION = '4.1.5-radc' # version of the client package APK_VERSION = '4.1.5.0' # read by buildozer.spec PROTOCOL_VERSION = '1.4' # protocol version requested # The hash of the mnemonic seed must begin with this SEED_PREFIX = '01' # Standard wallet SEED_PREFIX_SW = '100' # S...
electrum_version = '4.1.5-radc' apk_version = '4.1.5.0' protocol_version = '1.4' seed_prefix = '01' seed_prefix_sw = '100' seed_prefix_2_fa = '101' seed_prefix_2_fa_sw = '102' def seed_prefix(seed_type): if seed_type == 'standard': return SEED_PREFIX elif seed_type == 'segwit': return SEED_PREF...
""" Class for all excpetions used in following scripts - geocoder.py - geocoder_input.py """ class OverlappingGeographyError(Exception): def __init__(self, message): self.message = message # msg: geodataframe has overlapping polygons representing geographic features # please how shapefiles are pro...
""" Class for all excpetions used in following scripts - geocoder.py - geocoder_input.py """ class Overlappinggeographyerror(Exception): def __init__(self, message): self.message = message class Nooverlapspatialjoinerror(Exception): def __init__(self, message): self.message = message class ...
class Node(object): def __init__(self, name, follow_list, intention, lane): self.name = name self.follow_list = follow_list self.intention = intention self.lane = lane def __eq__(self, other): if isinstance(other, Node): if self.name == other.get...
class Node(object): def __init__(self, name, follow_list, intention, lane): self.name = name self.follow_list = follow_list self.intention = intention self.lane = lane def __eq__(self, other): if isinstance(other, Node): if self.name == other.get_name() and ...
#!python """ ANNOTATE FUNCTIONS WITH TIME AND SPACE COMPLEXITY!!!!! """ def linear_search(array, item): """return the first index of item in array or None if item is not found""" return linear_search_iterative(array, item) # return linear_search_recursive(array, item) def linear_search_iterative(ar...
""" ANNOTATE FUNCTIONS WITH TIME AND SPACE COMPLEXITY!!!!! """ def linear_search(array, item): """return the first index of item in array or None if item is not found""" return linear_search_iterative(array, item) def linear_search_iterative(array, item): """Time complexity: O(n) because you iterate thro...
class MikanException(Exception): """Generic Mikan exception""" class ConversionError(MikanException, ValueError): """Cannot convert a string"""
class Mikanexception(Exception): """Generic Mikan exception""" class Conversionerror(MikanException, ValueError): """Cannot convert a string"""
""" Minimum edit distance computes the cost it takes to get from one string to another string. This implementation uses the Levenshtein distance with a cost of 1 for insertions or deletions and a cost of 2 for substitutions. Resource: https://en.wikipedia.org/wiki/Edit_distance For example, getting from "intention" ...
""" Minimum edit distance computes the cost it takes to get from one string to another string. This implementation uses the Levenshtein distance with a cost of 1 for insertions or deletions and a cost of 2 for substitutions. Resource: https://en.wikipedia.org/wiki/Edit_distance For example, getting from "intention" ...
#!/usr/bin/python # -*- coding: utf-8 -*- # Function to encrypt message using key is defined def encrypt(msg, key): # Defining empty strings and counters hexadecimal = '' iteration = 0 # Running for loop in the range of MSG and comparing the BITS for i in range(len(msg)): ...
def encrypt(msg, key): hexadecimal = '' iteration = 0 for i in range(len(msg)): temp = ord(msg[i]) ^ ord(key[iteration]) hexadecimal += hex(temp)[2:].zfill(2) iteration += 1 if iteration >= len(key): iteration = 0 return hexadecimal def decrypt(msg, key): ...
number_of_participants, number_of_pens, number_of_notebooks = map(int, input().split()) if number_of_pens >= number_of_participants and number_of_notebooks >= number_of_participants: print('Yes') else: print('No')
(number_of_participants, number_of_pens, number_of_notebooks) = map(int, input().split()) if number_of_pens >= number_of_participants and number_of_notebooks >= number_of_participants: print('Yes') else: print('No')
""" Custom exceptions for nflfastpy module """ class SeasonNotFoundError(Exception): pass
""" Custom exceptions for nflfastpy module """ class Seasonnotfounderror(Exception): pass
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Now write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. By a fixed monthly payment, we mean a single number which does not change each month, but instead is a constant amount that will be ...
""" Now write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. By a fixed monthly payment, we mean a single number which does not change each month, but instead is a constant amount that will be paid each month. In this problem, we will not b...
# coding: utf-8 # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
mebibyte = 1024 * 1024 streaming_default_part_size = 10 * MEBIBYTE default_part_size = 128 * MEBIBYTE object_use_multipart_size = 128 * MEBIBYTE
# Curbrock Summon 2 CURBROCK2 = 9400930 # MOD ID CURBROCKS_ESCAPE_ROUTE_VER2 = 600050040 # MAP ID CURBROCKS_ESCAPE_ROUTE_VER3 = 600050050 # MAP ID 2 sm.spawnMob(CURBROCK2, 190, -208, False) sm.createClock(1800) sm.addEvent(sm.invokeAfterDelay(1800000, "warp", CURBROCKS_ESCAPE_ROUTE_VER3, 0)) sm.waitForMobDeath(CURBRO...
curbrock2 = 9400930 curbrocks_escape_route_ver2 = 600050040 curbrocks_escape_route_ver3 = 600050050 sm.spawnMob(CURBROCK2, 190, -208, False) sm.createClock(1800) sm.addEvent(sm.invokeAfterDelay(1800000, 'warp', CURBROCKS_ESCAPE_ROUTE_VER3, 0)) sm.waitForMobDeath(CURBROCK2) sm.warp(CURBROCKS_ESCAPE_ROUTE_VER2) sm.stopEv...
def getNumBags(color): if color=='': return 0 numBags=1 for bag in rules[color]: numBags+=bag[1]*getNumBags(bag[0]) return numBags with open('day7/input.txt') as f: rules=dict([l.split(' contain') for l in f.read().replace(' bags', '').replace(' bag', '').replace('.', '').replace(' ...
def get_num_bags(color): if color == '': return 0 num_bags = 1 for bag in rules[color]: num_bags += bag[1] * get_num_bags(bag[0]) return numBags with open('day7/input.txt') as f: rules = dict([l.split(' contain') for l in f.read().replace(' bags', '').replace(' bag', '').replace('.',...
class SVDError(Exception): """Generic errors.""" pass
class Svderror(Exception): """Generic errors.""" pass
''' Largest rectangle area in a histogram:: Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity, assume that all bars have same width and the width is 1 unit. ''' def max_area_histogram(histogram): stack = list()...
""" Largest rectangle area in a histogram:: Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity, assume that all bars have same width and the width is 1 unit. """ def max_area_histogram(histogram): stack = list() ...
def sort(arr): # Start index 0. start = 0 # End index end = len(arr)-1 while start <= end: # Swap all positive value with last index end & decrease end by 1. if arr[start] >= 0: arr[start], arr[end] = arr[end], arr[start] end -= 1 else: # ...
def sort(arr): start = 0 end = len(arr) - 1 while start <= end: if arr[start] >= 0: (arr[start], arr[end]) = (arr[end], arr[start]) end -= 1 else: start += 1 if __name__ == '__main__': arr = [-1, 2, -3, 4, 5, 6, -7, 8, 9] sort(arr) print(arr)
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'includes': [ '../build/win_precompile.gypi', 'base.gypi', ], 'targets': [ { 'tar...
{'variables': {'chromium_code': 1}, 'includes': ['../build/win_precompile.gypi', 'base.gypi'], 'targets': [{'target_name': 'base', 'type': '<(component)', 'toolsets': ['host', 'target'], 'variables': {'base_target': 1, 'enable_wexit_time_destructors': 1, 'optimize': 'max'}, 'dependencies': ['base_static', 'allocator/al...
"""Define mixins to easily compose custom FilterDefinition classes.""" class TermsQueryMixin: """A mixin for filter definitions that need to apply term queries.""" def get_query_fragment(self, data): """Build the query fragments as term queries for each selected value.""" value_list = data.ge...
"""Define mixins to easily compose custom FilterDefinition classes.""" class Termsquerymixin: """A mixin for filter definitions that need to apply term queries.""" def get_query_fragment(self, data): """Build the query fragments as term queries for each selected value.""" value_list = data.get...
# Look at the charactercreator_character table # GET_CHARACTERS = """ # SELECT * # FROM charactercreator_character; # """ # How many total Characters are there? (302) TOTAL_CHARACTERS = """ SELECT COUNT(*) as number_of_characters FROM charactercreator_character; """ # How many of each specific subclass? # TOTAL_SUBC...
total_characters = '\nSELECT COUNT(*) as number_of_characters\nFROM charactercreator_character;\n' class = 'SELECT COUNT(*) FROM charactercreator_' total_items = '\nSELECT COUNT(item_id) as items\nFROM armory_item;\n' weapons = '\nSELECT COUNT(item_ptr_id)\nFROM armory_weapon;\n' non_weapons = '\nSELECT COUNT(items.nam...
def translate_bbox(bbox, y_offset=0, x_offset=0): """Translate bounding boxes. This method is mainly used together with image transforms, such as padding and cropping, which translates the left top point of the image from coordinate :math:`(0, 0)` to coordinate :math:`(y, x) = (y_{offset}, x_{offse...
def translate_bbox(bbox, y_offset=0, x_offset=0): """Translate bounding boxes. This method is mainly used together with image transforms, such as padding and cropping, which translates the left top point of the image from coordinate :math:`(0, 0)` to coordinate :math:`(y, x) = (y_{offset}, x_{offse...
k=0 while k!=1: print(k) k+=1
k = 0 while k != 1: print(k) k += 1
class Some_enum(Enum): some_literal = "some_literal" class Something(Some_enum): pass class Reference: pass __book_url__ = "dummy" __book_version__ = "dummy" associate_ref_with(Reference)
class Some_Enum(Enum): some_literal = 'some_literal' class Something(Some_enum): pass class Reference: pass __book_url__ = 'dummy' __book_version__ = 'dummy' associate_ref_with(Reference)
def orangesRotting(elemnts): if not elemnts or len(elemnts) == 0: return 0 n = len(elemnts) m = len(elemnts[0]) rotten = [] for i in range(n): for j in range(m): if elemnts[i][j] == 2: rotten.append((i, j)) mins = 0 def dfs(rotten): ...
def oranges_rotting(elemnts): if not elemnts or len(elemnts) == 0: return 0 n = len(elemnts) m = len(elemnts[0]) rotten = [] for i in range(n): for j in range(m): if elemnts[i][j] == 2: rotten.append((i, j)) mins = 0 def dfs(rotten): count...
input = """ 2 18 3 0 3 19 20 21 1 1 1 0 18 2 23 3 0 3 19 24 25 1 1 2 1 21 23 3 5 21 19 20 24 25 0 0 6 0 5 5 21 19 20 24 25 1 1 1 1 1 0 21 a 19 b 20 c 24 d 25 e 28 f 0 B+ 0 B- 1 0 1 """ output = """ COST 1@1 """
input = '\n2 18 3 0 3 19 20 21\n1 1 1 0 18\n2 23 3 0 3 19 24 25\n1 1 2 1 21 23\n3 5 21 19 20 24 25 0 0\n6 0 5 5 21 19 20 24 25 1 1 1 1 1\n0\n21 a\n19 b\n20 c\n24 d\n25 e\n28 f\n0\nB+\n0\nB-\n1\n0\n1\n' output = '\nCOST 1@1\n'
class TaskA: def run(self): V, A, B, C = map(int, input().split()) pass class TaskB: def run(self): A = int(input()) B = int(input()) C = int(input()) X = int(input()) counter = 0 for a in range(A+1): for b in range(B+1): ...
class Taska: def run(self): (v, a, b, c) = map(int, input().split()) pass class Taskb: def run(self): a = int(input()) b = int(input()) c = int(input()) x = int(input()) counter = 0 for a in range(A + 1): for b in range(B + 1): ...
def banner_text(text): screen_width = 80 if len(text) > screen_width - 4: print("EEK!!") print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH") if text == "*": print("*" * screen_width) else: centred_text = text.center(screen_width - 4) output_string = "**{0...
def banner_text(text): screen_width = 80 if len(text) > screen_width - 4: print('EEK!!') print('THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH') if text == '*': print('*' * screen_width) else: centred_text = text.center(screen_width - 4) output_string = '**{0}...
######################################################## FLASK SETTINGS ############################################################## #Variable used to securly sign cookies ##THIS IS SET IN DEV ENVIRONMENT FOR CONVENIENCE BUT SHOULD BE SET AS AN ENVIRONMENT VARIABLE IN PROD SECRET_KEY = "dev" ########################...
secret_key = 'dev' database_uri = 'bolt://test:test@localhost:7687'
def init(): global brightness global calibration_mode brightness = 500 calibration_mode = False
def init(): global brightness global calibration_mode brightness = 500 calibration_mode = False
class Node: def __init__(self, data): self.data = data self.prev = None self.next = None class SingleLinkedList: def __init__(self): self.head = None def add(self, ele): new_node = Node(ele) if self.head is None: self.head = new_node ...
class Node: def __init__(self, data): self.data = data self.prev = None self.next = None class Singlelinkedlist: def __init__(self): self.head = None def add(self, ele): new_node = node(ele) if self.head is None: self.head = new_node ...
def solution(A): total = sum(A) m = float('inf') left_sum = 0 for n in A[:-1]: left_sum += n v = abs(total - 2*left_sum) if v < m: m = v return m
def solution(A): total = sum(A) m = float('inf') left_sum = 0 for n in A[:-1]: left_sum += n v = abs(total - 2 * left_sum) if v < m: m = v return m
#! /usr/bin/env python3 """ constants.py - Contains all constants used by the device manager Author: - Pablo Caruana (pablo dot caruana at gmail dot com) Date: 12/3/2016 """ number_of_rows = 3 # total number rows of Index Servers number_of_links = 5 # number of links to be ...
""" constants.py - Contains all constants used by the device manager Author: - Pablo Caruana (pablo dot caruana at gmail dot com) Date: 12/3/2016 """ number_of_rows = 3 number_of_links = 5 number_of_chunks = 5 number_of_comps = 10
#!/usr/bin/python2 # # Copyright (c) 2012 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # """ Some common boilerplates and helper functions for source code generation in files dgen_test_output.py and dgen_decode_out...
""" Some common boilerplates and helper functions for source code generation in files dgen_test_output.py and dgen_decode_output.py. """ header_boilerplate = '/*\n * Copyright 2013 The Native Client Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style license that can\n * be found in th...
def matrix_form(): r = int(input("Enter the no of rows")) c = int(input("Enter the no of columns")) matrix=[] print("Enter the enteries") for i in range(r): a = [] for j in range(c): a.append(int(input())) matrix.append(a) return(matrix) def check_matrix(fi...
def matrix_form(): r = int(input('Enter the no of rows')) c = int(input('Enter the no of columns')) matrix = [] print('Enter the enteries') for i in range(r): a = [] for j in range(c): a.append(int(input())) matrix.append(a) return matrix def check_matrix(fir...
description = 'PGAA setup with XYZOmega sample table' group = 'basic' sysconfig = dict( datasinks = ['mcasink', 'chnsink', 'csvsink', 'livesink'] ) includes = [ 'system', 'reactor', 'nl4b', 'pressure', 'sampletable', 'pilz', 'detector', 'collimation', ] devices = dict( mcasin...
description = 'PGAA setup with XYZOmega sample table' group = 'basic' sysconfig = dict(datasinks=['mcasink', 'chnsink', 'csvsink', 'livesink']) includes = ['system', 'reactor', 'nl4b', 'pressure', 'sampletable', 'pilz', 'detector', 'collimation'] devices = dict(mcasink=device('nicos_mlz.pgaa.devices.MCASink', settypes=...
"""Queue represented by a pseudo stack (represented by a list with pop and append)""" class Queue: def __init__(self): self.stack = [] self.length = 0 def __str__(self): printed = "<" + str(self.stack)[1:-1] + ">" return printed """Enqueues {@code item} @param item ...
"""Queue represented by a pseudo stack (represented by a list with pop and append)""" class Queue: def __init__(self): self.stack = [] self.length = 0 def __str__(self): printed = '<' + str(self.stack)[1:-1] + '>' return printed 'Enqueues {@code item}\n @param item\n ...
# Assignment 1 Day 8 # write a decorator function for taking input for you # any kind of function you want to build def getInput(calculate_arg_fuc): def wrap_function(): print("Enter two numbers ") a=int(input("Enter first number = ")) b=int(input("Enter second number = ")) ...
def get_input(calculate_arg_fuc): def wrap_function(): print('Enter two numbers ') a = int(input('Enter first number = ')) b = int(input('Enter second number = ')) calculate_arg_fuc(a, b) return wrap_function @getInput def addition(num1, num2): print('Addition = ', num1 + ...
def unlock(m): return m.lower().translate( str.maketrans( 'abcdefghijklmnopqrstuvwxyz', '22233344455566677778889999' ) )
def unlock(m): return m.lower().translate(str.maketrans('abcdefghijklmnopqrstuvwxyz', '22233344455566677778889999'))
""" A Token is a button or other object on the table that represents a position, a game state, layer state, or some other piece of info """ class Token(object): def __init__(self, name, table): self.table = table self.name = name self.seat = None
""" A Token is a button or other object on the table that represents a position, a game state, layer state, or some other piece of info """ class Token(object): def __init__(self, name, table): self.table = table self.name = name self.seat = None
nis=get('nis') q1="xpto1" q2=nis + "xpto2" query=query1.q2 koneksi=0 q=execute(query,koneksi)
nis = get('nis') q1 = 'xpto1' q2 = nis + 'xpto2' query = query1.q2 koneksi = 0 q = execute(query, koneksi)
def nearest_mid(input_list, lower_bound_index, upper_bound_index, search_value): return lower_bound_index + ( (upper_bound_index - lower_bound_index) // (input_list[upper_bound_index] - input_list[lower_bound_index]) ) * (search_value - input_list[lower_bound_index]) def interpolation_search(o...
def nearest_mid(input_list, lower_bound_index, upper_bound_index, search_value): return lower_bound_index + (upper_bound_index - lower_bound_index) // (input_list[upper_bound_index] - input_list[lower_bound_index]) * (search_value - input_list[lower_bound_index]) def interpolation_search(ordered_list, term): s...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Provide function to calculate SDE distance @auth: Jungang Zou @date: 2021/05/05 """ def SDE(front, values1, values2): shifted_dict = {} for i in front: shifted_dict[i] = [(values1[i], values2[i])] shifted_list = [] for j in front: ...
""" Provide function to calculate SDE distance @auth: Jungang Zou @date: 2021/05/05 """ def sde(front, values1, values2): shifted_dict = {} for i in front: shifted_dict[i] = [(values1[i], values2[i])] shifted_list = [] for j in front: if i == j: continue ...
#!/usr/bin/env python # coding: utf-8 # In[ ]: #List and function # In[6]: # empty list my_list = [] # list of integers my_list = [1, 2, 3] # list with mixed data types my_list = [1, "Hello", 3.4] # In[7]: # nested list my_list = ["mouse", [8, 4, 6], ['a']] # In[11]: # List indexing my_list = ['p', '...
my_list = [] my_list = [1, 2, 3] my_list = [1, 'Hello', 3.4] my_list = ['mouse', [8, 4, 6], ['a']] my_list = ['p', 'r', 'o', 'b', 'e'] print(my_list[0]) print(my_list[2]) print(my_list[4]) n_list = ['Happy', [2, 0, 1, 5]] print(n_list[0][1]) print(n_list[1][3]) print(my_list[4]) odd = [1, 3, 5] odd.append(7) print(odd)...
def pickingNumbers(a): # Write your code here max = 0 for i in a: c = a.count(i) d = a.count(i-1) e = c+d if e>max: max = e return max
def picking_numbers(a): max = 0 for i in a: c = a.count(i) d = a.count(i - 1) e = c + d if e > max: max = e return max
expected_output = { "vrf": { "VRF1": { "address_family": { "ipv6": { "instance": { "rip ripng": { "redistribute": { "static": {"route_policy": "static-to-rip"}, ...
expected_output = {'vrf': {'VRF1': {'address_family': {'ipv6': {'instance': {'rip ripng': {'redistribute': {'static': {'route_policy': 'static-to-rip'}, 'connected': {}}, 'interfaces': {'GigabitEthernet3.200': {}, 'GigabitEthernet2.200': {}}}}}}}}}
#!/usr/bin/env python sw1_show_cdp_neighbors = ''' SW1>show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone Device ID Local Intrfce Holdtme Capability Platform ...
sw1_show_cdp_neighbors = '\nSW1>show cdp neighbors\nCapability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge\n S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone\nDevice ID Local Intrfce Holdtme Capability Platform Port ID\nR1 ...
EVENT_SCHEDULER_STARTED = EVENT_SCHEDULER_START = 2 ** 0 EVENT_SCHEDULER_SHUTDOWN = 2 ** 1 EVENT_SCHEDULER_PAUSED = 2 ** 2 EVENT_SCHEDULER_RESUMED = 2 ** 3 EVENT_EXECUTOR_ADDED = 2 ** 4 EVENT_EXECUTOR_REMOVED = 2 ** 5 EVENT_JOBSTORE_ADDED = 2 ** 6 EVENT_JOBSTORE_REMOVED = 2 ** 7 EVENT_ALL_JOBS_REMOVED = 2 ** 8 EVENT_JO...
event_scheduler_started = event_scheduler_start = 2 ** 0 event_scheduler_shutdown = 2 ** 1 event_scheduler_paused = 2 ** 2 event_scheduler_resumed = 2 ** 3 event_executor_added = 2 ** 4 event_executor_removed = 2 ** 5 event_jobstore_added = 2 ** 6 event_jobstore_removed = 2 ** 7 event_all_jobs_removed = 2 ** 8 event_jo...
""" @Time : 201/21/19 10:47 @Author : TaylorMei @Email : mhy845879017@gmail.com @Project : iccv @File : base3_plus.py @Function: """
""" @Time : 201/21/19 10:47 @Author : TaylorMei @Email : mhy845879017@gmail.com @Project : iccv @File : base3_plus.py @Function: """
# -*- coding: utf-8 -*- """ pyRofex.components.messages Defines APIs messages templates """ # Template for a Market Data Subscription message MARKET_DATA_SUBSCRIPTION = '{{"type":"smd","level":1, "entries":[{entries}],"products":[{symbols}]}}' # Template for an Order Subscription message ORDER_SUBSCRIPTION = ...
""" pyRofex.components.messages Defines APIs messages templates """ market_data_subscription = '{{"type":"smd","level":1, "entries":[{entries}],"products":[{symbols}]}}' order_subscription = '{{"type":"os","account":{{"id":"{a}"}},"snapshotOnlyActive":{snapshot}}}' instrument = '{{"symbol":"{ticker}","marketId...
__author__ = 'Elias Haroun' class BinaryNode(object): def __init__(self, data, left, right): self.data = data self.left = left self.right = right def getData(self): return self.data def getLeft(self): return self.left def getRight(self): return self.r...
__author__ = 'Elias Haroun' class Binarynode(object): def __init__(self, data, left, right): self.data = data self.left = left self.right = right def get_data(self): return self.data def get_left(self): return self.left def get_right(self): return sel...
# The isBadVersion API is already defined for you. # @param version, an integer # @return a bool # def isBadVersion(version): class Solution(object): def firstBadVersion(self, n): start = 1 end = n while start + 1 < end: mid = start + (end - start) / 2 if isBadVersi...
class Solution(object): def first_bad_version(self, n): start = 1 end = n while start + 1 < end: mid = start + (end - start) / 2 if is_bad_version(mid): end = mid else: start = mid if is_bad_version(start): ...
# -*- coding: utf-8; -*- """Define error strings raised by the application.""" MISSING_CONFIG_VALUE = """ '{0}' is not specified or invalid in the config file! """.strip()
"""Define error strings raised by the application.""" missing_config_value = "\n'{0}' is not specified or invalid in the config file!\n".strip()
# python version 1.0 DO NOT EDIT # # Generated by smidump version 0.4.8: # # smidump -f python ZYXEL-GS4012F-MIB FILENAME = "mibs/ZyXEL/zyxel-GS4012F.mib" MIB = { "moduleName" : "ZYXEL-GS4012F-MIB", "ZYXEL-GS4012F-MIB" : { "nodetype" : "module", "language" : "SMIv2", "organizat...
filename = 'mibs/ZyXEL/zyxel-GS4012F.mib' mib = {'moduleName': 'ZYXEL-GS4012F-MIB', 'ZYXEL-GS4012F-MIB': {'nodetype': 'module', 'language': 'SMIv2', 'organization': 'ZyXEL', 'contact': '', 'description': 'Fault event trap definitions', 'revisions': ({'date': '2004-11-03 12:00', 'description': '[Revision added by libsmi...
#!/usr/bin/env python3 def binary(code, max, bits): ret = [] for i in range(max): ret.append(bits[code[i]]) return int(''.join(ret), base=2) mid = 0 with open('input5.txt') as f: for line in f.readlines(): line = line[:-1] row = binary(line[:7], 7, {'F': '0', 'B': '1'}) ...
def binary(code, max, bits): ret = [] for i in range(max): ret.append(bits[code[i]]) return int(''.join(ret), base=2) mid = 0 with open('input5.txt') as f: for line in f.readlines(): line = line[:-1] row = binary(line[:7], 7, {'F': '0', 'B': '1'}) col = binary(line[7:], 3...
""" custom_stocks_py base module. This is the principal module of the custom_stocks_py project. here you put your main classes and objects. Be creative! do whatever you want! If you want to replace this with a Flask application run: $ make init and then choose `flask` as template. """ class BaseClass: de...
""" custom_stocks_py base module. This is the principal module of the custom_stocks_py project. here you put your main classes and objects. Be creative! do whatever you want! If you want to replace this with a Flask application run: $ make init and then choose `flask` as template. """ class Baseclass: de...
def test_list_example_directory(client): response = client.get("/api/files") assert response.status_code == 200 file_list = response.get_json() assert len(file_list) == 5 assert file_list[0]['key'] == 'image_annotated.jpg' assert file_list[1]['key'] == 'image.jpg' assert file_list[2]['key']...
def test_list_example_directory(client): response = client.get('/api/files') assert response.status_code == 200 file_list = response.get_json() assert len(file_list) == 5 assert file_list[0]['key'] == 'image_annotated.jpg' assert file_list[1]['key'] == 'image.jpg' assert file_list[2]['key'] ...
# This Part will gather Infos and demonstrate the use of Variables. usrName = input("What is your Name?") usrAge = int(input("What is your Age?")) usrGPA = float(input("What is your GPA?")) print () #cheap way to get a new line print ("Hello, %s" % (usrName)) print ("Did you know that in two years you will be %d years ...
usr_name = input('What is your Name?') usr_age = int(input('What is your Age?')) usr_gpa = float(input('What is your GPA?')) print() print('Hello, %s' % usrName) print('Did you know that in two years you will be %d years old? ' % (usrAge + 2)) print('Also you need to improve your GPA by %f points to have a perfect scor...
class Message: def __init__(self, from_channel=None, **kwargs): self._channel = from_channel if kwargs is not None: for key, value in kwargs.items(): setattr(self, key, value) @property def carrier(self): return self._channel def sender(self): ...
class Message: def __init__(self, from_channel=None, **kwargs): self._channel = from_channel if kwargs is not None: for (key, value) in kwargs.items(): setattr(self, key, value) @property def carrier(self): return self._channel def sender(self): ...
""" A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ solved = False for a in range(1, 1000): for b in range(1, 1000): for c in range(...
""" A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ solved = False for a in range(1, 1000): for b in range(1, 1000): for c i...
def main(): print("|\_/|") print("|q p| /}") print("( 0 )\"\"\"\\") print("|\"^\"` |") print("||_/=\\\\__|") if __name__ == "__main__": main()
def main(): print('|\\_/|') print('|q p| /}') print('( 0 )"""\\') print('|"^"` |') print('||_/=\\\\__|') if __name__ == '__main__': main()
# -*- coding: utf-8 -*- n, w = map(int, input().split()) for _ in range(n): entrada = input() last_space = entrada.rfind(' ') if int(entrada[last_space:]) > w: print(entrada[:last_space])
(n, w) = map(int, input().split()) for _ in range(n): entrada = input() last_space = entrada.rfind(' ') if int(entrada[last_space:]) > w: print(entrada[:last_space])
def marcs_cakewalk(calorie): """Hackerrank Problem: https://www.hackerrank.com/challenges/marcs-cakewalk/problem Marc loves cupcakes, but he also likes to stay fit. Each cupcake has a calorie count, and Marc can walk a distance to expend those calories. If Marc has eaten j cupcakes so far, after eating a c...
def marcs_cakewalk(calorie): """Hackerrank Problem: https://www.hackerrank.com/challenges/marcs-cakewalk/problem Marc loves cupcakes, but he also likes to stay fit. Each cupcake has a calorie count, and Marc can walk a distance to expend those calories. If Marc has eaten j cupcakes so far, after eating a c...