content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python # -*- coding: utf-8 -*- """ synthqc.errors This module holds project defined errors Author: Jacob Reinhold (jacob.reinhold@jhu.edu) Created on: Nov 15, 2018 """ class SynthQCError(Exception): pass
""" synthqc.errors This module holds project defined errors Author: Jacob Reinhold (jacob.reinhold@jhu.edu) Created on: Nov 15, 2018 """ class Synthqcerror(Exception): pass
a = [1, 2, 3] b = a print(a == b) # => True print(a is b) # => True c = list(a) # == evaluates to true if the objects referred by the variables are equal print(a == c) # => True # is evaluates to true if both variables point to the same object print(a is c) # => false
a = [1, 2, 3] b = a print(a == b) print(a is b) c = list(a) print(a == c) print(a is c)
# Best # time O(log(n)) # space O(1) def binarySearch(array, target): low = 0 high = len(array)-1 while low<=high: mid = (low+high)//2 if array[mid] == target: return mid if target > array[mid]: low = mid + 1 else: high = mid -...
def binary_search(array, target): low = 0 high = len(array) - 1 while low <= high: mid = (low + high) // 2 if array[mid] == target: return mid if target > array[mid]: low = mid + 1 else: high = mid - 1 return -1 def binary_search_helpe...
l = [1,2,3,4] def printCombo(l): for j in range(1, len(l)+1): for i in range(len(l)-1): l[i],l[i+1]=l[i+1],l[i] print(l) for i in range(len(l)): printCombo(l[i:])
l = [1, 2, 3, 4] def print_combo(l): for j in range(1, len(l) + 1): for i in range(len(l) - 1): (l[i], l[i + 1]) = (l[i + 1], l[i]) print(l) for i in range(len(l)): print_combo(l[i:])
def read_u8(f): """Reads an unsigned byte from the file object f. """ temp = f.read(1) if not temp: raise EOFError("EOF") return int.from_bytes(temp, byteorder='little', signed=False) def read_u16(f): """Reads a two byte unsigned value from the file object f. """ temp = f.read...
def read_u8(f): """Reads an unsigned byte from the file object f. """ temp = f.read(1) if not temp: raise eof_error('EOF') return int.from_bytes(temp, byteorder='little', signed=False) def read_u16(f): """Reads a two byte unsigned value from the file object f. """ temp = f.read(...
""" Author: David Oniani Purpose: Homework (problem 8) NOTE: I have not included the algorithm to check that 6210001000 is indeed the only number that meets the conditions. It needs a bit more explanation for optimizations so I decided to take it out. """ def check(ten_digit_number): """ Function to check wh...
""" Author: David Oniani Purpose: Homework (problem 8) NOTE: I have not included the algorithm to check that 6210001000 is indeed the only number that meets the conditions. It needs a bit more explanation for optimizations so I decided to take it out. """ def check(ten_digit_number): """ Function to check whe...
s = """75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 3...
s = '75\n95 64\n17 47 82\n18 35 87 10\n20 04 82 47 65\n19 01 23 75 03 34\n88 02 77 73 07 63 67\n99 65 04 28 06 16 70 92\n41 41 26 56 83 40 80 70 33\n41 48 72 33 47 32 37 16 94 29\n53 71 44 65 25 43 91 52 97 51 14\n70 11 33 28 77 73 17 78 39 68 17 57\n91 71 52 38 17 14 91 43 58 50 27 29 48\n63 66 04 68 89 53 67 30 73 16...
f=open('This.txt','r') # this is Default read mode of file f=open('This.txt') #open file # data=f.read() data=f.read(5) #Starting 5 characters from file print(data) f.close()
f = open('This.txt', 'r') f = open('This.txt') data = f.read(5) print(data) f.close()
# Create cache for known results factorial_memo = {} def factorial(k): if k < 2: return 1 if not k in factorial_memo: factorial_memo[k] = k * factorial(k-1) return factorial_memo[k] print(factorial_memo) print(factorial(4)) print(factorial_memo) print(factorial(5)) print(factorial_mem...
factorial_memo = {} def factorial(k): if k < 2: return 1 if not k in factorial_memo: factorial_memo[k] = k * factorial(k - 1) return factorial_memo[k] print(factorial_memo) print(factorial(4)) print(factorial_memo) print(factorial(5)) print(factorial_memo)
# author: Gonzalo Salazar # assigment: Homework #2 # description: contains three functions # First function: # Input: temperature value in degrees Centigrade # Output: temperature value in degrees Fahrenheit # Second function: # Input: temperature value in degrees Fahrenheit # Output: temper...
def centigrade_to_fahrenheit(T_c): t_f = 9 / 5 * T_c + 32 return T_f def fahrenheit_to_centigrade(T_f): t_c = 5 / 9 * (T_f - 32) return T_c def wind_chill_factor(TEMPERATURE, WIND): wc = 0.0817 * (3.71 * WIND ** 0.5 + 5.81 - 0.25 * WIND) * (TEMPERATURE - 91.4) + 91.4 return wc
# -*- coding: utf-8 -*- """ Mobile Forms - Controllers """ module = request.controller # ----------------------------------------------------------------------------- def forms(): """ Controller to download a list of available forms """ if request.env.request_method == "GET": if aut...
""" Mobile Forms - Controllers """ module = request.controller def forms(): """ Controller to download a list of available forms """ if request.env.request_method == 'GET': if auth.permission.format == 'json': if settings.get_mobile_masterkey_filter(): master...
# https://leetcode.com/problems/maximum-product-subarray/ class Solution: def maxProduct(self, nums: List[int]) -> int: res = nums[0] maxNum, minNum = 1, 1 for num in nums: tempMax = num * maxNum tempMin = num...
class Solution: def max_product(self, nums: List[int]) -> int: res = nums[0] (max_num, min_num) = (1, 1) for num in nums: temp_max = num * maxNum temp_min = num * minNum max_num = max(num, tempMax, tempMin) min_num = min(num, tempMax, tempMin)...
# Program to reverse an array def reverseArray(arr : list) : for i in range(len(arr) // 2) : arr[i], arr[len(arr)-1-i] = arr[len(arr)-1-i], arr[i] if __name__ == "__main__": arr = [1,2,3,4,5,6,7] reverseArray(arr) print(arr)
def reverse_array(arr: list): for i in range(len(arr) // 2): (arr[i], arr[len(arr) - 1 - i]) = (arr[len(arr) - 1 - i], arr[i]) if __name__ == '__main__': arr = [1, 2, 3, 4, 5, 6, 7] reverse_array(arr) print(arr)
# # PySNMP MIB module Juniper-MPLS-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-MPLS-CONF # Produced by pysmi-0.3.4 at Mon Apr 29 19:52:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ...
class Solution: def searchInsert(self, nums: List[int], target: int) -> int: s = 0 e = len(nums) - 1 while(s <= e): m = (s + e) // 2 if (nums[m] < target): s = m + 1 elif (nums[m] > target): e = m - 1 else: return m return s
class Solution: def search_insert(self, nums: List[int], target: int) -> int: s = 0 e = len(nums) - 1 while s <= e: m = (s + e) // 2 if nums[m] < target: s = m + 1 elif nums[m] > target: e = m - 1 else: ...
#%% # dutch_w = 0.664 # turkish_w = 0.075 # moroccan_w = 0.13 # ghanaian_w = 0.021 # suriname_w = 0.11 # sample_n = 4000 # dutch_pop = sample_n * dutch_w # suriname_pop = sample_n * suriname_w # turkish_pop = sample_n * turkish_w # moroccan_pop = sample_n * moroccan_w # ghanaian_pop = sample_n * ghanaian_w # ethn...
debug = True savetype = 'group' root = 'C:/Users/Admin/Code/status/' results_dir = 'C:/Users/Admin/Code/status/results/' param_dict = {'similarity_min': [], 'interactions': [], 'ses_noise': [], 'vul_param': [], 'psr_param': [], 'coping_noise': [], 'recover_param': [], 'prestige_beta': [], 'prestige_param': [], 'stresso...
entries = [ { 'env-title': 'atari-alien', 'env-variant': 'Human start', 'score': 570.20, }, { 'env-title': 'atari-amidar', 'env-variant': 'Human start', 'score': 133.40, }, { 'env-title': 'atari-assault', 'env-variant': 'Human start', ...
entries = [{'env-title': 'atari-alien', 'env-variant': 'Human start', 'score': 570.2}, {'env-title': 'atari-amidar', 'env-variant': 'Human start', 'score': 133.4}, {'env-title': 'atari-assault', 'env-variant': 'Human start', 'score': 3332.3}, {'env-title': 'atari-asterix', 'env-variant': 'Human start', 'score': 124.5},...
SECRET_KEY = 'secret' ROOT_URLCONF = 'jsonrpc.tests.test_backend_django.urls' ALLOWED_HOSTS = ['testserver'] DATABASE_ENGINE = 'django.db.backends.sqlite3' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } JSONRPC_MAP_VIEW_ENABLED = True
secret_key = 'secret' root_urlconf = 'jsonrpc.tests.test_backend_django.urls' allowed_hosts = ['testserver'] database_engine = 'django.db.backends.sqlite3' databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} jsonrpc_map_view_enabled = True
packages = { 'Greenspace': { 'description': '', 'foundations' : [ 'neighborhood_development_18_027', 'neighborhood_development_18_021' ], 'default_foundation' : 'neighborhood_development_18_027', 'slides' : [ 'neighborhood_development_18_003', 'neighborhood_de...
packages = {'Greenspace': {'description': '', 'foundations': ['neighborhood_development_18_027', 'neighborhood_development_18_021'], 'default_foundation': 'neighborhood_development_18_027', 'slides': ['neighborhood_development_18_003', 'neighborhood_development_18_004', 'neighborhood_development_18_005'], 'default_slid...
# Solution 2 # def fib(num, l=[]): # a=b=1 # while(True): # a+=b # if a % 2 == 0: # l.append(a) # a,b=b,a # if a >= num: # break # return l # print(sum(fib(4000000))) # Solution 3 # import math # def factors(num): # factors_list = [] # for value in range(2, math.ceil(math...
palindrome = [] for val in range(2, 1000)[::-1]: for value in range(2, val)[::-1]: str_int = str(val * value) if list(str_int) == list(str_int)[::-1]: palindrome.append(val * value) print(max(palindrome))
l = [4, 3, 5, 4, -3,10,2,33,98,4] print(l) min = l[0] max = l[0] n = len(l) for i in range(1, n): curr = l[i] if curr < min: min=curr if curr>max: max=curr print("Min=",min,"Max=",max)
l = [4, 3, 5, 4, -3, 10, 2, 33, 98, 4] print(l) min = l[0] max = l[0] n = len(l) for i in range(1, n): curr = l[i] if curr < min: min = curr if curr > max: max = curr print('Min=', min, 'Max=', max)
class MinMaxHeap: # Checks if a binary tree is a min/max heap. @staticmethod def is_valid(values, index, level, min_value, max_value): if index >= len(values): return True if (values[index] > min_value and values[index] < max_value) == False: return False ...
class Minmaxheap: @staticmethod def is_valid(values, index, level, min_value, max_value): if index >= len(values): return True if (values[index] > min_value and values[index] < max_value) == False: return False if level % 2 != 0: min_value = values[in...
chars2get = set() with open('biofic2take.tsv', encoding = 'utf-8') as f: for line in f: fields = line.strip().split('\t') charid = fields[0] chars2get.add(charid) outlines = [] with open('../biofic50/biofic50_doctopics.txt', encoding = 'utf-8') as f: for line in f: fields = li...
chars2get = set() with open('biofic2take.tsv', encoding='utf-8') as f: for line in f: fields = line.strip().split('\t') charid = fields[0] chars2get.add(charid) outlines = [] with open('../biofic50/biofic50_doctopics.txt', encoding='utf-8') as f: for line in f: fields = line.stri...
# Homework 01 - Game of life # # Your task is to implement part of the cell automata called # Game of life. The automata is a 2D simulation where each cell # on the grid is either dead or alive. # # State of each cell is updated in every iteration based state of neighbouring cells. # Cell neighbours are cells that ar...
def create_board(rows, cols): board = [[False] * cols for i in range(rows)] return board def fill_board(board, alive): for j in alive: (x, y) = j board[x][y] = True return None def is_alive(board, x, y, rows, cols): if x < 0 or x >= rows: return False if y < 0 or y >= c...
class BoundingBox: def __init__(self, top: float, right: float, bottom: float, left: float): self.top = top self.right = right self.bottom = bottom self.left = left def to_flickr_bounding_box(self): return '{self.left}, {self.bottom}, {self.right}, {self.top}'.format(sel...
class Boundingbox: def __init__(self, top: float, right: float, bottom: float, left: float): self.top = top self.right = right self.bottom = bottom self.left = left def to_flickr_bounding_box(self): return '{self.left}, {self.bottom}, {self.right}, {self.top}'.format(se...
#!/usr/bin/python3.6 class Reaction: # the sets of reactants, inhibitors and products of the reaction name = None reactants = set() inhibitors = set() products = set() # the creation of a reaction is made through the called of a function in which all the controls are performed, so we can ...
class Reaction: name = None reactants = set() inhibitors = set() products = set() def __init__(self, _name, _reactants, _inhibitors, _products): self.name = _name self.reactants = _reactants self.inhibitors = _inhibitors self.products = _products def __str__(sel...
# adapted from https://raw.githubusercontent.com/lucien2k/wipy-urllib/master/urllib.py def unquote(s): """Kindly rewritten by Damien from Micropython""" """No longer uses caching because of memory limitations""" res = s.split('%') for i in range(1, len(res)): item = res[i] try: ...
def unquote(s): """Kindly rewritten by Damien from Micropython""" 'No longer uses caching because of memory limitations' res = s.split('%') for i in range(1, len(res)): item = res[i] try: res[i] = chr(int(item[:2], 16)) + item[2:] except ValueError: res[i]...
# Description: Find H-bonds around a residue. # Source: placeHolder """ cmd.do('remove element h; distance hbonds, all, all, 3.2, mode=2;') """ cmd.do('remove element h; distance hbonds, all, all, 3.2, mode=2;')
""" cmd.do('remove element h; distance hbonds, all, all, 3.2, mode=2;') """ cmd.do('remove element h; distance hbonds, all, all, 3.2, mode=2;')
# Pattern that would startup the DUT, then do nothing else. # Should still generate. with Pattern() as pat: ...
with pattern() as pat: ...
N = int(input()) total = 0 for i in range(1, N+1): if (i % 3) != 0 and (i % 5) != 0: total = total+i print(total)
n = int(input()) total = 0 for i in range(1, N + 1): if i % 3 != 0 and i % 5 != 0: total = total + i print(total)
INSTRUCTIONS = { "SUM": 0b00001, "SUB": 0b00010, "MULT": 0b00011, "DIV": 0b00101, } def instrFor(instr): return INSTRUCTIONS[instr]
instructions = {'SUM': 1, 'SUB': 2, 'MULT': 3, 'DIV': 5} def instr_for(instr): return INSTRUCTIONS[instr]
class Solution(object): # def isPerfectSquare(self, num): # """ # :type num: int # :rtype: bool # """ # i = 1 # while num > 0: # num -= i # i += 2 # return num == 0 def isPerfectSquare(self, num): low, high = 1, num ...
class Solution(object): def is_perfect_square(self, num): (low, high) = (1, num) while low <= high: mid = (low + high) / 2 mid_square = mid * mid if mid_square == num: return True elif mid_square < num: low = mid + 1 ...
VAT_NUMBER_REGEXES = { # EU VAT number regexes have a high certainty 'AT': r'^U\d{8}$', 'BE': r'^[01]\d{9}$', 'BG': r'^\d{9,10}$', 'CY': r'^\d{8}[A-Z]$', 'CZ': r'^\d{8,10}$', 'DE': r'^\d{9}$', 'DK': r'^\d{8}$', 'EE': r'^\d{9}$', 'EL': r'^\d{9}$', 'ES': r'^([A-Z]\d{7}[A-Z0-9]|...
vat_number_regexes = {'AT': '^U\\d{8}$', 'BE': '^[01]\\d{9}$', 'BG': '^\\d{9,10}$', 'CY': '^\\d{8}[A-Z]$', 'CZ': '^\\d{8,10}$', 'DE': '^\\d{9}$', 'DK': '^\\d{8}$', 'EE': '^\\d{9}$', 'EL': '^\\d{9}$', 'ES': '^([A-Z]\\d{7}[A-Z0-9]|\\d{8}[A-Z])$', 'FI': '^\\d{8}$', 'FR': '^[A-Z0-9]{2}\\d{9}$', 'GB': '^(\\d{9}|\\d{12}|GD\\...
# # This file contains the Python code from Program 6.7 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm06_07.txt # class StackAsLinked...
class Stackaslinkedlist(Stack): def push(self, obj): self._list.prepend(obj) self._count += 1 def pop(self): if self._count == 0: raise ContainerEmpty result = self._list.first self._list.extract(result) self._count -= 1 return result de...
class Model(): def __init__(self, model): pass
class Model: def __init__(self, model): pass
pound = int(input()) conv_to_dollar = pound * 1.31 print(f"{conv_to_dollar:.3f}")
pound = int(input()) conv_to_dollar = pound * 1.31 print(f'{conv_to_dollar:.3f}')
""" Codemonk link: https://www.hackerearth.com/practice/basic-programming/implementation/basics-of-implementation/practice-problems/algorithm/binary-movement/ You are given a bit array (0 and 1) of size n. Your task is to perform Q queries. In each query you have to toggle all the bits from the index L to R (L and...
""" Codemonk link: https://www.hackerearth.com/practice/basic-programming/implementation/basics-of-implementation/practice-problems/algorithm/binary-movement/ You are given a bit array (0 and 1) of size n. Your task is to perform Q queries. In each query you have to toggle all the bits from the index L to R (L and R i...
# Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). # Example 1: # Input: [1,3,5,4,7] # Output: 3 # Explanation: The longest continuous increasing subsequence is [1,3,5], its length is 3. # Even though [1,3,5,7] is also an increasing subsequence, it's not a ...
class Solution(object): def find_length_of_lcis(self, nums): """ :type nums: List[int] :rtype: int """ l = len(nums) if l < 2: return l lens = 0 temp = 1 for i in range(1, l): if nums[i] <= nums[i - 1]: ...
S, W = map(int, input().split()) if(W >= S): print("unsafe") else: print("safe")
(s, w) = map(int, input().split()) if W >= S: print('unsafe') else: print('safe')
#medicine = 'Coughussin' #dosage = 5 #duration = 4.5 #instructions = '{} - Take {} ML by mouth every {} hours.'.format(medicine, dosage, duration) #print(instructions) #instructions = '{2} - Take {1} ML by mouth every {0} hours'.format(medicine, dosage, duration) #print(instructions) #instructions = '{medicine} - Take...
value = 'hi' print(f'.{value:<25}.') print(f'.{value:>25}.') print(f'.{value:^25}.') print(f'.{value:-^25}.')
# TWITTER PYTHON # Copyright 2022 Billyfranklim # See LICENSE for details. __version__ = '0.1.0' __author__ = 'Billyfranklim Pereira' __license__ = 'MIT'
__version__ = '0.1.0' __author__ = 'Billyfranklim Pereira' __license__ = 'MIT'
""" 586. Sqrt(x) II Implement double sqrt(double x) and x >= 0. Compute and return the square root of x. You do not care about the accuracy of the result, we will help you to output results. binary search? by result? """ class Solution: """ @param x: a double @return: the square root of x """ de...
""" 586. Sqrt(x) II Implement double sqrt(double x) and x >= 0. Compute and return the square root of x. You do not care about the accuracy of the result, we will help you to output results. binary search? by result? """ class Solution: """ @param x: a double @return: the square root of x """ ...
"""Top-level package for Female Health Analysis.""" __author__ = """Daniel Schulz""" __email__ = 'danielschulz2005@hotmail.com' __version__ = '0.1.0'
"""Top-level package for Female Health Analysis.""" __author__ = 'Daniel Schulz' __email__ = 'danielschulz2005@hotmail.com' __version__ = '0.1.0'
# Time: O(n) # Space: O(n) # 1182 biweekly contest 8 9/7/2019 # You are given an array colors, in which there are three colors: 1, 2 and 3. # # You are also given some queries. Each query consists of two integers i and c, return the shortest distance # between the given index i and the target color c. If there is no...
try: xrange except NameError: xrange = range class Solution(object): def shortest_distance_color(self, colors, queries): n = len(colors) dp = [[float('inf')] * N for _ in xrange(4)] dp[colors[0]][0] = 0 for i in range(1, N): for c in range(1, 4): ...
# def print_hi(name): # print(f'Hi, {name}') # if __name__ == '__main__': # print_hi('PyCharm') print("Hello World Python xd") # Para saber la direccion de memoria de cierta variable se usa el metodo id() name = "Juan Diego Castellanos" print(name) print(id(name)) print("------") print("tipo de dato") print(ty...
print('Hello World Python xd') name = 'Juan Diego Castellanos' print(name) print(id(name)) print('------') print('tipo de dato') print(type(name)) last_name: str = 'Castellanos Jerez' print(last_name) print('---------Day Qualifier--------') dia = int(input('How was your day? (between 1 to 10 ): ')) print(f'Your day was...
""" Shared constant values. """ """ ## Handling Concurrency. When appending events to a stream, you can supply a *stream state* or *stream revision*. Your client can use this to tell EventStoreDB what state or version you expect the stream to be in when you append. If the stream isn't in that state the an exception wi...
""" Shared constant values. """ "\n## Handling Concurrency.\nWhen appending events to a stream, you can supply a\n*stream state* or *stream revision*. Your client can\nuse this to tell EventStoreDB what state or version\nyou expect the stream to be in when you append. If the\nstream isn't in that state the an exception...
""" Django Rest Framework Auth provides very simple & quick way to adopt authentication APIs' to your django project. Rationale --------- django-rest-framework's `Serializer` is nice idea for detaching business logic from view functions. It's very similar to django's ``Form``, but serializer is not obligible for ren...
""" Django Rest Framework Auth provides very simple & quick way to adopt authentication APIs' to your django project. Rationale --------- django-rest-framework's `Serializer` is nice idea for detaching business logic from view functions. It's very similar to django's ``Form``, but serializer is not obligible for ren...
''' Your plot of the ECDF and determination of the confidence interval make it pretty clear that the beaks of G. scandens on Daphne Major have gotten deeper. But is it possible that this effect is just due to random chance? In other words, what is the probability that we would get the observed difference in mean beak d...
""" Your plot of the ECDF and determination of the confidence interval make it pretty clear that the beaks of G. scandens on Daphne Major have gotten deeper. But is it possible that this effect is just due to random chance? In other words, what is the probability that we would get the observed difference in mean beak d...
#!/usr/bin/env python3 def isBalanced(s: str) -> bool: stack = [] pair = {'(': ')', '{': '}', '[': ']'} for ch in s: # For left brackets push right brackets if (ch in pair.keys()): stack.append(pair[ch]) else: # Unmatch right char if len(stack) =...
def is_balanced(s: str) -> bool: stack = [] pair = {'(': ')', '{': '}', '[': ']'} for ch in s: if ch in pair.keys(): stack.append(pair[ch]) else: if len(stack) == 0: return False if ch != stack[-1]: return False ...
# # if type(input) == string: # find if palindrome # elif type(input) == number: # find factorial # find if palindrome # def pal(st): l = len(st) i = 0 flag = True while i < l//2: if st[i] == st[l-i-1]: pass else: flag = False i += 1 return flag while True: print("Menu\n1. for palindrome\n2...
def pal(st): l = len(st) i = 0 flag = True while i < l // 2: if st[i] == st[l - i - 1]: pass else: flag = False i += 1 return flag while True: print('Menu\n1. for palindrome\n2. for factorial\n3. exit') ip = int(input('enter your choise: ')) ...
class TSDBClientException(Exception): pass class TSDBNotAlive(TSDBClientException): pass class TagsError(TSDBClientException): pass class ValidationError(TSDBClientException): pass class UnknownTSDBConnectProtocol(TSDBClientException): def __init__(self, protocol): self.protocol = ...
class Tsdbclientexception(Exception): pass class Tsdbnotalive(TSDBClientException): pass class Tagserror(TSDBClientException): pass class Validationerror(TSDBClientException): pass class Unknowntsdbconnectprotocol(TSDBClientException): def __init__(self, protocol): self.protocol = proto...
# Author: Jocelino F.G a, b = input().split(), input().split() q1 = int(a[1]) v1 = float(a[2]) q2 = int(b[1]) v2 = float(b[2]) t1 = q1 * v1 t2 = q2 * v2 tt = t1 + t2 print('VALOR A PAGAR: R$ %.2f' %tt)
(a, b) = (input().split(), input().split()) q1 = int(a[1]) v1 = float(a[2]) q2 = int(b[1]) v2 = float(b[2]) t1 = q1 * v1 t2 = q2 * v2 tt = t1 + t2 print('VALOR A PAGAR: R$ %.2f' % tt)
def merge_sort(unsorted_list): if len(unsorted_list) <= 1: return unsorted_list # Finding the middle point and partitioning the array into two halves middle = len(unsorted_list) // 2 left = unsorted_list[:middle] right = unsorted_list[middle:] left = merge_sort(left) right = merge_s...
def merge_sort(unsorted_list): if len(unsorted_list) <= 1: return unsorted_list middle = len(unsorted_list) // 2 left = unsorted_list[:middle] right = unsorted_list[middle:] left = merge_sort(left) right = merge_sort(right) return list(merge(left, right)) def merge(left, right): ...
x = 0 drone_chk = [112, 334, 4444, 4444, 445, 112, 27466, 445, 27466] for i in drone_chk: x ^= i print("The missing drone order ID is:", x)
x = 0 drone_chk = [112, 334, 4444, 4444, 445, 112, 27466, 445, 27466] for i in drone_chk: x ^= i print('The missing drone order ID is:', x)
############################################################################ # # Copyright (C) 2016 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. # # Commercial License Usage # Licensees holding valid commercial Qt licenses may use this file in # accordance with the co...
source('../../shared/qtcreator.py') def main(): files = check_and_copy_files(testData.dataset('files.tsv'), 'filename', temp_dir()) if not files: return start_application('qtcreator' + SettingsPath) if not started_without_plugin_error(): return for current_file in files: tes...
""" Code Challenge 1 Certificate Generator Develop a Python code that can generate certificates in image format. It must take names and other required information from the user and generates certificate of participation in a Python Bootcamp conducted by Forsk. Certificate should have Forsk Seal, Forsk Signature, ...
""" Code Challenge 1 Certificate Generator Develop a Python code that can generate certificates in image format. It must take names and other required information from the user and generates certificate of participation in a Python Bootcamp conducted by Forsk. Certificate should have Forsk Seal, Forsk Signature, D...
# # PySNMP MIB module F5-3DNS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/F5-3DNS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:11:39 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...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ...
#Return the sum of all the multiples of 3 or 5 below the number passed in. def solution(number): lit = [] for i in range(0, number): if i % 3 == 0 or i % 5 == 0: lit.append(i) return sum(lit) #Alternate Solution def solution(number): return sum(x for x in range(number) if x % 3 == 0...
def solution(number): lit = [] for i in range(0, number): if i % 3 == 0 or i % 5 == 0: lit.append(i) return sum(lit) def solution(number): return sum((x for x in range(number) if x % 3 == 0 or x % 5 == 0))
class Queue: def __init__(self, initial_values): self.queue = initial_values def enqueue(self, val): self.queue.insert(0, val) def dequeue(self): if self.is_empty(): return None else: return self.queue.pop() def size(self): return len(...
class Queue: def __init__(self, initial_values): self.queue = initial_values def enqueue(self, val): self.queue.insert(0, val) def dequeue(self): if self.is_empty(): return None else: return self.queue.pop() def size(self): return len(s...
# <auto-generated> # This code was generated by the UnitCodeGenerator tool # # Changes to this file will be lost if the code is regenerated # </auto-generated> def to_millilitres(value): return value * 14.786764781249998848 def to_litres(value): return value * 0.014786764781249998848 def to_kilolitres(value): re...
def to_millilitres(value): return value * 14.78676478125 def to_litres(value): return value * 0.01478676478125 def to_kilolitres(value): return value * 1.4786764781249997e-05 def to_teaspoons(value): return value * 2.498021521399172 def to_tablespoons(value): return value * 0.8326738404663907 d...
# Configure schema: 'Column_name': ['List', 'of', 'synonyms'] columns_with_synonyms = { 'Name': ['Mitglied des Landtages'], 'Fraktion': ['Partei', 'Fraktion (ggf. Partei)', ], 'Wahlkreis': ['Landtagswahlkreis der Direktkandidaten', 'Landtagswahlkreis', ...
columns_with_synonyms = {'Name': ['Mitglied des Landtages'], 'Fraktion': ['Partei', 'Fraktion (ggf. Partei)'], 'Wahlkreis': ['Landtagswahlkreis der Direktkandidaten', 'Landtagswahlkreis', 'Wahlkreis/Liste'], 'Kommentar': ['Anmerkung', 'Anmerkungen', 'Bemerkungen'], 'Bild': ['Foto'], 'Wikipedia-URL': []} schema = list(c...
#!/usr/bin/env python # AUTHOR OF MODULE NAME AUTHOR="Mauricio Velazco (@mvelazco)" # DESCRIPTION OF THE MODULE DESCRIPTION="This module simulates an adversary leveraging a compromised host to perform password spray attacks." LONGDESCRIPTION="This scenario can occur if an adversary has obtained control of a domain j...
author = 'Mauricio Velazco (@mvelazco)' description = 'This module simulates an adversary leveraging a compromised host to perform password spray attacks.' longdescription = 'This scenario can occur if an adversary has obtained control of a domain joined computer through a --spear phishing attack or any other kind of c...
""" for a string with '(' find the count of complete '()' ones, '(()))" does not count, if does not have full brackets, return -1 time & space: O(n), n = length of S """ def count_brackets(S): # initializations cs,stack,cnt = S[:],[],0 # iterate through char array of S for c in cs: # if it is ...
""" for a string with '(' find the count of complete '()' ones, '(()))" does not count, if does not have full brackets, return -1 time & space: O(n), n = length of S """ def count_brackets(S): (cs, stack, cnt) = (S[:], [], 0) for c in cs: if c == '(': stack.append(c) elif c == ')'...
# 18. Write a language program to get the volume of a sphere with radius 6 radius=6 volume=(4/3)*3.14*(radius**3) print("Volume of sphere with radius 6= ",volume)
radius = 6 volume = 4 / 3 * 3.14 * radius ** 3 print('Volume of sphere with radius 6= ', volume)
# I usually do not hard-code urls here, # but there is not much need for complex configuration BASEURL = 'https://simple-chat-asapp.herokuapp.com/' login_button_text = 'Login' sign_in_message = 'Sign in to Chat' who_are_you = 'Who are you?' who_are_you_talking_to = 'Who are you talking to?' chatting_text = 'Chatting'...
baseurl = 'https://simple-chat-asapp.herokuapp.com/' login_button_text = 'Login' sign_in_message = 'Sign in to Chat' who_are_you = 'Who are you?' who_are_you_talking_to = 'Who are you talking to?' chatting_text = 'Chatting' chatting_with_text = "You're {0}, and you're chatting with {1}" say_something_text = 'Say someth...
# code to run in IPython shell to test whether clustering info in spikes struct array and in # the neurons dict is consistent: for nid in sorted(self.sort.neurons): print(nid, (self.sort.neurons[nid].sids == np.where(self.sort.spikes['nid'] == nid)[0]).all())
for nid in sorted(self.sort.neurons): print(nid, (self.sort.neurons[nid].sids == np.where(self.sort.spikes['nid'] == nid)[0]).all())
def sum67(nums): count = 0 blocked = False for n in nums: if n == 6: blocked = True continue if n == 7 and blocked: blocked = False continue if not blocked: count += n return count
def sum67(nums): count = 0 blocked = False for n in nums: if n == 6: blocked = True continue if n == 7 and blocked: blocked = False continue if not blocked: count += n return count
# author : @akash kumar # problem link: # https://prepinsta.com/tcs-coding-question-1/ x,y,d,t=0,0,10,1 for n in range(int(input())): if t==1: x+=d t=2 d+=10 elif t==2: y+=d t=3 d+=10 elif t==3: x-=d t=4 d+=10 elif t==4: y-=d t=5...
(x, y, d, t) = (0, 0, 10, 1) for n in range(int(input())): if t == 1: x += d t = 2 d += 10 elif t == 2: y += d t = 3 d += 10 elif t == 3: x -= d t = 4 d += 10 elif t == 4: y -= d t = 5 d += 10 else: ...
#!/usr/bin/env python3 #encoding=utf-8 #-------------------------------------------- # Usage: python3 3-calltracer_descr-for-method.py # Description: make descriptor class as decorator to decorate class method #-------------------------------------------- class Tracer: # a decorator + descriptor def __ini...
class Tracer: def __init__(self, func): print('in property descriptor __init__') self.calls = 0 self.func = func def __call__(self, *args, **kwargs): print('in property descriptor __call__') self.calls += 1 print('call %s to %s' % (self.calls, self.func.__name__...
def bytes2int(data: bytes) -> int: return int.from_bytes(data, byteorder="big", signed=True) def int2bytes(x: int) -> bytes: return int.to_bytes(x, length=4, byteorder="big", signed=True)
def bytes2int(data: bytes) -> int: return int.from_bytes(data, byteorder='big', signed=True) def int2bytes(x: int) -> bytes: return int.to_bytes(x, length=4, byteorder='big', signed=True)
#!/usr/bin/python3.4 tableData = [['apples','oranges','cherries','bananas'], ['Alice','Bob','Carol','David'], ['dogs','cats','moose','goose']] # Per the hint colWidth = [0] * len(tableData) # Who knew you had to transpose this list of lists def matrixTranspose( matrix ): if not matrix: ...
table_data = [['apples', 'oranges', 'cherries', 'bananas'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']] col_width = [0] * len(tableData) def matrix_transpose(matrix): if not matrix: return [] return [[row[i] for row in matrix] for i in range(len(matrix[0]))] def print_table...
#!/usr/bin/env python3 """ ATTOM API https://api.developer.attomdata.com """ HINSDALE = "HINSDALE, IL" MADISON_HINSDALE = {} HOMES = { "216 S MADISON ST": HINSDALE, "607 S ADAMS ST": HINSDALE, "428 MINNEOLA ST": HINSDALE, "600 S BRUNER ST": HINSDALE, "637 S BRUNER ST": HINSDALE, "142 S STOUGH ST": HINSDA...
""" ATTOM API https://api.developer.attomdata.com """ hinsdale = 'HINSDALE, IL' madison_hinsdale = {} homes = {'216 S MADISON ST': HINSDALE, '607 S ADAMS ST': HINSDALE, '428 MINNEOLA ST': HINSDALE, '600 S BRUNER ST': HINSDALE, '637 S BRUNER ST': HINSDALE, '142 S STOUGH ST': HINSDALE, '106 S BRUNER ST': HINSDALE, '37 S ...
folder_nm='end_to_end' coref_path="/home/raj/"+folder_nm+"/output/coreferent_pairs/output2.txt" chains_path="/home/raj/"+folder_nm+"/output/chains/chains.txt" f1=open(chains_path,"w+") def linear_search(obj, item, start=0): for l in range(start, len(obj)): if obj[l] == item: return l return...
folder_nm = 'end_to_end' coref_path = '/home/raj/' + folder_nm + '/output/coreferent_pairs/output2.txt' chains_path = '/home/raj/' + folder_nm + '/output/chains/chains.txt' f1 = open(chains_path, 'w+') def linear_search(obj, item, start=0): for l in range(start, len(obj)): if obj[l] == item: re...
SCOUTOATH = ''' On my honor, I will do my best to do my duty to God and my country to obey the Scout Law to help other people at all times to keep myself physically strong, mentally awake and morally straight. ''' SCOUTLAW = ''' A scout is: Trustworthy Loyal Helpful Friendly Courteous Kind ...
scoutoath = '\nOn my honor, I will do my best\nto do my duty to God and my country\nto obey the Scout Law\nto help other people at all times\nto keep myself physically strong, mentally awake and morally straight.\n' scoutlaw = '\nA scout is:\n Trustworthy\n Loyal\n Helpful\n Friendly\n Courteous\n Kin...
# Colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREY = (140, 140, 140) CYAN = (0, 255, 255) DARK_CYAN = (0, 150, 150) ORANGE = (255, 165, 0) RED = (255, 0, 0) GREEN = (0, 255, 0)
black = (0, 0, 0) white = (255, 255, 255) grey = (140, 140, 140) cyan = (0, 255, 255) dark_cyan = (0, 150, 150) orange = (255, 165, 0) red = (255, 0, 0) green = (0, 255, 0)
data = ( 'kka', # 0x00 'kk', # 0x01 'nu', # 0x02 'no', # 0x03 'ne', # 0x04 'nee', # 0x05 'ni', # 0x06 'na', # 0x07 'mu', # 0x08 'mo', # 0x09 'me', # 0x0a 'mee', # 0x0b 'mi', # 0x0c 'ma', # 0x0d 'yu', # 0x0e 'yo', # 0x0f 'ye', # 0x10 'yee', # 0x11 'yi', # 0x12 'ya...
data = ('kka', 'kk', 'nu', 'no', 'ne', 'nee', 'ni', 'na', 'mu', 'mo', 'me', 'mee', 'mi', 'ma', 'yu', 'yo', 'ye', 'yee', 'yi', 'ya', 'ju', 'ju', 'jo', 'je', 'jee', 'ji', 'ji', 'ja', 'jju', 'jjo', 'jje', 'jjee', 'jji', 'jja', 'lu', 'lo', 'le', 'lee', 'li', 'la', 'dlu', 'dlo', 'dle', 'dlee', 'dli', 'dla', 'lhu', 'lho', 'l...
# -*- Python -*- # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Alex Dementsov # California Institute of Technology # (C) 2010 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
testtext = '\n/*******************************************************************************\n*\n*\n*\n* McStas, neutron ray-tracing package\n* Copyright 1997-2002, All rights reserved\n* Risoe National Laboratory, Roskilde, Denmark\n* Institut Laue Langevin, Grenoble, France\n*\n* Component: ...
class RangeQuery: def __init__(self, data, func=min): self.func = func self._data = _data = [list(data)] i, n = 1, len(_data[0]) while 2 * i <= n: prev = _data[-1] _data.append([func(prev[j], prev[j + i]) for j in range(n - 2 * i + 1)]) i <<= 1 ...
class Rangequery: def __init__(self, data, func=min): self.func = func self._data = _data = [list(data)] (i, n) = (1, len(_data[0])) while 2 * i <= n: prev = _data[-1] _data.append([func(prev[j], prev[j + i]) for j in range(n - 2 * i + 1)]) i <<= ...
""" Main python file for the sssdevops example """ def mean(num_list): """ Calculate the mean of a list of numbers Parameters ---------- num_list: list of int or float Returns ------- float of the mean of the list Examples -------- >>> mean([1, 2, 3, 4, 5]) 3.0 ...
""" Main python file for the sssdevops example """ def mean(num_list): """ Calculate the mean of a list of numbers Parameters ---------- num_list: list of int or float Returns ------- float of the mean of the list Examples -------- >>> mean([1, 2, 3, 4, 5]) 3.0 ""...
class SymbolTableItem: def __init__(self, type, name, customId, value): self.type = type self.name = name self.value = value # if type == 'int' or type == 'bool': # self.value = 0 # elif type == 'string': # self.value = ' ' # else: # ...
class Symboltableitem: def __init__(self, type, name, customId, value): self.type = type self.name = name self.value = value self.id = 'id_{}'.format(customId) def __str__(self): return '{}, {}, {}, {}'.format(self.type, self.name, self.value, self.id)
# Define the fileName as a variable fileToWrite = 'outputFile.txt' fileHandle = open(fileToWrite, 'w') i = 0 while i < 10: fileHandle.write("This is line Number " + str(i) + "\n") i += 1 fileHandle.close()
file_to_write = 'outputFile.txt' file_handle = open(fileToWrite, 'w') i = 0 while i < 10: fileHandle.write('This is line Number ' + str(i) + '\n') i += 1 fileHandle.close()
NOTES = """ (c) 2017 JUSTYN CHAYKOWSKI PROVIDED UNDER MIT LICENSE SCHOOLOGY.COM ACCESS CODE: GNH9N-KZ2C2 RIC 115 <-- OFFICE HOURS: M 4-6 PM W 12-6 PM ########################################## # RICE LAB # # TEXT BOOK = ARDX ARDUINO EXPERIMENTER'S KIT - OOMLOUT # # CLASS PROJECT --MUST-- BUILD OFF OF WORK ALREADY D...
notes = '\n(c) 2017 JUSTYN CHAYKOWSKI\nPROVIDED UNDER MIT LICENSE\n\nSCHOOLOGY.COM\nACCESS CODE: GNH9N-KZ2C2\n\n\nRIC 115 <-- OFFICE HOURS:\nM 4-6 PM\nW 12-6 PM\n\n##########################################\n# RICE LAB\n#\n# TEXT BOOK = ARDX ARDUINO EXPERIMENTER\'S KIT - OOMLOUT\n#\n# CLASS PROJECT --MUST-- BUILD OFF O...
a = source() if True: b = a + 3 * sanitizer2(y) else: b = sanitizer(a) sink(b)
a = source() if True: b = a + 3 * sanitizer2(y) else: b = sanitizer(a) sink(b)
# # This file contains the Python code from Program 10.10 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm10_10.txt # class AVLTree(Bin...
class Avltree(BinarySearchTree): def balance(self): self.adjustHeight() if self.balanceFactor > 1: if self._left.balanceFactor > 0: self.doLLRotation() else: self.doLRRotation() elif self.balanceFactor < -1: if self._right....
# Python program to print Even Numbers in given range start, end = 4, 19 # iterating each number in list for num in range(start, end + 1): # checking condition if num % 2 == 0: print(num, end = " ")
(start, end) = (4, 19) for num in range(start, end + 1): if num % 2 == 0: print(num, end=' ')
x = input() y = input() z = input() flag = z % (1 + 1) == 0 and (1 < x and x < 123) or (1 > y and y > x and x > y and y < 123) def identity(var): return var if x ^ y == 1 or ( x % 2 == 0 and (3 > x and x <= 3 and 3 <= y and y > z and z >= 5) or ( identity(-1) + hash('hello') < 10 + 120 and 10 +...
x = input() y = input() z = input() flag = z % (1 + 1) == 0 and (1 < x and x < 123) or (1 > y and y > x and (x > y) and (y < 123)) def identity(var): return var if x ^ y == 1 or (x % 2 == 0 and (3 > x and x <= 3 and (3 <= y) and (y > z) and (z >= 5)) or (identity(-1) + hash('hello') < 10 + 120 and 10 + 120 < hash(...
def main(): class student: std = [] def __init__(self,name,id,cgpa): self.name = name self.id = id self.cgpa = cgpa def showId(self): return self.id def result(self): if(self.cgpa > 8.5): print(...
def main(): class Student: std = [] def __init__(self, name, id, cgpa): self.name = name self.id = id self.cgpa = cgpa def show_id(self): return self.id def result(self): if self.cgpa > 8.5: print('Great ...
def valid(a): a = str(a) num = set() for char in a: num.add(char) return len(a) == len(num) n = int(input()) n += 1 while True: if valid(n): print(n) break else: n += 1
def valid(a): a = str(a) num = set() for char in a: num.add(char) return len(a) == len(num) n = int(input()) n += 1 while True: if valid(n): print(n) break else: n += 1
class QtConnectionError(Exception): pass class QtRestApiError(Exception): """ Problem with authentification""" pass class QtFileTypeError(Exception): """Invalid type of file""" pass class QtArgumentError(Exception): pass class QtVocabularyError(Exception): pass class QtModelError(E...
class Qtconnectionerror(Exception): pass class Qtrestapierror(Exception): """ Problem with authentification""" pass class Qtfiletypeerror(Exception): """Invalid type of file""" pass class Qtargumenterror(Exception): pass class Qtvocabularyerror(Exception): pass class Qtmodelerror(Except...
class PeculiarBalance: """ Can we save them? Beta Rabbit is trying to break into a lab that contains the only known zombie cure - but there's an obstacle. The door will only open if a challenge is solved correctly. The future of the zombified rabbit population is at stake, so Beta reads the challenge: ...
class Peculiarbalance: """ Can we save them? Beta Rabbit is trying to break into a lab that contains the only known zombie cure - but there's an obstacle. The door will only open if a challenge is solved correctly. The future of the zombified rabbit population is at stake, so Beta reads the challenge: T...
P, A, B = map(int, input().split()) if P >= A+B: print(P) elif B > P: print(-1) else: print(A+B)
(p, a, b) = map(int, input().split()) if P >= A + B: print(P) elif B > P: print(-1) else: print(A + B)
PASSWORD = "PASSW0RD2019" TO = ["test@gmail.com", "test2@gmail.com"] FROM = "test@gmail.com"
password = 'PASSW0RD2019' to = ['test@gmail.com', 'test2@gmail.com'] from = 'test@gmail.com'
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incor...
def edgeorder_order_show(client, name, resource_group_name, location): return client.get_order_by_name(order_name=name, resource_group_name=resource_group_name, location=location) def edgeorder_list_config(client, configuration_filters, skip_token=None, registered_features=None, location_placement_id=None, quota_i...
class Config(object): ORG_NAME = 'footprints' ORG_DOMAIN = 'footprints.devel' APP_NAME = 'Footprints' APP_VERSION = '0.4.0'
class Config(object): org_name = 'footprints' org_domain = 'footprints.devel' app_name = 'Footprints' app_version = '0.4.0'
class Solution: def minSubArrayLen(self, s: int, nums: List[int]) -> int: left, sum, count = 0, 0, float('inf') for right in range(len(nums)): sum += nums[right] while sum >= s: count = min(count, right - left + 1) sum -= ...
class Solution: def min_sub_array_len(self, s: int, nums: List[int]) -> int: (left, sum, count) = (0, 0, float('inf')) for right in range(len(nums)): sum += nums[right] while sum >= s: count = min(count, right - left + 1) sum -= nums[left] ...
def line(y1, x1, y2, x2): """ Yield integer coordinates for a line from (y1, x1) to (y2, x2). """ dy = abs(y2 - y1) dx = abs(x2 - x1) if dy == 0: # Horizontal for x in range(x1, x2 + 1): yield y1, x elif dx == 0: # Vertical for y in range(y1, y2 + 1): ...
def line(y1, x1, y2, x2): """ Yield integer coordinates for a line from (y1, x1) to (y2, x2). """ dy = abs(y2 - y1) dx = abs(x2 - x1) if dy == 0: for x in range(x1, x2 + 1): yield (y1, x) elif dx == 0: for y in range(y1, y2 + 1): yield (y, x1) elif...
""" TESTS TO WRITE: * API contract tests for notify/email provider, github, trello """
""" TESTS TO WRITE: * API contract tests for notify/email provider, github, trello """
def pisano(m): prev,curr=0,1 for i in range(0,m*m): prev,curr=curr,(prev+curr)%m if prev==0 and curr == 1 : return i+1 def fib(n,m): seq=pisano(m) n%=seq if n<2: return n f=[0]*(n+1) f[1]=1 for i in range(2,n+1): f[i]=f[i-1]+f[i-2] ...
def pisano(m): (prev, curr) = (0, 1) for i in range(0, m * m): (prev, curr) = (curr, (prev + curr) % m) if prev == 0 and curr == 1: return i + 1 def fib(n, m): seq = pisano(m) n %= seq if n < 2: return n f = [0] * (n + 1) f[1] = 1 for i in range(2, n ...
# # PySNMP MIB module TRAPEZE-NETWORKS-RF-BLACKLIST-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-RF-BLACKLIST-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:27:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, constraints_union, value_range_constraint) ...
T = int(input()) for i in range(T): try: a, b = map(str, input().split()) print(int(int(a)//int(b))) except Exception as e: print("Error Code:", e)
t = int(input()) for i in range(T): try: (a, b) = map(str, input().split()) print(int(int(a) // int(b))) except Exception as e: print('Error Code:', e)