content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def shortest_path(sx, sy, maze): w = len(maze[0]) h = len(maze) board = [[None for i in range(w)] for i in range(h)] board[sx][sy] = 1 arr = [(sx, sy)] while arr: x, y = arr.pop(0) for i in [[1, 0], [-1, 0], [0, -1], [0, 1]]: nx, ny = x + i[0], y + i[1] ...
def shortest_path(sx, sy, maze): w = len(maze[0]) h = len(maze) board = [[None for i in range(w)] for i in range(h)] board[sx][sy] = 1 arr = [(sx, sy)] while arr: (x, y) = arr.pop(0) for i in [[1, 0], [-1, 0], [0, -1], [0, 1]]: (nx, ny) = (x + i[0], y + i[1]) ...
# ----------------------------------------------------------------------------- # Copyright (c) 2013-2022, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is in the file COPYING.tx...
excludedimports = ['pytest']
def bytes(b): """ Print bytes in a humanized way """ def humanize(b, base, suffices=[]): bb = int(b) for suffix in suffices: if bb < base: break bb /= float(base) return "%.2f %s" % (bb, suffix) print("Base 1024: ", humanize( b, 1024, ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB',...
def bytes(b): """ Print bytes in a humanized way """ def humanize(b, base, suffices=[]): bb = int(b) for suffix in suffices: if bb < base: break bb /= float(base) return '%.2f %s' % (bb, suffix) print('Base 1024: ', humanize(b, 1024, ['B', 'Ki...
""" Merge Sort Algorithm: Divide and Conquer Algorithm""" """Implementation: Merging two sorted arrays""" def merge_sort(arr1, arr2): n1 = len(arr1) n2 = len(arr2) index1, index2 = 0, 0 while index1 < n1 and index2 < n2: if arr1[index1] <= arr2[index2]: print(arr1[index1], end=" ...
""" Merge Sort Algorithm: Divide and Conquer Algorithm""" 'Implementation: Merging two sorted arrays' def merge_sort(arr1, arr2): n1 = len(arr1) n2 = len(arr2) (index1, index2) = (0, 0) while index1 < n1 and index2 < n2: if arr1[index1] <= arr2[index2]: print(arr1[index1], end=' ') ...
#!/usr/bin/env python """ generated source for module Mapping """ class Mapping(object): """ generated source for class Mapping """ key = [] def __init__(self): """ generated source for method __init__ """ self.key = ["#"]*26 @classmethod def fromTranslation(self, cipher, translati...
""" generated source for module Mapping """ class Mapping(object): """ generated source for class Mapping """ key = [] def __init__(self): """ generated source for method __init__ """ self.key = ['#'] * 26 @classmethod def from_translation(self, cipher, translation): """ g...
# 1 # Answer: Programming language # 2 # Answer: B # 3 print("Hi") # 4 # Answer: quit() # 5 # Answer: 6 # 6 # Answer: B # 7 # Answer: - 10 + # 8 # Answer: >>> 1 / 0 # 9 # Answer: A # 10 # Answer: 15.0 # 11 # Answer: 3 # 12 # Answer: A # 13 # Answer: \"something\" # 14 # Answer: input # 15 # Answer: "World...
print('Hi')
#!/usr/bin/env python3 # vim: set fileencoding=utf-8 fileformat=unix expandtab : """__setup__.py -- metadata for xdwlib, A DocuWorks library for Python. Copyright (C) 2010 HAYASHI Hideki <hideki@hayasix.com> All rights reserved. This software is subject to the provisions of the Zope Public License, Version 2.1 (ZPL...
"""__setup__.py -- metadata for xdwlib, A DocuWorks library for Python. Copyright (C) 2010 HAYASHI Hideki <hideki@hayasix.com> All rights reserved. This software is subject to the provisions of the Zope Public License, Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. THIS SOFTWARE IS PROVIDED...
#!/usr/bin/env python NAME = 'BIG-IP Local Traffic Manager (F5 Networks)' def is_waf(self): if self.matchcookie(r'^BIGipServer'): return True elif self.matchheader(('X-Cnection', r'^close$'), attack=True): return True else: return False
name = 'BIG-IP Local Traffic Manager (F5 Networks)' def is_waf(self): if self.matchcookie('^BIGipServer'): return True elif self.matchheader(('X-Cnection', '^close$'), attack=True): return True else: return False
print("ma petite chaine en or", end='')
print('ma petite chaine en or', end='')
# function for insertion sort def Insertion_Sort(list): for i in range(1, len(list)): temp = list[i] j = i - 1 while j >= 0 and list[j] > temp: list[j + 1] = list[j] j -= 1 list[j + 1] = temp # function to print list def Print_list(list): for i in range(...
def insertion__sort(list): for i in range(1, len(list)): temp = list[i] j = i - 1 while j >= 0 and list[j] > temp: list[j + 1] = list[j] j -= 1 list[j + 1] = temp def print_list(list): for i in range(0, len(list)): print(list[i], end=' ') prin...
def cleanupFile(file_path): with open(file_path,'r') as f: with open("data/transactions.csv",'w') as f1: next(f) # skip header line for line in f: f1.write(line) def getDateParts(date_string): year = '' month = '' day = '' date_parts = date_string.split('-') if (len(date_parts) > 2): year = date_...
def cleanup_file(file_path): with open(file_path, 'r') as f: with open('data/transactions.csv', 'w') as f1: next(f) for line in f: f1.write(line) def get_date_parts(date_string): year = '' month = '' day = '' date_parts = date_string.split('-') if...
#calculation of power using recursion def exponentOfNumber(base,power): if power == 0: return 1 else: return base * exponentOfNumber(base,power-1) print("Enter only positive numbers below: ",) print("Enter a base: ") number = int(input()) print("Enter a power: ") exponent = int(input()) re...
def exponent_of_number(base, power): if power == 0: return 1 else: return base * exponent_of_number(base, power - 1) print('Enter only positive numbers below: ') print('Enter a base: ') number = int(input()) print('Enter a power: ') exponent = int(input()) result = exponent_of_number(number, exp...
def sma(): pass def ema(): pass
def sma(): pass def ema(): pass
dict1={'Influenza':['Relenza','B 0 D'],'Swine Flu':['Symmetrel','B L D'],'Cholera':['Ciprofloxacin','B 0 D'],'Typhoid':['Azithromycin','B L D'],'Sunstroke':['Barbiturates','0 0 D'],'Common cold':['Ibuprufen','B 0 D'],'Whooping Cough':['Erthromycin','B 0 D'],'Gastroentritis':['Gelusil','B 0 D'],'Conjunctivitus':['Romyci...
dict1 = {'Influenza': ['Relenza', 'B 0 D'], 'Swine Flu': ['Symmetrel', 'B L D'], 'Cholera': ['Ciprofloxacin', 'B 0 D'], 'Typhoid': ['Azithromycin', 'B L D'], 'Sunstroke': ['Barbiturates', '0 0 D'], 'Common cold': ['Ibuprufen', 'B 0 D'], 'Whooping Cough': ['Erthromycin', 'B 0 D'], 'Gastroentritis': ['Gelusil', 'B 0 D'],...
""" The Program receives from the USER a university EVALUATION in LETTERS (for example: A+, C-, F, etc.) and returns (displaying it) the corresponding evaluation in POINTS. """ # START Definition of FUNCTIONS def letterGradeValida(letter): if len(letter) == 1: if (65 <= ord(letter[0].upper()) <= 68) or ...
""" The Program receives from the USER a university EVALUATION in LETTERS (for example: A+, C-, F, etc.) and returns (displaying it) the corresponding evaluation in POINTS. """ def letter_grade_valida(letter): if len(letter) == 1: if 65 <= ord(letter[0].upper()) <= 68 or letter[0].upper() == 'F': ...
def solve(captcha, step): result = 0 for i in range(len(captcha)): if captcha[i] == captcha[(i + step) % len(captcha)]: result += int(captcha[i]) return result if __name__ == '__main__': solve_part1 = lambda captcha: solve(captcha, 1) solve_part2 = lambda captcha: solve(captcha,...
def solve(captcha, step): result = 0 for i in range(len(captcha)): if captcha[i] == captcha[(i + step) % len(captcha)]: result += int(captcha[i]) return result if __name__ == '__main__': solve_part1 = lambda captcha: solve(captcha, 1) solve_part2 = lambda captcha: solve(captcha, ...
print ('{0:.3f}'.format(1.0/3)) print('{0} / {1} = {2:.3f}'.format(3, 4,3/4 )) # fill with underscores (_) with the text centered # (^) to 11 width '___hello___' print ('{0:_^9}'.format('hello')) def variable(name=''): print('{0:*^12}'.format(name)) variable() print('{0:*^12}'.format('sendra')) variable() # keyword...
print('{0:.3f}'.format(1.0 / 3)) print('{0} / {1} = {2:.3f}'.format(3, 4, 3 / 4)) print('{0:_^9}'.format('hello')) def variable(name=''): print('{0:*^12}'.format(name)) variable() print('{0:*^12}'.format('sendra')) variable() print('{name} read {book} now.'.format(name='My Lovely Friend Sendra', book='A Byte of Py...
INH = "Inherent" # The 'address' is inherent in the opcode. e.g. ABX INT = "Interregister" # An pseudo-addressing for an immediate operand which specified registers for the EXG and TFR instructions IMM = "Immediate" # Operand immediately follows the opcode. A literal. Could be 8-bit (LDA), 16-bi...
inh = 'Inherent' int = 'Interregister' imm = 'Immediate' dir = 'PageDirect' idx = 'Indexed' ext = 'ExtendedDirect' rel8 = 'Relative8 8-bit' rel16 = 'Relative8 16-bit'
"""Question 3: Accept string from a user and display only those characters which are present at an even index number.""" def evenIndexNumber(palabra): print("Printing only even index chars") for i in range(0, len(palabra), 2): print("index[", i, "]", palabra[i:i+1]) word=input("Enter Strin...
"""Question 3: Accept string from a user and display only those characters which are present at an even index number.""" def even_index_number(palabra): print('Printing only even index chars') for i in range(0, len(palabra), 2): print('index[', i, ']', palabra[i:i + 1]) word = input('Enter String ') pr...
''' Given a number A. Find the fatorial of the number. Problem Constraints 1 <= A <= 100 ''' def factorial(A: int) -> int: if A <= 1: return 1 return (A * factorial(A-1)) if __name__ == "__main__": A = 3 print(factorial(A))
""" Given a number A. Find the fatorial of the number. Problem Constraints 1 <= A <= 100 """ def factorial(A: int) -> int: if A <= 1: return 1 return A * factorial(A - 1) if __name__ == '__main__': a = 3 print(factorial(A))
i = 125874 while True: if sorted(str(i)) == sorted(str(i * 2)) == sorted(str(i * 3)) == sorted(str(i * 4)) == sorted(str(i * 5)) == sorted(str(i * 6)): break else: i += 1 print(i)
i = 125874 while True: if sorted(str(i)) == sorted(str(i * 2)) == sorted(str(i * 3)) == sorted(str(i * 4)) == sorted(str(i * 5)) == sorted(str(i * 6)): break else: i += 1 print(i)
#!/usr/bin/env python3 a = ["uno", "dos", "tres"] b = [f"{i:#04d} {e}" for i,e in enumerate(a)] print(b)
a = ['uno', 'dos', 'tres'] b = [f'{i:#04d} {e}' for (i, e) in enumerate(a)] print(b)
def test_app_is_created(app): assert app.name == 'care_api.app' def test_request_returns_404(client): assert client.get('/url_not_found').status_code == 404
def test_app_is_created(app): assert app.name == 'care_api.app' def test_request_returns_404(client): assert client.get('/url_not_found').status_code == 404
def pi_nks(limit: int) -> float: pi: float = 3.0 s: int = 1 for i in range(2, limit, 2): pi += (s*4/(i*(i+1)*(i+2))) s = s*(-1) return pi def pi_gls(limit: int) -> float: pi: float = 0.0 s: int = 1 for i in range(1, limit, 2): pi += (s*(4/i)) s = s*(-1) ...
def pi_nks(limit: int) -> float: pi: float = 3.0 s: int = 1 for i in range(2, limit, 2): pi += s * 4 / (i * (i + 1) * (i + 2)) s = s * -1 return pi def pi_gls(limit: int) -> float: pi: float = 0.0 s: int = 1 for i in range(1, limit, 2): pi += s * (4 / i) s = ...
# # Script for converting collected NR data into # the format for comparison with the simulations # def clean_and_save(file1, file2, cx, cy, ech): ''' Remove rows with character ech from the data in file1 column cy and corresponding rows in cx, then save to file2. Column numbering starts with 0. ''' with...
def clean_and_save(file1, file2, cx, cy, ech): """ Remove rows with character ech from the data in file1 column cy and corresponding rows in cx, then save to file2. Column numbering starts with 0. """ with open(file1, 'r') as fin, open(file2, 'w') as fout: next(fin) for line in fin: ...
# Set to 1 or 2 to show what we send and receive from the SMTP server SMTP_DEBUG = 0 SMTP_HOST = '' SMTP_PORT = 465 SMTP_FROM_ADDRESSES = () SMTP_TO_ADDRESS = '' # these two can also be set by the environment variables with the same name SMTP_USERNAME = '' SMTP_PASSWORD = '' IMAP_HOSTNAME = '' IMAP_USERNAME = '' IMA...
smtp_debug = 0 smtp_host = '' smtp_port = 465 smtp_from_addresses = () smtp_to_address = '' smtp_username = '' smtp_password = '' imap_hostname = '' imap_username = '' imap_password = '' imap_list_folder = 'INBOX' check_accept_age_seconds = 3600
""" Messages dictionary ================== This module takes care of logging, using levels ERROR|DEBUG. Other levels could be added in the future This is to make it easier to translate the language of this tool and to centralize the logging behavior > Ignacio Tamayo, TSP, 2016 > Version 1.4 > Date: Sept 2016 """ ...
""" Messages dictionary ================== This module takes care of logging, using levels ERROR|DEBUG. Other levels could be added in the future This is to make it easier to translate the language of this tool and to centralize the logging behavior > Ignacio Tamayo, TSP, 2016 > Version 1.4 > Date: Sept 2016 """ ...
class Memorability_Prediction: def mem_calculation(frame1): #print ("Inside mem_calculation function") start_time1 = time.time() resized_image = caffe.io.resize_image(frame1,[227,227]) net1.blobs['data'].data[...] = transformer1.preprocess('data', resized_image) ...
class Memorability_Prediction: def mem_calculation(frame1): start_time1 = time.time() resized_image = caffe.io.resize_image(frame1, [227, 227]) net1.blobs['data'].data[...] = transformer1.preprocess('data', resized_image) value = net1.forward() value = value['fc8-euclidean']...
# # PySNMP MIB module ZYXEL-OAM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-OAM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:45:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, single_value_constraint, value_range_constraint) ...
def to_xyz(self): """Performs the corrdinate change and stores the resulting field in a VectorField object. Parameters ---------- self : VectorField a VectorField object Returns ------- a VectorField object """ # Dynamic import to avoid loop module = __import__("SciDataT...
def to_xyz(self): """Performs the corrdinate change and stores the resulting field in a VectorField object. Parameters ---------- self : VectorField a VectorField object Returns ------- a VectorField object """ module = __import__('SciDataTool.Classes.VectorField', fromlist=[...
class ToolVariables: @classmethod def ExcheckUpdate(cls): cls.INTAG = "ExCheck" return cls
class Toolvariables: @classmethod def excheck_update(cls): cls.INTAG = 'ExCheck' return cls
test = { 'name': 'q1_2', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> mean_based_estimator(np.array([1, 2, 3])) is not None True """, 'hidden': False, 'locked': False }, { 'code': r""" >>>...
test = {'name': 'q1_2', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> mean_based_estimator(np.array([1, 2, 3])) is not None\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> int(np.round(mean_based_estimator(np.array([1, 2, 3]))))\n 4\n ', 'hidde...
class ScheduleItem: def __init__(item, task): item.task = task item.start_time = None item.end_time = None item.child_start_time = None item.pred_task = None item.duration = task.duration item.total_effort = None item.who = '' class Schedule: def ...
class Scheduleitem: def __init__(item, task): item.task = task item.start_time = None item.end_time = None item.child_start_time = None item.pred_task = None item.duration = task.duration item.total_effort = None item.who = '' class Schedule: de...
#%% class Book: def __init__(self,author,name,pageNum): self.__author = author self.__name = name self.__pageNum = pageNum def getAuthor(self): return self.__author def getName(self): return self.__name def getPageNum(self): return self.__pageNu...
class Book: def __init__(self, author, name, pageNum): self.__author = author self.__name = name self.__pageNum = pageNum def get_author(self): return self.__author def get_name(self): return self.__name def get_page_num(self): return self.__pageNum ...
# --------------------------------------------------------------------------------------------- # Copyright (c) Akash Nag. All rights reserved. # Licensed under the MIT License. See LICENSE.md in the project root for license information. # ------------------------------------------------------------------------------...
class Cursorposition: def __init__(self, y, x): self.y = y self.x = x def __str__(self): return '(' + str(self.y + 1) + ',' + str(self.x + 1) + ')' def __repr__(self): return '(' + str(self.y) + ',' + str(self.x) + ')'
N = int(input()) M = int(input()) res = list() for x in range(N, M+1): cnt = 0 if x > 1: for i in range(2, x): if x % i == 0: cnt += 1 break if cnt == 0: res.append(x) if len(res) > 0: print(sum(res)) print(min(res)) else: ...
n = int(input()) m = int(input()) res = list() for x in range(N, M + 1): cnt = 0 if x > 1: for i in range(2, x): if x % i == 0: cnt += 1 break if cnt == 0: res.append(x) if len(res) > 0: print(sum(res)) print(min(res)) else: pri...
# Application settings # Flask settings DEBUG = False # Flask-restplus settings RESTPLUS_MASK_SWAGGER = False SWAGGER_UI_DOC_EXPANSION = 'none' # API metadata API_TITLE = 'MAX Breast Cancer Mitosis Detector' API_DESC = 'Predict the probability of the input image containing mitosis.' API_VERSION = '0.1' # default mo...
debug = False restplus_mask_swagger = False swagger_ui_doc_expansion = 'none' api_title = 'MAX Breast Cancer Mitosis Detector' api_desc = 'Predict the probability of the input image containing mitosis.' api_version = '0.1' model_name = 'MAX Breast Cancer Mitosis Detector' default_model_path = 'assets/deep_histopath_mod...
# # @lc app=leetcode id=1431 lang=python3 # # [1431] Kids With the Greatest Number of Candies # # @lc code=start class Solution: def kidsWithCandies(self, candies: List[int], extra_candies: int) -> List[bool]: max_candies = max(candies) return [i + extra_candies >= max_candies for i in candies] # @...
class Solution: def kids_with_candies(self, candies: List[int], extra_candies: int) -> List[bool]: max_candies = max(candies) return [i + extra_candies >= max_candies for i in candies]
""" This module contains all files for a django deployment 'site'. When called via the manage.py command, this folder is used as regular django setup. """
""" This module contains all files for a django deployment 'site'. When called via the manage.py command, this folder is used as regular django setup. """
# -*- coding: utf-8 -*- """ This package implements various parameterisations of properties from the litterature with relevance in chemistry. """
""" This package implements various parameterisations of properties from the litterature with relevance in chemistry. """
def repeated_n_times(nums): # nums.length == 2 * n n = len(nums) // 2 for num in nums: if nums.count(num) == n: return num print(repeated_n_times([1, 2, 3, 3])) print(repeated_n_times([2, 1, 2, 5, 3, 2])) print(repeated_n_times([5, 1, 5, 2, 5, 3, 5, 4]))
def repeated_n_times(nums): n = len(nums) // 2 for num in nums: if nums.count(num) == n: return num print(repeated_n_times([1, 2, 3, 3])) print(repeated_n_times([2, 1, 2, 5, 3, 2])) print(repeated_n_times([5, 1, 5, 2, 5, 3, 5, 4]))
# (C) Datadog, Inc. 2020-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) # See: # https://docs.microsoft.com/en-us/windows/win32/eventlog/event-types # https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-reporteventa#parameters # https://docs.microsoft.com/en...
event_types = {'success': 4, 'error': 2, 'warning': 3, 'information': 4, 'success audit': 4, 'failure audit': 2}
@outputSchema('vals: {(val:chararray)}') def convert(the_input): # This converts the indeterminate number of vals into a bag. out = [] for map in the_input: out.append(map) return out
@output_schema('vals: {(val:chararray)}') def convert(the_input): out = [] for map in the_input: out.append(map) return out
"""Settings for depicting LaTex figures""" class Figure: """Figure class for depicting HTML and LaTeX. :param path: The path to an image :type path: str :param title: The caption of the figure :param title: str :param label: The label of the label :p...
"""Settings for depicting LaTex figures""" class Figure: """Figure class for depicting HTML and LaTeX. :param path: The path to an image :type path: str :param title: The caption of the figure :param title: str :param label: The label of the label :p...
class Solution: def recurse(self, n, stack, cur_open) : if n == 0 : self.ans.append(stack+')'*cur_open) return for i in range(cur_open+1) : self.recurse(n-1, stack+(')'*i)+'(', cur_open-i+1) # @param A : integer # @return a list of strings def g...
class Solution: def recurse(self, n, stack, cur_open): if n == 0: self.ans.append(stack + ')' * cur_open) return for i in range(cur_open + 1): self.recurse(n - 1, stack + ')' * i + '(', cur_open - i + 1) def generate_parenthesis(self, A): if A <= 0: ...
class Solution: def rangeBitwiseAnd(self, left: int, right: int) -> int: i = 0 # how many bit right shifted while left != right: left >>= 1 right >>= 1 i += 1 return left << i # TESTS for left, right, expected in [ (5, 7, 4), (0, 1, 0), (26,...
class Solution: def range_bitwise_and(self, left: int, right: int) -> int: i = 0 while left != right: left >>= 1 right >>= 1 i += 1 return left << i for (left, right, expected) in [(5, 7, 4), (0, 1, 0), (26, 30, 24)]: sol = solution() actual = sol...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"plot_sequence": "10_core_overview.ipynb", "plot_sequence_1d": "10_core_overview.ipynb", "get_alphabet": "11_core_elements.ipynb", "get_element_counts": "11_core_elements.ipynb", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'plot_sequence': '10_core_overview.ipynb', 'plot_sequence_1d': '10_core_overview.ipynb', 'get_alphabet': '11_core_elements.ipynb', 'get_element_counts': '11_core_elements.ipynb', 'get_first_positions': '11_core_elements.ipynb', 'get_element_frequenc...
print("Challenges 38: WAF program to print the number of prime numbers which are less than or equal to a given integer.") n = 7 nums = range(2, n+1) num_of_divisors = 0 counter = 0 for x in nums: for i in range(1, x+1): if x % i == 0: num_of_divisors += 1 if num_of_divisors == 2: counter ...
print('Challenges 38: WAF program to print the number of prime numbers which are less than or equal to a given integer.') n = 7 nums = range(2, n + 1) num_of_divisors = 0 counter = 0 for x in nums: for i in range(1, x + 1): if x % i == 0: num_of_divisors += 1 if num_of_divisors == 2: counter...
def n_to_triangularno_stevilo(n): stevilo = 0 a = 1 for i in range(n): stevilo += a a += 1 return stevilo def prvo_triangularno_stevilo_Z_vec_kot_k_delitelji(k): j = 0 n = 0 stevilo_deliteljev = 0 while stevilo_deliteljev <= k: stevilo_deliteljev = 0 ...
def n_to_triangularno_stevilo(n): stevilo = 0 a = 1 for i in range(n): stevilo += a a += 1 return stevilo def prvo_triangularno_stevilo_z_vec_kot_k_delitelji(k): j = 0 n = 0 stevilo_deliteljev = 0 while stevilo_deliteljev <= k: stevilo_deliteljev = 0 j +=...
# mock.py # Test tools for mocking and patching. # Copyright (C) 2007 Michael Foord # E-mail: fuzzyman AT voidspace DOT org DOT uk # mock 0.3.1 # http://www.voidspace.org.uk/python/mock.html # Released subject to the BSD License # Please see http://www.voidspace.org.uk/python/license.shtml # Scripts maintained at ht...
__all__ = ('Mock', 'patch', 'sentinel', '__version__') __version__ = '0.3.1' class Mock(object): def __init__(self, methods=None, spec=None, name=None, parent=None): self._parent = parent self._name = name if spec is not None and methods is None: methods = [member for member in...
"""Decorators used for adding functionality to the library.""" def downcast_field(property_name, default_value = None): """A decorator function for handling downcasting.""" def store_downcast_field_value(class_reference): """Store the key map.""" setattr(class_reference, "__deserialize_downca...
"""Decorators used for adding functionality to the library.""" def downcast_field(property_name, default_value=None): """A decorator function for handling downcasting.""" def store_downcast_field_value(class_reference): """Store the key map.""" setattr(class_reference, '__deserialize_downcast_...
a = 10 def f(): global a a = 100 def ober(): b = 100 def unter(): nonlocal b b = 1000 def unterunter(): nonlocal b b = 10000 unterunter() unter() print(b) ober() def xyz(x): return x * x z = lambda x: x * x print(z(...
a = 10 def f(): global a a = 100 def ober(): b = 100 def unter(): nonlocal b b = 1000 def unterunter(): nonlocal b b = 10000 unterunter() unter() print(b) ober() def xyz(x): return x * x z = lambda x: x * x print(z(3)) my_list = [1...
# Responsible for giving targets to the Quadrocopter control lopp class HighLevelLogic: def __init__(self, control_loop, state_provider): self.controllers self.flightmode = FlightModeLanded() self.control_loop = control_loop state_provider.registerListener(self) # Tells all sy...
class Highlevellogic: def __init__(self, control_loop, state_provider): self.controllers self.flightmode = flight_mode_landed() self.control_loop = control_loop state_provider.registerListener(self) def update(self, timedelta): newmode = self.flightmode.update(timedelta...
keyb = '`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;\'ZXCVBNM,./' while True: try: frase = input() decod = '' for c in frase: if c == ' ': decod += c else: decod += keyb[keyb.index(c)-1] print(decod) except EOFError: break
keyb = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./" while True: try: frase = input() decod = '' for c in frase: if c == ' ': decod += c else: decod += keyb[keyb.index(c) - 1] print(decod) except EOFError: break
outputs = [] ## Test Constructor output = """PROFILING Command: ['./testConstructor '] PrecisionTuner: MODE PROFILING PrecisionTuner: MODE PROFILING """ outputs.append(output) output = """Error no callstacks\n""" outputs.append(output) output = """Strategy Command: ['./testConstructor '] Strategy: 1, STEP reached:...
outputs = [] output = "PROFILING Command: ['./testConstructor ']\nPrecisionTuner: MODE PROFILING\nPrecisionTuner: MODE PROFILING\n\n" outputs.append(output) output = 'Error no callstacks\n' outputs.append(output) output = "Strategy Command: ['./testConstructor ']\nStrategy: 1, STEP reached: NoOccurence\nNo more strat...
# Bubble Sort def bubble_sort(array: list) -> tuple: """"will return the sorted array, and number of swaps""" total_swaps = 0 for i in range(len(array)): swaps = 0 for j in range(len(array) - 1): if array[j] > array[j + 1]: array[j], array[j + 1] = array[j + 1], ...
def bubble_sort(array: list) -> tuple: """"will return the sorted array, and number of swaps""" total_swaps = 0 for i in range(len(array)): swaps = 0 for j in range(len(array) - 1): if array[j] > array[j + 1]: (array[j], array[j + 1]) = (array[j + 1], array[j]) ...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
"""A helper library for coverage_test.py - coverage is added to this library.""" def simple_func(a): return 2 * a def if_func(a): x = a if x: return 2 else: return 3 def cmp_less(a, b): return a < b def cmp_greater(a, b): return a > b def cmp_const_less(a): return 1 < a ...
def fun(n): fact = 1 for i in range(1,n+1): fact = fact * i return fact n= int(input()) k = fun(n) j = fun(n//2) l = j//(n//2) print(((k//(j**2))*(l**2))//2)
def fun(n): fact = 1 for i in range(1, n + 1): fact = fact * i return fact n = int(input()) k = fun(n) j = fun(n // 2) l = j // (n // 2) print(k // j ** 2 * l ** 2 // 2)
palavras = ("Aprender", "Programar", "Linguagem", "Python", "Curso", "Gratis", "Estudar", "Praticar", "Trabalhar ", "Mercado", "Programar", "Futuro") for vol in palavras: print(f"\nNa palavra {vol.upper()} temos", end=" ") for letra in vol: if letra.lower() in "aeiou": print(letra, end=" ")
palavras = ('Aprender', 'Programar', 'Linguagem', 'Python', 'Curso', 'Gratis', 'Estudar', 'Praticar', 'Trabalhar ', 'Mercado', 'Programar', 'Futuro') for vol in palavras: print(f'\nNa palavra {vol.upper()} temos', end=' ') for letra in vol: if letra.lower() in 'aeiou': print(letra, end=' ')
# a = int(input('Numerador: ')) # se tentarmos colocar uma letra aqui vai da erro de valor ValueError # b = int(input('Denominador: ')) # se colocar 0 aqui vai acontecer uma excecao ZeroDivisionError - divisao por zero # r = a/b # print(f'A divisao de {a} por {b} vale = {r}') # para tratar erros a gente usa o com...
try: a = int(input('Numerador: ')) b = int(input('Denominador: ')) r = a / b except Exception as erro: print(f'Erro encontrado = {erro.__class__}') else: print(f'O resultado foi = {r}') finally: print('Volte sempre! Obrigado!')
class Color(APIObject, IDisposable): """ Represents a color in Autodesk Revit. Color(red: Byte,green: Byte,blue: Byte) """ def Dispose(self): """ Dispose(self: APIObject,A_0: bool) """ pass def ReleaseManagedResources(self, *args): """ ReleaseManagedResources(s...
class Color(APIObject, IDisposable): """ Represents a color in Autodesk Revit. Color(red: Byte,green: Byte,blue: Byte) """ def dispose(self): """ Dispose(self: APIObject,A_0: bool) """ pass def release_managed_resources(self, *args): """ ReleaseManagedResources(self: APIObje...
class Solution: def numTilings(self, n: int) -> int: mod = 1_000_000_000 + 7 f = [[0 for i in range(1 << 2)] for i in range(2)] f[0][(1 << 2) - 1] = 1 o0 = 0 o1 = 1 for i in range(n): f[o1][0] = f[o0][(1 << 2) - 1] f[o1][1] = (f[o0][0] + f[o0][...
class Solution: def num_tilings(self, n: int) -> int: mod = 1000000000 + 7 f = [[0 for i in range(1 << 2)] for i in range(2)] f[0][(1 << 2) - 1] = 1 o0 = 0 o1 = 1 for i in range(n): f[o1][0] = f[o0][(1 << 2) - 1] f[o1][1] = (f[o0][0] + f[o0][2...
"""Constants that define time formats""" F1 = '%Y-%m-%dT%H:%M:%S' F2 = '%Y-%m-%d'
"""Constants that define time formats""" f1 = '%Y-%m-%dT%H:%M:%S' f2 = '%Y-%m-%d'
def escreva(texto): tam = len(texto) + 4 print('~' * tam) print(f' {texto}') print('~' * tam) escreva(str(input('Digite um texto: ')))
def escreva(texto): tam = len(texto) + 4 print('~' * tam) print(f' {texto}') print('~' * tam) escreva(str(input('Digite um texto: ')))
"""Media files location specifications.""" def workflow_step_media_location(instance, filename): """Return the location of a stored media file for a Workflow Step.""" workflow_id = instance.workflow_step.workflow.id step_id = instance.workflow_step_id ui_identifier = instance.ui_identifier file_ex...
"""Media files location specifications.""" def workflow_step_media_location(instance, filename): """Return the location of a stored media file for a Workflow Step.""" workflow_id = instance.workflow_step.workflow.id step_id = instance.workflow_step_id ui_identifier = instance.ui_identifier file_ext...
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # normal recursive solution # this recursive solution will call more methods which cause Time Limit Exceed class Solution1: # @param {TreeNode} root # @return...
class Solution1: def max_depth(self, root): if root is None: return 0 if self.left is None and self.right is None: return 1 elif self.left is not None and self.right is not None: return self.maxDepth(self.left) + 1 if self.maxDepth(self.left) > self.maxDe...
url = 'http://127.0.0.1:3001/post' dapr_url = "http://localhost:3500/v1.0/invoke/dp-61c2cb20562850d49d47d1c7-executorapp/method/health" # dapr_url = "http://localhost:3500/v1.0/healthz" # res = requests.post(dapr_url, json.dumps({'a': random.random() * 1000})) # res = requests.get(dapr_url, ) # # # # print(res.text) ...
url = 'http://127.0.0.1:3001/post' dapr_url = 'http://localhost:3500/v1.0/invoke/dp-61c2cb20562850d49d47d1c7-executorapp/method/health'
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_v_floatarray.tif test_splineinverse_c_flo...
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_v_floatarray.tif test_splineinverse_c_float_v_floatarray') command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_u_floatarray.tif test_splineinverse_c_float_u_floatarray') command += testshade('-t 1 -g 64...
# src: https://github.com/dchest/tweetnacl-js/blob/acab4d4883e7a0be0b230df7b42c0bbd25210d39/nacl.js __pragma__("js", "{}", r""" (function(nacl) { 'use strict'; // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. // Public domain. // // Implementation derived from TweetNaCl version 20140427. // See for details: htt...
__pragma__('js', '{}', '\n(function(nacl) {\n\'use strict\';\n\n// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.\n// Public domain.\n//\n// Implementation derived from TweetNaCl version 20140427.\n// See for details: http://tweetnacl.cr.yp.to/\n\nvar u64 = function(h, l) { this.hi = h|0 >>> 0; this.lo = l|0 >>> ...
""" N : 1 * 2 * 3 * .... * N """ def factorial(n: int) -> int: result = 1 for i in range(1, n + 1): result *= i return result """ nPr = n! / (n - r)! """ def permutation(n: int, r: int) -> int: return factorial(n) // factorial(n - r) # return 24 // factorial(n - r) # return 24 // f...
""" N : 1 * 2 * 3 * .... * N """ def factorial(n: int) -> int: result = 1 for i in range(1, n + 1): result *= i return result '\nnPr = n! / (n - r)!\n' def permutation(n: int, r: int) -> int: return factorial(n) // factorial(n - r) def combination(n: int, r: int) -> int: return permutatio...
''' Example: import dk cfg = dk.load_config(config_path='~/donkeycar/donkeycar/parts/RLConfig.py') print(cfg.CAMERA_RESOLUTION) ''' MODE_COMPLEX_LANE_FOLLOW = 0 MODE_SIMPLE_LINE_FOLLOW = 1 MODE_STEER_THROTTLE = MODE_COMPLEX_LANE_FOLLOW # MODE_STEER_THROTTLE = MODE_SIMPLE_LINE_FOLLOW PARTIAL_NN_CNT = 45000 #...
""" Example: import dk cfg = dk.load_config(config_path='~/donkeycar/donkeycar/parts/RLConfig.py') print(cfg.CAMERA_RESOLUTION) """ mode_complex_lane_follow = 0 mode_simple_line_follow = 1 mode_steer_throttle = MODE_COMPLEX_LANE_FOLLOW partial_nn_cnt = 45000 switch_to_nn = 1000 update_nn = 1000 save_nn = 1000 thr...
def build_filter(args): return Filter(args) class Filter: def __init__(self, args): pass def file_data_filter(self, file_data): file_ctx = file_data["file_ctx"] if not file_ctx.isbinary(): file_data["data"] = file_data["data"].replace(b"\r\n", b"\n")
def build_filter(args): return filter(args) class Filter: def __init__(self, args): pass def file_data_filter(self, file_data): file_ctx = file_data['file_ctx'] if not file_ctx.isbinary(): file_data['data'] = file_data['data'].replace(b'\r\n', b'\n')
print(round(1.23,1)) print(round(1.2345, 3)) # Negative numbers round the ones, tens, hundreds and so on.. print(round(123124123, -1)) print(round(54213, -2)) # Round is not neccessary for display reasons. use format instead x = 1.8913479812313 print("value is {:0.3f}".format(x))
print(round(1.23, 1)) print(round(1.2345, 3)) print(round(123124123, -1)) print(round(54213, -2)) x = 1.8913479812313 print('value is {:0.3f}'.format(x))
def get_emails(): while True: email_info = input().split(' ') if email_info[0] == 'Stop': break sender, receiver, content = email_info email = Email(sender, receiver, content) emails.append(email) class Email: def __init__(self, sender, receiver, content):...
def get_emails(): while True: email_info = input().split(' ') if email_info[0] == 'Stop': break (sender, receiver, content) = email_info email = email(sender, receiver, content) emails.append(email) class Email: def __init__(self, sender, receiver, content):...
pattern_zero=[0.0, 0.017538265306, 0.03443877551, 0.035714285714, 0.050701530612, 0.05325255102, 0.066326530612, 0.070153061224, 0.071428571429, 0.08131377551, 0.086415816327, 0.088966836735, 0.095663265306, 0.102040816327, 0.105867346939, 0.107142857143, 0.109375, 0.117028061224, 0.122130102041, 0.122448979592, 0.1246...
pattern_zero = [0.0, 0.017538265306, 0.03443877551, 0.035714285714, 0.050701530612, 0.05325255102, 0.066326530612, 0.070153061224, 0.071428571429, 0.08131377551, 0.086415816327, 0.088966836735, 0.095663265306, 0.102040816327, 0.105867346939, 0.107142857143, 0.109375, 0.117028061224, 0.122130102041, 0.122448979592, 0.12...
def main() -> None: x0, y0, x1, y1 = map(int, input().split()) for dx in range(-2, 3): for dy in range(-2, 3): if abs(dx) + abs(dy) != 3: continue if abs(dx) == 0 or abs(dy) == 0: continue x = x0 + dx y = y0 + dy ...
def main() -> None: (x0, y0, x1, y1) = map(int, input().split()) for dx in range(-2, 3): for dy in range(-2, 3): if abs(dx) + abs(dy) != 3: continue if abs(dx) == 0 or abs(dy) == 0: continue x = x0 + dx y = y0 + dy ...
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This file was split off from ppapi.gyp to prevent PPAPI users from # needing to DEPS in ~10K files due to mesa. { 'includes': [ '../../../third...
{'includes': ['../../../third_party/mesa/mesa.gypi'], 'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'ppapi_egl', 'type': 'static_library', 'dependencies': ['<(DEPTH)/ppapi/ppapi.gyp:ppapi_c'], 'include_dirs': ['include'], 'defines': ['PUBLIC=', '_EGL_PLATFORM_PPAPI=_EGL_NUM_PLATFORMS', '_EGL_NATIVE_PLA...
# 5658. Maximum Absolute Sum of Any Subarray # Biweekly contest 45 class Solution: def maxAbsoluteSum(self, nums: List[int]) -> int: currentmax = globalmax = currentmin = nums[0] for i in range(1, len(nums)): x, y = nums[i] + currentmax, nums[i] + currentmin currentmax = max...
class Solution: def max_absolute_sum(self, nums: List[int]) -> int: currentmax = globalmax = currentmin = nums[0] for i in range(1, len(nums)): (x, y) = (nums[i] + currentmax, nums[i] + currentmin) currentmax = max(nums[i], x, y) currentmin = min(nums[i], x, y) ...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
def capital_checker(dicti): correct_ans = {'New York': 'Albany', 'California': 'Sacramento', 'New Mexico': 'Santa Fe', 'Florida': 'Tallahassee', 'Michigan': 'Lansing'} return_dict = {} for (keys, values) in dicti.items(): if values.lower() != correct_ans[keys].lower(): return_dict[keys] ...
TEST_OCF_ACCOUNTS = ( 'sanjay', # an old, sorried account with kerberos princ 'alec', # an old, sorried account with no kerberos princ 'guser', # an account specifically made for testing 'nonexist', # this account does not exist ) TESTER_CALNET_UIDS = ( 872544, # daradib 1034192, # ckueh...
test_ocf_accounts = ('sanjay', 'alec', 'guser', 'nonexist') tester_calnet_uids = (872544, 1034192, 869331, 1031366, 1099131, 1101587, 1511731, 1623751, 1619256) test_group_accounts = ((91740, 'The Testing Group'), (46187, 'Open Computing Facility'), (46692, 'Awesome Group of Awesome'), (92029, 'eXperimental Computing F...
# -*- coding: utf-8 -*- """ awsecommerceservice This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Item13(object): """Implementation of the 'Item13' model. TODO: type model description here. Attributes: asin (string): TODO: type description here....
""" awsecommerceservice This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Item13(object): """Implementation of the 'Item13' model. TODO: type model description here. Attributes: asin (string): TODO: type description here. offer_listing_id (...
class NotFoundError(Exception): def __init__(self, url): super().__init__(url) self.type = "notfound" class NoTitleError(Exception): def __init__(self, url): super().__init__(url) self.type = "notitle" class ErrorPageError(Exception): def __init__(self, url): supe...
class Notfounderror(Exception): def __init__(self, url): super().__init__(url) self.type = 'notfound' class Notitleerror(Exception): def __init__(self, url): super().__init__(url) self.type = 'notitle' class Errorpageerror(Exception): def __init__(self, url): sup...
init_info = input().split(" ") sapce_width = int(init_info[0]) space_length = int(init_info[1]) space_gun = int(init_info[2]) gun_x = [] gun_y = [] for each_input in range(space_gun): init_gun = input().split() gun_x.append(int(init_gun[0])) gun_y.append(int(init_gun[1])) new_width = sapce_width -...
init_info = input().split(' ') sapce_width = int(init_info[0]) space_length = int(init_info[1]) space_gun = int(init_info[2]) gun_x = [] gun_y = [] for each_input in range(space_gun): init_gun = input().split() gun_x.append(int(init_gun[0])) gun_y.append(int(init_gun[1])) new_width = sapce_width - len(set(g...
""" File: anagram.py Name: Howard ---------------------------------- This program recursively finds all the anagram(s) for the word input by user and terminates when the input string matches the EXIT constant defined at line 19 If you correctly implement this program, you should see the number of anagrams for each wor...
""" File: anagram.py Name: Howard ---------------------------------- This program recursively finds all the anagram(s) for the word input by user and terminates when the input string matches the EXIT constant defined at line 19 If you correctly implement this program, you should see the number of anagrams for each wor...
# Create a calculator function # The function should accept three parameters: # first_number: a numeric value for the math operation # second_number: a numeric value for the math operation # operation: the word 'add' or 'subtract' # the function should return the result of the two numbers added or subtracted # based on...
def calcutate(first, second, operation): if operation.lower() == 'add': result = first + second elif operation.lower() == 'substract': result = first - second else: result = 'Operation, not supported' return result first = float(input('Enter first number: ')) second = float(input...
''' We can pass multiple arguments to the .order_by() method to order by multiple columns. In fact, we can also sort in ascending or descending order for each individual column. Each column in the .order_by() method is fully sorted from left to right. This means that the first column is completely sorted, and then with...
""" We can pass multiple arguments to the .order_by() method to order by multiple columns. In fact, we can also sort in ascending or descending order for each individual column. Each column in the .order_by() method is fully sorted from left to right. This means that the first column is completely sorted, and then with...
#!/usr/bin/env python3 #################################################################################### # # # Program purpose: Finds the difference between the largest and the smallest # # integer which a...
def read_data(mess: str): valid = False data = 0 while not valid: try: temp_data = list(input(mess).strip()) if len(temp_data) != 8: raise value_error('Number must be 8-digit long') else: for x in range(len(temp_data)): ...
############################################################################# # _____ __________ ___ __ # # / ___// ____/ __ \/ | / / # # \__ \/ / / /_/ / /| | / / # # ___...
""" SCRAL - constants This file contains useful constants for this module. """ url_cloud = 'https://api.smartdatanet.it/api' url_tenant = 'https://api.smartdatanet.it/metadataapi/api/v02/search?tenant=cittato_rumore' uri_default = '/scral/v1.0/phono-gw' uri_active_devices = URI_DEFAULT + '/active-devices' activ...
class AuthenticationError(Exception): pass class MarketClosedError(Exception): pass class MarketEmptyError(Exception): pass
class Authenticationerror(Exception): pass class Marketclosederror(Exception): pass class Marketemptyerror(Exception): pass
# coding=utf-8 # @Time : 2021/3/26 10:34 # @Auto : zzf-jeff class GlobalSetting(): label_path = './coco.names' model_path = './weights/yolov5x-simpler.engine' # model_path = './weights/yolov5s.pt' output_path = './output' img_path = './test_imgs' conf_thresh = 0.3 iou...
class Globalsetting: label_path = './coco.names' model_path = './weights/yolov5x-simpler.engine' output_path = './output' img_path = './test_imgs' conf_thresh = 0.3 iou_thresh = 0.45 anchors = [[[10, 13], [16, 30], [33, 23]], [[30, 61], [62, 45], [59, 119]], [[116, 90], [156, 198], [373, 326...
def test_trading_fee(position): entry_price = 100000000000000000000 # 100 current_price = 150000000000000000000 # 150 notional = 10000000000000000000 # 10 debt = 2000000000000000000 # 2 liquidated = False trading_fee_rate = 750000000000000 oi = int((notional / entry_price) * 10000000000...
def test_trading_fee(position): entry_price = 100000000000000000000 current_price = 150000000000000000000 notional = 10000000000000000000 debt = 2000000000000000000 liquidated = False trading_fee_rate = 750000000000000 oi = int(notional / entry_price * 1000000000000000000) fraction = 100...
# 9th Solutions #-------------------------- n = int(input()) d = {} for i in range(n): x = input().split() d[x[0]] = x[1] while True: try: name = input() if name in d: print(name, '=', d[name], sep='') else: print('Not found') except: break
n = int(input()) d = {} for i in range(n): x = input().split() d[x[0]] = x[1] while True: try: name = input() if name in d: print(name, '=', d[name], sep='') else: print('Not found') except: break
def define_targets(rules): rules.cc_test( name = "test", srcs = ["impl/CUDATest.cpp"], deps = [ "@com_google_googletest//:gtest_main", "//c10/cuda", ], target_compatible_with = rules.requires_cuda_enabled(), )
def define_targets(rules): rules.cc_test(name='test', srcs=['impl/CUDATest.cpp'], deps=['@com_google_googletest//:gtest_main', '//c10/cuda'], target_compatible_with=rules.requires_cuda_enabled())
def vogal(c): if c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u' or c == 'A' or c == 'E' or c == 'I' or c == 'O' or c == 'U': return True else: return False
def vogal(c): if c == 'a' or c == 'e' or c == 'i' or (c == 'o') or (c == 'u') or (c == 'A') or (c == 'E') or (c == 'I') or (c == 'O') or (c == 'U'): return True else: return False
# Copyright 2020 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
"""Proof of concept. License restriction.""" load('@rules_license//rules:providers.bzl', 'LicenseInfo', 'LicenseKindInfo', 'LicensesInfo') def _default_licenses_impl(ctx): licenses = [] for dep in ctx.attr.deps: if LicenseInfo in dep: licenses.append(dep[LicenseInfo]) return [licenses_i...
# Copyright 2021 Variscite LTD # SPDX-License-Identifier: BSD-3-Clause __version__ = "1.0.0"
__version__ = '1.0.0'
#!/usr/bin/env python # Copyright (c) 2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides the base class for user-defined actor controllers. All user-defined controls must be derived from this class. A ...
""" This module provides the base class for user-defined actor controllers. All user-defined controls must be derived from this class. A user must not modify the module. """ class Basiccontrol(object): """ This class is the base class for user-defined actor controllers All user-defined agents must be deri...
# dfs def walk_parents(vertex): return sum( (walk_parents(parent) for parent in vertex.parents), [] ) + [vertex] def walk_children(vertex): return sum( (walk_children(child) for child in vertex.children), [] ) + [vertex]
def walk_parents(vertex): return sum((walk_parents(parent) for parent in vertex.parents), []) + [vertex] def walk_children(vertex): return sum((walk_children(child) for child in vertex.children), []) + [vertex]
""" https://leetcode.com/problems/power-of-four/ Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: Input: 16 Output: true Example 2: Input: 5 Output: false Follow up: Could you solve it without loops/recursion? """ # Inspired by @h285zhao in the discussion panel. If...
""" https://leetcode.com/problems/power-of-four/ Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: Input: 16 Output: true Example 2: Input: 5 Output: false Follow up: Could you solve it without loops/recursion? """ class Solution: def is_power_of_four(self, num...
# list1 = [i for i in range(5, 16)] # print(list1) # list1 = [i for i in range(0, 11)] # for i in range(11): # if i > 0: # print(list1[i-1] * list1[i]) # list1 = [i * j for i in range(1, 10) for j in range(1, 10)] # print(list1) str1 = str(input()) strArray = list(str1) newList = [] for i in strArray: ...
str1 = str(input()) str_array = list(str1) new_list = [] for i in strArray: if i > 'e': del i else: newList.append(i) print(*newList)