content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
expected_output = { "bgp_id": 65109, "vrf": { "VRF1": { "neighbor": { "192.168.10.253": { "address_family": { "vpnv4 unicast": { "version": 4, "as": 65555, ...
expected_output = {'bgp_id': 65109, 'vrf': {'VRF1': {'neighbor': {'192.168.10.253': {'address_family': {'vpnv4 unicast': {'version': 4, 'as': 65555, 'msg_rcvd': 20, 'msg_sent': 12, 'tbl_ver': 189, 'input_queue': 0, 'output_queue': 0, 'up_down': '00:03:52', 'state_pfxrcd': '13', 'route_identifier': '192.168.10.254', 'lo...
i = input('digite um numero inteiro: ') for k in range(11): l = int(i)*int(k) print(i,' * ',k,' = ',l)
i = input('digite um numero inteiro: ') for k in range(11): l = int(i) * int(k) print(i, ' * ', k, ' = ', l)
self.description = "Replace a package with a file in 'backup' (local modified)" # FS#24543 lp = pmpkg("dummy") lp.files = ["etc/dummy.conf*", "bin/dummy"] lp.backup = ["etc/dummy.conf"] self.addpkg2db("local", lp) sp = pmpkg("replacement") sp.replaces = ["dummy"] sp.files = ["etc/dummy.conf", "bin/dummy*"] sp.backup ...
self.description = "Replace a package with a file in 'backup' (local modified)" lp = pmpkg('dummy') lp.files = ['etc/dummy.conf*', 'bin/dummy'] lp.backup = ['etc/dummy.conf'] self.addpkg2db('local', lp) sp = pmpkg('replacement') sp.replaces = ['dummy'] sp.files = ['etc/dummy.conf', 'bin/dummy*'] sp.backup = ['etc/dummy...
a=int(input("Enter no of input = ")) for i in range (a): b=int(input("Enter the 1 or 2= ")) if (b==1): class A: def odd(self): oddInteger=int(input("Enter odd integer = ")) for i in range (oddInteger*2): if(i%2!=0): ...
a = int(input('Enter no of input = ')) for i in range(a): b = int(input('Enter the 1 or 2= ')) if b == 1: class A: def odd(self): odd_integer = int(input('Enter odd integer = ')) for i in range(oddInteger * 2): if i % 2 != 0: ...
# Solfec-2.0 input command test: GRAVITY spl = SPLINE ([0, 0, -5, 1, 2, -9.81, 3, -9.81]) def call(t): return 0.0 GRAVITY (0.0, call, spl) print_GRAVITY()
spl = spline([0, 0, -5, 1, 2, -9.81, 3, -9.81]) def call(t): return 0.0 gravity(0.0, call, spl) print_gravity()
""" A module of mass 14 requires 2 fuel. This fuel requires no further fuel (2 divided by 3 and rounded down is 0, which would call for a negative fuel), so the total fuel required is still just 2. At first, a module of mass 1969 requires 654 fuel. Then, this fuel requires 216 more fuel (654 / 3 - 2). 216 then...
""" A module of mass 14 requires 2 fuel. This fuel requires no further fuel (2 divided by 3 and rounded down is 0, which would call for a negative fuel), so the total fuel required is still just 2. At first, a module of mass 1969 requires 654 fuel. Then, this fuel requires 216 more fuel (654 / 3 - 2). 216 then require...
#!/usr/bin/python3 with open('./input.txt', 'r') as input: lines = input.read() input.close() lines = lines.split("\n\n") rules = lines[0].split("\n") rule_list = [] for rule in rules: resp_dict = {} for parsed_rule in rule.split(": ")[1].split(" or "): rule_list.append({'start': int(parsed_rul...
with open('./input.txt', 'r') as input: lines = input.read() input.close() lines = lines.split('\n\n') rules = lines[0].split('\n') rule_list = [] for rule in rules: resp_dict = {} for parsed_rule in rule.split(': ')[1].split(' or '): rule_list.append({'start': int(parsed_rule.split('-')[0]), 'stop'...
#!/usr/bin/python3 def is_palindrome(s: str) -> (bool): return s == s[::-1] def solve() -> (int): solution = int(0) for i in reversed(range(100, 1000)): for j in reversed(range(100, 1000)): product = i * j if is_palindrome(str(product)): if product > solut...
def is_palindrome(s: str) -> bool: return s == s[::-1] def solve() -> int: solution = int(0) for i in reversed(range(100, 1000)): for j in reversed(range(100, 1000)): product = i * j if is_palindrome(str(product)): if product > solution: s...
''' Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4] Output: 24 Note: The length of the given array will be in range [3,104] and all elements are in the range [-1000, 1000]. Multiplication of a...
""" Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4] Output: 24 Note: The length of the given array will be in range [3,104] and all elements are in the range [-1000, 1000]. Multiplication of a...
class Solution: def diStringMatch(self, S: str) -> List[int]: small = 0 large = len(S) result = [] for s in S: if s == "I": result.append(small) small += 1 elif s == "D": result.append(large) larg...
class Solution: def di_string_match(self, S: str) -> List[int]: small = 0 large = len(S) result = [] for s in S: if s == 'I': result.append(small) small += 1 elif s == 'D': result.append(large) l...
def array_not(arr): r = [] for item in arr: if item == 0: r.append(1) else: r.append(0) return r def bin2int(arr): r = 0 for i in range(len(arr)): if arr[len(arr) - 1 - i] == 1: r += 2**i return r with open('input.txt') as f: a = ...
def array_not(arr): r = [] for item in arr: if item == 0: r.append(1) else: r.append(0) return r def bin2int(arr): r = 0 for i in range(len(arr)): if arr[len(arr) - 1 - i] == 1: r += 2 ** i return r with open('input.txt') as f: a =...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tests for 'biblio.isbn', using nose. """ ### IMPORTS ### ## CONSTANTS & DEFINES ### ### TESTS ### ### END ####################################################################
""" Tests for 'biblio.isbn', using nose. """
class ValidateImports: type_of_connections = [] type_of_imports=[] def get_types_of_nodes(self, content, node_val): self.type_of_connections.clear() for node in node_val: nodes = content["topology_template"]["node_templates"][node]["requirements"] for n in range(len(...
class Validateimports: type_of_connections = [] type_of_imports = [] def get_types_of_nodes(self, content, node_val): self.type_of_connections.clear() for node in node_val: nodes = content['topology_template']['node_templates'][node]['requirements'] for n in range(le...
class BinaryExploder(object): def __init__(self, num): self.num = num def __iter__(self): num = self.num if num != 0: value, length = num & 1, 1 num >>= 1 while num != 0: if num & 1 != value: yield value, length ...
class Binaryexploder(object): def __init__(self, num): self.num = num def __iter__(self): num = self.num if num != 0: (value, length) = (num & 1, 1) num >>= 1 while num != 0: if num & 1 != value: yield (value, leng...
""" The __init__.py file lets the Python interpreter know that a directory contains code for a Python module. An __init__.py file can be blank. Without one, you cannot import modules from another folder into your project. @see https://careerkarma.com/blog/what-is-init-py/ """
""" The __init__.py file lets the Python interpreter know that a directory contains code for a Python module. An __init__.py file can be blank. Without one, you cannot import modules from another folder into your project. @see https://careerkarma.com/blog/what-is-init-py/ """
class PokemonNotFound(Exception): def __init__(self, value): super().__init__() self.value = value def __str__(self): return "{} was not found in PokeAPI".format(self.value)
class Pokemonnotfound(Exception): def __init__(self, value): super().__init__() self.value = value def __str__(self): return '{} was not found in PokeAPI'.format(self.value)
######################### Common settings ################################ # Number of files that need to generate. current_file_num = 300 # Size of each file. Only the 'current_file_size' will be read, and its unit is byte. current_file_size_mib = 25 # Size unit is MiB current_file_size_unit = int(10 ** 6) current_...
current_file_num = 300 current_file_size_mib = 25 current_file_size_unit = int(10 ** 6) current_file_size = int(current_file_size_mib * current_file_size_unit) current_file_name_length = 24 current_output_folder = 'output_folder' benchmark_output_folder = 'benchmark_output_folder' generator_name = 'os_urandom' parallel...
#!/usr/bin/python3 #!/usr/bin/env python3 def isValidSequence(seq): check_array = ['A','T','G','C'] for i in seq: if i not in check_array: return False return True #To check if Sequence consists of only A,T,G,C def inputSequence(): seq = str(raw_input("Please Enter Your Sequence: ")) print(seq) return seq ...
def is_valid_sequence(seq): check_array = ['A', 'T', 'G', 'C'] for i in seq: if i not in check_array: return False return True def input_sequence(): seq = str(raw_input('Please Enter Your Sequence: ')) print(seq) return seq def reverse_sequence(seq): rev_string = seq[::...
def build_placements(shoes): """ (list of str) -> dict of {str: list of int} Return a dictionary where each key is a company and each value is a list of placements by people wearing shoes made by that company. >>> result = build_placements(['Saucony', 'Asics', \ 'Asics', 'NB...
def build_placements(shoes): """ (list of str) -> dict of {str: list of int} Return a dictionary where each key is a company and each value is a list of placements by people wearing shoes made by that company. >>> result = build_placements(['Saucony', 'Asics', 'Asics', 'NB', 'Saucon...
class UnknownUser(Exception): pass class UnknownRole(Exception): pass class UnknownAccessLevel(Exception): pass class UserNotAssignedToRole(Exception): pass
class Unknownuser(Exception): pass class Unknownrole(Exception): pass class Unknownaccesslevel(Exception): pass class Usernotassignedtorole(Exception): pass
age = int(input('what is your current age: ')) remain = 90 - age print(f'You have {remain*365} days, {remain*52} weeks, and {remain*12} months left!')
age = int(input('what is your current age: ')) remain = 90 - age print(f'You have {remain * 365} days, {remain * 52} weeks, and {remain * 12} months left!')
class UnionFind: def __init__(self, n): self.par = [-1 for i in range(n)] self.siz = [1 for i in range(n)] def root(self, x): if self.par[x] == -1: return x else: self.par[x] = self.root(self.par[x]) return self.par[x] def is_same(sel...
class Unionfind: def __init__(self, n): self.par = [-1 for i in range(n)] self.siz = [1 for i in range(n)] def root(self, x): if self.par[x] == -1: return x else: self.par[x] = self.root(self.par[x]) return self.par[x] def is_same(self, ...
# # PySNMP MIB module CISCO-RMON-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-RMON-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:54:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_intersection, constraints_union, value_range_constraint) ...
""" A backed-up folder """ # pylint: disable=too-many-instance-attributes class Folder: """ A backup folder """ def __init__(self): """ . """ self.__folder_path = None self.__folder_permissions = None self.__folder_owner = None self.__folder_grou...
""" A backed-up folder """ class Folder: """ A backup folder """ def __init__(self): """ . """ self.__folder_path = None self.__folder_permissions = None self.__folder_owner = None self.__folder_group = None @property def folder_path(sel...
ALL = "All tested clients" OUTLOOK = "Outlook 2007/10/13" OUTLOOK_EXPRESS = "Outlook 03/Express/Mail" OUTLOOK_COM = "Outlook.com" APPLE_MAIL = "Apple Mail 6.5" IPHONE = "Iphone iOS 7/iPad" YAHOO = "Yahoo! Mail" GMAIL = "Google Gmail" ANDROID = "Android 4 (Gmail)"
all = 'All tested clients' outlook = 'Outlook 2007/10/13' outlook_express = 'Outlook 03/Express/Mail' outlook_com = 'Outlook.com' apple_mail = 'Apple Mail 6.5' iphone = 'Iphone iOS 7/iPad' yahoo = 'Yahoo! Mail' gmail = 'Google Gmail' android = 'Android 4 (Gmail)'
# works 100% A = [] def solution(A, K): if len(A) == 0: return A M = K if K > len(A): M = K % len(A) return A[len(A)-M:len(A)] + A[0:len(A)-M] print(solution(A, 42))
a = [] def solution(A, K): if len(A) == 0: return A m = K if K > len(A): m = K % len(A) return A[len(A) - M:len(A)] + A[0:len(A) - M] print(solution(A, 42))
a=input('enter a word') for i in range(len(a)): print(chr(ord(a[i])-32),end='')
a = input('enter a word') for i in range(len(a)): print(chr(ord(a[i]) - 32), end='')
def set_template(args): # Set the templates here if args.template.find('jpeg') >= 0: args.data_train = 'DIV2K_jpeg' args.data_test = 'DIV2K_jpeg' args.epochs = 200 args.decay = '100' if args.template.find('EDSR_paper') >= 0: args.model = 'EDSR' args.n_resbloc...
def set_template(args): if args.template.find('jpeg') >= 0: args.data_train = 'DIV2K_jpeg' args.data_test = 'DIV2K_jpeg' args.epochs = 200 args.decay = '100' if args.template.find('EDSR_paper') >= 0: args.model = 'EDSR' args.n_resblocks = 32 args.n_feats =...
# Python - 2.7.6 def narcissistic(value): v, nums = value, [] while v > 0: nums.append(v % 10) v = v // 10 return sum(map(lambda num: num ** len(nums), nums)) == value
def narcissistic(value): (v, nums) = (value, []) while v > 0: nums.append(v % 10) v = v // 10 return sum(map(lambda num: num ** len(nums), nums)) == value
#Find the smallest positive number #missing from an unsorted array #Link to problem https://leetcode.com/explore/interview/card/top-interview-questions-hard/116/array-and-strings/832/ def findMissing(a, n): for i in range(n) : # if value is negative or greater than array size then we skip the curren...
def find_missing(a, n): for i in range(n): if a[i] <= 0 or a[i] > n: continue v = arr[i] while a[v - 1] != v: nextval = a[v - 1] a[v - 1] = v v = nextval if v <= 0 or v > n: break for i in range(n): if a[...
r""" ======================================================= Cone Ply Piece Optimization Tool (:mod:`desicos.cppot`) ======================================================= .. currentmodule:: desicos.cppot Please, refer to the :ref:`CPPOT tutorial <cppot_tutorial>` for more details about how to use this module. .. a...
""" ======================================================= Cone Ply Piece Optimization Tool (:mod:`desicos.cppot`) ======================================================= .. currentmodule:: desicos.cppot Please, refer to the :ref:`CPPOT tutorial <cppot_tutorial>` for more details about how to use this module. .. au...
# import gspread # from db import database # import asyncio # from datetime import datetime class sheets: def __init__(self): """Initialises the connection to the google sheet using the google sheets API """ self.gc1 = gspread.service_account(filename='credantials.json') s...
class Sheets: def __init__(self): """Initialises the connection to the google sheet using the google sheets API """ self.gc1 = gspread.service_account(filename='credantials.json') self.sh1 = self.gc1.open_by_key('1b53CQsonQUc2DCce_fnXoeHTh2qXH1l8wuWrzDHqB4k') self.courseWork...
"""Errors thrown by DTOs or DAOs.""" class PlayerNotCreatorError(Exception): """ Is raised when a non host tries to execs creator rights. """
"""Errors thrown by DTOs or DAOs.""" class Playernotcreatorerror(Exception): """ Is raised when a non host tries to execs creator rights. """
# -*- coding: utf-8 -*- """ Created on Mon Jan 20 15:06:01 2020 @author: teja """ n = int(input()) t = [] d = [] ans = [] for i in range(n): temp = list(input().split()) t.append(temp[0]) d.append(temp[1]) for i in range(len(t)): minval = min(t) minind = t.index(minval) ans.append() f...
""" Created on Mon Jan 20 15:06:01 2020 @author: teja """ n = int(input()) t = [] d = [] ans = [] for i in range(n): temp = list(input().split()) t.append(temp[0]) d.append(temp[1]) for i in range(len(t)): minval = min(t) minind = t.index(minval) ans.append() for i in range(minind): ...
def get_reference(node, identifiers): """Recurses through yaml node to find the target key.""" if len(identifiers) == 1: return {identifiers[0]: node[identifiers[0]]} if not identifiers[0]: # skip over any empties return get_reference(node, identifiers[1:]) return get_reference(node[...
def get_reference(node, identifiers): """Recurses through yaml node to find the target key.""" if len(identifiers) == 1: return {identifiers[0]: node[identifiers[0]]} if not identifiers[0]: return get_reference(node, identifiers[1:]) return get_reference(node[identifiers[0]], identifiers...
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : 2022424.py @Contact : huanghoward@foxmail.com @Modify Time : 2022/4/24 20:14 ------------ """ def solu(a, b, c): def f(x): return x ** 3 + a * x ** 2 + b * x - c up = 1e6 while f(up) < 0: up = up * 10 l...
""" @File : 2022424.py @Contact : huanghoward@foxmail.com @Modify Time : 2022/4/24 20:14 ------------ """ def solu(a, b, c): def f(x): return x ** 3 + a * x ** 2 + b * x - c up = 1000000.0 while f(up) < 0: up = up * 10 low = 0 while up - low > 1e-07: m...
# Sengoku Era Questline | Master Room (811000008) # Author: Tiger SUKUNO = 9130124 AYAME = 9130100 if sm.hasQuest(58908) or sm.hasQuestCompleted(58908): sm.lockInGameUI(False) sm.hideNpcByTemplateId(9130104, False, False) # respawns princess sakuno's npc else: sm.hideNpcByTemplateId(9130104, True, True) #...
sukuno = 9130124 ayame = 9130100 if sm.hasQuest(58908) or sm.hasQuestCompleted(58908): sm.lockInGameUI(False) sm.hideNpcByTemplateId(9130104, False, False) else: sm.hideNpcByTemplateId(9130104, True, True)
a=int(input("Enter A value:")) rev=0 while a>0: rem=a%10 rev=(rev*10)+rem a=a//10 print("Reeverse value of A is: ",rev)
a = int(input('Enter A value:')) rev = 0 while a > 0: rem = a % 10 rev = rev * 10 + rem a = a // 10 print('Reeverse value of A is: ', rev)
#!/opt/bitnami/python/bin/python # EASY-INSTALL-SCRIPT: 'XlsxWriter==0.9.3','vba_extract.py' __requires__ = 'XlsxWriter==0.9.3' __import__('pkg_resources').run_script('XlsxWriter==0.9.3', 'vba_extract.py')
__requires__ = 'XlsxWriter==0.9.3' __import__('pkg_resources').run_script('XlsxWriter==0.9.3', 'vba_extract.py')
class Queue: def __init__(self, first): self.first = first self.last = None self.size = 1 def pop_item(self): if self.size < 2: self.size = 0 t = self.first self.first = None return t elif self.size == 2: self.s...
class Queue: def __init__(self, first): self.first = first self.last = None self.size = 1 def pop_item(self): if self.size < 2: self.size = 0 t = self.first self.first = None return t elif self.size == 2: self....
# # PySNMP MIB module FASTTRAKIDERAID-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTTRAKIDERAID-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:58:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) ...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def constructMaximumBinaryTree(self, nums): """ :type nums: List[int] :rtype: TreeNode ""...
class Solution(object): def construct_maximum_binary_tree(self, nums): """ :type nums: List[int] :rtype: TreeNode """ def max_node(nums, i, j): if i > j: return None m = i for k in range(i, j + 1): if nums[...
#Write a python program to print out: #name, preferred pronouns, favorite movie and favorite food #main functions and print statements def main(): print("Name: Edison Chen\nPronouns: he/him") print("My favorite movie is The Matrix") print("My favorite food is sushi") #check for main function and call it if _...
def main(): print('Name: Edison Chen\nPronouns: he/him') print('My favorite movie is The Matrix') print('My favorite food is sushi') if __name__ == '__main__': main()
""" Cycles are notoriously dangerous bugs in linked lists. There is however a very elegant algorithm to detect these cycles. Edge cases: 1. One node linked lists 2. Loops on the first node 3. Loop in a two node linked list 4. Loop on the tail node """ def is_cycle(head): """Detect a cycle where a ...
""" Cycles are notoriously dangerous bugs in linked lists. There is however a very elegant algorithm to detect these cycles. Edge cases: 1. One node linked lists 2. Loops on the first node 3. Loop in a two node linked list 4. Loop on the tail node """ def is_cycle(head): """Detect a cycle where a ...
print ("Hola Mundo!!!") m = [5, 'old', 'new', 8, 'time', 2] print (m[0]) print (m[-1])
print('Hola Mundo!!!') m = [5, 'old', 'new', 8, 'time', 2] print(m[0]) print(m[-1])
# """ # This is BinaryMatrix's API interface. # You should not implement it, or speculate about its implementation # """ #class BinaryMatrix(object): # def get(self, x: int, y: int) -> int: # def dimensions(self) -> list[]: class Solution: def leftMostColumnWithOne(self, binaryMatrix: 'BinaryMatrix') -> int:...
class Solution: def left_most_column_with_one(self, binaryMatrix: 'BinaryMatrix') -> int: (rows, columns) = binaryMatrix.dimensions() cand = -1 (left, right) = (0, columns - 1) while left < rows and right >= 0: if binaryMatrix.get(left, right) == 1: cand ...
''' Pattern 9 Hollow mirrored right triangle Enter number of rows: 5 * ** * * * * ***** ''' print('Hollow mirrored right triangle:') rows=int(input('Enter number of rows:')) for i in range(0,rows+1): for j in range(i,rows+1): print(' ',end='') for j in range(1,i+1): if i==rows or j==1 o...
""" Pattern 9 Hollow mirrored right triangle Enter number of rows: 5 * ** * * * * ***** """ print('Hollow mirrored right triangle:') rows = int(input('Enter number of rows:')) for i in range(0, rows + 1): for j in range(i, rows + 1): print(' ', end='') for j in range(1, i + 1): if i =...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"GAMMA": "00_core.ipynb", "api_settings": "00_core.ipynb", "nofilt": "00_core.ipynb", "API": "00_core.ipynb", "massachusetts_getter": "00_core.ipynb", "michigan_ge...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'GAMMA': '00_core.ipynb', 'api_settings': '00_core.ipynb', 'nofilt': '00_core.ipynb', 'API': '00_core.ipynb', 'massachusetts_getter': '00_core.ipynb', 'michigan_getter': '00_core.ipynb', 'rhode_island_getter': '00_core.ipynb', 'NEW_YORK_EVENTS': '00...
# -*- coding: utf-8 -*- """Top-level package for pixie.""" __author__ = """Sabih Hasan""" __email__ = 'sabih.chr@gmail.com' __version__ = '0.1.0'
"""Top-level package for pixie.""" __author__ = 'Sabih Hasan' __email__ = 'sabih.chr@gmail.com' __version__ = '0.1.0'
# Range: 1 : 100,000 # Time: 28m20.028s # Written by Alex Vear in 2019 # Public domain. No rights reserved. startval = 1 endval = 100000 for num in range(startval, endval): sqr = (num*num)*2 for i in range(startval, endval): tri = i*(i+1) if sqr == tri: sqr = sqr/2 t...
startval = 1 endval = 100000 for num in range(startval, endval): sqr = num * num * 2 for i in range(startval, endval): tri = i * (i + 1) if sqr == tri: sqr = sqr / 2 tri = tri / 2 print('Square Number:', sqr, ' Triangle Number:', tri, ' Squared:', num, ' Trian...
def quick_sort_channel_logs(channel_logs): # sort channels to match the server's default chosen positions if len(channel_logs) <= 1: return channel_logs else: return quick_sort_channel_logs([e for e in channel_logs[1:] \ if e.get_channel().position <= channel_logs[0].get_channel().positi...
def quick_sort_channel_logs(channel_logs): if len(channel_logs) <= 1: return channel_logs else: return quick_sort_channel_logs([e for e in channel_logs[1:] if e.get_channel().position <= channel_logs[0].get_channel().position]) + [channel_logs[0]] + quick_sort_channel_logs([e for e in channel_lo...
""" Datos de entrada edad_uno-->e_uno-->int edad_dos-->e_dos-->int edad_tres-->e_tres-->int datos de salida promedio-->p--float """ #Entradas e_uno=int(input("Digite edad uno: ")) e_dos=int(input("Digite edad dos: ")) e_tres=int(input("Digite edad tres: ")) #Cajanegra p=(e_uno+e_dos+e_tres)/3#float #Salida print (F"El...
""" Datos de entrada edad_uno-->e_uno-->int edad_dos-->e_dos-->int edad_tres-->e_tres-->int datos de salida promedio-->p--float """ e_uno = int(input('Digite edad uno: ')) e_dos = int(input('Digite edad dos: ')) e_tres = int(input('Digite edad tres: ')) p = (e_uno + e_dos + e_tres) / 3 print(f'El promedio es: {p}')
# Bubble Sort def swap(arr, i, j): tmp = arr[i] arr[i] = arr[j] arr[j] = tmp def bubble_sort(arr): n = len(arr) is_swapped = True while is_swapped: is_swapped = False for i in range(n-1): if arr[i] > arr[i+1]: swap(arr, i, i+1) is_s...
def swap(arr, i, j): tmp = arr[i] arr[i] = arr[j] arr[j] = tmp def bubble_sort(arr): n = len(arr) is_swapped = True while is_swapped: is_swapped = False for i in range(n - 1): if arr[i] > arr[i + 1]: swap(arr, i, i + 1) is_swapped = Tr...
""" Lets start from a node in the initial. DFS through the graph. [0] When a node is infected, we paint it by color1. After the DFS is done, we start from another node in the initial. DFS through the graph. When a node is infected, we paint it by color2. ... We don't paint the node that we already colored. [1] The mor...
""" Lets start from a node in the initial. DFS through the graph. [0] When a node is infected, we paint it by color1. After the DFS is done, we start from another node in the initial. DFS through the graph. When a node is infected, we paint it by color2. ... We don't paint the node that we already colored. [1] The mor...
async def f(): yield True x = yield True def f(): async for fob in oar: pass async for fob in oar: pass def f(): async with baz: pass async with baz: pass
async def f(): yield True x = (yield True) def f(): async for fob in oar: pass async for fob in oar: pass def f(): async with baz: pass async with baz: pass
""" Please input your first name and last name Then you will have a welcome information :) This is a python script written by Qi Zhao """ usrFirstName = input("Please tell me your first name: ") usrLastName = input("Please tell me your last name: ") print(f"Hello {usrFirstName} {usrLastName}")
""" Please input your first name and last name Then you will have a welcome information :) This is a python script written by Qi Zhao """ usr_first_name = input('Please tell me your first name: ') usr_last_name = input('Please tell me your last name: ') print(f'Hello {usrFirstName} {usrLastName}')
class Printer: def __init__(self, s): self.string = s def __call__(self): print(self.string) print_something = Printer("something") print_something() # Objects can be made callable by defining a __call__ function.
class Printer: def __init__(self, s): self.string = s def __call__(self): print(self.string) print_something = printer('something') print_something()
# -*- coding: utf-8 -*- """ Created on Fri Dec 15 12:17:19 2017 @author: scd """ #%% global model options """ global_option_list = ['APPINFO', 'APPINFOCHG', 'APPSTATUS', 'BNDS_CHK', 'COLDSTART', 'CSV_READ', 'CSV_WRITE', 'CTRLMODE', 'CTRL_HOR', 'CTRL_TIME', 'CTRL_UNITS', 'CV_...
""" Created on Fri Dec 15 12:17:19 2017 @author: scd """ "\nglobal_option_list = ['APPINFO', 'APPINFOCHG', 'APPSTATUS', 'BNDS_CHK', 'COLDSTART',\n 'CSV_READ', 'CSV_WRITE', 'CTRLMODE', 'CTRL_HOR', 'CTRL_TIME',\n 'CTRL_UNITS', 'CV_TYPE', 'CV_WGT_SLOPE', 'CV_WGT_START',\n ...
#-*- coding:utf-8 -*- __author__ = 'Ulric Qin' __all__ = [ "api", "cluster", "expression", "group", "home", "host", "nodata", "plugin", "strategy", "template", "alarm", "alert_link", ]
__author__ = 'Ulric Qin' __all__ = ['api', 'cluster', 'expression', 'group', 'home', 'host', 'nodata', 'plugin', 'strategy', 'template', 'alarm', 'alert_link']
def mystery(s: str, n: int) -> str: if n == 0: return '' return ''.join(i for i, k in zip(s, bin(n)[2:]) if k == '1')
def mystery(s: str, n: int) -> str: if n == 0: return '' return ''.join((i for (i, k) in zip(s, bin(n)[2:]) if k == '1'))
""" ## Questions ### 535. [Encode and Decode TinyURL](https://leetcode.com/problems/encode-and-decode-tinyurl/) Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns...
""" ## Questions ### 535. [Encode and Decode TinyURL](https://leetcode.com/problems/encode-and-decode-tinyurl/) Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns...
devices = { 'fungen':[ 'lantz.drivers.keysight.Keysight_33622A.Keysight_33622A', ['TCPIP0::A-33622A-01461.local::inst0::INSTR'], # connecting function generator with ethernet works better for Arb mode {} ], 'wm':[ 'lantz.drivers.bristol.bristol771.Bristol_771', ...
devices = {'fungen': ['lantz.drivers.keysight.Keysight_33622A.Keysight_33622A', ['TCPIP0::A-33622A-01461.local::inst0::INSTR'], {}], 'wm': ['lantz.drivers.bristol.bristol771.Bristol_771', [6535], {}], 'SRS': ['lantz.drivers.stanford.srs900.SRS900', ['GPIB0::2::INSTR'], {}]} spyrelets = {'spectroscopy_cwicker': ['spyre....
# # PySNMP MIB module HUAWEI-SNMP-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-SNMP-EXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:36:53 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, constraints_intersection, value_size_constraint, single_value_constraint) ...
def my_decorator(func): def wrap_func(): func() return wrap_func @my_decorator def hello(): #print('hello baby duck') print(''' Hello Baby Duck! ..---.. .' _ `. __..' (o) : `..__ ; `. / ; `..---...___ .' `~-. .-') . ...
def my_decorator(func): def wrap_func(): func() return wrap_func @my_decorator def hello(): print("\n Hello Baby Duck!\n ..---..\n .' _ `.\n __..' (o) :\n`..__ ;\n `. /\n ; `..---...___\n .' `~-. .-')\n . ...
class BinaryHeapNode: def __init__(self, elem, key, index): """ this class represents a generic binary heap node :param elem: the elem to store :param key: int, the key to be used as priority function :param index: int, the index related to the binary node """ ...
class Binaryheapnode: def __init__(self, elem, key, index): """ this class represents a generic binary heap node :param elem: the elem to store :param key: int, the key to be used as priority function :param index: int, the index related to the binary node """ ...
# Copyright (c) 2021 - present, Timur Shenkao # 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 appl...
closing = {')': '(', '}': '{', ']': '['} class Solution: def is_valid(self, s: str) -> bool: """ Time complexity: O(n). We iterate through the string once Space complexity: O(n). We use stack to keep brackets. If brackets are of the same type, then O(1) as we don'...
try: ageStr = input('Enter your age:') age = int(ageStr) print('You are', age, 'years old.') except Exception as esmerelda: print('Something went wrong: ', esmerelda)
try: age_str = input('Enter your age:') age = int(ageStr) print('You are', age, 'years old.') except Exception as esmerelda: print('Something went wrong: ', esmerelda)
x = int(input('podaj liczbe: ')) suma = 0 for i in range(len(str(x))): suma += int(str(x)[i]) print(suma)
x = int(input('podaj liczbe: ')) suma = 0 for i in range(len(str(x))): suma += int(str(x)[i]) print(suma)
""" Introduction The first century spans from the year 1 up to and including the year 100, The second - from the year 101 up to and including the year 200, etc. Task : Given a year, return the century it is in. Input , Output Examples : 1705 --> 18 1900 --> 19 1601 --> 17 2000 --> 20 Hope you enjoy it .. Awaiting ...
""" Introduction The first century spans from the year 1 up to and including the year 100, The second - from the year 101 up to and including the year 200, etc. Task : Given a year, return the century it is in. Input , Output Examples : 1705 --> 18 1900 --> 19 1601 --> 17 2000 --> 20 Hope you enjoy it .. Awaiting ...
test = { "artifacts": [], "blocker": None, "ciTestId": None, "configXML": None, "dependsOnMethods": None, "finishTime": None, "id": None, "knownIssue": None, "message": None, "messageHashCode": None, "name": "NAME", "needRerun": None, "retry": None, "startTime": None, "status": None, "te...
test = {'artifacts': [], 'blocker': None, 'ciTestId': None, 'configXML': None, 'dependsOnMethods': None, 'finishTime': None, 'id': None, 'knownIssue': None, 'message': None, 'messageHashCode': None, 'name': 'NAME', 'needRerun': None, 'retry': None, 'startTime': None, 'status': None, 'testArgs': None, 'testCaseId': 'TES...
_base_ = [ './optimizer_cfgs/adam_cfg.py', './scheduler_cfgs/multi_step_lr_cfg.py', './loss_cfgs/triplet_loss_cfg.py', ] train_cfg = dict( save_per_epoch=10, val_per_epoch=5, batch_sampler_type='ExpansionBatchSampler', batch_sampler_cfg=dict( max_batch_size=64, batch_size_ex...
_base_ = ['./optimizer_cfgs/adam_cfg.py', './scheduler_cfgs/multi_step_lr_cfg.py', './loss_cfgs/triplet_loss_cfg.py'] train_cfg = dict(save_per_epoch=10, val_per_epoch=5, batch_sampler_type='ExpansionBatchSampler', batch_sampler_cfg=dict(max_batch_size=64, batch_size_expansion_rate=1.4, batch_expansion_threshold=0.7, b...
a = list(map(int, input().split())) b = list(map(int, input().split())) alice = sum([(1 if a[i] > b[i] else 0) for i in range (3)]) bob = sum([(1 if a[i] < b[i] else 0) for i in range (3)]) print(alice, bob) # Another Solution: a = list(map(int, input().split())) b = list(map(int, input().split())) alice = 0 bob =...
a = list(map(int, input().split())) b = list(map(int, input().split())) alice = sum([1 if a[i] > b[i] else 0 for i in range(3)]) bob = sum([1 if a[i] < b[i] else 0 for i in range(3)]) print(alice, bob) a = list(map(int, input().split())) b = list(map(int, input().split())) alice = 0 bob = 0 for (a_val, b_val) in zip(a,...
def seat_id(line): row = int(''.join('0' if c == "F" else '1' for c in line[:7]), 2) col = int(''.join('1' if c == "R" else '0' for c in line[7:]), 2) return row*8+col print(max(seat_id(line) for line in map(str.rstrip, open('d5.txt'))))
def seat_id(line): row = int(''.join(('0' if c == 'F' else '1' for c in line[:7])), 2) col = int(''.join(('1' if c == 'R' else '0' for c in line[7:])), 2) return row * 8 + col print(max((seat_id(line) for line in map(str.rstrip, open('d5.txt')))))
###OOPS ### Inheritence , Polymorphism, Encapsulation and Abastraction ### Inheritence ##Polymorphism - # print(type("adsad")) # print(type(("adsad", "adfsad"))) # Encapsulation ###Abstction class User: def __init__( self, name, id): self.name = name self.id = id self.account_bala...
class User: def __init__(self, name, id): self.name = name self.id = id self.account_balance = 0 def deposit(self, amount): self.account_balance += amount return self def withdraw(self, amount): self.account_balance -= amount return self def tr...
# Logic # The required solution can be obtained by simply sorting the arrays. After sorting check if the arrays are exactly same or not. # If the arrays are same, it's possible to obtain the desired configuration, otherwise it's impossible. def organizingContainers(container): rows = [sum(x) for x in container] ...
def organizing_containers(container): rows = [sum(x) for x in container] cols = [sum(y) for y in zip(*container)] (rows, cols) = (sorted(rows), sorted(cols)) if all((x == y for (x, y) in zip(rows, cols))): return 'Possible' else: return 'Impossible' if __name__ == '__main__': q =...
""" Problem: https://www.hackerrank.com/challenges/list-comprehensions/problem Max Score: 10 Difficulty: Easy Author: Ric Date: Nov 13, 2019 """ if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) # arr = [] # for i in range (x + 1): # for j i...
""" Problem: https://www.hackerrank.com/challenges/list-comprehensions/problem Max Score: 10 Difficulty: Easy Author: Ric Date: Nov 13, 2019 """ if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) print([[i, j, k] for i in range(x + 1) for j in range(y + 1)...
class AmiRegionMap(dict): def __init__(self, more={}): self['us-east-1'] = {'GENERAL': 'ami-60b6c60a'} self['us-west-1'] = {'GENERAL': 'ami-d5ea86b5'} self['us-west-2'] = {'GENERAL': 'ami-f0091d91'} # TODO: add other regions # 'eu-west-1' # 'eu-central-1' #...
class Amiregionmap(dict): def __init__(self, more={}): self['us-east-1'] = {'GENERAL': 'ami-60b6c60a'} self['us-west-1'] = {'GENERAL': 'ami-d5ea86b5'} self['us-west-2'] = {'GENERAL': 'ami-f0091d91'} self.add_map(more) def add_map(self, ami_map): """Add a set of region =...
numOfChocolates = int(input("How many chocolates do you want: ")) if numOfChocolates <= 10: print("We have enough chocolates for you :D") bill = numOfChocolates * 15 print(f'Your total bill will be {bill} rupees.') elif numOfChocolates > 10: print("We don't have enough chocolates for you D:") else: prin...
num_of_chocolates = int(input('How many chocolates do you want: ')) if numOfChocolates <= 10: print('We have enough chocolates for you :D') bill = numOfChocolates * 15 print(f'Your total bill will be {bill} rupees.') elif numOfChocolates > 10: print("We don't have enough chocolates for you D:") else: ...
# General settings for BGI script tools # Source language slang = 'ja' # Destination languages dlang = ['cn'] # Insertion language ilang = 'cn' # Dump file extension dext = '.txt' # Source encoding senc = 'cp932' # Dump file encoding denc = 'utf-8' # Insertion encoding ienc = 'cp936' # Copy source line to desti...
slang = 'ja' dlang = ['cn'] ilang = 'cn' dext = '.txt' senc = 'cp932' denc = 'utf-8' ienc = 'cp936' dcopy = True
#* Asked in Microsoft #? You are given an array of intervals - that is, an array of tuples (start, end). #? The array may not be sorted, and could contain overlapping intervals. Return another array where the overlapping intervals are merged. #! For example: #! [(1, 3), (5, 8), (4, 10), (20, 25)] #? This input sho...
def merge_sort(arr): if len(arr) <= 1: return arr mid = len(arr) // 2 (left, right) = (merge_sort(arr[:mid]), merge_sort(arr[mid:])) return merge(left, right, arr.copy()) def merge(left, right, merged): (left_cursor, right_cursor) = (0, 0) while left_cursor < len(left) and right_cursor ...
''' The Civil Rights Act of 1964 was one of the most important pieces of legislation ever passed in the USA. Excluding "present" and "abstain" votes, 153 House Democrats and 136 Republicans voted yea. However, 91 Democrats and 35 Republicans voted nay. Did party affiliation make a difference in the vote? To answer thi...
""" The Civil Rights Act of 1964 was one of the most important pieces of legislation ever passed in the USA. Excluding "present" and "abstain" votes, 153 House Democrats and 136 Republicans voted yea. However, 91 Democrats and 35 Republicans voted nay. Did party affiliation make a difference in the vote? To answer thi...
class Solution: def findLonelyPixel(self, k: List[List[str]]) -> int: x=[] a=0 y=[] for i in k: if i.count("B")==0: continue if i.count("B")>1: y+=[i for i, n in enumerate(i) if n == 'B'] continue x.a...
class Solution: def find_lonely_pixel(self, k: List[List[str]]) -> int: x = [] a = 0 y = [] for i in k: if i.count('B') == 0: continue if i.count('B') > 1: y += [i for (i, n) in enumerate(i) if n == 'B'] continu...
list1 = [1,2,3,4] def change_list(mode,number): if mode == 'remove': list1.remove(number) elif mode == 'add' and number in list1: list.append(number) else: print('Vy vveli nevernie dannie') change_list('remove',1) change_list('add',1) print(list1)
list1 = [1, 2, 3, 4] def change_list(mode, number): if mode == 'remove': list1.remove(number) elif mode == 'add' and number in list1: list.append(number) else: print('Vy vveli nevernie dannie') change_list('remove', 1) change_list('add', 1) print(list1)
# first line: 1 @memory.cache def _format_results_to_df(metrics, results, n): # Format into a dataframe # Create the metric names and repeat them n_metrics = len(metrics) index_names = [*metrics.keys()]*n # convert to a dataframe df_res = pd.DataFrame( results, index= ...
@memory.cache def _format_results_to_df(metrics, results, n): n_metrics = len(metrics) index_names = [*metrics.keys()] * n df_res = pd.DataFrame(results, index=pd.MultiIndex.from_tuples(zip(index_names, np.repeat(range(n), n_metrics)))) df_res = df_res.sort_index() return df_res
# vim: set fileencoding=<utf-8> : # Copyright 2020 John Lees '''Visualisation of pathogen population structure''' __version__ = '1.2.2'
"""Visualisation of pathogen population structure""" __version__ = '1.2.2'
# # PySNMP MIB module CISCO-L2-CONTROL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-L2-CONTROL-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:04:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, constraints_union, value_range_constraint) ...
class ValueTransform: r""" Abstract base class for value transforms. See :class:`coax.value_transforms.LogTransform` for a specific implementation. """ __slots__ = ('_transform_func', '_inverse_func') def __init__(self, transform_func, inverse_func): self._transform_func = transform_...
class Valuetransform: """ Abstract base class for value transforms. See :class:`coax.value_transforms.LogTransform` for a specific implementation. """ __slots__ = ('_transform_func', '_inverse_func') def __init__(self, transform_func, inverse_func): self._transform_func = transform_fu...
"""Module in which the constants that are used by Dota Responses Bot are declared.""" __author__ = 'Jonarzz' APP_ID = '' APP_SECRET = '' APP_URI = '' APP_REFRESH_CODE = '' USER_AGENT = """A tool that finds a Dota 2-related comments with the game heroes\' responses and links to the proper audio sample fro...
"""Module in which the constants that are used by Dota Responses Bot are declared.""" __author__ = 'Jonarzz' app_id = '' app_secret = '' app_uri = '' app_refresh_code = '' user_agent = "A tool that finds a Dota 2-related comments with the game heroes' responses and links to the proper\n audio sample from ht...
class Solution: def judgePoint24(self, nums: List[int]) -> bool: def generate(a: float, b: float) -> List[float]: return [a * b, math.inf if b == 0 else a / b, math.inf if a == 0 else b / a, a + b, a - b, b - a] def dfs(nums: List[float]) -> bool: if len(...
class Solution: def judge_point24(self, nums: List[int]) -> bool: def generate(a: float, b: float) -> List[float]: return [a * b, math.inf if b == 0 else a / b, math.inf if a == 0 else b / a, a + b, a - b, b - a] def dfs(nums: List[float]) -> bool: if len(nums) == 1: ...
class SQueue(object): def __init__(self, init_len=8): self.__elem = [0] * init_len self.__len = init_len self.__head = 0 self.__num = 0 def __extend(self): old_len = self.__len self.__len *= 2 new_elems = [0] * self.__len for i in range(old_len): new_elems[i] = self.__elem[(self.__head + i) % old...
class Squeue(object): def __init__(self, init_len=8): self.__elem = [0] * init_len self.__len = init_len self.__head = 0 self.__num = 0 def __extend(self): old_len = self.__len self.__len *= 2 new_elems = [0] * self.__len for i in range(old_len):...
# source: http://www.usb.org/developers/docs/devclass_docs/USB_Video_Class_1_5.zip, 2017-01-08 class SUBCLASS: SC_UNDEFINED = 0x00 SC_VIDEOCONTROL = 0x01 SC_VIDEOSTREAMING = 0x02 SC_VIDEO_INTERFACE_COLLECTION = 0x03 class PROTOCOL: SC_PROTOCOL_UNDEFINED = 0x00 SC_PROTOCOL_15 = 0x01 class D...
class Subclass: sc_undefined = 0 sc_videocontrol = 1 sc_videostreaming = 2 sc_video_interface_collection = 3 class Protocol: sc_protocol_undefined = 0 sc_protocol_15 = 1 class Descriptor_Subtype: vc_descriptor_undefined = 0 vc_header = 1 vc_input_terminal = 2 vc_output_terminal...
## Script (Python) "getInfografia" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title=Retorna a lista infografias pautas = context.portal_vocabularies.getVocabularyByName('PoliticaPublica') return pautas.getVocabularyDict() ...
pautas = context.portal_vocabularies.getVocabularyByName('PoliticaPublica') return pautas.getVocabularyDict()
def roman_to_int(s): dic = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} num = 0 for i in range(len(s)): if i == len(s) - 1: num += dic[s[i]] elif dic[s[i]] >= dic[s[i + 1]]: num += dic[s[i]] else: num -= dic[s[i]] return n...
def roman_to_int(s): dic = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} num = 0 for i in range(len(s)): if i == len(s) - 1: num += dic[s[i]] elif dic[s[i]] >= dic[s[i + 1]]: num += dic[s[i]] else: num -= dic[s[i]] return nu...
def divisor_game(n): i = -1 # even Alice, odd Bob while True: for x in range(1, n): if n % x == 0: n -= x i += 1 break else: if i % 2 == 0: return True return False print(divisor_game(3))
def divisor_game(n): i = -1 while True: for x in range(1, n): if n % x == 0: n -= x i += 1 break else: if i % 2 == 0: return True return False print(divisor_game(3))
class Proveedor: def __init__(self, direccion, telefono, nombre): self.__Direccion = direccion self.__Telefono = telefono self.__Nombre = nombre def getDireccion(self): return self.__Direccion def getTelefono(self): return self.__Telefono def getNombre(self): ...
class Proveedor: def __init__(self, direccion, telefono, nombre): self.__Direccion = direccion self.__Telefono = telefono self.__Nombre = nombre def get_direccion(self): return self.__Direccion def get_telefono(self): return self.__Telefono def get_nombre(self...
class ClassInterfaceAttribute(Attribute, _Attribute): """ Indicates the type of class interface to be generated for a class exposed to COM,if an interface is generated at all. ClassInterfaceAttribute(classInterfaceType: ClassInterfaceType) ClassInterfaceAttribute(classInterfaceType: Int16) """ ...
class Classinterfaceattribute(Attribute, _Attribute): """ Indicates the type of class interface to be generated for a class exposed to COM,if an interface is generated at all. ClassInterfaceAttribute(classInterfaceType: ClassInterfaceType) ClassInterfaceAttribute(classInterfaceType: Int16) """ def __i...
#!/usr/bin/env python3 DICT_PATHS = {} def n_paths(x, y): if (x, y) in DICT_PATHS: return DICT_PATHS[(x, y)] if x == 0 or y == 0: paths = 1 else: paths = n_paths(x - 1, y) + n_paths(x, y - 1) DICT_PATHS[(x, y)] = paths return paths print(n_paths(20, 20))
dict_paths = {} def n_paths(x, y): if (x, y) in DICT_PATHS: return DICT_PATHS[x, y] if x == 0 or y == 0: paths = 1 else: paths = n_paths(x - 1, y) + n_paths(x, y - 1) DICT_PATHS[x, y] = paths return paths print(n_paths(20, 20))
class Config(): def __init__(self): self.TENSORBOARD_DIR = './tensorboard/' self.LEARNING_RATE = 0.1 self.STEP_LR_STEP_SIZE = 1 self.STEP_LR_GAMMA = 0.9 self.BATCH_SIZE = 512 self.NUM_EPOCHS = 30 self.EARLY_STOPPING_PATIENCE = 11 self.EMBEDDINGS_SIZE = 128 # "Attention Is all You Need" PAPE...
class Config: def __init__(self): self.TENSORBOARD_DIR = './tensorboard/' self.LEARNING_RATE = 0.1 self.STEP_LR_STEP_SIZE = 1 self.STEP_LR_GAMMA = 0.9 self.BATCH_SIZE = 512 self.NUM_EPOCHS = 30 self.EARLY_STOPPING_PATIENCE = 11 self.EMBEDDINGS_SIZE = ...
# # PySNMP MIB module CISCO-CDSTV-ISA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CDSTV-ISA-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:53:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ...
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Complementary DNA #Problem level: 7 kyu dna_c = {'A':'T', 'T':'A', 'G':'C', 'C':'G'} def DNA_strand(dna): return ''.join(dna_c[x] for x in dna)
dna_c = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'} def dna_strand(dna): return ''.join((dna_c[x] for x in dna))