content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class FakeSerial: def __init__( self, port=None, baudrate = 19200, timeout=1, bytesize = 8, parity = 'N', stopbits = 1, xonxoff=0, rtscts = 0): print("Port is ", port) self.halfduplex = True self.name = port self.port = port self.ti...
class Fakeserial: def __init__(self, port=None, baudrate=19200, timeout=1, bytesize=8, parity='N', stopbits=1, xonxoff=0, rtscts=0): print('Port is ', port) self.halfduplex = True self.name = port self.port = port self.timeout = timeout self.parity = parity s...
""" Recipes which illustrate augmentation of ORM SELECT behavior as used by :meth:`_orm.Session.execute` with :term:`2.0 style` use of :func:`_sql.select`, as well as the :term:`1.x style` :class:`_orm.Query` object. Examples include demonstrations of the :func:`_orm.with_loader_criteria` option as well as the :meth:`...
""" Recipes which illustrate augmentation of ORM SELECT behavior as used by :meth:`_orm.Session.execute` with :term:`2.0 style` use of :func:`_sql.select`, as well as the :term:`1.x style` :class:`_orm.Query` object. Examples include demonstrations of the :func:`_orm.with_loader_criteria` option as well as the :meth:`...
class CustomException(Exception): def __init__(self, *args): if args: self.message = args[0] else: self.message = None def get_str(self, class_name): if self.message: return '{0}, {1} '.format(self.message, class_name) else: return...
class Customexception(Exception): def __init__(self, *args): if args: self.message = args[0] else: self.message = None def get_str(self, class_name): if self.message: return '{0}, {1} '.format(self.message, class_name) else: retur...
# Copyright 2014 Cloudera Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
base_identifiers = ['add', 'aggregate', 'all', 'alter', 'and', 'api_version', 'as', 'asc', 'avro', 'between', 'bigint', 'binary', 'boolean', 'by', 'cached', 'case', 'cast', 'change', 'char', 'class', 'close_fn', 'column', 'columns', 'comment', 'compute', 'create', 'cross', 'data', 'database', 'databases', 'date', 'date...
# -*- coding: utf-8 -*- """Top-level package for Grbl Link.""" __author__ = """Darius Montez""" __email__ = 'darius.montez@gmail.com' __version__ = '0.1.4'
"""Top-level package for Grbl Link.""" __author__ = 'Darius Montez' __email__ = 'darius.montez@gmail.com' __version__ = '0.1.4'
H = {0: [0], 1: [1, 2, 4, 8], 2: [3, 5, 6, 9, 10], 3: [7, 11]} M = {0: [0], 1: [1, 2, 4, 8, 16, 32], 2: [3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 33, 34, 36, 40, 48], 3: [7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56], 4: [15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58], 5: ...
h = {0: [0], 1: [1, 2, 4, 8], 2: [3, 5, 6, 9, 10], 3: [7, 11]} m = {0: [0], 1: [1, 2, 4, 8, 16, 32], 2: [3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 33, 34, 36, 40, 48], 3: [7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56], 4: [15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58], 5: [31, 47, 5...
class SDCMeter(object): """Stores the SDCs probabilities""" def __init__(self): self.reset() def updateAcc(self, acc1, acc5): self.acc1 = acc1 self.acc5 = acc5 def updateGoldenData(self, scoreTensors): for scores in scoreTensors.cpu().numpy(): self.goldenSco...
class Sdcmeter(object): """Stores the SDCs probabilities""" def __init__(self): self.reset() def update_acc(self, acc1, acc5): self.acc1 = acc1 self.acc5 = acc5 def update_golden_data(self, scoreTensors): for scores in scoreTensors.cpu().numpy(): self.golde...
yusuke_power = {"Yusuke Urameshi": "Spirit Gun"} hiei_power = {"Hiei": "Jagan Eye"} powers = dict() # Iteration for dictionary in (yusuke_power, hiei_power): for key, value in dictionary.items(): powers[key] = value # Dictionary Comprehension powers = {key: value for d in (yusuke_power, hiei_power) for key, v...
yusuke_power = {'Yusuke Urameshi': 'Spirit Gun'} hiei_power = {'Hiei': 'Jagan Eye'} powers = dict() for dictionary in (yusuke_power, hiei_power): for (key, value) in dictionary.items(): powers[key] = value powers = {key: value for d in (yusuke_power, hiei_power) for (key, value) in d.items()} powers = yusuk...
SIMPLE_QUEUE = 'simple' WORK_QUEUE = 'work_queue' RABBITMQ_HOST = '0.0.0.0' LOG_EXCHANGE = 'logs' ROUTING_EXCHANGE = 'direct_exchange' TOPIC_EXCHANGE = 'topic_exchange' SEVERITIES = ['err', 'info', 'debug'] FACILITIES = ['kern', 'mail', 'user', 'local0']
simple_queue = 'simple' work_queue = 'work_queue' rabbitmq_host = '0.0.0.0' log_exchange = 'logs' routing_exchange = 'direct_exchange' topic_exchange = 'topic_exchange' severities = ['err', 'info', 'debug'] facilities = ['kern', 'mail', 'user', 'local0']
# triple nested exceptions passed = 1 def f(): try: foo() passed = 0 except: print("except 1") try: bar() passed = 0 except: print("except 2") try: baz() passed = 0 except: ...
passed = 1 def f(): try: foo() passed = 0 except: print('except 1') try: bar() passed = 0 except: print('except 2') try: baz() passed = 0 except: print('except 3')...
""" Take Home Project 1. Write a program for an e-commerce store. The program must accept at least 10 products on the first run. The storekeeper should be given the option to Add a product, remove a product, empty the product catalog and close the program. 2. Create a membership system that allows users to re...
""" Take Home Project 1. Write a program for an e-commerce store. The program must accept at least 10 products on the first run. The storekeeper should be given the option to Add a product, remove a product, empty the product catalog and close the program. 2. Create a membership system that allows users to register a...
uctable = [ [ 194, 178 ], [ 194, 179 ], [ 194, 185 ], [ 194, 188 ], [ 194, 189 ], [ 194, 190 ], [ 224, 167, 180 ], [ 224, 167, 181 ], [ 224, 167, 182 ], [ 224, 167, 183 ], [ 224, 167, 184 ], [ 224, 167, 185 ], [ 224, 173, 178 ], [ 224, 173, 179 ], [ 224, 173, 180 ], [ 224, 173, 181 ], [ ...
uctable = [[194, 178], [194, 179], [194, 185], [194, 188], [194, 189], [194, 190], [224, 167, 180], [224, 167, 181], [224, 167, 182], [224, 167, 183], [224, 167, 184], [224, 167, 185], [224, 173, 178], [224, 173, 179], [224, 173, 180], [224, 173, 181], [224, 173, 182], [224, 173, 183], [224, 175, 176], [224, 175, 177],...
#A def greeting(x :str) -> str: return "hello, "+ x def main(): # input s = input() # compute # output print(greeting(s)) if __name__ == '__main__': main()
def greeting(x: str) -> str: return 'hello, ' + x def main(): s = input() print(greeting(s)) if __name__ == '__main__': main()
def test_delete_first__group(app): app.session.open_home_page() app.session.login("admin", "secret") app.group.delete_first_group() app.session.logout()
def test_delete_first__group(app): app.session.open_home_page() app.session.login('admin', 'secret') app.group.delete_first_group() app.session.logout()
#####count freq of words in text file word_count= dict() with open(r'C:/Users/Jen/Downloads/resumes/PracticeCodeM/cantrbry/plrabn12.txt', 'r') as fi: for line in fi: words = line.split() prepared_words = [w.lower() for w in words] for w in prepared_words: word_count[w] =...
word_count = dict() with open('C:/Users/Jen/Downloads/resumes/PracticeCodeM/cantrbry/plrabn12.txt', 'r') as fi: for line in fi: words = line.split() prepared_words = [w.lower() for w in words] for w in prepared_words: word_count[w] = 1 if w not in word_count else word_count[w] + ...
""" Writing to a textfile: 1. open the file as either "w" or "a" (write or append) 2. write the data """ with open("hello.txt", "w") as fout: fout.write("Hello World\n") with open("/etc/shells", "r") as fin: with open("hello.txt", "a") as fout: for line in fin: fout.write(line)
""" Writing to a textfile: 1. open the file as either "w" or "a" (write or append) 2. write the data """ with open('hello.txt', 'w') as fout: fout.write('Hello World\n') with open('/etc/shells', 'r') as fin: with open('hello.txt', 'a') as fout: for line in fin: fout.write(line)
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml. def _jar_artifact_impl(ctx): jar_name = "%s.jar" % ctx.name ctx.download( output=ctx.path("jar/%s" % jar_name), url=ctx.attr.urls, sha256=ctx.attr.sha256, executable=False ) src_name="%s-sources.jar...
def _jar_artifact_impl(ctx): jar_name = '%s.jar' % ctx.name ctx.download(output=ctx.path('jar/%s' % jar_name), url=ctx.attr.urls, sha256=ctx.attr.sha256, executable=False) src_name = '%s-sources.jar' % ctx.name srcjar_attr = '' has_sources = len(ctx.attr.src_urls) != 0 if has_sources: ct...
# Copyright 2018 Oinam Romesh Meitei. All Rights Reserved. # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under th...
class Molog: filname = '' def __init__(self): apple = 0 def set_name(self, string): molog.filname = string def initiate(self): out = open(molog.filname, 'w') out.write(' ******************\n') out.write(' ***** MOLEPY *****\n') ...
Dev = { "db_server": "Dbsed4555", "user": "<db_username>", "passwd": "<password>", "driver": "SQL Server", "port": "1433" } Oracle = { "db_server": "es20-scan01", "port": "1521", "user": "<db_username>", "passwd": "<password>", "service_name": "cmc1st01svc.uhc.com" } Sybase = { ...
dev = {'db_server': 'Dbsed4555', 'user': '<db_username>', 'passwd': '<password>', 'driver': 'SQL Server', 'port': '1433'} oracle = {'db_server': 'es20-scan01', 'port': '1521', 'user': '<db_username>', 'passwd': '<password>', 'service_name': 'cmc1st01svc.uhc.com'} sybase = {'db_server': 'DBSPS0181', 'user': '<db_usernam...
message_id = { b"\x00\x00": "init", b"\x00\x01": "ping", b"\x00\x02": "pong", b"\x00\x03": "give nodes", b"\x00\x04": "take nodes", b"\x00\x05": "give next headers", b"\x00\x06": "take the headers", b"\x00\x07": "give blocks", b"\x00\x08": "take the blocks", b"\x00\x09": "give the txos", b"\x00\x0a": "take the txos", b...
message_id = {b'\x00\x00': 'init', b'\x00\x01': 'ping', b'\x00\x02': 'pong', b'\x00\x03': 'give nodes', b'\x00\x04': 'take nodes', b'\x00\x05': 'give next headers', b'\x00\x06': 'take the headers', b'\x00\x07': 'give blocks', b'\x00\x08': 'take the blocks', b'\x00\t': 'give the txos', b'\x00\n': 'take the txos', b'\x00...
def accuracy(y_test, y): cont = 0 for i in range(len(y)): if y[i] == y_test[i]: cont += 1 return cont / float(len(y)) def f_measure(y_test, y, beta=1): tp = 0.0 # true pos fp = 0.0 # false pos tn = 0.0 # true neg fn = 0.0 # false neg for i in range(len(y)): if y_test[i] == 1.0 and y[i] =...
def accuracy(y_test, y): cont = 0 for i in range(len(y)): if y[i] == y_test[i]: cont += 1 return cont / float(len(y)) def f_measure(y_test, y, beta=1): tp = 0.0 fp = 0.0 tn = 0.0 fn = 0.0 for i in range(len(y)): if y_test[i] == 1.0 and y[i] == 1.0: ...
# MIT License # (C) Copyright 2021 Hewlett Packard Enterprise Development LP. # # applianceCrashHistory : returns and posts all Appliances crash history def appliance_crash_history( self, action: str = None, ): """Get appliance crash history. Can optionally send crash reports to Cloud Portal .. l...
def appliance_crash_history(self, action: str=None): """Get appliance crash history. Can optionally send crash reports to Cloud Portal .. list-table:: :header-rows: 1 * - Swagger Section - Method - Endpoint * - applianceCrashHistory - GET - /...
name0_1_1_0_1_0_0 = None name0_1_1_0_1_0_1 = None name0_1_1_0_1_0_2 = None name0_1_1_0_1_0_3 = None name0_1_1_0_1_0_4 = None
name0_1_1_0_1_0_0 = None name0_1_1_0_1_0_1 = None name0_1_1_0_1_0_2 = None name0_1_1_0_1_0_3 = None name0_1_1_0_1_0_4 = None
class HandResponse: cost = None han = None fu = None fu_details = None yaku = None error = None is_open_hand = False def __init__(self, cost=None, han=None, fu=None, yaku=None, error=None, fu_details=None, is_open_hand=False): """ :param cost: dict :param han: in...
class Handresponse: cost = None han = None fu = None fu_details = None yaku = None error = None is_open_hand = False def __init__(self, cost=None, han=None, fu=None, yaku=None, error=None, fu_details=None, is_open_hand=False): """ :param cost: dict :param han: in...
''' - Leetcode problem: 653 - Difficulty: Easy - Brief problem description: Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. Example 1: Input: 5 / \ 3 6 / \ \ 2 4 7 Target = 9 Output: ...
""" - Leetcode problem: 653 - Difficulty: Easy - Brief problem description: Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. Example 1: Input: 5 / 3 6 / \\ 2 4 7 Target = 9 Output: Tru...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isSymmetric(self, root: Optional[TreeNode]) -> bool: # both does not exist if not root.l...
class Solution: def is_symmetric(self, root: Optional[TreeNode]) -> bool: if not root.left and (not root.right): return True elif not root.left or not root.right: return False stack1 = [root.left] output1 = [root.left.val] stack2 = [root.right] ...
load("@bazel_gazelle//:deps.bzl", "go_repository") def go_dependencies(): go_repository( name = "com_github_aws_aws_sdk_go", importpath = "github.com/aws/aws-sdk-go", sum = "h1:3+AsCrxxnhiUQEhWV+j3kEs7aBCIn2qkDjA+elpxYPU=", version = "v1.33.13", ) go_repository( name...
load('@bazel_gazelle//:deps.bzl', 'go_repository') def go_dependencies(): go_repository(name='com_github_aws_aws_sdk_go', importpath='github.com/aws/aws-sdk-go', sum='h1:3+AsCrxxnhiUQEhWV+j3kEs7aBCIn2qkDjA+elpxYPU=', version='v1.33.13') go_repository(name='com_github_bazelbuild_remote_apis', importpath='github...
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. def source(): pass def sinkA(x): pass def sinkB(x): pass def sinkC(x): pass def sinkD(x): pass def split(x): ...
def source(): pass def sink_a(x): pass def sink_b(x): pass def sink_c(x): pass def sink_d(x): pass def split(x): y = x._params sink_b(y) sink_c(y) sink_d(y) return x def wrapper(x): y = split(x) sink_a(y) def issue(): x = source() wrapper(x) def splitwrapp...
x=[11,12,13,14] y=[50,60,70] for i in range(1,10,2): x.append("Item# "+str(i)) for i in x: print(i) x.extend(y) print(x) x.append(y) print(x) x.remove(y) print(x) """ this is multiine comment operator... for i in x: #if int(i.replace("Item# ",""))%2!=0: if(isinstance(i,str)==False): if(i%2...
x = [11, 12, 13, 14] y = [50, 60, 70] for i in range(1, 10, 2): x.append('Item# ' + str(i)) for i in x: print(i) x.extend(y) print(x) x.append(y) print(x) x.remove(y) print(x) ' this is multiine comment operator...\nfor i in x:\n #if int(i.replace("Item# ",""))%2!=0:\n if(isinstance(i,str)==False):\n ...
# @file motion_sensor.py # @author marco # @date 07 Oct 2021 class MotionSensor: def __init__(self, pin): self._pin = pin pinMode(self._pin, INPUT) def movement_detected(self): """Return True if motion has been detected""" return digitalRead(self._pin) == 1 def value(se...
class Motionsensor: def __init__(self, pin): self._pin = pin pin_mode(self._pin, INPUT) def movement_detected(self): """Return True if motion has been detected""" return digital_read(self._pin) == 1 def value(self): """Return value caught by sensor. 1 = movement, 0...
#output comments variables input calculations output constants def display_output(): print('hello') def test_config(): return True
def display_output(): print('hello') def test_config(): return True
n = int(input()) f = {} while n > 1: i = 2 while True: if n % i == 0: if i not in f: f[i] = 0 f[i] += 1 n = n // i break i = i + 1 s = "" for k, v in f.items(): s += "{}".format(k) if v != 1: s += "^{}".format(v) ...
n = int(input()) f = {} while n > 1: i = 2 while True: if n % i == 0: if i not in f: f[i] = 0 f[i] += 1 n = n // i break i = i + 1 s = '' for (k, v) in f.items(): s += '{}'.format(k) if v != 1: s += '^{}'.format(v) ...
def divisors(x): divisorList = [] for i in range(1, x+1): if x%i == 0: divisorList.append(i) return divisorList def main(): while True: try: x = int(input("Type a number please:")) break except ValueError: pass y = divisors(x)...
def divisors(x): divisor_list = [] for i in range(1, x + 1): if x % i == 0: divisorList.append(i) return divisorList def main(): while True: try: x = int(input('Type a number please:')) break except ValueError: pass y = divisor...
# Exercise 8.2 # You can call a method directly on the string, as well as on a variable # of type string. So here I call count directly on 'banana', with the # argument 'a' as the letter/substring to count. print('banana'.count('a')) # Exercise 8.3 def is_palindrome(s): # The slice uses the entire string if the ...
print('banana'.count('a')) def is_palindrome(s): return s == s[::-1] def any_lowercase1(s): for c in s: if c.islower(): return True else: return False def any_lowercase2(s): for c in s: if 'c'.islower(): return 'True' else: r...
''' Created on 30 de nov de 2018 @author: filiped ''' class Base: def __init__(self): self.s="" self.p=0 self.fim="@" self.pilha = ["z0"] def le_palavra(self,palavra="@"): self.p=0 self.s = palavra+"@" def xp(self,c=""): print(s...
""" Created on 30 de nov de 2018 @author: filiped """ class Base: def __init__(self): self.s = '' self.p = 0 self.fim = '@' self.pilha = ['z0'] def le_palavra(self, palavra='@'): self.p = 0 self.s = palavra + '@' def xp(self, c=''): print(self.s[s...
class ConsumptionTax: def __init__(self, tax_rate): self.tax_rate = tax_rate def apply(self, price): return int((price * self.tax_rate) / 100) + price
class Consumptiontax: def __init__(self, tax_rate): self.tax_rate = tax_rate def apply(self, price): return int(price * self.tax_rate / 100) + price
# -*- coding: utf-8 -*- __author__ = 'gzp' class Solution: def maxTurbulenceSize(self, A): """ :type A: List[int] :rtype: int """ len_a = len(A) dp = {0: 1} i = 1 last_cmp = None while i < len_a: if A[i - 1] < A[i] and last_cmp ...
__author__ = 'gzp' class Solution: def max_turbulence_size(self, A): """ :type A: List[int] :rtype: int """ len_a = len(A) dp = {0: 1} i = 1 last_cmp = None while i < len_a: if A[i - 1] < A[i] and last_cmp != '<': ...
# Nach einer Idee von Kevin Workman # (https://happycoding.io/examples/p5js/images/image-palette) WIDTH = 800 HEIGHT = 640 palette = ["#264653", "#2a9d8f", "#e9c46a", "#f4a261", "#e76f51"] def setup(): global img size(WIDTH, HEIGHT) this.surface.setTitle("Image Palette") img = loadImage("akt.jpg") ...
width = 800 height = 640 palette = ['#264653', '#2a9d8f', '#e9c46a', '#f4a261', '#e76f51'] def setup(): global img size(WIDTH, HEIGHT) this.surface.setTitle('Image Palette') img = load_image('akt.jpg') image(img, 0, 0) no_loop() def draw(): global y, img for x in range(width / 2): ...
def front_and_back_search(lst, item): rear=0 front=len(lst)-1 u=None if rear>front: return False else: while rear<=front: if item==lst[rear] or item==lst[front]: u='' return True elif item!=lst[rear] and item!=lst[front]: ...
def front_and_back_search(lst, item): rear = 0 front = len(lst) - 1 u = None if rear > front: return False else: while rear <= front: if item == lst[rear] or item == lst[front]: u = '' return True elif item != lst[rear] and item...
# Darren Keenan 2018-02-27 # Exercise 4 - Project Euler 5 # What is the smallest number divisible by 1 to 20 def divisibleby1to20(n): for i in range(1, 21): if n % i != 0: return False return True n = 1 while True: if divisibleby1to20(n): break n += 1 print(n) # The smallest ...
def divisibleby1to20(n): for i in range(1, 21): if n % i != 0: return False return True n = 1 while True: if divisibleby1to20(n): break n += 1 print(n)
# Three number sum def threeSumProblem(arr: list, target: int) : arr.sort() result = list() for i in range(0, len(arr) - 2) : left = i+1;right=len(arr)-1 while left < right : curren_sum = arr[i] + arr[left] + arr[right] if curren_sum == target : ...
def three_sum_problem(arr: list, target: int): arr.sort() result = list() for i in range(0, len(arr) - 2): left = i + 1 right = len(arr) - 1 while left < right: curren_sum = arr[i] + arr[left] + arr[right] if curren_sum == target: result.append...
class animal: def eat(self): print("eat") class mammal(animal): def walk(self): print("walk") class fish(animal): def swim(self): print("swim") moka = mammal() moka.eat() moka.walk()
class Animal: def eat(self): print('eat') class Mammal(animal): def walk(self): print('walk') class Fish(animal): def swim(self): print('swim') moka = mammal() moka.eat() moka.walk()
# Copyright 2018 Cyril Roelandt # # Licensed under the 3-clause BSD license. See the LICENSE file. class InvalidPackageNameError(Exception): """Invalid package name or non-existing package.""" def __init__(self, frontend, pkg_name): self.frontend = frontend self.pkg_name = pkg_name d...
class Invalidpackagenameerror(Exception): """Invalid package name or non-existing package.""" def __init__(self, frontend, pkg_name): self.frontend = frontend self.pkg_name = pkg_name def __str__(self): return f'The package {self.pkg_name} could not be found by frontend {self.front...
g1 = 1 def display(): global g1 g1 = 2 print(g1) print("inside",id(g1)) display() print(g1) print("outside",id(g1))
g1 = 1 def display(): global g1 g1 = 2 print(g1) print('inside', id(g1)) display() print(g1) print('outside', id(g1))
showroom = set() showroom.add('Chevrolet SS') showroom.add('Mazda Miata') showroom.add('GMC Yukon XL Denali') showroom.add('Porsche Cayman') # print(showroom) # print (len(showroom)) showroom.update(['Jaguar F-Type', 'Ariel Atom 3']) # print (showroom) showroom.remove('GMC Yukon XL Denali') # print (showroom) junky...
showroom = set() showroom.add('Chevrolet SS') showroom.add('Mazda Miata') showroom.add('GMC Yukon XL Denali') showroom.add('Porsche Cayman') showroom.update(['Jaguar F-Type', 'Ariel Atom 3']) showroom.remove('GMC Yukon XL Denali') junkyard = set() junkyard.update(['Mazda Miata', 'Chevy Caprice', 'Isuzu Trooper', 'Satur...
class Solution: def validSquare(self, p1, p2, p3, p4): """ :type p1: List[int] :type p2: List[int] :type p3: List[int] :type p4: List[int] :rtype: bool """ def dis(P, Q): "Return distance between two points." return sum((p - q) ...
class Solution: def valid_square(self, p1, p2, p3, p4): """ :type p1: List[int] :type p2: List[int] :type p3: List[int] :type p4: List[int] :rtype: bool """ def dis(P, Q): """Return distance between two points.""" return sum((...
""" From Kapil Sharma's lecture 11 Jun 2020 Given the head of a sll and a value, delete the node with that value. Return True if successful; False otherwise. """ class Node: def __init__(self, data): self.data = data self.next = None def delete_node_given_value(value, head): # Edge cases ...
""" From Kapil Sharma's lecture 11 Jun 2020 Given the head of a sll and a value, delete the node with that value. Return True if successful; False otherwise. """ class Node: def __init__(self, data): self.data = data self.next = None def delete_node_given_value(value, head): if head == None o...
input = """ 8 2 2 3 0 0 8 2 4 5 0 0 8 2 6 7 0 0 6 0 4 0 2 3 4 5 1 1 1 1 0 4 c 3 b 7 f 2 a 6 e 5 d 0 B+ 0 B- 1 0 1 """ output = """ COST 2@1 """
input = '\n8 2 2 3 0 0\n8 2 4 5 0 0\n8 2 6 7 0 0\n6 0 4 0 2 3 4 5 1 1 1 1\n0\n4 c\n3 b\n7 f\n2 a\n6 e\n5 d\n0\nB+\n0\nB-\n1\n0\n1\n' output = '\nCOST 2@1\n'
TARGET_COL = 'class' ID_COL = 'id' N_FOLD = 5 N_CLASS = 3 SEED = 42
target_col = 'class' id_col = 'id' n_fold = 5 n_class = 3 seed = 42
# # PySNMP MIB module ROHC-UNCOMPRESSED-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ROHC-UNCOMPRESSED-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:49:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ...
# 11. print(list(range(1, 10))) # 12. print(list(range(100, 20, -5)))
print(list(range(1, 10))) print(list(range(100, 20, -5)))
def A(m, n): if m == 0: return n + 1 if m > 0 and n == 0: return A(m - 1, 1) if m > 0 and n > 0: return A(m - 1, A(m, n - 1)) def main() -> None: print(A(2, 2)) if __name__ == "__main__": main()
def a(m, n): if m == 0: return n + 1 if m > 0 and n == 0: return a(m - 1, 1) if m > 0 and n > 0: return a(m - 1, a(m, n - 1)) def main() -> None: print(a(2, 2)) if __name__ == '__main__': main()
"""Test for W0623, overwriting names in exception handlers.""" __revision__ = '' class MyError(Exception): """Special exception class.""" pass def some_function(): """A function.""" try: {}["a"] except KeyError as some_function: # W0623 pass
"""Test for W0623, overwriting names in exception handlers.""" __revision__ = '' class Myerror(Exception): """Special exception class.""" pass def some_function(): """A function.""" try: {}['a'] except KeyError as some_function: pass
# input -1 n = int(input('input nilai: ')) if n <= 0: # Menentukan pengecualian & teks yang akan di tampilkan raise ValueError('nilai n harus bilangan positif') try: n = int(input('input nilai: ')) if n <= 0: # Menentukan pengecualian & teks yang akan di tampilkan raise ValueError('nil...
n = int(input('input nilai: ')) if n <= 0: raise value_error('nilai n harus bilangan positif') try: n = int(input('input nilai: ')) if n <= 0: raise value_error('nilai n harus bilangan positif') except ValueError as ve: print(ve)
# # PySNMP MIB module CYCLONE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CYCLONE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:34:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, constraints_union, value_range_constraint) ...
def tapcode_to_fingers(tapcode:int): return '{0:05b}'.format(1)[::-1] def mouse_data_msg(data: bytearray): vx = int.from_bytes(data[1:3],"little", signed=True) vy = int.from_bytes(data[3:5],"little", signed=True) prox = data[9] == 1 return vx, vy, prox def air_gesture_data_msg(data: bytearray): return [data[0]]...
def tapcode_to_fingers(tapcode: int): return '{0:05b}'.format(1)[::-1] def mouse_data_msg(data: bytearray): vx = int.from_bytes(data[1:3], 'little', signed=True) vy = int.from_bytes(data[3:5], 'little', signed=True) prox = data[9] == 1 return (vx, vy, prox) def air_gesture_data_msg(data: bytearray...
# Copyright 2019 The Bazel 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 applicable la...
""" A rule for generating the environment plist """ load('@build_bazel_rules_apple//apple/internal:rule_factory.bzl', 'rule_factory') load('@build_bazel_apple_support//lib:apple_support.bzl', 'apple_support') load('@build_bazel_rules_apple//apple/internal:platform_support.bzl', 'platform_support') load('@bazel_skylib//...
class DBConnector: def save_graph(self, local_graph): pass def get_reader_endpoint(self): pass def get_writer_endpoint(self): pass def disconnect(self): pass
class Dbconnector: def save_graph(self, local_graph): pass def get_reader_endpoint(self): pass def get_writer_endpoint(self): pass def disconnect(self): pass
test = { 'name': 'contains?', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (contains? odds 3) ; True or False True """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (contains...
test = {'name': 'contains?', 'points': 1, 'suites': [{'cases': [{'code': '\n scm> (contains? odds 3) ; True or False\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n scm> (contains? odds 9) ; True or False\n True\n ', 'hidden': False, 'locked': False}...
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
class Datapilotfieldgroupby(object): """ Const Class These constants select different types for grouping members of a DataPilot field by date or time. See Also: `API DataPilotFieldGroupBy <https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1sheet_1_1DataPilotFieldGroupBy.ht...
input = """ 1 2 2 1 3 4 1 3 2 1 2 4 1 4 0 0 1 5 1 0 2 1 6 1 0 5 1 5 1 0 6 0 3 d 2 c 6 b 5 a 0 B+ 0 B- 1 0 1 """ output = """ {d} {c, a, b} """
input = '\n1 2 2 1 3 4\n1 3 2 1 2 4\n1 4 0 0\n1 5 1 0 2\n1 6 1 0 5\n1 5 1 0 6\n0\n3 d\n2 c\n6 b\n5 a\n0\nB+\n0\nB-\n1\n0\n1\n' output = '\n{d}\n{c, a, b}\n'
#! python # Problem # : 50A # Created on : 2019-01-14 21:29:26 def Main(): m, n = map(int, input().split(' ')) val = m * n cnt = int(val / 2) print(cnt) if __name__ == '__main__': Main()
def main(): (m, n) = map(int, input().split(' ')) val = m * n cnt = int(val / 2) print(cnt) if __name__ == '__main__': main()
def organize_data(lines): max_x = 0 max_y = 0 line_segments = [] # store all of the line segments for line in lines: points = line.split(" -> ") point1 = points[0].split(",") point2 = points[1].split(",") x1 = int(point1[0].strip()) y1 = int(point1[1].strip()...
def organize_data(lines): max_x = 0 max_y = 0 line_segments = [] for line in lines: points = line.split(' -> ') point1 = points[0].split(',') point2 = points[1].split(',') x1 = int(point1[0].strip()) y1 = int(point1[1].strip()) x2 = int(point2[0].strip()) ...
class Config: def __init__(self, name:str=None, username:str=None, pin:int=2, email:str=None, password:str=None, set_password:bool=False, set_email_notify:bool=False): self.name = name self.username = username self.pin = pin self.email = email self.password = password ...
class Config: def __init__(self, name: str=None, username: str=None, pin: int=2, email: str=None, password: str=None, set_password: bool=False, set_email_notify: bool=False): self.name = name self.username = username self.pin = pin self.email = email self.password = password...
# https://leetcode.com/problems/longest-increasing-subsequence/ class Solution: def lengthOfLIS(self, nums: list[int]) -> int: # Patience sorting-like approach, but keeping track # only of the topmost element at each stack. stack_tops = [nums[0]] for num in nums[1:]: for...
class Solution: def length_of_lis(self, nums: list[int]) -> int: stack_tops = [nums[0]] for num in nums[1:]: for idx in range(len(stack_tops)): if stack_tops[idx] >= num: stack_tops[idx] = num break else: ...
# -*- coding: utf-8 -*- """ Created on Wed Dec 30 13:55:35 2020 @author: SethHarden BINARY SEARCH - ITERATIVE """ # Iterative Binary Search Function # It returns index of x in given array arr if present, # else returns -1 def binary_search(arr, x): low = 0 high = len(arr) - 1 mid = 0 while low...
""" Created on Wed Dec 30 13:55:35 2020 @author: SethHarden BINARY SEARCH - ITERATIVE """ def binary_search(arr, x): low = 0 high = len(arr) - 1 mid = 0 while low <= high: mid = (high + low) // 2 if arr[mid] < x: low = mid + 1 elif arr[mid] > x: high = ...
""" This is the helper module. The attributes of this module do not interact withy facebook rather help get better info about the objects fethced from facebook. """ D=type( {1:1} ) L=type( [1,2] ) def get_fields(d, s): if type(d) == D: for i in d.keys(): if type(d[i]) =...
""" This is the helper module. The attributes of this module do not interact withy facebook rather help get better info about the objects fethced from facebook. """ d = type({1: 1}) l = type([1, 2]) def get_fields(d, s): if type(d) == D: for i in d.keys(): if type(d[i]) == L: pr...
# # @lc app=leetcode id=497 lang=python3 # # [497] Random Point in Non-overlapping Rectangles # # @lc code=start class Solution: def __init__(self, rects): """ :type rects: List[List[int]] """ self.rects = rects self.N = len(rects) areas = [(x2 - x1 + 1) * (y2 -...
class Solution: def __init__(self, rects): """ :type rects: List[List[int]] """ self.rects = rects self.N = len(rects) areas = [(x2 - x1 + 1) * (y2 - y1 + 1) for (x1, y1, x2, y2) in rects] self.preSum = [0] * self.N self.preSum[0] = areas[0] f...
{ "targets": [{ "target_name": "binding", "sources": ["binding.cc"], "include_dirs": [ "<!(node -e \"require('nan')\")", "/opt/vc/include", "/opt/vc/include/interface/vcos/pthreads", "/opt/vc/include/interface/vmcs_host/linux" ], ...
{'targets': [{'target_name': 'binding', 'sources': ['binding.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")', '/opt/vc/include', '/opt/vc/include/interface/vcos/pthreads', '/opt/vc/include/interface/vmcs_host/linux'], 'libraries': ['-lbcm_host', '-L/opt/vc/lib']}]}
RES_SPA_MASSAGE_PARLOR = [ "spa", "table", "shower", "nuru", "slide", "therapy", "therapist", "bodyrub", "sauna", "gel", "shiatsu", "jacuzzi" ]
res_spa_massage_parlor = ['spa', 'table', 'shower', 'nuru', 'slide', 'therapy', 'therapist', 'bodyrub', 'sauna', 'gel', 'shiatsu', 'jacuzzi']
'''function in python ''' print('=== function in python ===') def func_args(*args): print('* function *args') for x in args: print(x) def func_kwargs(**kwargs): print('* function **kwargs') print('kwargs[name]', kwargs['name']) func_args('hainv', '23') func_kwargs(name="Tobias", lname="Re...
"""function in python """ print('=== function in python ===') def func_args(*args): print('* function *args') for x in args: print(x) def func_kwargs(**kwargs): print('* function **kwargs') print('kwargs[name]', kwargs['name']) func_args('hainv', '23') func_kwargs(name='Tobias', lname='Refsnes...
# config.py class Config(object): num_channels = 256 linear_size = 256 output_size = 4 max_epochs = 10 lr = 0.001 batch_size = 128 seq_len = 300 # 1014 in original paper dropout_keep = 0.5
class Config(object): num_channels = 256 linear_size = 256 output_size = 4 max_epochs = 10 lr = 0.001 batch_size = 128 seq_len = 300 dropout_keep = 0.5
arr = input() for i in range(0, len(arr), 7): bits = arr[i:i + 7] result = 0 n = 1 for b in bits[::-1]: result += n * int(b) n *= 2 print(result)
arr = input() for i in range(0, len(arr), 7): bits = arr[i:i + 7] result = 0 n = 1 for b in bits[::-1]: result += n * int(b) n *= 2 print(result)
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the messag...
def test(): assert 'X' in __solution__, "Make sure you are using 'X' as a variable" assert 'y' in __solution__, "Make sure you are using 'y' as a variable" assert X.shape == (25, 8), 'The dimensions of X is incorrect. Are you selcting the correct columns?' assert y.shape == (25,), 'The dimensions of y i...
n = int(input('Enter number of lines:')) for i in range(1, n +1): for j in range(1, n+1): if i == 1 or j == 1 or i == n or j == n: print("*", end = ' ') else: print(' ', end = ' ') print()
n = int(input('Enter number of lines:')) for i in range(1, n + 1): for j in range(1, n + 1): if i == 1 or j == 1 or i == n or (j == n): print('*', end=' ') else: print(' ', end=' ') print()
##------------------------------------------------------------------- """ Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 ...
""" Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / 4 8 / / 11 13 4 / \\ / 7 2 5 1 return [ [5,4,11,2], [5...
# Get the abuse API key from the site abuseKey = '' # Get the hybrid API key from the site hybridKey = '' # Get the malshare API key from the site malshareKey = '' # Get the urlscan key from the site urlScanKey = '' # Get the valhalla key from the site valhallaKey = '' # Get the Virustotal API key from the site vt...
abuse_key = '' hybrid_key = '' malshare_key = '' url_scan_key = '' valhalla_key = '' vt_key = '' "\nimport requests\ndata = {'username': '<USER>','password': '<PASSWD>'}\nresponse = requests.post('https://capesandbox.com/apiv2/api-token-auth/', data=data)\nprint(response.json()) \n" '\ncurl -d "username=<USER>&password...
"""Top-level package for DJI Android SDK to Python.""" __author__ = """Carlos Tovar""" __email__ = 'cartovarc@gmail.com' __version__ = '0.1.0'
"""Top-level package for DJI Android SDK to Python.""" __author__ = 'Carlos Tovar' __email__ = 'cartovarc@gmail.com' __version__ = '0.1.0'
#import sys #file = sys.stdin file = open( r".\data\listcomprehensions.txt" ) data = file.read().strip().split() #x,y,z,n = input(), input(), input(), input() x,y,z = map(eval, map(''.join, (zip(data[:3], ['+1']*3)))) n = int(data[3]) print(x,y,z,n) coords = [[a,b,c] for a in range(x) for b in range(y) for c in range...
file = open('.\\data\\listcomprehensions.txt') data = file.read().strip().split() (x, y, z) = map(eval, map(''.join, zip(data[:3], ['+1'] * 3))) n = int(data[3]) print(x, y, z, n) coords = [[a, b, c] for a in range(x) for b in range(y) for c in range(z) if a + b + c != n] print(coords)
routes_in=(('/forca/(?P<a>.*)','/\g<a>'),) default_application = 'ForCA' # ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_out=(('/(?P<a>.*)','/forca/\g<a>'),)
routes_in = (('/forca/(?P<a>.*)', '/\\g<a>'),) default_application = 'ForCA' default_controller = 'default' default_function = 'index' routes_out = (('/(?P<a>.*)', '/forca/\\g<a>'),)
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ """ Init signature: SissoRegressor( n_nonzero_coefs=1, n_features_per_sis_iter=1, all_l0_combinations=True, ) Docstring: A simple implementation of the SISSO algorithm (R. Ouyang, S. Curtarolo, E. Ahmetcik e...
""" Spyder Editor This is a temporary script file. """ '\nInit signature:\nSissoRegressor(\n n_nonzero_coefs=1,\n n_features_per_sis_iter=1,\n all_l0_combinations=True,\n)\nDocstring: \nA simple implementation of the SISSO algorithm (R. Ouyang, S. Curtarolo, \nE. Ahmetcik et al., Phys. Rev. Mater.2, 08380...
print ("Dit is het FIZZBUZZ spel!") end = input("""\nWe gaan even na of een getal deelbaar is door 3 OF 5 .\nOf door 3 EN 5.\n Geef een geheel getal in tussen 1 en 100: """) # try-except statement: # if the code inside try fails, the program automatically goes to the except part. try: end = int(end) # convert ...
print('Dit is het FIZZBUZZ spel!') end = input('\nWe gaan even na of een getal deelbaar is door 3 OF 5 .\nOf door 3 EN 5.\n\nGeef een geheel getal in tussen 1 en 100: ') try: end = int(end) for num in range(1, end + 1): if num % 3 == 0 and num % 5 == 0: print('FIZZBUZZ-3-5') elif num...
"""Define package errors.""" class WeatherbitError(Exception): """Define a base error.""" pass class InvalidApiKey(WeatherbitError): """Define an error related to invalid or missing API Key.""" pass class RequestError(WeatherbitError): """Define an error related to invalid requests.""" ...
"""Define package errors.""" class Weatherbiterror(Exception): """Define a base error.""" pass class Invalidapikey(WeatherbitError): """Define an error related to invalid or missing API Key.""" pass class Requesterror(WeatherbitError): """Define an error related to invalid requests.""" pass ...
N = int(input()) X = 0 W = 0 Y = 0 Z = 0 for i in range(N): W = Z + 1 X = W + 1 Y = X + 1 Z = Y + 1 print('{} {} {} PUM'.format(W, X, Y))
n = int(input()) x = 0 w = 0 y = 0 z = 0 for i in range(N): w = Z + 1 x = W + 1 y = X + 1 z = Y + 1 print('{} {} {} PUM'.format(W, X, Y))
#!/usr/bin/env python3 # Write a program that prints out the position, frame, and letter of the DNA # Try coding this with a single loop # Try coding this with nested loops dna = 'ATGGCCTTT' ''' for i in range(len(dna)): frame = 0 print(i, frame, dna[i]) if frame == 2: frame = 0 else: frame +=1 #initial att...
dna = 'ATGGCCTTT' '\nfor i in range(len(dna)):\n\tframe = 0\n\tprint(i, frame, dna[i])\n\tif frame == 2:\n\t\tframe = 0\n\telse:\n\t\tframe +=1 #initial attempt - functional but more complicated than necessary \n' for i in range(len(dna)): print(i, i % 3, dna[i]) for i in range(0, len(dna), 3): for j in rang...
# pylint: disable=missing-function-docstring, missing-module-docstring/ # coding: utf-8 #$ header class Parallel(public, with, openmp) #$ header method __init__(Parallel, str, str, str [:], str [:], str [:], str [:], str, str [:], str) #$ header method __del__(Parallel) #$ header method __enter__(Parallel) #$ header m...
class Parallel(object): def __init__(self, num_threads, if_test, private, firstprivate, shared, reduction, default, copyin, proc_bind): self._num_threads = num_threads self._if_test = if_test self._private = private self._firstprivate = firstprivate self._shared = shared ...
class MyMetaClass(type): def __new__(cls, name, bases, ns): ns['kw_created_by_metaclass'] = lambda self, arg: arg.upper() return type.__new__(cls, name, bases, ns) def method_in_metaclass(cls): pass class MetaClassLibrary(metaclass=MyMetaClass): def greet(self, name): re...
class Mymetaclass(type): def __new__(cls, name, bases, ns): ns['kw_created_by_metaclass'] = lambda self, arg: arg.upper() return type.__new__(cls, name, bases, ns) def method_in_metaclass(cls): pass class Metaclasslibrary(metaclass=MyMetaClass): def greet(self, name): ret...
lower_camel_case = input() snake_case = "" for char in lower_camel_case: if char.isupper(): snake_case += "_" + char.lower() else: snake_case += char print(snake_case)
lower_camel_case = input() snake_case = '' for char in lower_camel_case: if char.isupper(): snake_case += '_' + char.lower() else: snake_case += char print(snake_case)
class MIFARE1k(object): SECTORS = 16 BLOCKSIZE = 4 BLOCKWITH = 16 def __init__(self, uid, data): self.uid = uid self.data = data def __str__(self): """ Get a nice printout for debugging and dev. """ ret = "Card: " for i in range(4): ...
class Mifare1K(object): sectors = 16 blocksize = 4 blockwith = 16 def __init__(self, uid, data): self.uid = uid self.data = data def __str__(self): """ Get a nice printout for debugging and dev. """ ret = 'Card: ' for i in range(4): ...
#wap to find the numbers which are divisible by 3 a=int(input('Enter starting range ')) b=int(input('Enter ending range ')) number=int(input('Enter the number whose multiples you want to find in the range ')) print('Numbers which are divisible') for i in range(a,b+1): if i%number==0: print(i,end=' ')
a = int(input('Enter starting range ')) b = int(input('Enter ending range ')) number = int(input('Enter the number whose multiples you want to find in the range ')) print('Numbers which are divisible') for i in range(a, b + 1): if i % number == 0: print(i, end=' ')
ENTRY_POINT = 'get_closest_vowel' #[PROMPT] def get_closest_vowel(word): """You are given a word. Your task is to find the closest vowel that stands between two consonants from the right side of the word (case sensitive). Vowels in the beginning and ending doesn't count. Return empty string if you di...
entry_point = 'get_closest_vowel' def get_closest_vowel(word): """You are given a word. Your task is to find the closest vowel that stands between two consonants from the right side of the word (case sensitive). Vowels in the beginning and ending doesn't count. Return empty string if you didn't f...
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: ''' 92.22% // 75.79% ''' def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: slow = fast = head {(fast := fast.next) for _...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: """ 92.22% // 75.79% """ def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: slow = fast = head {(fast := fast.next) for _ in range(n)} if fast is N...
q = int(input()) for _ in range(q): n, m = map(int, input().split()) d = n // m a = [0] * 10 for i in range(10): a[i] = (m + a[i - 1]) % 10 s = sum(a) print((d // 10) * s + sum(a[: (d % 10)]))
q = int(input()) for _ in range(q): (n, m) = map(int, input().split()) d = n // m a = [0] * 10 for i in range(10): a[i] = (m + a[i - 1]) % 10 s = sum(a) print(d // 10 * s + sum(a[:d % 10]))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Pieter Huycke email: pieter.huycke@ugent.be GitHub: phuycke """ #%% area = 8080464.3 # area of 48 contiguous states in km^2 volume = 22810 # volume of water in Great lakes in km^3 height = (volume / area) # km^3 / km^2 = m print('...
""" @author: Pieter Huycke email: pieter.huycke@ugent.be GitHub: phuycke """ area = 8080464.3 volume = 22810 height = volume / area print('Kilometres water on surface if evenly spread: {0:.5f}'.format(height)) print('Metres water on surface if evenly spread: {0:.5f}'.format(height * 1000))
__author__ = 'shukkkur' ''' https://codeforces.com/problemset/problem/110/A ''' i = input() n = i.count('4') + i.count('7') s = str(n) s = s.replace('4', '') s = s.replace('7', '') if s == '': print('YES') else: print('NO')
__author__ = 'shukkkur' '\nhttps://codeforces.com/problemset/problem/110/A\n' i = input() n = i.count('4') + i.count('7') s = str(n) s = s.replace('4', '') s = s.replace('7', '') if s == '': print('YES') else: print('NO')
""" A package of Python modules, used to configure and test IBIS-AMI models. .. moduleauthor:: David Banas <capn.freako@gmail.com> Original Author: David Banas <capn.freako@gmail.com> Original Date: 3 July 2012 Copyright (c) 2012 by David Banas; All rights reserved World wide. """
""" A package of Python modules, used to configure and test IBIS-AMI models. .. moduleauthor:: David Banas <capn.freako@gmail.com> Original Author: David Banas <capn.freako@gmail.com> Original Date: 3 July 2012 Copyright (c) 2012 by David Banas; All rights reserved World wide. """
PYTHON_PLATFORM = "python" SUPPORTED_PLATFORMS = ((PYTHON_PLATFORM, "Python"),) LOG_LEVEL_DEBUG = "debug" LOG_LEVEL_INFO = "info" LOG_LEVEL_ERROR = "error" LOG_LEVEL_FATAL = "fatal" LOG_LEVEL_SAMPLE = "sample" LOG_LEVEL_WARNING = "warning" LOG_LEVELS = ( (LOG_LEVEL_DEBUG, "Debug"), (LOG_LEVEL_INFO, "Info"), ...
python_platform = 'python' supported_platforms = ((PYTHON_PLATFORM, 'Python'),) log_level_debug = 'debug' log_level_info = 'info' log_level_error = 'error' log_level_fatal = 'fatal' log_level_sample = 'sample' log_level_warning = 'warning' log_levels = ((LOG_LEVEL_DEBUG, 'Debug'), (LOG_LEVEL_INFO, 'Info'), (LOG_LEVEL_E...
""" Addition I - Numbers & Strings """ # Add the below sets of variables together without causing any Type Errors. # A) a = 0 b = 2 print(a + b) # 2 # B) c = '0' d = '2' print(c + d) # '2' # C) e = '0' f = 2 print(int(e) + f) # 2
""" Addition I - Numbers & Strings """ a = 0 b = 2 print(a + b) c = '0' d = '2' print(c + d) e = '0' f = 2 print(int(e) + f)
# Copyright 2017 The Bazel 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 applicable la...
"""Helper functions to expand paths into runfiles """ def expand_location_into_runfiles(ctx, path): """Expand a path into runfiles if it contains a $(location). If the path has a location expansion, expand it. Otherwise return as-is. Args: ctx: context path: the path to expand Returns: ...
""" Illustrates how to embed `dogpile.cache <https://dogpilecache.readthedocs.io/>`_ functionality within the :class:`.Query` object, allowing full cache control as well as the ability to pull "lazy loaded" attributes from long term cache. In this demo, the following techniques are illustrated: * Using custom subclas...
""" Illustrates how to embed `dogpile.cache <https://dogpilecache.readthedocs.io/>`_ functionality within the :class:`.Query` object, allowing full cache control as well as the ability to pull "lazy loaded" attributes from long term cache. In this demo, the following techniques are illustrated: * Using custom subclas...