content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class OpenAPISchemaError(Exception): """ Custom exception raised when package tests fail. """ pass
class Openapischemaerror(Exception): """ Custom exception raised when package tests fail. """ pass
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # This file is part of ltlf2dfa. # # ltlf2dfa is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later v...
"""Declaration of metadata for the package.""" __title__ = 'ltlf2dfa' __description__ = 'LTLf and PLTLf to Deterministic Finite-state Automata (DFA)' __url__ = 'https://github.com/whitemech/ltlf2dfa.git' __version__ = '1.0.2' __author__ = 'Francesco Fuggitti' __author_email__ = 'fuggitti@diag.uniroma1.it' __license__ =...
# my_script.py # enlarge function def enlarge(n): return n * 100
def enlarge(n): return n * 100
DEFINE = 'define' BEGIN = 'begin' SET = 'set!' LAMBDA = 'lambda' LET = 'let' LET_STAR = 'let*' LET_REC = 'letrec' OPEN_PARANT = '(' CLOSE_PARANT = ')' ADD = '+' SUB = '-' MULT = '*' DIV = '/' DOT = '.' QUOTE = 'quote' QUASIQUOTE = 'quasiquote' UNQUOTE = 'unquote' UNQUOTE_SPLICING = 'unquote-splicing' APPLY = 'apply' IF...
define = 'define' begin = 'begin' set = 'set!' lambda = 'lambda' let = 'let' let_star = 'let*' let_rec = 'letrec' open_parant = '(' close_parant = ')' add = '+' sub = '-' mult = '*' div = '/' dot = '.' quote = 'quote' quasiquote = 'quasiquote' unquote = 'unquote' unquote_splicing = 'unquote-splicing' apply = 'apply' if...
""" System configuration constants """ RANGE_MIN = 1 RANGE_MAX = 100000 ENTRY_SIZE = 3 MAX_INPUT_SIZE = 99 ERROR_MSG_INVALID_FILE_EXTENSION = "The provided file has an invalid format. Only text (.txt) files are accepted." ERROR_MSG_EXCEEDED_MAX_INPUT_SIZE = "Number of entries bigger than the allowed maximum (%d)." %...
""" System configuration constants """ range_min = 1 range_max = 100000 entry_size = 3 max_input_size = 99 error_msg_invalid_file_extension = 'The provided file has an invalid format. Only text (.txt) files are accepted.' error_msg_exceeded_max_input_size = 'Number of entries bigger than the allowed maximum (%d).' % MA...
"""Library for wally. This library provides an API for budgeting. """
"""Library for wally. This library provides an API for budgeting. """
################################### # File Name : compare_identity_analysis.py ################################### #!/usr/bin/python3 def main(): print ("=== compare identity ===") print (999 is 999) x = 999; y = 999; print (x is y) z = 999; print (x is z) print (id(x)) print (id(y)) ...
def main(): print('=== compare identity ===') print(999 is 999) x = 999 y = 999 print(x is y) z = 999 print(x is z) print(id(x)) print(id(y)) print(id(z)) if __name__ == '__main__': main()
# # PySNMP MIB module FASTPATH-PFC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-PFC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:12:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ...
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this # list of condit...
class X86Systemvparametermanager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): esp = self.__emulator.registers['esp'] return self.__emulator.read_memory(esp + 4 * index + 4, 4) def __setitem__(self, index, value): esp = sel...
def find_path(start, end, parents): """ Constructs a path between two vertices, given the parents of all vertices. """ path, parent = [], end while parent != parents[start]: path.append(parent) parent = parents[parent] return path[::-1]
def find_path(start, end, parents): """ Constructs a path between two vertices, given the parents of all vertices. """ (path, parent) = ([], end) while parent != parents[start]: path.append(parent) parent = parents[parent] return path[::-1]
def resolve(): ''' code here ''' num_S, num_c = [int(item) for item in input().split()] delta = num_c - num_S *2 scc = 0 if num_S != 0: if num_c // 2 <= num_S : scc = num_c//2 else: scc = num_S scc += delta//4 else: scc = num_...
def resolve(): """ code here """ (num_s, num_c) = [int(item) for item in input().split()] delta = num_c - num_S * 2 scc = 0 if num_S != 0: if num_c // 2 <= num_S: scc = num_c // 2 else: scc = num_S scc += delta // 4 else: scc = ...
class Template(object): def __init__(self, usages, snippets, blocks): self.usages = usages self.snippets = snippets self.blocks = blocks def accept(self, visitor): visitor.visit_template(self) class Text(object): def __init__(self, text_token): self._token = text...
class Template(object): def __init__(self, usages, snippets, blocks): self.usages = usages self.snippets = snippets self.blocks = blocks def accept(self, visitor): visitor.visit_template(self) class Text(object): def __init__(self, text_token): self._token = text_...
#take user inputs for Item code itemCode = input("Item Code : ") while itemCode != "1" and itemCode != "2" and itemCode != "3": print("Invalid Input!! Try again") itemCode = input("Item Code : ") #take user inputs for quantity quantity = input("Quantity : ") quantity = float(quantity) #take user inputs for c...
item_code = input('Item Code : ') while itemCode != '1' and itemCode != '2' and (itemCode != '3'): print('Invalid Input!! Try again') item_code = input('Item Code : ') quantity = input('Quantity : ') quantity = float(quantity) c_type = input('Customer Type (L / N) : ') while cType != 'L' and cType != 'l' and (c...
"""API operation on tags.""" class TagOperator(object): """Task tag settings.""" def __init__(self, connect): """Initialize instance. Args: connect (rayvision_api.api.connect.Connect): The connect instance. """ self._connect = connect def add_label(self, new...
"""API operation on tags.""" class Tagoperator(object): """Task tag settings.""" def __init__(self, connect): """Initialize instance. Args: connect (rayvision_api.api.connect.Connect): The connect instance. """ self._connect = connect def add_label(self, new_...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Keyword TOKEN_TYPE_IF = 0 TOKEN_TYPE_ELIF = 1 TOKEN_TYPE_ELSE = 2 TOKEN_TYPE_FOR = 3 TOKEN_TYPE_IN = 4 TOKEN_TYPE_WHILE = 5 TOKEN_TYPE_BREAK = 6 TOKEN_TYPE_NOT = 7 TOKEN_TYPE_AND = 8 TOKEN_TYPE_OR = 9 TOKEN_TYPE_RETURN = 10 TOKEN_TYPE_IMPORT = 11 TOKEN_TYPE_FUN = 12 TOK...
token_type_if = 0 token_type_elif = 1 token_type_else = 2 token_type_for = 3 token_type_in = 4 token_type_while = 5 token_type_break = 6 token_type_not = 7 token_type_and = 8 token_type_or = 9 token_type_return = 10 token_type_import = 11 token_type_fun = 12 token_type_class = 13 token_type_let = 14 token_type_global =...
############################################################################### '''''' ############################################################################### # import unittest def testfunc(a, b, c, d=4, # another comment /, e: int = 5, # stuff f=6, ...
"""""" def testfunc(a, b, c, d=4, /, e: int=5, f=6, g=7, h=8, *args, i, j=10, k0=11, k1=110, k2=1100, l=12, m=13, n=14, o=15, fee='fee', fie='fie', foe='foe', fum='fum', boo='boo', p=16, **kwargs): print(a, b, c, d, e, f, g, h, args, i, j, k0, k1, k2, l, m, n, o, p, kwargs)
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: retlisthead, retlistpos = None, None lv: int = 0 while l1 is not N...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: (retlisthead, retlistpos) = (None, None) lv: int = 0 while l1 is not None or l2 is not None: ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]: Len = 0 tmp = root while tmp: Len+=1 ...
class Solution: def split_list_to_parts(self, root: ListNode, k: int) -> List[ListNode]: len = 0 tmp = root while tmp: len += 1 tmp = tmp.next part_len = Len // k remain = Len % k res = [] for _ in range(k): head = list_nod...
T = int(input()) for _ in range(T): s = input() n_1 = 0 for c in s: if c == '1': n_1 += 1 if n_1%2: print('WIN') else: print('LOSE')
t = int(input()) for _ in range(T): s = input() n_1 = 0 for c in s: if c == '1': n_1 += 1 if n_1 % 2: print('WIN') else: print('LOSE')
def obrnut(tekst): return tekst[::-1] def da_li_je_palindrom(tekst): return tekst == obrnut(tekst) nesto = input("Ukucja tekst: ") if(da_li_je_palindrom(nesto)): print("Da, to je palindrom") else: print("Ne to nije palindrom")
def obrnut(tekst): return tekst[::-1] def da_li_je_palindrom(tekst): return tekst == obrnut(tekst) nesto = input('Ukucja tekst: ') if da_li_je_palindrom(nesto): print('Da, to je palindrom') else: print('Ne to nije palindrom')
def arrayPartition(nums): nums.sort() suma=0 for i in range(0,len(nums),2): suma+=min(nums[i],nums[i+1]) return suma nums = [1,4,3,2] print(arrayPartition(nums))
def array_partition(nums): nums.sort() suma = 0 for i in range(0, len(nums), 2): suma += min(nums[i], nums[i + 1]) return suma nums = [1, 4, 3, 2] print(array_partition(nums))
# Write your solution here def spruce(n): row = "*" print("a spruce!") while n > 0: print(" " * (n-1) + row + " " * (n-1)) row += "**" n -= 1 l = int((len(row)-3)/2) print(" " * l + "*" + " " * l) # You can test your function by callil if __name__ == "__main__": spruce(5...
def spruce(n): row = '*' print('a spruce!') while n > 0: print(' ' * (n - 1) + row + ' ' * (n - 1)) row += '**' n -= 1 l = int((len(row) - 3) / 2) print(' ' * l + '*' + ' ' * l) if __name__ == '__main__': spruce(5) spruce(4)
""" Copyright (c) 2021 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ # OSBS2 TBD def get_inspect_for_image(image): # util.get_inspect_for_image(image, registry, insecure=False, dockercfg_path=None) # o...
""" Copyright (c) 2021 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ def get_inspect_for_image(image): return {} def get_image_history(image): return [] def inspect_built_image(): return {} def b...
class Rule_Set: def __init__(self): """Creates a single rule set for IP2 packets based on 10 fields. Args: - self: this index, the one to create. mandatory object reference. Returns: None. """ self.source_IP = {} self.dest_IP = {} ...
class Rule_Set: def __init__(self): """Creates a single rule set for IP2 packets based on 10 fields. Args: - self: this index, the one to create. mandatory object reference. Returns: None. """ self.source_IP = {} self.dest_IP = {} self.sourc...
class Node: def __init__(self,key): self.left = None self.right = None self.val = key def printInorder(root): if root: printInorder(root.left) print(root.val), printInorder(root.right) def printPostorder(root): if root: ...
class Node: def __init__(self, key): self.left = None self.right = None self.val = key def print_inorder(root): if root: print_inorder(root.left) (print(root.val),) print_inorder(root.right) def print_postorder(root): if root: print_postorder(root.l...
"""Example Sudoku problems and solutions.""" # keys of problems that are easy to solve by brute force # used by the tests TEST_KEYS = ['easy1', 'hard1', 'hard2', 'swordfish1'] # ##### Example Sudoku problems # Notes: # 1) 'swordfish1' requires the complicated swordfish manoeuver # http://www.sudokuoftheday.com/p...
"""Example Sudoku problems and solutions.""" test_keys = ['easy1', 'hard1', 'hard2', 'swordfish1'] sudoku_problems = {'easy1': [[0, 0, 3, 7, 0, 0, 0, 5, 0], [0, 7, 0, 0, 5, 0, 8, 0, 0], [1, 0, 0, 0, 0, 6, 0, 0, 4], [5, 0, 2, 0, 0, 0, 0, 0, 0], [8, 0, 0, 9, 0, 4, 0, 0, 6], [0, 0, 0, 0, 0, 0, 9, 0, 2], [3, 0, 0, 5, 0, 0,...
with open("input.txt") as f: p1 = [] f.readline() line = f.readline() while line != "\n": p1.append(int(line.strip())) line = f.readline() f.readline() p2 = [] line = f.readline() while line != "": p2.append(int(line.strip())) line = f.readline() game_his...
with open('input.txt') as f: p1 = [] f.readline() line = f.readline() while line != '\n': p1.append(int(line.strip())) line = f.readline() f.readline() p2 = [] line = f.readline() while line != '': p2.append(int(line.strip())) line = f.readline() game_hist...
nota1 = int(input("escriba la prmera nota de su alumno:")) nota2 = int(input("escriba la segunda nota de su alumno:")) nota3 = int(input("escriba la tercera nota de su alumno:")) nota4 = int(input("escriba la cuarta nota de su alumno:")) media = (nota1 + nota2 + nota3 + nota4) / 4 print(media) sapo = True while sapo ==...
nota1 = int(input('escriba la prmera nota de su alumno:')) nota2 = int(input('escriba la segunda nota de su alumno:')) nota3 = int(input('escriba la tercera nota de su alumno:')) nota4 = int(input('escriba la cuarta nota de su alumno:')) media = (nota1 + nota2 + nota3 + nota4) / 4 print(media) sapo = True while sapo ==...
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return an integer def minDepth(self, root): if root is None: return 0 #...
class Solution: def min_depth(self, root): if root is None: return 0 queue1 = [] queue2 = [] queue1.append(root) queue2.append(1) while queue1: root = queue1.pop(0) depth = queue2.pop(0) if root.left is None and root.ri...
# Python - 3.6.0 Test.describe('Basic tests') Test.assert_equals(sequence_sum(2, 6, 2), 12) Test.assert_equals(sequence_sum(1, 5, 1), 15) Test.assert_equals(sequence_sum(1, 5, 3), 5) Test.assert_equals(sequence_sum(0, 15, 3), 45) Test.assert_equals(sequence_sum(16, 15, 3), 0) Test.assert_equals(sequence_sum(2, 24, 22)...
Test.describe('Basic tests') Test.assert_equals(sequence_sum(2, 6, 2), 12) Test.assert_equals(sequence_sum(1, 5, 1), 15) Test.assert_equals(sequence_sum(1, 5, 3), 5) Test.assert_equals(sequence_sum(0, 15, 3), 45) Test.assert_equals(sequence_sum(16, 15, 3), 0) Test.assert_equals(sequence_sum(2, 24, 22), 26) Test.assert_...
def test_atom_feed(app): app.get("/stream.atom") def test_rss_feed(app): app.get("/stream.rss")
def test_atom_feed(app): app.get('/stream.atom') def test_rss_feed(app): app.get('/stream.rss')
"""Constants for integration_blueprint.""" # Base component constants NAME = "TuneBlade" DOMAIN = "tuneblade" DOMAIN_DATA = f"{DOMAIN}_data" VERSION = "0.0.5" ISSUE_URL = "https://github.com/spycle/tuneblade/issues" # Icons ICON = "mdi:cast-audio-variant" # Device classes MEDIA_PLAYER_DEVICE_CLASS = "speaker" # Plat...
"""Constants for integration_blueprint.""" name = 'TuneBlade' domain = 'tuneblade' domain_data = f'{DOMAIN}_data' version = '0.0.5' issue_url = 'https://github.com/spycle/tuneblade/issues' icon = 'mdi:cast-audio-variant' media_player_device_class = 'speaker' switch = 'switch' media_player = 'media_player' platforms = [...
age = 12 if age < 4: print("Your admission cost is $0.") elif age < 18: print("Your admission cost is $25.") else: print("Your admission cost is $40.") age = 12 if age < 4: price = 0 elif age < 18: price = 25 print(f"Your admission cost is ${price}.") age = 12 if age < 4: price = 0 elif ag...
age = 12 if age < 4: print('Your admission cost is $0.') elif age < 18: print('Your admission cost is $25.') else: print('Your admission cost is $40.') age = 12 if age < 4: price = 0 elif age < 18: price = 25 print(f'Your admission cost is ${price}.') age = 12 if age < 4: price = 0 elif age < 18...
class Updated: def __init__(self, payload): self.tiers_added = payload['tiersAdded'] self.orb_count_diff = payload['orbCountDiff'] self.inventory_updates = payload['inventoryUpdates']
class Updated: def __init__(self, payload): self.tiers_added = payload['tiersAdded'] self.orb_count_diff = payload['orbCountDiff'] self.inventory_updates = payload['inventoryUpdates']
#2XX Success SUCESS_OK = 200 #4XX Error ERROR_BAD_REQUEST = 400 ERROR_UNAUTHORIZED = 401 ERROR_FORBIDDEN = 403 ERROR_NOT_FOUND = 404 #5xx ERROR_SERVER = 500
sucess_ok = 200 error_bad_request = 400 error_unauthorized = 401 error_forbidden = 403 error_not_found = 404 error_server = 500
s1 = "xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz" s2 = "xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb" # take 2 strings s1 and s2 including only letters from ato z. # Return a new sorted string, the longest possible, containing distinct letters def longest(s1, s2)...
s1 = 'xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz' s2 = 'xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb' def longest(s1, s2): s = sorted(set(s1 + s2)) return s
def fc(claim, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim) def fdlc(claim): return fc(claim, s='dl') def scope(scope, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(su...
def fc(claim, s=None): suffix = '-' + s if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim) def fdlc(claim): return fc(claim, s='dl') def scope(scope, s=None): suffix = '-' + s if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(su...
# Given a string, use recursion to output a list of all the possible permutations of a string # If a character is repeated, treat all versions as distinct # Itertools does permutations def permute(s): out = [] # Base case is when there is only one letter if len(s) < 2: out = [s] else: # For every let...
def permute(s): out = [] if len(s) < 2: out = [s] else: for (i, letter) in enumerate(s): for perm in permute(s[:i] + s[i + 1:]): out += [let + perm] return out s = 'abc' print(permute(s))
# from https://github.com/peteboyd/lammps_interface.git ATOMIC_MASSES = { "H": 1.00794, "He": 4.002602, "Li": 6.941, "Be": 9.012182, "B": 10.811, "C": 12.0107, "N": 14.0067, "O": 15.9994, "F": 18.9984032, "Ne": 20.1797, "Na": 22.98976928, "Mg": 24.3050, "Al": 26.9815...
atomic_masses = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B': 10.811, 'C': 12.0107, 'N': 14.0067, 'O': 15.9994, 'F': 18.9984032, 'Ne': 20.1797, 'Na': 22.98976928, 'Mg': 24.305, 'Al': 26.9815386, 'Si': 28.0855, 'P': 30.973762, 'S': 32.065, 'Cl': 35.453, 'Ar': 39.948, 'K': 39.0983, 'Ca': 40.078, 'Sc': ...
# # pkpgcounter : a generic Page Description Language parser # # (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet <alet@librelogiciel.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either vers...
"""This modules defines some important constants used in this software.""" __version__ = '3.50' __doc__ = 'pkpgcounter : a generic Page Description Languages parser.' __author__ = 'Jerome Alet' __authoremail__ = 'alet@librelogiciel.com' __years__ = '2003, 2004, 2005, 2006, 2007' __gplblurb__ = 'This program is free sof...
""" Entradas --- Salidas: todos los numeros enteros impares menores que 100, sin contar multiplos de 7 Numeros --> int --> A """ # Caja negra A = 1 for i in range(50): if (A%7) != 0: print(A) # Salida A += 2 else: A += 2
""" Entradas --- Salidas: todos los numeros enteros impares menores que 100, sin contar multiplos de 7 Numeros --> int --> A """ a = 1 for i in range(50): if A % 7 != 0: print(A) a += 2 else: a += 2
def func(): print('func') def func2(): print('func2') def func3(): print('func3') __all__ = ['func2', 'func3']
def func(): print('func') def func2(): print('func2') def func3(): print('func3') __all__ = ['func2', 'func3']
class BaseArray(Element, IDisposable): """ An abstract base class that represents an array within the Revit project. """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def getBoundingBox(self, *args): """ getBoundingBox(self: Element,view: View) -> Boundin...
class Basearray(Element, IDisposable): """ An abstract base class that represents an array within the Revit project. """ def dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def get_bounding_box(self, *args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXY...
""" Q701 Insert into a Binary Search Tree Medium Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST. Note that there may e...
""" Q701 Insert into a Binary Search Tree Medium Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST. Note that there may e...
__all__ = ('func', 'C') def func(): pass class C: pass
__all__ = ('func', 'C') def func(): pass class C: pass
DBPEDIA_URI = "http://dbpedia.org/sparql" # dsbox02.isi.edu # ELASTICSEARCH_URI "http://kg2018a.isi.edu:9200/my_wiki_content_first/_search" # SPARQL_URI = "http://dsbox02.isi.edu:8888/bigdata/namespace/wdq/sparql" # IDENTIFIER_WIKIFIER = "http://minds03.isi.edu:4444/get_properties" # DataMachines Nov 2019 ELASTICSEA...
dbpedia_uri = 'http://dbpedia.org/sparql' elasticsearch_uri = 'http://10.108.20.4:9200/my_wiki_content_first/_search' sparql_uri = 'http://10.108.20.4:9966/bigdata/namespace/wdq/sparql' identifier_wikifier = 'http://10.108.20.4:9000/get_properties'
""" Python Fundamentals 2 @author: Balint Szoke @date: 2/11/2017 """ """--------------------------------------------------- REVIEW ---------------------------------------------------""" # Assignment x = 3.14 # Strings s = 'this is a string' type(s) len(s) # Lists l = [1,...
""" Python Fundamentals 2 @author: Balint Szoke @date: 2/11/2017 """ '---------------------------------------------------\nREVIEW\n---------------------------------------------------' x = 3.14 s = 'this is a string' type(s) len(s) l = [1, 'help', 12.14] print('This is a', type(l), 'containing', len(l), 'items') 's i...
class Config(object): c_dim = 5 c2_dim = 8 celeba_crop_size = 178 rafd_crop_size = 256 image_size = 128 g_conv_dim = 64 d_conv_dim = 64 g_repeat_num = 6 d_repeat_num = 6 lambda_cls = 1 lambda_rec = 10 lambda_gp = 10 dataset = 'CelebA' batch_size = 16 num_iter...
class Config(object): c_dim = 5 c2_dim = 8 celeba_crop_size = 178 rafd_crop_size = 256 image_size = 128 g_conv_dim = 64 d_conv_dim = 64 g_repeat_num = 6 d_repeat_num = 6 lambda_cls = 1 lambda_rec = 10 lambda_gp = 10 dataset = 'CelebA' batch_size = 16 num_iters...
""" This package contains exceptions that may be raised by the CHARMM components of the OpenMM Application layer This file is part of the OpenMM molecular simulation toolkit originating from Simbios, the NIH National Center for Physics-Based Simulation of Biological Structures at Stanford, funded under the NIH Roadmap...
""" This package contains exceptions that may be raised by the CHARMM components of the OpenMM Application layer This file is part of the OpenMM molecular simulation toolkit originating from Simbios, the NIH National Center for Physics-Based Simulation of Biological Structures at Stanford, funded under the NIH Roadmap...
li = input().split() dicti={} for i in li: if i not in dicti: dicti[i]=1 else: print(i)
li = input().split() dicti = {} for i in li: if i not in dicti: dicti[i] = 1 else: print(i)
formatter = "{} {} {} {}" #this gives 4 empty slots in the formatter variable print(formatter.format(1, 2, 3, 4)) #this fill the slots with 1234 print(formatter.format("one", "two", "three", "four")) #this fills the slots with one two three four print(formatter.format(True, False, False, True)) #this fills the slots w...
formatter = '{} {} {} {}' print(formatter.format(1, 2, 3, 4)) print(formatter.format('one', 'two', 'three', 'four')) print(formatter.format(True, False, False, True)) print(formatter.format(formatter, formatter, formatter, formatter)) print(formatter.format('Try your', 'Own text here', 'Maybe a poem', 'Or a song about ...
class LavadoraFacade(object): def lavar(self): self._lavar = Lavar() self._lavar.subsistema_operation() def enjuagar(self): self._enjuagar = Enjuagar() self._enjuagar.subsistema_operation() def centrifugado(self): self._centrifugado = Centrifugado() self._cent...
class Lavadorafacade(object): def lavar(self): self._lavar = lavar() self._lavar.subsistema_operation() def enjuagar(self): self._enjuagar = enjuagar() self._enjuagar.subsistema_operation() def centrifugado(self): self._centrifugado = centrifugado() self._c...
#Given an array of integers, find and print the maximum number of integers you #can select from the array such that the absolute difference between any two of #the chosen integers is less than or equal to . For example, if your array is , #you can create two subarrays meeting the criterion: and . The maxim...
list = input().split() list = [int(i) for i in list] list.sort() print(list) def picking_numbers(list): maximum = [] maxim = 0 while len(list) > 1: if len(list) != 0: a = max(list) count_max = list.count(A) for j in range(count_max): list.remove(m...
# Python lists can be used as Arrays in Python # Creating an array things = ['pen', 'car', 'books'] print(things) # accessing the array element print(things[0]) # prints the first element of the array things # modifying the value of the array element things[1] = 'pencil' # second element of things, gets changed to ...
things = ['pen', 'car', 'books'] print(things) print(things[0]) things[1] = 'pencil' print(things[1]) length = len(things) print(length) for a in things: print(a) for i in range(len(things)): print(things[i])
def isDivisibleBy(int, divisor): return int % divisor == 0; def doFizzBuzz(): for i in range(1, 101): isDivisibleByThree = isDivisibleBy(i, 3) isDivisibleByFive = isDivisibleBy(i, 5) if (isDivisibleByThree and isDivisibleByFive): print('fizzbuzz') elif isDivisibleByThree: print('fizz') elif isD...
def is_divisible_by(int, divisor): return int % divisor == 0 def do_fizz_buzz(): for i in range(1, 101): is_divisible_by_three = is_divisible_by(i, 3) is_divisible_by_five = is_divisible_by(i, 5) if isDivisibleByThree and isDivisibleByFive: print('fizzbuzz') elif isD...
# -*- coding: utf-8 -*- """ Created on Thu Nov 21 15:38:43 2019 @author: Mijael """ vnclass_dict = { 'stop-55.4': ['causer', 'theme', 'location'], 'masquerade-29.6': ['agent', 'attribute', 'location'], 'masquerade-29.6-1': ['agent', 'attribute', 'location'], 'masquerade-29.6-2': ...
""" Created on Thu Nov 21 15:38:43 2019 @author: Mijael """ vnclass_dict = {'stop-55.4': ['causer', 'theme', 'location'], 'masquerade-29.6': ['agent', 'attribute', 'location'], 'masquerade-29.6-1': ['agent', 'attribute', 'location'], 'masquerade-29.6-2': ['agent', 'attribute', 'location'], 'captain-29.8': ['agent', 'b...
__all__ = ["analyze_traffic", "utils", "manage_resolutions", "url_regex_resolver", "get_popular_urls", "funnel_in_outs", "funnel_stats", "sankey_funnel", "frequent_funnel", "analyze_clicks", "analyze_timing"]
__all__ = ['analyze_traffic', 'utils', 'manage_resolutions', 'url_regex_resolver', 'get_popular_urls', 'funnel_in_outs', 'funnel_stats', 'sankey_funnel', 'frequent_funnel', 'analyze_clicks', 'analyze_timing']
# # PySNMP MIB module CISCO-FCIP-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FCIP-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:41:05 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') (constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ...
class unionFindSet: def __init__(self, S): self.S = {i: i for i in S} self.size = {i: 1 for i in S} def find(self, x): if x != self.S[x]: self.S[x] = self.find(self.S[x]) return self.S[x] def union(self, a, b, key=lambda x: x): x, y = sorted((self.find(a...
class Unionfindset: def __init__(self, S): self.S = {i: i for i in S} self.size = {i: 1 for i in S} def find(self, x): if x != self.S[x]: self.S[x] = self.find(self.S[x]) return self.S[x] def union(self, a, b, key=lambda x: x): (x, y) = sorted((self.fin...
""" ---For Bolinger Trade Strategy--- 1. Goes to Tick Data in cassandra and check if we will get a fill on Mid level value or Not 2. If Yes then returns TRUE else returns FALSE """ def check_data(product,time_start,time_end,date1,session,mid_price,side): query_fet...
""" ---For Bolinger Trade Strategy--- 1. Goes to Tick Data in cassandra and check if we will get a fill on Mid level value or Not 2. If Yes then returns TRUE else returns FALSE """ def check_data(product, time_start, time_end, date1, session, mid_price, side): query_fet...
# -*- coding: utf-8 -*- """ Created on Tue Apr 9 15:15:50 2020 @author: Patrick """ """Implementation of Fast Orthogonal Search""" #============================================== #candidates_generation.py #============================================== def CandidatePool_Generation(x_train, y_train, K, L): Candid...
""" Created on Tue Apr 9 15:15:50 2020 @author: Patrick """ 'Implementation of Fast Orthogonal Search' def candidate_pool__generation(x_train, y_train, K, L): candidates = [] for l in range(0, L + 1): zero_list = l * [0] data_list = x_train[:len(x_train) - l] xn_l = [*zero_list, *data_l...
""" This package includes the internal APIs for PySpark about interoperability between pandas, PySpark and PyArrow. This package should not be directly imported and used. """
""" This package includes the internal APIs for PySpark about interoperability between pandas, PySpark and PyArrow. This package should not be directly imported and used. """
class Solution: def combine(self, n, k): """ :type n: int :type k: int :rtype: List[List[int]] """ ret = [] curr = [] def generate(curr_pos): if len(curr) == k: ret.append(curr[:]) else: for i in...
class Solution: def combine(self, n, k): """ :type n: int :type k: int :rtype: List[List[int]] """ ret = [] curr = [] def generate(curr_pos): if len(curr) == k: ret.append(curr[:]) else: for i i...
registered = False api_key = None environment = None log_404 = False log_403 = False log_405 = False use_ssl = False
registered = False api_key = None environment = None log_404 = False log_403 = False log_405 = False use_ssl = False
pytest_plugins = [ "polygon.tests.fixtures", "polygon.plugins.tests.fixtures", "polygon.graphql.tests.fixtures", ]
pytest_plugins = ['polygon.tests.fixtures', 'polygon.plugins.tests.fixtures', 'polygon.graphql.tests.fixtures']
ry = 0 def setup(): size(800, 800, P3D) global obj, texture1 texture1 = loadImage("texture.jpg") obj = loadShape("man.obj") def draw(): global ry background(0) lights() translate(width / 2, height / 2 + 200, -200) rotateZ(PI) rotateY(ry) scale(25) # Orange point ...
ry = 0 def setup(): size(800, 800, P3D) global obj, texture1 texture1 = load_image('texture.jpg') obj = load_shape('man.obj') def draw(): global ry background(0) lights() translate(width / 2, height / 2 + 200, -200) rotate_z(PI) rotate_y(ry) scale(25) point_light(150, 1...
"""***************************************************************************** * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
"""***************************************************************************** * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
def ft_filter(function_to_apply, list_of_inputs): for elem in list_of_inputs: res = function_to_apply(elem) if res is True: yield elem
def ft_filter(function_to_apply, list_of_inputs): for elem in list_of_inputs: res = function_to_apply(elem) if res is True: yield elem
STX: bytes = b"\x02" # Start of text, indicates the start of a message. ETX: bytes = b"\x03" # End of text, indicates the end of a message ENQ: bytes = b"\x05" # Enquiry about the PC interface being ready to receive a new message. ACK: bytes = b"\x06" # Positive acknowledgement to a PMS message or enquiry (ENQ). NA...
stx: bytes = b'\x02' etx: bytes = b'\x03' enq: bytes = b'\x05' ack: bytes = b'\x06' nak: bytes = b'\x15' lrc_skip: bytes = b'\r' def lrc(message: bytes) -> bytes: result = 0 for b in message + ETX: result ^= b return bytes([result])
class Interval: def __init__(self, start, end): if start < end: self.start = start self.end = end else: self.start = end self.end = start def overlap(self, other): if self.start > other.start and self.start < other.end: return ...
class Interval: def __init__(self, start, end): if start < end: self.start = start self.end = end else: self.start = end self.end = start def overlap(self, other): if self.start > other.start and self.start < other.end: return...
# create a loop counter = 10 while counter > 0: print(counter) counter = counter -1 print('Blastoff!!')
counter = 10 while counter > 0: print(counter) counter = counter - 1 print('Blastoff!!')
"""Providers for interop between JS rules. This file has to live in the built-in so that all rules can load() the providers even if users haven't installed any of the packages/* These providers allows rules to interoperate without knowledge of each other. You can think of a provider as a message bus. A rule "publish...
"""Providers for interop between JS rules. This file has to live in the built-in so that all rules can load() the providers even if users haven't installed any of the packages/* These providers allows rules to interoperate without knowledge of each other. You can think of a provider as a message bus. A rule "publish...
# Hacer un programa que pida un caracter e indique si es una boca o no caracter = input("Digite un caracter: ").lower()# para mayusculas #caracter = caracter.lower() #caracter = caracter.upper() if caracter =="a" or caracter =="b" or caracter =="c" or caracter =="d" or caracter =="e": print("Es Una vocal") else: p...
caracter = input('Digite un caracter: ').lower() if caracter == 'a' or caracter == 'b' or caracter == 'c' or (caracter == 'd') or (caracter == 'e'): print('Es Una vocal') else: print('No es una vocal')
grocery_list = ["fish", "tomato", "apples"] # Create new list print("tomato" in grocery_list) # Check that grocery_list contains "tomato" item grocery_dict = {"fish": 1, "tomato": 6, "apples": 3} # create new dictionary print("fish" in grocery_dict)
grocery_list = ['fish', 'tomato', 'apples'] print('tomato' in grocery_list) grocery_dict = {'fish': 1, 'tomato': 6, 'apples': 3} print('fish' in grocery_dict)
def _impl(ctx): args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks] args_file = ctx.actions.declare_file(ctx.label.name + ".args") ctx.actions.write( output = args_file, content = "\n".join(args), ) ctx.actions.run( mnemonic = "Concat", inputs = ctx.f...
def _impl(ctx): args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks] args_file = ctx.actions.declare_file(ctx.label.name + '.args') ctx.actions.write(output=args_file, content='\n'.join(args)) ctx.actions.run(mnemonic='Concat', inputs=ctx.files.chunks + [args_file], outputs=[ctx.outputs.ou...
k = int(input()) r = list(map(int, input().split())) p = set(r) # stores the sum of all unique elements x total no of groups a = sum(p)*k # stores the sum of element in the list b = sum(r) # (a - b) = (k - 1)*captains_room_no # prints the the difference of a and b divided by k-1 print((a-b)//(k-1))
k = int(input()) r = list(map(int, input().split())) p = set(r) a = sum(p) * k b = sum(r) print((a - b) // (k - 1))
""" Tema: Herencia. Curso: Curso de python, video 31. Plataforma: Youtube. Profesor: Juan diaz - Pildoras informaticas. Alumno: @edinsonrequena. """ class Vehiculo: def __init__(self, marca, modelo): self.marca = marca self.modelo = modelo self.enmarcha = False self.acelera = Fa...
""" Tema: Herencia. Curso: Curso de python, video 31. Plataforma: Youtube. Profesor: Juan diaz - Pildoras informaticas. Alumno: @edinsonrequena. """ class Vehiculo: def __init__(self, marca, modelo): self.marca = marca self.modelo = modelo self.enmarcha = False self.acelera = Fal...
def swap(arr, i, j): temp = arr[i] arr[i] = arr[j] arr[j] = temp def selectionSort(arr): for i in range(len(arr)): smallest = arr[i] for j in range(i+1, len(arr)): print(i) if smallest > arr[j]: print(f"replacing {j} th position with {i}th pos...
def swap(arr, i, j): temp = arr[i] arr[i] = arr[j] arr[j] = temp def selection_sort(arr): for i in range(len(arr)): smallest = arr[i] for j in range(i + 1, len(arr)): print(i) if smallest > arr[j]: print(f'replacing {j} th position with {i}th posi...
with open('input.txt', 'r') as reader: input = [line for line in reader.read().splitlines()] def part1(numbers): length = len(numbers[0]) sums = [0] * length for number in numbers: for i in range(length): sums[i] += int(number[i]) gamma = [1 if v > len(numbers) / 2 else 0 for v i...
with open('input.txt', 'r') as reader: input = [line for line in reader.read().splitlines()] def part1(numbers): length = len(numbers[0]) sums = [0] * length for number in numbers: for i in range(length): sums[i] += int(number[i]) gamma = [1 if v > len(numbers) / 2 else 0 for v ...
class Solution(object): def isPowerOfThree(self, n): """ :type n: int :rtype: bool """ left, right = 0, 19 while left <= right: mid = left + (right - left) / 2 if 3 ** mid == n: return True elif 3 ** mid > n: ...
class Solution(object): def is_power_of_three(self, n): """ :type n: int :rtype: bool """ (left, right) = (0, 19) while left <= right: mid = left + (right - left) / 2 if 3 ** mid == n: return True elif 3 ** mid > n:...
"""Top-level package for QBOB.""" __author__ = """Guen Prawiroatmodjo""" __email__ = 'guenp@microsoft.com' __version__ = '0.1.0'
"""Top-level package for QBOB.""" __author__ = 'Guen Prawiroatmodjo' __email__ = 'guenp@microsoft.com' __version__ = '0.1.0'
def sieve(n): checkArray = [1] * (n+1) checkArray[0] = 0 checkArray[1] = 0 for i in range(2,n+1): j = i + i step = j + i for j in range(j,n+1,i): checkArray[j] = 0 for i in range(0,n+1): if checkArray[i] != 0: print(i) if __name__ == "__main__": n = int(input()) sieve(n)
def sieve(n): check_array = [1] * (n + 1) checkArray[0] = 0 checkArray[1] = 0 for i in range(2, n + 1): j = i + i step = j + i for j in range(j, n + 1, i): checkArray[j] = 0 for i in range(0, n + 1): if checkArray[i] != 0: print(i) if __name__ ...
"""Different environment settings.""" # TODO: Add correct objects LOCATION_TYPE_MAP = { "floor": {"color": "gray", "gray_color": "gray", "mesh": ":/objects/floor.obj",}, "rack": {"color": "#62ca5f", "gray_color": "gray", "mesh": ":/objects/rack.obj",}, "wall": {"color": "black", "gray_color": "black", "mes...
"""Different environment settings.""" location_type_map = {'floor': {'color': 'gray', 'gray_color': 'gray', 'mesh': ':/objects/floor.obj'}, 'rack': {'color': '#62ca5f', 'gray_color': 'gray', 'mesh': ':/objects/rack.obj'}, 'wall': {'color': 'black', 'gray_color': 'black', 'mesh': ':/objects/floor.obj'}, 'inbound_door': ...
#Printing 'reverse Pyramid Shape ! ''' * * * * * * * * * * * * * * * ''' n=int(input()) for i in range(n,0,-1): #for rows for j in range(0,n-i): # for space print(end=' ') for j in range(0,i): # creating star print("*",end=' ') print() #other method n=int(input()) for i in range(n,...
""" * * * * * * * * * * * * * * * """ n = int(input()) for i in range(n, 0, -1): for j in range(0, n - i): print(end=' ') for j in range(0, i): print('*', end=' ') print() n = int(input()) for i in range(n, 0, -1): print(' ' * (n - i) + '* ' * i)
class StepParseError(Exception): pass class RatDisconnectedError(Exception): pass class InvalidTimeoutExceptionError(Exception): pass class RatCallbackTimeoutError(Exception): pass class MissingFileError(Exception): pass
class Stepparseerror(Exception): pass class Ratdisconnectederror(Exception): pass class Invalidtimeoutexceptionerror(Exception): pass class Ratcallbacktimeouterror(Exception): pass class Missingfileerror(Exception): pass
def max_of_maximums(dTEmax, dsRNAmax): print('Finding max of maximums') dmax = {} for i in list(dTEmax.keys()): for j in list(dsRNAmax.keys()): try: dTEmax[j] except: dmax[j] = dsRNAmax[j] else: dmax[j] = max(dTEmax[...
def max_of_maximums(dTEmax, dsRNAmax): print('Finding max of maximums') dmax = {} for i in list(dTEmax.keys()): for j in list(dsRNAmax.keys()): try: dTEmax[j] except: dmax[j] = dsRNAmax[j] else: dmax[j] = max(dTEmax[...
# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. # See LICENSE in the project root for license information. # Client ID and secret. client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84' client_secret = '7CmTo1brGWMmh5RoFiTdO0n'
client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84' client_secret = '7CmTo1brGWMmh5RoFiTdO0n'
registry = { "centivize_service": { "grpc": 7003, }, }
registry = {'centivize_service': {'grpc': 7003}}
''' additional_datastructures.py: File containing custom utility data structures for use in simple_rl. ''' class SimpleRLStack(object): ''' Implementation for a basic Stack data structure ''' def __init__(self, _list=None): ''' Args: _list (list) : underlying elements in the stack ...
""" additional_datastructures.py: File containing custom utility data structures for use in simple_rl. """ class Simplerlstack(object): """ Implementation for a basic Stack data structure """ def __init__(self, _list=None): """ Args: _list (list) : underlying elements in the stack ...
# RUN: llvmPy %s > %t1 # RUN: cat -n %t1 >&2 # RUN: cat %t1 | FileCheck %s print(1 * 2) # CHECK: 2 print(2 * 2) # CHECK-NEXT: 4 print(0 * 2) # CHECK-NEXT: 0
print(1 * 2) print(2 * 2) print(0 * 2)
# 1st solution class Solution: def nthMagicalNumber(self, n: int, a: int, b: int) -> int: g = self.gcd(a, b) largest = a // g * b lst = [] numOne, numTwo = a, b while numOne <= largest and numTwo <= largest: if numOne < numTwo: lst.append(numOne) ...
class Solution: def nth_magical_number(self, n: int, a: int, b: int) -> int: g = self.gcd(a, b) largest = a // g * b lst = [] (num_one, num_two) = (a, b) while numOne <= largest and numTwo <= largest: if numOne < numTwo: lst.append(numOne) ...
class Stopper: """Base class for implementing a Tune experiment stopper. Allows users to implement experiment-level stopping via ``stop_all``. By default, this class does not stop any trials. Subclasses need to implement ``__call__`` and ``stop_all``. .. code-block:: python import time ...
class Stopper: """Base class for implementing a Tune experiment stopper. Allows users to implement experiment-level stopping via ``stop_all``. By default, this class does not stop any trials. Subclasses need to implement ``__call__`` and ``stop_all``. .. code-block:: python import time ...
def old_exponent(n, k): """ n is base, k is exponent """ answer = 1 for i in range(k): answer *= n print(answer) def newExponent(n, k): """ n is base, k is exponent """ print("newExponent({0}, {1})".format(n, k)) if k == 1: return n elif k == 0: return 1 left = int(k/2) right = k - left return new...
def old_exponent(n, k): """ n is base, k is exponent """ answer = 1 for i in range(k): answer *= n print(answer) def new_exponent(n, k): """ n is base, k is exponent """ print('newExponent({0}, {1})'.format(n, k)) if k == 1: return n elif k == 0: return 1 ...
#default parameters #you can make default parameter(last_name= 'unknown') in last like after age #if we make all parameters defalut than ouput is unknowndef user_info(first_name='unknown', last_name= 'unknown',age = None) # None is used for numbers #'unknown' is used for string def user_info(first_name, last_name,age)...
def user_info(first_name, last_name, age): print(f'Your First name is: {first_name} ') print(f'Your last name is: {last_name} ') print(f'Your age is: {age} ') user_info('Beenash', 'Pervaiz', 20)
''' Calculate an optimized configuration based on overall memory, cpu, and sensible defaults. Will configure spark and yarn. The formula will be run on 5 node t2.large cluster hosted in AWS. t2.large nodes have 2 vcpus, and 8gb of memory each. 4 nodes are designed as yarn node managers. The formula will run with defa...
""" Calculate an optimized configuration based on overall memory, cpu, and sensible defaults. Will configure spark and yarn. The formula will be run on 5 node t2.large cluster hosted in AWS. t2.large nodes have 2 vcpus, and 8gb of memory each. 4 nodes are designed as yarn node managers. The formula will run with defa...
def total(lists): array = [] sum = 0 for i in lists: sum += i array.append(sum) return array listss = [1,2,3,5,5,4] print(total(listss))
def total(lists): array = [] sum = 0 for i in lists: sum += i array.append(sum) return array listss = [1, 2, 3, 5, 5, 4] print(total(listss))
description = 'Setup for the ma11 dom motor' devices = dict( dom = device('nicos_ess.devices.epics.motor.EpicsMotor', description = 'Sample stick rotation', motorpv = 'SQ:SANS:ma11:dom', errormsgpv = 'SQ:SANS:ma11:dom-MsgTxt', precision = 0.1, ), )
description = 'Setup for the ma11 dom motor' devices = dict(dom=device('nicos_ess.devices.epics.motor.EpicsMotor', description='Sample stick rotation', motorpv='SQ:SANS:ma11:dom', errormsgpv='SQ:SANS:ma11:dom-MsgTxt', precision=0.1))
with open("input.txt", "r") as f: values = [int(e) for e in f.readlines()] windowsSum = list() index = 0 for value in values: if(index+2 < len(values)): sum = value sum += values[index+1] sum += values[index+2] windowsSum.append(sum) index...
with open('input.txt', 'r') as f: values = [int(e) for e in f.readlines()] windows_sum = list() index = 0 for value in values: if index + 2 < len(values): sum = value sum += values[index + 1] sum += values[index + 2] windowsSum.append(sum) ...
TOKEN = "<Your Bot Token Here>" LOG_LEVEL_STDOUT = "DEBUG" # Console log level LOG_LEVEL_FILE = "INFO" # File log level
token = '<Your Bot Token Here>' log_level_stdout = 'DEBUG' log_level_file = 'INFO'
# Bus Routes # each routes[i] is a bus route that the i-th bus repeats forever # we start at bus stop S and we want to go to bus stop T # rravelling by buses only, find the least number of buses to take class Solution(object): def numBusesToDestination(self, routes, S, T): """ :type routes: List[Lis...
class Solution(object): def num_buses_to_destination(self, routes, S, T): """ :type routes: List[List[int]] :type S: int :type T: int :rtype: int """ stop_to_routes = collections.defaultdict(set) for (i, route) in enumerate(routes): for st...