content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" Copyright 2021 DataDistillr Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
""" Copyright 2021 DataDistillr Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
class TestReportAxis: def __init__(self, stat, label, unit): self.stat = stat self.label = label self.unit = unit class TestReport: def __init__(self, x_axis, y_axis): self.x_axis = x_axis self.y_axis = y_axis class TestCase: def __init__(self, i...
class Testreportaxis: def __init__(self, stat, label, unit): self.stat = stat self.label = label self.unit = unit class Testreport: def __init__(self, x_axis, y_axis): self.x_axis = x_axis self.y_axis = y_axis class Testcase: def __init__(self, id='', alt_id='', ...
#Delegar acesso a atributos class A: def fazer_algo(self): pass def outro_metodo(self): pass def algum_metodo(self, nome): print(nome) class B: def __init__(self): self.a = A() # Instancia da classe A def fazer_algo(self): #delega para self.a ...
class A: def fazer_algo(self): pass def outro_metodo(self): pass def algum_metodo(self, nome): print(nome) class B: def __init__(self): self.a = a() def fazer_algo(self): return self.a.fazer_algo() def outro_metodo(self): return self.a.outro...
""" Copyright 2020 Andrew Brown (aka SherpDaWerp) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by appl...
""" Copyright 2020 Andrew Brown (aka SherpDaWerp) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable la...
# https://www.codewars.com/kata/54ff3102c1bad923760001f3/train/python def get_count(input_str): num_vowels = 0 list_vowels=["a","e","i","o","u"] for i in range(len(input_str)): if input_str[i] in list_vowels: num_vowels+=1 i+=1 return num_vowels #sentence=input("Sentence: ") #print(get...
def get_count(input_str): num_vowels = 0 list_vowels = ['a', 'e', 'i', 'o', 'u'] for i in range(len(input_str)): if input_str[i] in list_vowels: num_vowels += 1 i += 1 return num_vowels
"""Total brought This program totals everything being brought to a picnic by storing the guest's names and items brought as a :obj:`dict` of :obj:`dicts <dict>`. Attributes: allGuests (dict): Dictionary of dictionaries with guest names as keys and values of dictionaries with items as keys and number of it...
"""Total brought This program totals everything being brought to a picnic by storing the guest's names and items brought as a :obj:`dict` of :obj:`dicts <dict>`. Attributes: allGuests (dict): Dictionary of dictionaries with guest names as keys and values of dictionaries with items as keys and number of it...
class CheckException(Exception): def __init__(self, message, exceptions=[]): super(Exception, self).__init__(message) self.errors = exceptions class ParamMissingException(CheckException): type = 'config-param-missing' class NonExistentRuntimeVariableException(CheckException): type = 'c...
class Checkexception(Exception): def __init__(self, message, exceptions=[]): super(Exception, self).__init__(message) self.errors = exceptions class Parammissingexception(CheckException): type = 'config-param-missing' class Nonexistentruntimevariableexception(CheckException): type = 'conf...
""" Moonstream library and API version. """ MOONSTREAM_VERSION = "0.0.1"
""" Moonstream library and API version. """ moonstream_version = '0.0.1'
#!/usr/bin/env python # -*- coding: utf-8 -*- rabbitmq = {} runs = []
rabbitmq = {} runs = []
def sum_two_nums(num1, num2): return num1 + num2 number1 = int(input('Enter first num: ')) number2 = int(input('Enter second num: ')) result = sum_two_nums(number1, number2) print(f'{number1} + {number2} = {result}')
def sum_two_nums(num1, num2): return num1 + num2 number1 = int(input('Enter first num: ')) number2 = int(input('Enter second num: ')) result = sum_two_nums(number1, number2) print(f'{number1} + {number2} = {result}')
#!/usr/bin/env python3 # Write a program that prints out the position, frame, and letter of the DNA # Try coding this with a single loop # Try coding this with nested loops s = 'ATGGCCTTT' x = 0 print('Nested Loop:') for i in range (0, len(s), 3): for j in range (0,3): print (x, j, s[x]) x += 1 pr...
s = 'ATGGCCTTT' x = 0 print('Nested Loop:') for i in range(0, len(s), 3): for j in range(0, 3): print(x, j, s[x]) x += 1 print('---------') print('Single Loop:') x = 0 for i in range(0, len(s), 3): print(x, 0, s[x]) x += 1 print(x, 1, s[x]) x += 1 print(x, 2, s[x]) x += 1 pri...
s,n=map(int,input().split()) a=[] for _ in range(n): a.append(list(map(int,input().split()))) b=sorted(a) for x,y in b: if s<=x: print('NO') break else: s+=y else: print('YES')
(s, n) = map(int, input().split()) a = [] for _ in range(n): a.append(list(map(int, input().split()))) b = sorted(a) for (x, y) in b: if s <= x: print('NO') break else: s += y else: print('YES')
################################################################# # # # Solution to find the maximum sum of elements in whole # # hourglass shapes of an two dimensional array # # ...
matrix_dimension = 6 matrix = [[0 for x in range(matrixDimension)] for y in range(matrixDimension)] for i in range(matrixDimension): for j in range(matrixDimension): matrix[i][j] = int(input()) max = 0 row_adder = 0 column_adder = 0 for i in range(matrixDimension - 2): for j in range(matrixDimension - 2...
class Solution(object): def minMeetingRooms(self, intervals): """ :type intervals: List[Interval] :rtype: int """ meetings = [] for i in intervals: meetings.append((i.start, 1)) meetings.append((i.end, 0)) meetings.sort() ...
class Solution(object): def min_meeting_rooms(self, intervals): """ :type intervals: List[Interval] :rtype: int """ meetings = [] for i in intervals: meetings.append((i.start, 1)) meetings.append((i.end, 0)) meetings.sort() ans...
class Solution(object): def findMaxLength(self, nums): dic = {0: -1} count = 0 maxlen = 0 for x in range(0, len(nums)): count += (1 if nums[x] == 1 else - 1) if count not in dic: dic[count] = x else: maxlen = max(max...
class Solution(object): def find_max_length(self, nums): dic = {0: -1} count = 0 maxlen = 0 for x in range(0, len(nums)): count += 1 if nums[x] == 1 else -1 if count not in dic: dic[count] = x else: maxlen = max(max...
class PredictionsHandler: def __init__(self): pass def get_prediction(self, current_value): pass
class Predictionshandler: def __init__(self): pass def get_prediction(self, current_value): pass
USER_TYPES = [ ('admin', 'Admin'), ('buyer', 'Buyer'), ('seller', 'Seller'), ]
user_types = [('admin', 'Admin'), ('buyer', 'Buyer'), ('seller', 'Seller')]
"""Job Class """ class Job(object): def __init__(self, salary=50000, salary_growth_rate=0.01, savings_rate=0.05): self.salary = salary self.salary_growth_rate = salary_growth_rate self.savings_rate = savings_rate def to_dict(self): return { 'salary': self.salary,...
"""Job Class """ class Job(object): def __init__(self, salary=50000, salary_growth_rate=0.01, savings_rate=0.05): self.salary = salary self.salary_growth_rate = salary_growth_rate self.savings_rate = savings_rate def to_dict(self): return {'salary': self.salary, 'salary_growt...
class BadInputError(Exception): pass class InvalidComponentError(Exception): pass class InvalidEngineError(Exception): pass
class Badinputerror(Exception): pass class Invalidcomponenterror(Exception): pass class Invalidengineerror(Exception): pass
def clef(inst): clef='treble' if inst=='flute': clef='treble' elif inst=='alto_flute': clef='treble' elif inst=='baritone_generic': clef='bass' elif inst=='bassoon': clef='bass' elif inst=='bass_cl': clef='bass' elif inst=='bass_drum': clef='tr...
def clef(inst): clef = 'treble' if inst == 'flute': clef = 'treble' elif inst == 'alto_flute': clef = 'treble' elif inst == 'baritone_generic': clef = 'bass' elif inst == 'bassoon': clef = 'bass' elif inst == 'bass_cl': clef = 'bass' elif inst == 'bass...
#Program to check if given string is palindrome or not. string=input(("Enter your string:")) if(string==string[::-1]): print("The string is a palindrome") else: print("The string is not a palindrome")
string = input('Enter your string:') if string == string[::-1]: print('The string is a palindrome') else: print('The string is not a palindrome')
# # PySNMP MIB module CTRON-FRONTPANEL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-FRONTPANEL-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:44:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
# Space: O(n) # Time: O(n) # DFS approach # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def pathSum(self, root, sum): def dfs(root, target): ...
class Solution: def path_sum(self, root, sum): def dfs(root, target): if root is None: return 0 count = 0 if root.val == target: count = 1 count += dfs(root.left, target - root.val) count += dfs(root.right, target ...
"""Collection of benchmarks and downstream tasks on embeddings .. autosummary:: :toctree: _autosummary analogy """
"""Collection of benchmarks and downstream tasks on embeddings .. autosummary:: :toctree: _autosummary analogy """
hrs = input("Enter Hours:") h = float(hrs) rph = input("enter rate per hour:") r = float(rph) if h <= 40: result = h * r else: o = h - 40 result = o * (r * 1.50) + 40 * r print(result) # desired output # 498.75
hrs = input('Enter Hours:') h = float(hrs) rph = input('enter rate per hour:') r = float(rph) if h <= 40: result = h * r else: o = h - 40 result = o * (r * 1.5) + 40 * r print(result)
class Solution: def isOneBitCharacter(self, bits: List[int]) -> bool: visited = False i = 0 while i<len(bits): if bits[i] ==0: if i==len(bits)-1: return True i+=1 else:...
class Solution: def is_one_bit_character(self, bits: List[int]) -> bool: visited = False i = 0 while i < len(bits): if bits[i] == 0: if i == len(bits) - 1: return True i += 1 else: i += 2 ret...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def sum_node(self, node, low, high): if node.val >= low and node.val <= high: ...
class Solution(object): def sum_node(self, node, low, high): if node.val >= low and node.val <= high: tmp_sum = node.val else: tmp_sum = 0 if node.val >= low: if node.left: tmp_left = self.sum_node(node.left, low, high) tmp...
# configure me config = { 'pytan_dir': '/Users/jolsen/gh/pytan/lib', 'tanium_username': 'Tanium User', 'tanium_password': 'T@n!um', 'tanium_host': '172.16.31.128', 'max_data_age': 60, 'pct_complete_threshold': 98.00, 'sync_scan_name': 'Run Patch Scan Synchronously', 'sync_scan_opts': { ...
config = {'pytan_dir': '/Users/jolsen/gh/pytan/lib', 'tanium_username': 'Tanium User', 'tanium_password': 'T@n!um', 'tanium_host': '172.16.31.128', 'max_data_age': 60, 'pct_complete_threshold': 98.0, 'sync_scan_name': 'Run Patch Scan Synchronously', 'sync_scan_opts': {'command': 'cmd /c cscript //T:3600 ..\\..\\Tools\\...
# # PySNMP MIB module Inverter-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Inverter-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:47:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ...
class BaseValidator: """ Base class for all the validators """ def __init__(self): pass @staticmethod def eq(first, second): return first == second @staticmethod def neq(first, second): return first != second @staticmethod def lt(first, second): ...
class Basevalidator: """ Base class for all the validators """ def __init__(self): pass @staticmethod def eq(first, second): return first == second @staticmethod def neq(first, second): return first != second @staticmethod def lt(first, second): ...
def max(param_list, meta): ret = None if (not len(param_list)): return None items = param_list[0].obj_list() if (not len(items)): return None max_val = items[0].anchor_value() ret = items[0] for i in items: if(i.anchor_value() > max_val): ret = i ...
def max(param_list, meta): ret = None if not len(param_list): return None items = param_list[0].obj_list() if not len(items): return None max_val = items[0].anchor_value() ret = items[0] for i in items: if i.anchor_value() > max_val: ret = i ma...
# # PySNMP MIB module ONEACCESS-VOICE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-VOICE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:34:45 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_intersection, constraints_union, value_range_constraint, value_size_constraint, single_value_constraint) ...
set_name(0x80079688, "GetTpY__FUs", SN_NOWARN) set_name(0x800796A4, "GetTpX__FUs", SN_NOWARN) set_name(0x800796B0, "Remove96__Fv", SN_NOWARN) set_name(0x800796E8, "AppMain", SN_NOWARN) set_name(0x80079788, "MAIN_RestartGameTask__Fv", SN_NOWARN) set_name(0x800797B4, "GameTask__FP4TASK", SN_NOWARN) set_name(0x8007989C, "...
set_name(2147980936, 'GetTpY__FUs', SN_NOWARN) set_name(2147980964, 'GetTpX__FUs', SN_NOWARN) set_name(2147980976, 'Remove96__Fv', SN_NOWARN) set_name(2147981032, 'AppMain', SN_NOWARN) set_name(2147981192, 'MAIN_RestartGameTask__Fv', SN_NOWARN) set_name(2147981236, 'GameTask__FP4TASK', SN_NOWARN) set_name(2147981468, '...
""" Laventine distance Given two string how many operation like addition, substraction and substitution required to change one word to other word. solving using dynamic problems """ def calcLaventenstineDistance(str1, str2, m, n): """ Calculate the Laventenstine Distance of between two strings """...
""" Laventine distance Given two string how many operation like addition, substraction and substitution required to change one word to other word. solving using dynamic problems """ def calc_laventenstine_distance(str1, str2, m, n): """ Calculate the Laventenstine Distance of between two strings """ ...
class BaseException(Exception): """ Sub-class this with your custom exceptions. """ def __init__(self, message, *args): """ :param str message: The message to show in the exception's string representation. """ Exception.__init__(self, message, *args) #...
class Baseexception(Exception): """ Sub-class this with your custom exceptions. """ def __init__(self, message, *args): """ :param str message: The message to show in the exception's string representation. """ Exception.__init__(self, message, *args) ...
if __name__ == "__main__": t = int(input()) while t>0: lst = [] lst_sorted = [] m = int(input()) lst = list(input().split()) for i in range(m): lst[i] = int(lst[i]) lst_sorted = lst.copy() lst_sorted.sort(reverse = True) count = 0 for i in range(m): if lst[i] == lst_sorted[i]: cou...
if __name__ == '__main__': t = int(input()) while t > 0: lst = [] lst_sorted = [] m = int(input()) lst = list(input().split()) for i in range(m): lst[i] = int(lst[i]) lst_sorted = lst.copy() lst_sorted.sort(reverse=True) count = 0 ...
#encoding:utf-8 subreddit = 'completeanarchy' t_channel = '@completeanarchy_tg' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'completeanarchy' t_channel = '@completeanarchy_tg' def send_post(submission, r2t): return r2t.send_simple(submission)
class Solution: def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ for i in range(0, len(board)): if not board: return False for j in range(0, len(board[0])): ...
class Solution: def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ for i in range(0, len(board)): if not board: return False for j in range(0, len(board[0])): if self...
Months = set(["January","February", "March", "April", "May", "June"]) print("printing the original set ... ") print(Months) print("Removing some months from the set..."); Months.discard("January"); Months.discard("aaa"); print("Printing the modified set..."); print(Months) print("looping through the set elements ....
months = set(['January', 'February', 'March', 'April', 'May', 'June']) print('printing the original set ... ') print(Months) print('Removing some months from the set...') Months.discard('January') Months.discard('aaa') print('Printing the modified set...') print(Months) print('looping through the set elements ... ') fo...
''' A decimal number is called deci-binary if each of its digits is either 0 or 1 without any leading zeros. For example, 101 and 1100 are deci-binary, while 112 and 3001 are not. Given a string n that represents a positive decimal integer, return the minimum number of positive deci-binary ...
""" A decimal number is called deci-binary if each of its digits is either 0 or 1 without any leading zeros. For example, 101 and 1100 are deci-binary, while 112 and 3001 are not. Given a string n that represents a positive decimal integer, return the minimum number of positive deci-binary ...
def run() -> int: last_factor, current = 1, 2 target = 600851475143 while target > 1: if target % current == 0: target //= current last_factor, current = current, 2 else: current += 1 if current == 2 else 2 return last_factor if __name__ == '__main__...
def run() -> int: (last_factor, current) = (1, 2) target = 600851475143 while target > 1: if target % current == 0: target //= current (last_factor, current) = (current, 2) else: current += 1 if current == 2 else 2 return last_factor if __name__ == '__...
# # @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], extraCandies: int) -> List[bool]: return list(map(lambda c: max(candies) <= c+extraCandies, candies)) # @lc code=end
class Solution: def kids_with_candies(self, candies: List[int], extraCandies: int) -> List[bool]: return list(map(lambda c: max(candies) <= c + extraCandies, candies))
class FlatData(object): def __init__(self, data, order=None): self.data = data self.columns = [] self.table = {} self.headers = [] self.rows = [] self.order = order self.flatten_data() def flatten_data(self): row_count = 0 if isinstance(...
class Flatdata(object): def __init__(self, data, order=None): self.data = data self.columns = [] self.table = {} self.headers = [] self.rows = [] self.order = order self.flatten_data() def flatten_data(self): row_count = 0 if isinstance(s...
class ListNode: def __init__(self,x): self.value = x self.next = None class Solution: def deleteDuplicates(self,head): # type head: Linked Node # rtype: ListNode slow = head if slow == None: return head fast = head.next while(fast != N...
class Listnode: def __init__(self, x): self.value = x self.next = None class Solution: def delete_duplicates(self, head): slow = head if slow == None: return head fast = head.next while fast != None: if fast.value == slow.value: ...
# -*- coding: utf-8 -*- def main(): n, m, k, e = map(int, input().split()) a = sorted(list(map(int, input().split()))) b = [e] + sorted(list(map(int, input().split())), reverse=True) sum_a = sum(a) sum_b = sum(b[:k + 1]) count = 0 total = 0 if sum_b >= sum_a: prin...
def main(): (n, m, k, e) = map(int, input().split()) a = sorted(list(map(int, input().split()))) b = [e] + sorted(list(map(int, input().split())), reverse=True) sum_a = sum(a) sum_b = sum(b[:k + 1]) count = 0 total = 0 if sum_b >= sum_a: print('Yes') for i in range(k + 1)...
load("@io_bazel_rules_scala//scala:scala.bzl", uppstream_lib = "scala_library", uppstream_macro = "scala_macro_library", uppstream_bin = "scala_binary", uppstream_test = "scala_test", uppstream_scala_library_suite = "scala_library_suite") _default_scalac_opts = [ "-Ywarn-dead-code", "-...
load('@io_bazel_rules_scala//scala:scala.bzl', uppstream_lib='scala_library', uppstream_macro='scala_macro_library', uppstream_bin='scala_binary', uppstream_test='scala_test', uppstream_scala_library_suite='scala_library_suite') _default_scalac_opts = ['-Ywarn-dead-code', '-Ywarn-value-discard', '-Ypartial-unification'...
# # PySNMP MIB module Unisphere-Data-ISIS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-ISIS-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:31:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint) ...
"""Token representation.""" INTEGER = 'INTEGER' REAL = 'REAL' INTEGER_CONST = 'INTEGER_CONST' REAL_CONST = 'REAL_CONST' PLUS = 'PLUS' MINUS = 'MINUS' MUL = 'MUL' INTEGER_DIV = 'INTEGER_DIV' FLOAT_DIV = 'FLOAT_DIV' LPAREN = 'LPAREN' RPAREN = 'RPAREN' ID = 'ID' ASSIGN = 'ASSIGN' BEGIN = 'BEGIN' END = 'END' SEMI = 'SEMI'...
"""Token representation.""" integer = 'INTEGER' real = 'REAL' integer_const = 'INTEGER_CONST' real_const = 'REAL_CONST' plus = 'PLUS' minus = 'MINUS' mul = 'MUL' integer_div = 'INTEGER_DIV' float_div = 'FLOAT_DIV' lparen = 'LPAREN' rparen = 'RPAREN' id = 'ID' assign = 'ASSIGN' begin = 'BEGIN' end = 'END' semi = 'SEMI' ...
Time = float TimeInterval = float StepCount = int def repr_time(time: Time) -> str: return '{:.2e}'.format(time)
time = float time_interval = float step_count = int def repr_time(time: Time) -> str: return '{:.2e}'.format(time)
class DecisionTree: """ :brief: This class is the implementation of the Decision Tree CART algorithm. """ headers = [] def __init__(self, max_depth=float('inf'), min_samples_split=2, min_samples_leaf=1): """ :brief: Trivial constructor. :param max_depth: is the ...
class Decisiontree: """ :brief: This class is the implementation of the Decision Tree CART algorithm. """ headers = [] def __init__(self, max_depth=float('inf'), min_samples_split=2, min_samples_leaf=1): """ :brief: Trivial constructor. :param max_depth: is the max depth of...
_base_ = "./ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_woDepth_edgeLower_refinePM10_01_02MasterChefCan.py" OUTPUT_DIR = ( "output/self6dpp/ssYCBV/ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_woDepth_edgeLower_refinePM10/09_10PottedMeatCan" ) DATASETS = dict( TRAIN=("ycbv_010_potted_meat_can_train_real_aligned_K...
_base_ = './ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_woDepth_edgeLower_refinePM10_01_02MasterChefCan.py' output_dir = 'output/self6dpp/ssYCBV/ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_woDepth_edgeLower_refinePM10/09_10PottedMeatCan' datasets = dict(TRAIN=('ycbv_010_potted_meat_can_train_real_aligned_Kuw',), TRAIN2...
# # PySNMP MIB module CONTROL-SUNMANAGEMENTCENTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONTROL-SUNMANAGEMENTCENTER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:11:04 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pytho...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ...
# Logic to Select the Block that has Crime News def is_crime_news(tag): # Find All the Div's with section-title as class blocks = tag.findAll('div', {'class': 'section-title'}) if blocks: for block in blocks: # check if the Block is a Crime News Block return block and block...
def is_crime_news(tag): blocks = tag.findAll('div', {'class': 'section-title'}) if blocks: for block in blocks: return block and block.find('span') and str(block.find('span').text).__eq__('Crime')
# a predicate returns True or False and can raise ReductionDone to halt processing class ReductionDone(Exception): pass def reduce_list(list_to_reduce, predicate): reduced = [] for item in list_to_reduce: try: if predicate(item): reduced.append(item) except Re...
class Reductiondone(Exception): pass def reduce_list(list_to_reduce, predicate): reduced = [] for item in list_to_reduce: try: if predicate(item): reduced.append(item) except ReductionDone: break return reduced def sum_list(list_to_sum, predicate...
#!/usr/bin/env python # -*- coding: utf-8 -*- def check_setup(bboxes, setup): valid_setup = True computed_setup = {} valid_boxes = {} for item, item_nb in setup.items(): if bboxes[0][item] is None: valid_setup = False else: if bboxes[0][item].ndim == 2: ...
def check_setup(bboxes, setup): valid_setup = True computed_setup = {} valid_boxes = {} for (item, item_nb) in setup.items(): if bboxes[0][item] is None: valid_setup = False else: if bboxes[0][item].ndim == 2: box_nb = bboxes[0][item].shape[0] ...
# -*- coding: utf-8 -*- """ Some functions to handle data intended to be plotted through matplotlib """ __title__ = "filefunctions" __author__ = "Juliano Fischer Naves" __license__ = "Apache License 2.0" #date: Dec., 11, 2016 def extract_lines(myfile): """Returns the lines of a space separated file as a ...
""" Some functions to handle data intended to be plotted through matplotlib """ __title__ = 'filefunctions' __author__ = 'Juliano Fischer Naves' __license__ = 'Apache License 2.0' def extract_lines(myfile): """Returns the lines of a space separated file as a list let the file be: a b c d e f ...
## Count the Monkeys! ## 8 kyu ## https://www.codewars.com//kata/56f69d9f9400f508fb000ba7 def monkey_count(n): return list(range(1,n+1))
def monkey_count(n): return list(range(1, n + 1))
class Cuboid:#the Cuboid is the name of the class name = "Cuboid" #class attribute def __init__(self,lenght,breath,height,weight):#here we have given parameters which is l,b,h,w self.length = lenght self.breath = breath self.height = height self.weight = weight # Adding up a method, which is volume to cal...
class Cuboid: name = 'Cuboid' def __init__(self, lenght, breath, height, weight): self.length = lenght self.breath = breath self.height = height self.weight = weight def volume(self): x = self.length y = self.breath z = self.height v = x * y ...
def removeLetter(word, letter): return word.replace(letter, "") print(removeLetter("ban", "a"))
def remove_letter(word, letter): return word.replace(letter, '') print(remove_letter('ban', 'a'))
#################################################################################################### ########################################### vtools.vimg ############################################ ############################################ config.py ############################################# #################...
__version__ = '0.0.35' def _id_gen(): num = 0 while True: num += 1 yield str(num) __ident__ = _id_gen()
class Solution: def containsDuplicate(self, nums: List[int]) -> bool: # Normal Solution # if len(set(nums))==len(nums): # <--- Just comparing the number of element present in the list vs its set # return False # else: # return True #Using ...
class Solution: def contains_duplicate(self, nums: List[int]) -> bool: s = set() for i in nums: if i in s: return True s.add(i) return False
""" Author: Resul Emre AYGAN """ """ Project Description: Vowel Count Return the number (count) of vowels in the given string. We will consider a, e, i, o, u as vowels for this Kata (but not y). The input string will only consist of lower case letters and/or spaces. """ def get_count(input_str): return sum(ma...
""" Author: Resul Emre AYGAN """ '\nProject Description: Vowel Count\n\nReturn the number (count) of vowels in the given string.\n\nWe will consider a, e, i, o, u as vowels for this Kata (but not y).\n\nThe input string will only consist of lower case letters and/or spaces.\n' def get_count(input_str): return sum(...
# Hyppopy - A Hyper-Parameter Optimization Toolbox # # Copyright (c) German Cancer Research Center, # Division of Medical Image Computing. # All rights reserved. # # This software is distributed WITHOUT ANY WARRANTY; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. # # See L...
class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) return cls._instances[cls] @classmethod def __instancecheck__(mcs, instance): if instance._...
def group_services(feed, distinct_by_pattern=False): service_groups = get_groupable_services(feed, distinct_by_pattern) to_replace = {} for master, children in service_groups.items(): for child in children: to_replace.update({child: master}) # Replace in feed feed.trips['service_...
def group_services(feed, distinct_by_pattern=False): service_groups = get_groupable_services(feed, distinct_by_pattern) to_replace = {} for (master, children) in service_groups.items(): for child in children: to_replace.update({child: master}) feed.trips['service_id'] = feed.trips['s...
r, n = map(int, input().split()) l = [] found = False for i in range(n): l.append(int(input())) for i in range(1, r+1): if i not in l: print(i) found = True break if not found: print("too late")
(r, n) = map(int, input().split()) l = [] found = False for i in range(n): l.append(int(input())) for i in range(1, r + 1): if i not in l: print(i) found = True break if not found: print('too late')
#Implementation of the Sieve of Eratosthenes for enumerating all of the primes less than some integer n. Also includes a minor variant of it, #written for a Project Euler problem, which sums up the primes below n instead of returning a list of them. def primeSieve(n): boolList = [True] * (n + 1); primeList = []...
def prime_sieve(n): bool_list = [True] * (n + 1) prime_list = [] for i in range(2, n + 1): if boolList[i]: primeList.append(i) j = 2 * i while j < n + 1: boolList[j] = False j += i return primeList def sum_sieve(n): total =...
def Get_model(num_medical_conditions, num_drugs, layers=[16, 8], reg_layers=[0, 0]): assert len(layers) == len(reg_layers) num_layer = len(layers) # Number of layers in the MLP medical_condition_input = Input( shape=(1,), dtype='int32', name='user_input') drug_input = Input(shape=(1,), dty...
def get_model(num_medical_conditions, num_drugs, layers=[16, 8], reg_layers=[0, 0]): assert len(layers) == len(reg_layers) num_layer = len(layers) medical_condition_input = input(shape=(1,), dtype='int32', name='user_input') drug_input = input(shape=(1,), dtype='int32', name='item_input') mlp__embed...
class MusicalKeyboard: def __init__(self, brand, model, color, keys): self.brand = brand.upper() self.model = model.upper() self.color = color.capitalize() self.keys = keys def display_brand(self): return self.brand def display_model(self): return self.mode...
class Musicalkeyboard: def __init__(self, brand, model, color, keys): self.brand = brand.upper() self.model = model.upper() self.color = color.capitalize() self.keys = keys def display_brand(self): return self.brand def display_model(self): return self.mode...
# Time: O(n) # Space: O(h) # We want to use quad trees to store an N x N boolean grid. # Each cell in the grid can only be true or false. # The root node represents the whole grid. For each node, # it will be subdivided into four children nodes until the values # in the region it represents are all the same. # # Each...
class Node(object): def __init__(self, val, isLeaf, topLeft, topRight, bottomLeft, bottomRight): self.val = val self.isLeaf = isLeaf self.topLeft = topLeft self.topRight = topRight self.bottomLeft = bottomLeft self.bottomRight = bottomRight class Solution(object): ...
SSID1 = 'WiFi1' SALASANA1 = 'Salari1' SSID2 = 'WiFi2' SALASANA2 = 'Salari2' MQTT_SERVERI = 'ip' MQTT_PORTTI = '1883' MQTT_KAYTTAJA = 'useri' MQTT_SALASANA = 'salari' CLIENT_ID = "ESP32-etelaPIR1" DHCP_NIMI = "ESP32-etelaPIR" PIR_PINNI = 22 PIR_LIIKE_NOLLAUSAIKA = 5 AIHE_LIIKETUNNISTIN = 'koti/ulko/etela/pir...
ssid1 = 'WiFi1' salasana1 = 'Salari1' ssid2 = 'WiFi2' salasana2 = 'Salari2' mqtt_serveri = 'ip' mqtt_portti = '1883' mqtt_kayttaja = 'useri' mqtt_salasana = 'salari' client_id = 'ESP32-etelaPIR1' dhcp_nimi = 'ESP32-etelaPIR' pir_pinni = 22 pir_liike_nollausaika = 5 aihe_liiketunnistin = 'koti/ulko/etela/pir1' ntppalvel...
''' Now You Code 3: Shopping Cart In this program you will implement an online shopping cart using a Python list of dictionary. The program should start by allowing the user to enter: - Product name - Product price - Product quantity until the user enters a product name of 'checkout' after checkout the program s...
""" Now You Code 3: Shopping Cart In this program you will implement an online shopping cart using a Python list of dictionary. The program should start by allowing the user to enter: - Product name - Product price - Product quantity until the user enters a product name of 'checkout' after checkout the program s...
''' Title : Introduction to Sets Subdomain : Sets Domain : Python Author : codeperfectplus Created : 17 January 2020 ''' def average(array): # your code goes here array = set(array) return sum(array)/len(array) if __name__ == '__main__': n = int(input()) arr = list(map(int, input().spli...
""" Title : Introduction to Sets Subdomain : Sets Domain : Python Author : codeperfectplus Created : 17 January 2020 """ def average(array): array = set(array) return sum(array) / len(array) if __name__ == '__main__': n = int(input()) arr = list(map(int, input().split())) result = avera...
# python + maths are wonderful for j in range(int(input())): n = int(input()) ans = ((((2 * n + 3) * (n + 2) * (n + 1) // 6)) - (((2 + n + 1) // 2) * (n // 2 + 1)) * 2 + (n // 2 + 1)) * 2 - ((2 + n - 1) // 2) * (n // 2) * 6 - 3 print(ans % (10 ** 9 + 7))
for j in range(int(input())): n = int(input()) ans = ((2 * n + 3) * (n + 2) * (n + 1) // 6 - (2 + n + 1) // 2 * (n // 2 + 1) * 2 + (n // 2 + 1)) * 2 - (2 + n - 1) // 2 * (n // 2) * 6 - 3 print(ans % (10 ** 9 + 7))
class MangaListResult(list): def __init__(self, data) -> None: super().__init__(data.get('data')) self._limit = data.get('limit') self._offset = data.get('offset') self._total = data.get('total')
class Mangalistresult(list): def __init__(self, data) -> None: super().__init__(data.get('data')) self._limit = data.get('limit') self._offset = data.get('offset') self._total = data.get('total')
#!/usr/bin/env python3 def part1(): checksum = 0 with open('day02input.txt') as f: for line in f: line = line.split() l = list(map(int, line)) checksum += max(l) - min(l) print(checksum) def part2(): checksum = 0 with open('day02input.txt') as f: ...
def part1(): checksum = 0 with open('day02input.txt') as f: for line in f: line = line.split() l = list(map(int, line)) checksum += max(l) - min(l) print(checksum) def part2(): checksum = 0 with open('day02input.txt') as f: for line in f: ...
#! /usr/bin/env python3 # # Scrabble Game # Author: Chris Lyon # Contact: chris@cplyon.ca class Tile: def __init__(self, letter, score): self.letter = letter self.score = score def __str__(self): return f"({self.letter},{self.score})"
class Tile: def __init__(self, letter, score): self.letter = letter self.score = score def __str__(self): return f'({self.letter},{self.score})'
""" Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. Example 1: Input: s = "aab", Output: 1 Explanation: The palindrome partitioning ["aa","b"] could be produced using 1 cut. Example 2: Input: s = "a", Output...
""" Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. Example 1: Input: s = "aab", Output: 1 Explanation: The palindrome partitioning ["aa","b"] could be produced using 1 cut. Example 2: Input: s = "a", Output...
class MyLightCycleBot(LightCycleBaseBot): def get_next_step(self, arena, x, y): # Should return north, south, east or west return
class Mylightcyclebot(LightCycleBaseBot): def get_next_step(self, arena, x, y): return
# # PySNMP MIB module ISIS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ISIS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:02:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ...
class State: POMODORO = 'pomodoro' SHORT_BREAK = 'short break' LONG_BREAK = 'long break' COUNTDOWN = 'countdown' class AlertPath: POMO_START = '/app/bot/sounds/pomo_start.mp3' POMO_END = '/app/bot/sounds/pomo_end.mp3' LONG_BREAK_START = '/app/bot/sounds/long_break.mp3'
class State: pomodoro = 'pomodoro' short_break = 'short break' long_break = 'long break' countdown = 'countdown' class Alertpath: pomo_start = '/app/bot/sounds/pomo_start.mp3' pomo_end = '/app/bot/sounds/pomo_end.mp3' long_break_start = '/app/bot/sounds/long_break.mp3'
class ExcelProcessor: def __init__(self, xlsfilepath) -> None: super().__init__() self.xlsfilepath = xlsfilepath def bound(self)->tuple: pass def readCellValue(self, row, col): pass def writeCellValue(self, row, col, val): pass def insertRowBefore(self, ro...
class Excelprocessor: def __init__(self, xlsfilepath) -> None: super().__init__() self.xlsfilepath = xlsfilepath def bound(self) -> tuple: pass def read_cell_value(self, row, col): pass def write_cell_value(self, row, col, val): pass def insert_row_before...
def _dump_llvm(f, output_func): d = f.inspect_llvm() if isinstance(d, dict): for ty, code in d.items(): output_func("\n===== {}\n{}".format(ty, code)) else: output_func("\n" + d) def dump_numba_llvm(func): out = print module = __import__(func.__module__) if hasattr(...
def _dump_llvm(f, output_func): d = f.inspect_llvm() if isinstance(d, dict): for (ty, code) in d.items(): output_func('\n===== {}\n{}'.format(ty, code)) else: output_func('\n' + d) def dump_numba_llvm(func): out = print module = __import__(func.__module__) if hasattr...
class Individual: def __init__(self): self.dna = [] self.fit_value = 0
class Individual: def __init__(self): self.dna = [] self.fit_value = 0
class CFNType(object): def __init__(self, parameter_type): """Represents a CloudFormation Parameter Type. :class`CFNType`` can be used as the `type` for a Blueprint variable. Unlike other variables, a variable with `type` :class:`CFNType`, will be submitted to CloudFormation as a...
class Cfntype(object): def __init__(self, parameter_type): """Represents a CloudFormation Parameter Type. :class`CFNType`` can be used as the `type` for a Blueprint variable. Unlike other variables, a variable with `type` :class:`CFNType`, will be submitted to CloudFormation as a P...
#W.A.P TO FIND THE SUM OF DIGITS OF A NUMBER x=int(input('Enter a no.')) sum=0 t=x while(t!=0): sum=sum+int(t%10) t=t/10 print('Sum of digits of',int(x),'is:',sum)
x = int(input('Enter a no.')) sum = 0 t = x while t != 0: sum = sum + int(t % 10) t = t / 10 print('Sum of digits of', int(x), 'is:', sum)
while True: try: rooms = int(input("\nHow many rooms total? ")) break except: print("Only integers are accepted for total rooms.") inches = 0 for i in range(rooms): length = 0 while True: try: length = int(input("\nLength of room " + str(i+1) + " in inches? "...
while True: try: rooms = int(input('\nHow many rooms total? ')) break except: print('Only integers are accepted for total rooms.') inches = 0 for i in range(rooms): length = 0 while True: try: length = int(input('\nLength of room ' + str(i + 1) + ' in inches? ...
########################################################### # Populate the following variables with your desired values. # When done editing this file, rename it to _settings.py and leave it in the same directory. ### local directory to save data. # This is relevant to the decorator called _backupDFs in ReadWrite. ...
local_dir_to_save_data = ''
class RequestParameter: name: str value: str def __init__(self, name: str, value: str): self.name = name self.value = value
class Requestparameter: name: str value: str def __init__(self, name: str, value: str): self.name = name self.value = value
# -*- coding: utf-8 -*- type_table = { -2: 'Undefined device type.', -1: 'All devices type.', 0: 'Regulator type.', 1: 'Transformer type.', 2: 'Breaker type.', 3: 'LVCB type.', 4: 'Recloser type.', 5: 'Sectionalizer type.', 6: 'Switch type.', 7: 'Fuse type.', 8: 'Series Capacitor type.', 9: 'Seri...
type_table = {-2: 'Undefined device type.', -1: 'All devices type.', 0: 'Regulator type.', 1: 'Transformer type.', 2: 'Breaker type.', 3: 'LVCB type.', 4: 'Recloser type.', 5: 'Sectionalizer type.', 6: 'Switch type.', 7: 'Fuse type.', 8: 'Series Capacitor type.', 9: 'Series Reactor type.', 10: 'Underground type.', 11: ...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def insertNode(root, data): if root == None: root = Node(data) else: if root.data > data: root.left = insertNode(root.left, data) elif root.data < data: ...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def insert_node(root, data): if root == None: root = node(data) elif root.data > data: root.left = insert_node(root.left, data) elif root.data < data: root.right = ...
# Python program to demonstrate creation of list # creating a list List = [] print(List) # creating a list of strings List = ['GeeksForGeeks', 'Geeks'] print(List) # Creating a Multi-Dimensional List List = [['Geeks', 'For'], ['Geeks']] print(List) # adding element to a list List = [] # using append...
list = [] print(List) list = ['GeeksForGeeks', 'Geeks'] print(List) list = [['Geeks', 'For'], ['Geeks']] print(List) list = [] List.append(1) List.append(2) print(List) List.insert(3, 12) print(List) List.insert(0, 'Geeks') print(List) List.extend([8, 'Geeks', 'Always']) print(List) list = [1, 2, 3, 4, 5, 6] print(List...
K280 = 0x1c K281 = 0x3c K282 = 0x5c K283 = 0x7c K284 = 0x9c K285 = 0xbc K286 = 0xdc K287 = 0xfc K237 = 0xf7 K277 = 0xfb K297 = 0xfd K307 = 0xfe K_K = K285 K_R = K280 K_A = K283 SOF = K281 EOF = K287 EIGTHS = {} EIGTHS[0x1c] = 'K280' EIGTHS[0x3c] = 'K281' EIGTHS[0x5c] = 'K282' EIGTHS[0x7c] = 'K283' E...
k280 = 28 k281 = 60 k282 = 92 k283 = 124 k284 = 156 k285 = 188 k286 = 220 k287 = 252 k237 = 247 k277 = 251 k297 = 253 k307 = 254 k_k = K285 k_r = K280 k_a = K283 sof = K281 eof = K287 eigths = {} EIGTHS[28] = 'K280' EIGTHS[60] = 'K281' EIGTHS[92] = 'K282' EIGTHS[124] = 'K283' EIGTHS[156] = 'K284' EIGTHS[188] = 'K285' E...
n = int(input('Enter a range : ')) t1, t2 = 0,1 count = 0 for i in range(count, n, 1): print(t1, end = ' ') t3 = t1+t2 t1 = t2 t2 = t3 print()
n = int(input('Enter a range : ')) (t1, t2) = (0, 1) count = 0 for i in range(count, n, 1): print(t1, end=' ') t3 = t1 + t2 t1 = t2 t2 = t3 print()
def convert_to_closest_value_divisible_by_5(num): """ :param num: input :return: either ?5 or ?0 for two-digit number """ last_digit = int(num % 10) base = num - last_digit if last_digit >= 5: base += 5 return base def find_factorial_zeros(num): count = 0 base = conve...
def convert_to_closest_value_divisible_by_5(num): """ :param num: input :return: either ?5 or ?0 for two-digit number """ last_digit = int(num % 10) base = num - last_digit if last_digit >= 5: base += 5 return base def find_factorial_zeros(num): count = 0 base = convert_...
#Base or parent class class Employee(): def __init__(self, name, age, level, salary): self.name = name self.age = age self.level = level self.salary = salary def work(self): print(f"{self.name} is working..........") #child class that will inherit the attributes and met...
class Employee: def __init__(self, name, age, level, salary): self.name = name self.age = age self.level = level self.salary = salary def work(self): print(f'{self.name} is working..........') class Datascientist(Employee): pass class Machinelearningengineer(Emplo...
class Padlock(object): def __init_(self, combination): self.combination = combination self.isOpen = False def open(self, combination_entered): if self.isOpen: print("The lock is alread open") else: if self.combination != combination_entered: ...
class Padlock(object): def __init_(self, combination): self.combination = combination self.isOpen = False def open(self, combination_entered): if self.isOpen: print('The lock is alread open') elif self.combination != combination_entered: print('You enter...
t = int(input()) def sumdig(arr, s): sum = 0 for a in arr: sum+=int(a) if(sum<=s): return True else: return False answer = [] for a in range(t): line = input().split() n = int(line[0]) copn = n s = int(line[1]) copx = list(str(n)) if(sumdig(copx,s)): ...
t = int(input()) def sumdig(arr, s): sum = 0 for a in arr: sum += int(a) if sum <= s: return True else: return False answer = [] for a in range(t): line = input().split() n = int(line[0]) copn = n s = int(line[1]) copx = list(str(n)) if sumdig(copx, s): ...
# 1. Accepts Nothing | Returns None def greet(): print("Hello Python") # 2. Accepts data | Returns None def greet_v2(name: str): print(f"Hello {name}") # 3. Accepts Nothing | Returns Value def greet_v3() -> str: return "Hello Python (V3)" # 4. Accepts data | Returns Value def greet_v4(name: str) -> str:...
def greet(): print('Hello Python') def greet_v2(name: str): print(f'Hello {name}') def greet_v3() -> str: return 'Hello Python (V3)' def greet_v4(name: str) -> str: return f'Hello {name} (V4)' def main(): results = greet() print(f'1. Results: {results}') results = greet_v2('Shiva') p...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Computational graph definition. ''' class Graph(object): ''' Graph containing all computing nodes. ''' def __init__(self): ''' Graph constructor. ''' self.operations, self.constants, self.placeholders = [], [], [] self.variab...
""" Computational graph definition. """ class Graph(object): """ Graph containing all computing nodes. """ def __init__(self): """ Graph constructor. """ (self.operations, self.constants, self.placeholders) = ([], [], []) (self.variables, self.trainable_variables) = ([], []...
#!/usr/bin/python3 """We have system to system conversion (metric <-> U.S. System)""" def catch_given_input(): print(f'\n\033[1m**Enter your desired conversion...\033[0m\n') from_qty = input(f'\033[1;33m - From:\033[0m ') to_qty = input(f'\033[1;32m - To:\033[0m ') return from_qty, to_qty def del...
"""We have system to system conversion (metric <-> U.S. System)""" def catch_given_input(): print(f'\n\x1b[1m**Enter your desired conversion...\x1b[0m\n') from_qty = input(f'\x1b[1;33m - From:\x1b[0m ') to_qty = input(f'\x1b[1;32m - To:\x1b[0m ') return (from_qty, to_qty) def delimiter_fields(from_val...