content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class ErroresLexicos(): ''' Parametros: - Descripcion:str Descripcion - linea y columna:numeric linea y columna - clase origen:str Sirve para decir en que clase del patron interprete trono ''' def __init__(self, des...
class Erroreslexicos: """ Parametros: - Descripcion:str Descripcion - linea y columna:numeric linea y columna - clase origen:str Sirve para decir en que clase del patron interprete trono """ def __init__(self, descr...
# # PySNMP MIB module CISCO-PORT-CHANNEL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-PORT-CHANNEL-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:09:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint, constraints_union) ...
if __name__ == '__main__': na = int(input()) a = list(map(int,input().split())) nb = int(input()) b = list(map(int, input().split())) if len(a) == na and len(b) == nb: set_a = set(a) set_b = set(b) symmetric_diff = list(set_a.symmetric_difference(set_b)) symmetric_d...
if __name__ == '__main__': na = int(input()) a = list(map(int, input().split())) nb = int(input()) b = list(map(int, input().split())) if len(a) == na and len(b) == nb: set_a = set(a) set_b = set(b) symmetric_diff = list(set_a.symmetric_difference(set_b)) symmetric_di...
__author__ = "Dylan Hamel" __version__ = "0.1" __email__ = "dylan.hamel@protonmail.com" __status__ = "Prototype"
__author__ = 'Dylan Hamel' __version__ = '0.1' __email__ = 'dylan.hamel@protonmail.com' __status__ = 'Prototype'
budget = float(input()) season = input() budget_spent = 0 destination = "" place = "" if budget <= 100: if season == "summer": budget_spent = budget * 0.30 destination = "Bulgaria" place = "Camp" else: budget_spent = budget * 0.70 destination = "Bulgaria" place ...
budget = float(input()) season = input() budget_spent = 0 destination = '' place = '' if budget <= 100: if season == 'summer': budget_spent = budget * 0.3 destination = 'Bulgaria' place = 'Camp' else: budget_spent = budget * 0.7 destination = 'Bulgaria' place = 'H...
def ma_methode(x = 0, y = 0): print(x,y) a = 1 b = 2 ma_methode() ma_methode(a) ma_methode(a,b) y = 10; ma_methode(y) ma_methode(y = 10)
def ma_methode(x=0, y=0): print(x, y) a = 1 b = 2 ma_methode() ma_methode(a) ma_methode(a, b) y = 10 ma_methode(y) ma_methode(y=10)
class TestSettings(object): ETCD_PREFIX = '/config/etcd_settings' ETCD_ENV = 'test' ETCD_HOST = 'etcd' ETCD_PORT = 2379 ETCD_USERNAME = 'test' ETCD_PASSWORD = 'test' ETCD_DETAILS = dict( host='etcd', port=2379, prefix='/config/etcd_settings', username='test',...
class Testsettings(object): etcd_prefix = '/config/etcd_settings' etcd_env = 'test' etcd_host = 'etcd' etcd_port = 2379 etcd_username = 'test' etcd_password = 'test' etcd_details = dict(host='etcd', port=2379, prefix='/config/etcd_settings', username='test', password='test') settings = test_...
def length_of_longest_substring(s): l, r, max_len = 0, 0, 0 while r < len(s): substring = s[l:r + 1] max_len = max(max_len, len(substring)) if r + 1 < len(s) and s[r + 1] in substring: l += 1 else: r += 1 return max_len def length_of_longest_subst...
def length_of_longest_substring(s): (l, r, max_len) = (0, 0, 0) while r < len(s): substring = s[l:r + 1] max_len = max(max_len, len(substring)) if r + 1 < len(s) and s[r + 1] in substring: l += 1 else: r += 1 return max_len def length_of_longest_subst...
def aoc(data): total = 0 min, max = data.split("-") for x in [str(x) for x in range(int(min), int(max))]: inc = True double = False for i, d in enumerate(x[1:]): if d < x[i]: inc = False break for i, d in enumerate(x): ...
def aoc(data): total = 0 (min, max) = data.split('-') for x in [str(x) for x in range(int(min), int(max))]: inc = True double = False for (i, d) in enumerate(x[1:]): if d < x[i]: inc = False break for (i, d) in enumerate(x): ...
def swap_case(s): a="" for i in range(len(s)): if s[i].islower(): a=a+s[i].upper() else: a=a+s[i].lower() return a
def swap_case(s): a = '' for i in range(len(s)): if s[i].islower(): a = a + s[i].upper() else: a = a + s[i].lower() return a
expected_output = { "backbone_fast": False, "bpdu_filter": False, "bpdu_guard": False, "bridge_assurance": True, "configured_pathcost": {"method": "short"}, "etherchannel_misconfig_guard": True, "extended_system_id": True, "loop_guard": False, "mode": { "rapid_pvst": { ...
expected_output = {'backbone_fast': False, 'bpdu_filter': False, 'bpdu_guard': False, 'bridge_assurance': True, 'configured_pathcost': {'method': 'short'}, 'etherchannel_misconfig_guard': True, 'extended_system_id': True, 'loop_guard': False, 'mode': {'rapid_pvst': {'VLAN0001': {'blocking': 0, 'forwarding': 2, 'learnin...
f = open('pierwsze.txt', 'w') for item in range(2,100+1): for number in range(2,item): if item % number == 0: break else: f.write(str(item)) f.write(" ") f.close()
f = open('pierwsze.txt', 'w') for item in range(2, 100 + 1): for number in range(2, item): if item % number == 0: break else: f.write(str(item)) f.write(' ') f.close()
def maximo (a, b, c): if a>b and a>c: return a elif b>a and b>c: return b elif c>b and c>a: return c else: return a x = int(input("primeiro numero")) y= int( input("Segundo numero")) z = int( input("terceiro numero")) w=maximo(x,y,z) print(w)
def maximo(a, b, c): if a > b and a > c: return a elif b > a and b > c: return b elif c > b and c > a: return c else: return a x = int(input('primeiro numero')) y = int(input('Segundo numero')) z = int(input('terceiro numero')) w = maximo(x, y, z) print(w)
#Grace Kelly 07/03/2018 #Exercise 5 #Read iris data set #Print out four numerical values #Decimal places aligned #Space between columns with open("data/iris.csv") as f: for line in f: print(line.split(',') [:4])
with open('data/iris.csv') as f: for line in f: print(line.split(',')[:4])
# # PySNMP MIB module CISCOSB-rlIP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-rlIP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:24:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ...
class Solution: def isPalindrome(self, x: int) -> bool: if x < 0: return False digits = [] while x: digits.append(x % 10) x = int(x / 10) return digits == list(reversed(digits))
class Solution: def is_palindrome(self, x: int) -> bool: if x < 0: return False digits = [] while x: digits.append(x % 10) x = int(x / 10) return digits == list(reversed(digits))
a = float(input()) b = float(input()) c = float(input()) d = float(input()) e = float(input()) f = float(input()) if a == 0 and b == 0 and c == 0 and d == 0 and e == 0 and f == 0: print(5) elif a * d == b * c and a * f != c * e: print(0) elif a == 0 and b == 0 and e != 0: print(0) elif c == 0 and d == 0 an...
a = float(input()) b = float(input()) c = float(input()) d = float(input()) e = float(input()) f = float(input()) if a == 0 and b == 0 and (c == 0) and (d == 0) and (e == 0) and (f == 0): print(5) elif a * d == b * c and a * f != c * e: print(0) elif a == 0 and b == 0 and (e != 0): print(0) elif c == 0 and ...
class Solution: def sumOfDistancesInTree(self, n: int, edges: List[List[int]]) -> List[int]: graph = collections.defaultdict(set) for u, v in edges: graph[u].add(v) graph[v].add(u) count = [1 for _ in range(n)] ans = [0 for _ in range(n)] def...
class Solution: def sum_of_distances_in_tree(self, n: int, edges: List[List[int]]) -> List[int]: graph = collections.defaultdict(set) for (u, v) in edges: graph[u].add(v) graph[v].add(u) count = [1 for _ in range(n)] ans = [0 for _ in range(n)] def p...
# # PySNMP MIB module RFC1215-MIB (http://pysnmp.sf.net) # ( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") ( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ( ConstraintsUnion, SingleValueConstraint, ConstraintsInt...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ...
# Deleting tuples my_tuple = ('p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z') # can't delete items # TypeError: 'tuple' object doesn't support item deletion # del my_tuple[3] # Must delete an entire tuple del my_tuple # NameError: name 'my_tuple' is not defined print(my_tuple)
my_tuple = ('p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z') del my_tuple print(my_tuple)
class Solution: def largestSumAfterKNegations(self, A: List[int], K: int) -> int: heapq.heapify(A) for _ in range(K): val = heapq.heappop(A) heapq.heappush(A, -val) return sum(A)
class Solution: def largest_sum_after_k_negations(self, A: List[int], K: int) -> int: heapq.heapify(A) for _ in range(K): val = heapq.heappop(A) heapq.heappush(A, -val) return sum(A)
# Category description for the widget registry NAME = "SRW ESRF Extension" DESCRIPTION = "Widgets for SRW" BACKGROUND = "#969fde" ICON = "icons/esrf2.png" PRIORITY = 204
name = 'SRW ESRF Extension' description = 'Widgets for SRW' background = '#969fde' icon = 'icons/esrf2.png' priority = 204
San_Francisco_polygon = [[37.837174338616975,-122.48725891113281],[37.83364941345965,-122.48485565185547],[37.83093781796035,-122.4814224243164],[37.82415839321614,-122.48004913330078],[37.8203616433087,-122.47970581054688],[37.81059767530207,-122.47798919677734],[37.806122091729485,-122.47627258300781],[37.79215110146...
san__francisco_polygon = [[37.837174338616975, -122.48725891113281], [37.83364941345965, -122.48485565185547], [37.83093781796035, -122.4814224243164], [37.82415839321614, -122.48004913330078], [37.8203616433087, -122.47970581054688], [37.81059767530207, -122.47798919677734], [37.806122091729485, -122.47627258300781], ...
class EmptyQueueError(Exception): pass class DualStructureError(Exception): pass class ConservativeVolumeError(Exception): pass class PmsFluxFacesError(Exception): pass
class Emptyqueueerror(Exception): pass class Dualstructureerror(Exception): pass class Conservativevolumeerror(Exception): pass class Pmsfluxfaceserror(Exception): pass
dias = int(input('Digite os dias: ')) * 60 * 60 * 24 horas = int(input('Digite as horas: ')) * 60 * 60 minutos = int(input('Digite os minutos: ')) * 60 segundos = int(input('Digite os segundos: ')) print ('O total dias em segundos: %d' % dias) print ('O total de horas em segundos: %d' % horas) print ('O total d...
dias = int(input('Digite os dias: ')) * 60 * 60 * 24 horas = int(input('Digite as horas: ')) * 60 * 60 minutos = int(input('Digite os minutos: ')) * 60 segundos = int(input('Digite os segundos: ')) print('O total dias em segundos: %d' % dias) print('O total de horas em segundos: %d' % horas) print('O total de minutos e...
def apply_formatting_options(func): def wrapper(self, *args, **kwargs): type_config_dict = getattr(self, 'type_config_dict') supplied_key = args[0] supplied_value = args[1] anonymized_value = func(self, supplied_key, supplied_value) if type_config_dict.get('upper'): ...
def apply_formatting_options(func): def wrapper(self, *args, **kwargs): type_config_dict = getattr(self, 'type_config_dict') supplied_key = args[0] supplied_value = args[1] anonymized_value = func(self, supplied_key, supplied_value) if type_config_dict.get('upper'): ...
# nlantau, 2021-02-01 a1 = [-1,5,10,20,28,3] a2 = [26,134,135,15,17] sample_output = [28,26] def smallestDifference_passed7outof10(a, b): a.sort() b.sort() res = list() for i in a: t = max(a) + max(b) for j in b: if abs(j-i) < t: t = abs(j-i) ...
a1 = [-1, 5, 10, 20, 28, 3] a2 = [26, 134, 135, 15, 17] sample_output = [28, 26] def smallest_difference_passed7outof10(a, b): a.sort() b.sort() res = list() for i in a: t = max(a) + max(b) for j in b: if abs(j - i) < t: t = abs(j - i) res.cle...
if __name__ == "__main__": result = 1 for i in range(100): result *= i + 1 result = str(result) res = 0 for i in result: res += int(i) print("100! = ", res, "\n")
if __name__ == '__main__': result = 1 for i in range(100): result *= i + 1 result = str(result) res = 0 for i in result: res += int(i) print('100! = ', res, '\n')
name = 'therm_PRF.dat' fin = open(name,'r') fout = open(name+'_upper','w') for line in fin: fout.write(line.upper())
name = 'therm_PRF.dat' fin = open(name, 'r') fout = open(name + '_upper', 'w') for line in fin: fout.write(line.upper())
mozilla = [ 'Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:2.0b4) Gecko/20100818', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a3pre) Gecko/20070330', 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko', 'Mozi...
mozilla = ['Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:2.0b4) Gecko/20100818', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a3pre) Gecko/20070330', 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko', 'Mozilla/5.0 (Windows; U; ...
A, B = map(int, input().split()) if 6*A < B or A > B: print('No') else: print('Yes')
(a, b) = map(int, input().split()) if 6 * A < B or A > B: print('No') else: print('Yes')
# # PySNMP MIB module RAD-SONET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RAD-SONET-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:36:10 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, value_range_constraint, constraints_intersection, single_value_constraint) ...
class General(): ''' this class runs the experiments with given number of users of each category ''' def __init__(self, p_manager, c_manager, environment): self.person_manager = p_manager self.context_manager = c_manager self.environment = environment self.rewards_log = ...
class General: """ this class runs the experiments with given number of users of each category """ def __init__(self, p_manager, c_manager, environment): self.person_manager = p_manager self.context_manager = c_manager self.environment = environment self.rewards_log = []...
# usando generator, ele comsome menos memoria generator = (i ** 2 for i in range(10) if i % 2 == 0) #o next serve para extrair o valor do generator, importante o generator nbao e uma tupla print(next(generator)) print(next(generator)) print(next(generator)) print(next(generator)) print(next(generator)) # print(next(ge...
generator = (i ** 2 for i in range(10) if i % 2 == 0) print(next(generator)) print(next(generator)) print(next(generator)) print(next(generator)) print(next(generator))
def reverse_string(string): reversed_list = [] string_as_list = list(string) while string_as_list: reversed_list.append(string_as_list.pop()) print(''.join(reversed_list)) reverse_string(input())
def reverse_string(string): reversed_list = [] string_as_list = list(string) while string_as_list: reversed_list.append(string_as_list.pop()) print(''.join(reversed_list)) reverse_string(input())
n, m = map(int, input().split()) for _ in range(n): k, v = input().split()
(n, m) = map(int, input().split()) for _ in range(n): (k, v) = input().split()
#entrada e, f, c = str(input()).split() e = int(e) f = int(f) c = int(c) #processamento totalGarrafasVazias = e + f totalRefri = 0 while totalGarrafasVazias >= c: aux = totalGarrafasVazias // c totalRefri += aux totalGarrafasVazias = aux + (totalGarrafasVazias % c) #saida print(totalRefri)
(e, f, c) = str(input()).split() e = int(e) f = int(f) c = int(c) total_garrafas_vazias = e + f total_refri = 0 while totalGarrafasVazias >= c: aux = totalGarrafasVazias // c total_refri += aux total_garrafas_vazias = aux + totalGarrafasVazias % c print(totalRefri)
f1 = 10 print(f1) if f1: a1 = 1 a2 = 2 a3 = 3 a4 = 4 a5 = 5 a6 = 6 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) a1 = 1 a2 = 2 a3 = 3 a4 = 4 a5 = 5 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) ...
f1 = 10 print(f1) if f1: a1 = 1 a2 = 2 a3 = 3 a4 = 4 a5 = 5 a6 = 6 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) a1 = 1 a2 = 2 a3 = 3 a4 = 4 a5 = 5 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) ...
class ZException(Exception): ''' Exception when z0 is suboptimal. ''' def __init__(self, text, z, *args): super(ZException, self).__init__(text, z, *args) self.text = text self.z = z
class Zexception(Exception): """ Exception when z0 is suboptimal. """ def __init__(self, text, z, *args): super(ZException, self).__init__(text, z, *args) self.text = text self.z = z
# # PySNMP MIB module TUBS-PROC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TUBS-PROC-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:27:58 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_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ...
def operate(opcode, arg1, arg2): if (opcode==1): return arg1+arg2 elif (opcode==2): return arg1*arg2 elif (opcode==3): return arg1 elif (opcode==4): return arg1
def operate(opcode, arg1, arg2): if opcode == 1: return arg1 + arg2 elif opcode == 2: return arg1 * arg2 elif opcode == 3: return arg1 elif opcode == 4: return arg1
class event(object): def __init__(self): self.__funcs = set() def invoke(self, *args): for f in self.__funcs: f.__call__(*args) def reg(self, func): self.__funcs.add(func)
class Event(object): def __init__(self): self.__funcs = set() def invoke(self, *args): for f in self.__funcs: f.__call__(*args) def reg(self, func): self.__funcs.add(func)
cycle_info={} # populate some example cycle info cycle_info['cycle']=1 cycle_info['time']=1.0 print(cycle_info)
cycle_info = {} cycle_info['cycle'] = 1 cycle_info['time'] = 1.0 print(cycle_info)
#!/usr/bin/env python3 def minimumBribes(q): bribes = 0 for i in range(len(q) - 1, -1, -1): if q[i] - (i + 1) > 2: print("Too chaotic") return for j in range(max(0, q[i] - 2), i): if q[j] > q[i]: bribes += 1 print(bribes) if __name__ ==...
def minimum_bribes(q): bribes = 0 for i in range(len(q) - 1, -1, -1): if q[i] - (i + 1) > 2: print('Too chaotic') return for j in range(max(0, q[i] - 2), i): if q[j] > q[i]: bribes += 1 print(bribes) if __name__ == '__main__': t = int(i...
file = open('./input.txt', 'r') string = file.read() lines = string.split() int_lines = list(map(lambda x: int(x), lines)) result = 0 last_value = 10000 for value in int_lines: if last_value < value: result += 1 last_value = value print(result)
file = open('./input.txt', 'r') string = file.read() lines = string.split() int_lines = list(map(lambda x: int(x), lines)) result = 0 last_value = 10000 for value in int_lines: if last_value < value: result += 1 last_value = value print(result)
words_splitted = input("Give me some words: ") words = words_splitted.split(",") counter = 0 for i in range(len(words)): if words[i-1].isalpha() == True: counter += 1 print(counter)
words_splitted = input('Give me some words: ') words = words_splitted.split(',') counter = 0 for i in range(len(words)): if words[i - 1].isalpha() == True: counter += 1 print(counter)
def test_vcf(filename): with open(filename, encoding='utf-8') as handle: for index, line in enumerate(handle): line = line.replace('\n', '') # Already read meta and header in self.__init__ if line.startswith('#'): continue list_line = line.sp...
def test_vcf(filename): with open(filename, encoding='utf-8') as handle: for (index, line) in enumerate(handle): line = line.replace('\n', '') if line.startswith('#'): continue list_line = line.split('\t') ref = list_line[3] alt = l...
def gra(up, rundy, limit): boczne = { 1 : [3,4,2,5], 2 : [6,1,3,4], 3 : [6,1,2,5], 4 : [6,1,2,5], 5 : [6,1,3,4], 6 : [3,4,2,5] } punkty = [0 for k in range(len(rundy[0]))] wynik = punkty[:] for i in range(len(rundy)): runda = rundy[i]...
def gra(up, rundy, limit): boczne = {1: [3, 4, 2, 5], 2: [6, 1, 3, 4], 3: [6, 1, 2, 5], 4: [6, 1, 2, 5], 5: [6, 1, 3, 4], 6: [3, 4, 2, 5]} punkty = [0 for k in range(len(rundy[0]))] wynik = punkty[:] for i in range(len(rundy)): runda = rundy[i] for j in range(len(runda)): if ...
def getRoadsPoints(sf, shapeval, show=False): fields = sf.fields if show: print("Fields -> {0}".format(fields)) itype=None iint=None if shapeval.startswith("Airport"): for i,val in enumerate(fields): if val[0] == "FAA_AIRPOR": itype = i-1 ...
def get_roads_points(sf, shapeval, show=False): fields = sf.fields if show: print('Fields -> {0}'.format(fields)) itype = None iint = None if shapeval.startswith('Airport'): for (i, val) in enumerate(fields): if val[0] == 'FAA_AIRPOR': itype = i - 1 ...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorDebugInfo.msg;/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorIterData.msg" services_str = ...
messages_str = '/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorDebugInfo.msg;/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorIterData.msg' services_str = '' pkg_name = 'hector_mapping' dependencies_str = '' ...
# List of API keys ALPACA_API_KEY = "PKV6PG76ZRMOXUSLQMC6" ALPACA_SECRET_KEY = "YD22E2jiKZRfer69McRcQIJX0kxGpXy13I0oTIzN" ALPACA_BASE_URL = "https://paper-api.alpaca.markets" AMERITRADE_TOKEN = 'https://api.tdameritrade.com/v1/oauth2/token' AMERITRADE_KEY = '6JWAH9JYWA5CSCOG5WC6PAPLYIASBTTV'
alpaca_api_key = 'PKV6PG76ZRMOXUSLQMC6' alpaca_secret_key = 'YD22E2jiKZRfer69McRcQIJX0kxGpXy13I0oTIzN' alpaca_base_url = 'https://paper-api.alpaca.markets' ameritrade_token = 'https://api.tdameritrade.com/v1/oauth2/token' ameritrade_key = '6JWAH9JYWA5CSCOG5WC6PAPLYIASBTTV'
REGION = "your_region_name" BUCKET = "your_bucket_name" DATABASE = "your_database_name" TABLE = "your_table_name" INDEX_COLUMN_NAME = "date"
region = 'your_region_name' bucket = 'your_bucket_name' database = 'your_database_name' table = 'your_table_name' index_column_name = 'date'
## Error to exception # The intention is to return an error # from def withdraw(self, amount): if amount > self.balance: return -1 else: self.balance -= amount return 0 # to def withdraw(self, amount): if amount > self.balance: raise BalanceException() # or Exception self...
def withdraw(self, amount): if amount > self.balance: return -1 else: self.balance -= amount return 0 def withdraw(self, amount): if amount > self.balance: raise balance_exception() self.balance -= amount def get_value_for_period(periodNumber): try: return value...
# -*- coding: utf-8 -*- __version_info__ = '0.6.3' __version__ = '0.6.3' version = '0.6.3'
__version_info__ = '0.6.3' __version__ = '0.6.3' version = '0.6.3'
''' Building your own digit recognition model You've reached the final exercise of the course - you now know everything you need to build an accurate model to recognize handwritten digits! We've already done the basic manipulation of the MNIST dataset shown in the video, so you have X and y loaded and ready to model ...
""" Building your own digit recognition model You've reached the final exercise of the course - you now know everything you need to build an accurate model to recognize handwritten digits! We've already done the basic manipulation of the MNIST dataset shown in the video, so you have X and y loaded and ready to model ...
''' Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are on vacation, return a string of the form "7:00" indicating when the alarm clock should ring. Weekdays, the alarm should be "7:00" and on the weekend it should be "10:00". Unless we are on vacation -- then on weekday...
""" Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are on vacation, return a string of the form "7:00" indicating when the alarm clock should ring. Weekdays, the alarm should be "7:00" and on the weekend it should be "10:00". Unless we are on vacation -- then on weekday...
# # PySNMP MIB module ARISTA-QOS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ARISTA-QOS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:09:19 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(arista_mibs,) = mibBuilder.importSymbols('ARISTA-SMI-MIB', 'aristaMibs') (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constr...
# twonums_sum returns the index of the nums inside the list that can become n def twonums_sum(n, lst): d = {} for i in range(len(lst)): d[lst[i]] = i # create number-subscript pair for i in range(len(lst)): if n - lst[i] in d: return i, d[n-lst[i]] return -1 l...
def twonums_sum(n, lst): d = {} for i in range(len(lst)): d[lst[i]] = i for i in range(len(lst)): if n - lst[i] in d: return (i, d[n - lst[i]]) return -1 lst = [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 18, 19, 20, 21, 29, 34, 54, 65] n = int(input()) result = twonums_sum(n, l...
class Solution: def longestPalindrome(self, s: str) -> str: if not s or len(s) <= 1: return s result = '' max_len = 0 n = len(s) dp = [[False] * n for _ in range(n)] for i in range(n): dp[i][i] = True if 1 > max_len: ...
class Solution: def longest_palindrome(self, s: str) -> str: if not s or len(s) <= 1: return s result = '' max_len = 0 n = len(s) dp = [[False] * n for _ in range(n)] for i in range(n): dp[i][i] = True if 1 > max_len: ...
class Computer: def __init__(self,prog): if type(prog)==str: prog = [int(x.strip()) for x in prog.split(",") if x.strip()] self.memory = prog def evaluate(self): pc = 0 while pc<len(self.memory) and self.memory[pc]!=99: if self.memory[pc]==1: from_, to_, store = self.memory[pc+1:pc+4] self.memor...
class Computer: def __init__(self, prog): if type(prog) == str: prog = [int(x.strip()) for x in prog.split(',') if x.strip()] self.memory = prog def evaluate(self): pc = 0 while pc < len(self.memory) and self.memory[pc] != 99: if self.memory[pc] == 1: ...
# # PySNMP MIB module INTEL-ES480-VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTEL-ES480-VLAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:42:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
class BaseError(Exception): pass class AddQueryInvalid(Exception): def __init__(self, exception, message="Parameter Add condition is invalid"): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {sel...
class Baseerror(Exception): pass class Addqueryinvalid(Exception): def __init__(self, exception, message='Parameter Add condition is invalid'): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {sel...
lang1 = {'Hindi','Urdu'} lang2= {'Punjabi'} print("Original Set: ", lang2) lang2 = lang1.copy() print("Copied Set: ", lang2)
lang1 = {'Hindi', 'Urdu'} lang2 = {'Punjabi'} print('Original Set: ', lang2) lang2 = lang1.copy() print('Copied Set: ', lang2)
def datacfg(): datacfg = dict() datacfg['abalone'] = dict() datacfg['abalone']['filepath'] = '.\\data\\abalone.pkl' datacfg['abalone']['targets'] = ['rings'] datacfg['abalone']['probtype'] = ['regression', 'classification'] datacfg['autoMpg'] = dict() datacfg['autoMpg']['filepath'] = '.\\dat...
def datacfg(): datacfg = dict() datacfg['abalone'] = dict() datacfg['abalone']['filepath'] = '.\\data\\abalone.pkl' datacfg['abalone']['targets'] = ['rings'] datacfg['abalone']['probtype'] = ['regression', 'classification'] datacfg['autoMpg'] = dict() datacfg['autoMpg']['filepath'] = '.\\dat...
def my_function(function): function() print(my_function(lambda : 99))
def my_function(function): function() print(my_function(lambda : 99))
class Tokenizer: def tokenize(self, text): # remove comments but keep empty lines instead # to preserve line numbers lines = text.splitlines() lines = [('' if line.strip().startswith(';') else line) for line in lines] t = '\n'.join(lines) # expand symbols for easier...
class Tokenizer: def tokenize(self, text): lines = text.splitlines() lines = ['' if line.strip().startswith(';') else line for line in lines] t = '\n'.join(lines) t = t.replace('(', ' ( ') t = t.replace(')', ' ) ') tokens = t.split() return tokens
#!/usr/bin/env python3 bicycles = ["trek", "cannondale", "redline", "specialized"] print("{}\n".format(bicycles)) print("{} Object type: {}".format("bicycles", type(bicycles))) print(bicycles[0]) for bike in bicycles: print(bike.title())
bicycles = ['trek', 'cannondale', 'redline', 'specialized'] print('{}\n'.format(bicycles)) print('{} Object type: {}'.format('bicycles', type(bicycles))) print(bicycles[0]) for bike in bicycles: print(bike.title())
def merge(a: list, b: list) -> list: i = 0 j = 0 c = [0 for _ in range(len(a) + len(b))] while i < len(a) or j < len(b): if j == len(b) or i < len(a) and a[i] < b[j]: c[i + j] = a[i] i += 1 else: c[i + j] = b[j] j += 1 return c ...
def merge(a: list, b: list) -> list: i = 0 j = 0 c = [0 for _ in range(len(a) + len(b))] while i < len(a) or j < len(b): if j == len(b) or (i < len(a) and a[i] < b[j]): c[i + j] = a[i] i += 1 else: c[i + j] = b[j] j += 1 return c def s...
class CORSMiddleware: def process_response(self, request, response): response['Access-Control-Allow-Origin'] = "*" return response
class Corsmiddleware: def process_response(self, request, response): response['Access-Control-Allow-Origin'] = '*' return response
# Copyright 2019, Kay Hayen, mailto:kay.hayen@gmail.com # # Python test originally created or extracted from other peoples work. The # parts from me are licensed as below. It is at least Free Software where # it's copied from other people. In these cases, that will normally be # indicated. # # L...
loops = 50000 class Record: def __init__(self, PtrComp=None, Discr=0, EnumComp=0, IntComp=0, StringComp=0): self.PtrComp = PtrComp self.Discr = Discr self.EnumComp = EnumComp self.IntComp = IntComp self.StringComp = StringComp def copy(self): return record(self...
# Write a Python program to # input a string and change its # case to Sentence case using capitalize() # function. It will convert only the first # (beginning)lower case letter to upper case. # it will capitalize only first letter # of a Sentence. # The user will enter String # during program execution # Start of the ...
str1 = input('Enter a string to convert into Sentence case:') sentence_string = str1.capitalize() print(str1, 'In sentence case =', sentence_string)
# SPDX-License-Identifier: BSD-2-Clause QEMU_SPECIAL_KEYS = { " " : "spc", "!" : "shift-1", '"' : "shift-apostrophe", "#" : "shift-3", "$" : "shift-4", "%" : "shift-5", "&" : "shift-7", "'" : "apostrophe", "(" : "shift-9", ")" : "shift-0", "*" : "shift-8", "+" : "shift-e...
qemu_special_keys = {' ': 'spc', '!': 'shift-1', '"': 'shift-apostrophe', '#': 'shift-3', '$': 'shift-4', '%': 'shift-5', '&': 'shift-7', "'": 'apostrophe', '(': 'shift-9', ')': 'shift-0', '*': 'shift-8', '+': 'shift-equal', ',': 'comma', '-': 'minus', '.': 'dot', '/': 'slash', ':': 'shift-semicolon', ';': 'semicolon',...
# You are given two arrays (no duplicates): arr1 and arr2 where arr1 is a subset of arr2. # For each item x in arr1 find the first proceeding number, y, in arr2 such that y > x and # is to the right hand side of x in arr2. If such number does not exist, return -1. # # Ex. # arr1 = [4, 1, 2] # arr2 = [1, 3, 4, 2] # outp...
def next_greater_element(targetArr, numArr): dict = {} stack = [] for num in numArr: while stack and stack[len(stack) - 1] < num: dict.update({stack.pop(): num}) stack.append(num) for i in range(len(targetArr)): targetArr[i] = dict.get(targetArr[i], -1) return tar...
def solve(floor, room): pass if __name__ == '__main__': num_tc = int(input()) for _ in range(num_tc): k = int(input()) n = int(input()) print(solve(k, n))
def solve(floor, room): pass if __name__ == '__main__': num_tc = int(input()) for _ in range(num_tc): k = int(input()) n = int(input()) print(solve(k, n))
class Solution: def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]: n = len(buildings) if n == 0: return [] if n == 1: xLeft,xRight,y = buildings[0] return [[xLeft,y],[xRight,0]] leftSky = self.getSkyline(buildings[: n//2]...
class Solution: def get_skyline(self, buildings: List[List[int]]) -> List[List[int]]: n = len(buildings) if n == 0: return [] if n == 1: (x_left, x_right, y) = buildings[0] return [[xLeft, y], [xRight, 0]] left_sky = self.getSkyline(buildings[:n /...
for i in range(1, 100 + 1): text = '' if i % 3 == 0: text += 'Fizz' if i % 5 == 0: text += 'Buzz' if text == '': print(i) else: print(text)
for i in range(1, 100 + 1): text = '' if i % 3 == 0: text += 'Fizz' if i % 5 == 0: text += 'Buzz' if text == '': print(i) else: print(text)
def is_palindrome(n): if str(n) == str(n)[::-1]: return True return False # Examples: is_palindrome(101) # True is_palindrome(147) # False
def is_palindrome(n): if str(n) == str(n)[::-1]: return True return False is_palindrome(101) is_palindrome(147)
def rest_error_response(Status,Message,Format = 'XML',TwilioCode = None,TwilioMessage = None): response = { "Status" : Status, "Message" : Message } if TwilioCode is not None: response['Code'] = TwilioCode if TwilioMessage is not None: response['MoreInfo'] = TwilioMessage if Format == '' or Format == 'XML' o...
def rest_error_response(Status, Message, Format='XML', TwilioCode=None, TwilioMessage=None): response = {'Status': Status, 'Message': Message} if TwilioCode is not None: response['Code'] = TwilioCode if TwilioMessage is not None: response['MoreInfo'] = TwilioMessage if Format == '' or Fo...
# -*- coding:utf-8 -*- class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def deleteNode(self, listNode, toDeleteNode): if listNode == None or toDeleteNode == None: return listNode if listNode == toDeleteNode: return list...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def delete_node(self, listNode, toDeleteNode): if listNode == None or toDeleteNode == None: return listNode if listNode == toDeleteNode: return listNode.next if...
def build_filter(args): return Filter(args) class Filter: def __init__(self, args): if args == '': message = b'<empty commit message>' else: message = args.encode('utf8') self.message = message def commit_message_filter(self,commit_data): # Only writ...
def build_filter(args): return filter(args) class Filter: def __init__(self, args): if args == '': message = b'<empty commit message>' else: message = args.encode('utf8') self.message = message def commit_message_filter(self, commit_data): if commit...
# Calculates the total cost of a restaurant bill # including the meal cost, tip amount, and sales tax # Declare variables tipRate = 0.18 # 18% salesTaxRate = 0.07 # 7% # Prompt user for cost of meal mealCost = float(input('\nEnter total cost of meal: $')) # Calculate and display total tip, # total sales...
tip_rate = 0.18 sales_tax_rate = 0.07 meal_cost = float(input('\nEnter total cost of meal: $')) tip_cost = mealCost * tipRate sales_tax_cost = mealCost * salesTaxRate total_bill = mealCost + tipCost + salesTaxCost print('\nWith 18% tip: $', format(tipCost, ',.2f'), sep='') print('With 7% sales tax: $',...
#!/usr/bin/env python __author__ = "yangyanzhan" __email__ = "yangyanzhan@gmail.com" __url__ = "https://github.com/yangyanzhan/code-camp" __blog__ = "https://yanzhan.site" __youtube__ = "https://www.youtube.com/channel/UCDkz-__gl3frqLexukpG0DA?view_as=subscriber" __twitter__ = "https://twitter.com/YangYanzhan" mappin...
__author__ = 'yangyanzhan' __email__ = 'yangyanzhan@gmail.com' __url__ = 'https://github.com/yangyanzhan/code-camp' __blog__ = 'https://yanzhan.site' __youtube__ = 'https://www.youtube.com/channel/UCDkz-__gl3frqLexukpG0DA?view_as=subscriber' __twitter__ = 'https://twitter.com/YangYanzhan' mapping = {} class Solution: ...
# Copyright (c) 2016 Ericsson AB. # 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 w...
rpc_api_version = '1.0' topic_dc_manager = 'dcmanager' patch_vault_dir = '/opt/patch-vault' system_controller_name = 'SystemController' default_region_name = 'RegionOne' management_unmanaged = 'unmanaged' management_managed = 'managed' availability_offline = 'offline' availability_online = 'online' sync_status_unknown ...
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- def get_package_data(): # pragma: no cover return { str(_PACKAGE_NAME_ + '.tags.core.tests'): ['data/*.yaml']}
def get_package_data(): return {str(_PACKAGE_NAME_ + '.tags.core.tests'): ['data/*.yaml']}
t = ( 10, 11, 12, 34, 99, 4, 98) print (t[0]) t1 = (1, 1, 1, 2, 3, 4, 65, 65, 3, 2) #tuple with single element print (t1.count(1)) print (t1.index(65))
t = (10, 11, 12, 34, 99, 4, 98) print(t[0]) t1 = (1, 1, 1, 2, 3, 4, 65, 65, 3, 2) print(t1.count(1)) print(t1.index(65))
connChoices=( {'name':'automatic', 'rate':{'min':0, 'max':5000, 'def': 0}, 'conn':{'min':0, 'max':100, 'def': 0}, 'automatic':1}, {'name':'unlimited', 'rate':{'min':0, 'max':5000, 'def': 0, 'div': 50}, 'conn':{'min':4, 'max':100, 'def': 4}}, {'name':'dialup/isdn', 'r...
conn_choices = ({'name': 'automatic', 'rate': {'min': 0, 'max': 5000, 'def': 0}, 'conn': {'min': 0, 'max': 100, 'def': 0}, 'automatic': 1}, {'name': 'unlimited', 'rate': {'min': 0, 'max': 5000, 'def': 0, 'div': 50}, 'conn': {'min': 4, 'max': 100, 'def': 4}}, {'name': 'dialup/isdn', 'rate': {'min': 3, 'max': 8, 'def': 5...
# "sb" pytest fixture test in a method with no class def test_sb_fixture_with_no_class(sb): sb.open("https://google.com/ncr") sb.type('input[title="Search"]', "SeleniumBase GitHub\n") sb.click('a[href*="github.com/seleniumbase/SeleniumBase"]') sb.click('a[title="seleniumbase"]') # "sb" pytest fixture ...
def test_sb_fixture_with_no_class(sb): sb.open('https://google.com/ncr') sb.type('input[title="Search"]', 'SeleniumBase GitHub\n') sb.click('a[href*="github.com/seleniumbase/SeleniumBase"]') sb.click('a[title="seleniumbase"]') class Test_Sb_Fixture: def test_sb_fixture_inside_class(self, sb): ...
template = ' <!DOCTYPE html> \ <html lang="en"> \ <head> \ <title>AssiStudy</title> \ <meta charset="UTF-8"> \ <meta name="viewport" co ntent="width=device-width, initial-scale=1"> \ <!--===============================================================================================--> \ <link rel="icon" type...
template = ' <!DOCTYPE html> <html lang="en"> <head> \t<title>AssiStudy</title> \t<meta charset="UTF-8"> \t<meta name="viewport" co ntent="width=device-width, initial-scale=1"> <!--===============================================================================================--> \t<link rel="icon" type="image/png" href...
class Config: # dataset related exemplar_size = 127 # exemplar size instance_size = 255 # instance size context_amount = 0.5 # context amount # training related num_per_epoch = 53200 # num of samples per epoch train_r...
class Config: exemplar_size = 127 instance_size = 255 context_amount = 0.5 num_per_epoch = 53200 train_ratio = 0.9 frame_range = 100 train_batch_size = 8 valid_batch_size = 8 train_num_workers = 8 valid_num_workers = 8 lr = 0.01 momentum = 0.0 weight_decay = 0.0 s...
__all__ = ('indent_string',) def indent_string(s, num_spaces): add_newline = False if s[-1] == '\n': add_newline = True s = s[:-1] s = '\n'.join(num_spaces * ' ' + line for line in s.split('\n')) if add_newline: s += '\n' return s
__all__ = ('indent_string',) def indent_string(s, num_spaces): add_newline = False if s[-1] == '\n': add_newline = True s = s[:-1] s = '\n'.join((num_spaces * ' ' + line for line in s.split('\n'))) if add_newline: s += '\n' return s
# model settings model = dict( type='MAE', backbone=dict( type='MAEViT', arch='small', patch_size=16, mask_ratio=0.75), neck=dict( type='MAEPretrainDecoder', patch_size=16, in_chans=3, embed_dim=768, decoder_embed_dim=512, decoder_depth=6, # 3...
model = dict(type='MAE', backbone=dict(type='MAEViT', arch='small', patch_size=16, mask_ratio=0.75), neck=dict(type='MAEPretrainDecoder', patch_size=16, in_chans=3, embed_dim=768, decoder_embed_dim=512, decoder_depth=6, decoder_num_heads=16, mlp_ratio=4.0), head=dict(type='MAEPretrainHead', norm_pix=True, patch_size=16...
expected_output = { "report_id":{ "1634211151":{ "metric_name":"ENTITLEMENT", "feature_name":"dna-advantage", "metric_value":"regid.2017-05.com.cisco.c9300_dna_advantage,1.0_411773c3-2116-4c10-94a4-5d357fe6ff18", "udi":{ "pid":"C9300-24UX", "s...
expected_output = {'report_id': {'1634211151': {'metric_name': 'ENTITLEMENT', 'feature_name': 'dna-advantage', 'metric_value': 'regid.2017-05.com.cisco.c9300_dna_advantage,1.0_411773c3-2116-4c10-94a4-5d357fe6ff18', 'udi': {'pid': 'C9300-24UX', 'sn': 'FCW2303D16Y'}, 'previous_report_id': '0', 'next_report_id': '16342111...
''' Encrypt and decrypt a string ''' def encrypt(s): return s.encode('hex') def decrypt(s): return s.decode('hex')
""" Encrypt and decrypt a string """ def encrypt(s): return s.encode('hex') def decrypt(s): return s.decode('hex')
# Defines number of epochs n_epochs = 200 losses = [] for epoch in range(n_epochs): # inner loop loss = mini_batch(device, train_loader, train_step) losses.append(loss)
n_epochs = 200 losses = [] for epoch in range(n_epochs): loss = mini_batch(device, train_loader, train_step) losses.append(loss)
#----------------------------------------------------------------------------- # Runtime: 32ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def canJump(self, nums: [int]) -> bool: max_right = 0 for i, num in enumerate(nums...
class Solution: def can_jump(self, nums: [int]) -> bool: max_right = 0 for (i, num) in enumerate(nums): if i > max_right: return False else: max_right = max(max_right, i + num) return True
def floyd_warshall(start): d = [float("Inf") for i in range(n)] dist = [[graph[j][i] for i in range(n)] for j in range(n)] for k in range(n): for i in range(n): for j in range(n): dist[i][j] = min(dist[i][j], dist[j][k] + dist[k][j]) return dist if __name__ == "__ma...
def floyd_warshall(start): d = [float('Inf') for i in range(n)] dist = [[graph[j][i] for i in range(n)] for j in range(n)] for k in range(n): for i in range(n): for j in range(n): dist[i][j] = min(dist[i][j], dist[j][k] + dist[k][j]) return dist if __name__ == '__main...
__revision__ = '$Id: __init__.py,v 1.2 2006/08/12 15:56:26 jkloth Exp $' __all__ = ['XmlFormatter', 'ApiFormatter', 'ExtensionFormatter', 'CommandLineFormatter', ]
__revision__ = '$Id: __init__.py,v 1.2 2006/08/12 15:56:26 jkloth Exp $' __all__ = ['XmlFormatter', 'ApiFormatter', 'ExtensionFormatter', 'CommandLineFormatter']
display = { 0: 'ABCEFG', 1: 'CF', 2: 'ACDEG', 3: 'ACDFG', 4: 'BCDF', 5: 'ABDFG', 6: 'ABDEFG', 7: 'ACF', 8: 'ABCDEFG', 9: 'ABCDFG' } solve_it = { 'a': 'C', 'b': 'F', 'c': 'G', 'd': 'A', 'e': 'B', 'f': 'D', 'g': 'E' } def part1(input_str: str) -> None...
display = {0: 'ABCEFG', 1: 'CF', 2: 'ACDEG', 3: 'ACDFG', 4: 'BCDF', 5: 'ABDFG', 6: 'ABDEFG', 7: 'ACF', 8: 'ABCDEFG', 9: 'ABCDFG'} solve_it = {'a': 'C', 'b': 'F', 'c': 'G', 'd': 'A', 'e': 'B', 'f': 'D', 'g': 'E'} def part1(input_str: str) -> None: count = 0 for line in input_str.split('\n'): for output_...
n = input("value of n\n") n = int(n) if n < 5: print("n is less than 5") elif n == 5: print("n is equal to 5") else: print("n is greater than 5")
n = input('value of n\n') n = int(n) if n < 5: print('n is less than 5') elif n == 5: print('n is equal to 5') else: print('n is greater than 5')
''' practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates ''' #testing variable x = 8 print(x) x = "seven" #assigning the Sring to variable x print(x) x = 6 #end of the Program
""" practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates """ x = 8 print(x) x = 'seven' print(x) x = 6