content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
datas = { 'style' : 'boost', 'prefix' : ['boost','simd'], 'has_submodules' : True, }
datas = {'style': 'boost', 'prefix': ['boost', 'simd'], 'has_submodules': True}
# This script was crated to calculate my net worth across all my accounts, including crypto wallets. I track my fiat # currency using Mint. The majority of my crypto wallets are not able to sync with Mint. With this script, I answer a # few questions regarding wallet balances, then my change in net worth (annual a...
coin_balance = float(input('How much COIN do you have? ')) denominator = coin_balance / 1000 numerator = float(input('How much XYO do you get from 1000 COIN? ')) coin_to_xyo = round(numerator * denominator, 3) xyo__coin_gecko_plug = float(input(f'Enter USD from CoinGecko for {COIN_to_xyo} XYO. ')) print() print('Open M...
# # PySNMP MIB module CISCO-ITP-GSP2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ITP-GSP2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:46:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ...
""" datos de entrada presupuesto-->p-->float datos de salida presupuesto ginecologia-->pg-->float presupuesto traumatologia-->pt-->float presupuesto pediatria-->pp-->foat """ #entradas p=float(input("digite el presupuesto total:")) #caja negra pg=p*0.4 pt=p*0.3 pp=p*0.3 #salidas print("el presupue...
""" datos de entrada presupuesto-->p-->float datos de salida presupuesto ginecologia-->pg-->float presupuesto traumatologia-->pt-->float presupuesto pediatria-->pp-->foat """ p = float(input('digite el presupuesto total:')) pg = p * 0.4 pt = p * 0.3 pp = p * 0.3 print('el presupuesto de ginecologia:'...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 26 15:46:21 2020 @author: bezbakri """ """ |-------------------------------------------| | Problem 6: Write a program to find the | | factorial of a number | |-------------------------------------------| | Approach: ...
""" Created on Mon Oct 26 15:46:21 2020 @author: bezbakri """ '\n|-------------------------------------------|\n| Problem 6: Write a program to find the |\n| factorial of a number |\n|-------------------------------------------|\n| Approach: |\n| First, we take in...
entries = [] def parse(line): return list(map(lambda x: tuple(x.strip().split(' ')), line.strip().split('|'))) with open("input") as file: entries = list(map(parse, file)) count = 0 total = 0 for segments, outputs in entries: dict = {} for segment in segments: length = len(segment) ...
entries = [] def parse(line): return list(map(lambda x: tuple(x.strip().split(' ')), line.strip().split('|'))) with open('input') as file: entries = list(map(parse, file)) count = 0 total = 0 for (segments, outputs) in entries: dict = {} for segment in segments: length = len(segment) if...
#! /usr/bin/env python2.7 """ * Copyright (c) 2016 by Cisco Systems, Inc. * All rights reserved. Pathman init file Niklas Montin, 20141209, niklas@cisco.com odl_ip - ip address of odl controller odl_port - port for odl rest on controller log_file - file to write log to - lev...
""" * Copyright (c) 2016 by Cisco Systems, Inc. * All rights reserved. Pathman init file Niklas Montin, 20141209, niklas@cisco.com odl_ip - ip address of odl controller odl_port - port for odl rest on controller log_file - file to write log to - level INFO default log_si...
a = [1, 2, 3, 4, 5] print(a) a.clear() print(a)
a = [1, 2, 3, 4, 5] print(a) a.clear() print(a)
#!/usr/bin/python n = int(input()) for i in range(0, n): row = input().strip() for j in range(0, n): if row[j] == 'm': robot_x = j robot_y = i if row[j] == 'p': princess_x = j princess_y = i for i in range(0, abs(robot_x - princess_x)...
n = int(input()) for i in range(0, n): row = input().strip() for j in range(0, n): if row[j] == 'm': robot_x = j robot_y = i if row[j] == 'p': princess_x = j princess_y = i for i in range(0, abs(robot_x - princess_x)): if princess_x > robot_x: ...
class Solution: def reverseVowels(self, s: str) -> str: vows = [ch for ch in s[::-1] if ch.lower() in "aeiou"] chars = list(s) x = 0 for i, ch in enumerate(chars): if ch.lower() in "aeiou": chars[i] = vows[x] x += 1 return "".join(c...
class Solution: def reverse_vowels(self, s: str) -> str: vows = [ch for ch in s[::-1] if ch.lower() in 'aeiou'] chars = list(s) x = 0 for (i, ch) in enumerate(chars): if ch.lower() in 'aeiou': chars[i] = vows[x] x += 1 return ''.jo...
def defaultParamSet(): class P(): def __init__(self): # MAP-Elites Parameters self.nChildren = 2**7 self.mutSigma = 0.1 self.nGens = 2**8 # Infill Parameters self.nInitialSamples = 50 self.nAdditionalSamples = 10 ...
def default_param_set(): class P: def __init__(self): self.nChildren = 2 ** 7 self.mutSigma = 0.1 self.nGens = 2 ** 8 self.nInitialSamples = 50 self.nAdditionalSamples = 10 self.nTotalSamples = 500 self.trainingMod = 2 ...
def LCS_solution(X, Y, L): """Return the longest substring of X and Y, given LCS table L""" solution = [] j,k = lne(X), len(Y) while L[j][k] > 0: # common characters remain if X[j-1] == Y[k-1]: solution.append(X[j-1]) j -= 1 k -= 1 elif L[j-1][k] >= l[j][k-1]: j -= 1 else: k -= 1 return ""...
def lcs_solution(X, Y, L): """Return the longest substring of X and Y, given LCS table L""" solution = [] (j, k) = (lne(X), len(Y)) while L[j][k] > 0: if X[j - 1] == Y[k - 1]: solution.append(X[j - 1]) j -= 1 k -= 1 elif L[j - 1][k] >= l[j][k - 1]: ...
class JSIError(Exception): """JSIError wraps the message in html comments to be placed safely into the webpage. """ def __init__(self, message, data={}): # Wrap the message in an html comment. message = "<!-- [JSInclude Error] %s %s -->" % ( message, data.items() ...
class Jsierror(Exception): """JSIError wraps the message in html comments to be placed safely into the webpage. """ def __init__(self, message, data={}): message = '<!-- [JSInclude Error] %s %s -->' % (message, data.items()) Exception.__init__(self, message)
def fatorial(n): f = 1 for i in range(n, 0, -1): f *= i return f def dobro(n): return n*2 def triplo(n): return n*3
def fatorial(n): f = 1 for i in range(n, 0, -1): f *= i return f def dobro(n): return n * 2 def triplo(n): return n * 3
class Solution: # @return a list of integers def getRow(self, rowIndex): tri = [1] for i in range(rowIndex): for j in range(len(tri) - 2, -1, -1): tri[j + 1] = tri[j] + tri[j + 1] tri.append(1) return tri
class Solution: def get_row(self, rowIndex): tri = [1] for i in range(rowIndex): for j in range(len(tri) - 2, -1, -1): tri[j + 1] = tri[j] + tri[j + 1] tri.append(1) return tri
# # PySNMP MIB module WWP-LEOS-LLDP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-LLDP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:31:15 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'CYX' configs = { 'server': { 'host': '0.0.0.0', 'port': 9090 }, 'qshield': { 'jars': '/home/hadoop/qshield/opaque-ext/target/scala-2.11/opaque-ext_2.11-0.1.jar,/home/hadoop/qshield/data-owner/target/scala-2.11/data-owner_2.11-0.1.jar', 'master': ...
__author__ = 'CYX' configs = {'server': {'host': '0.0.0.0', 'port': 9090}, 'qshield': {'jars': '/home/hadoop/qshield/opaque-ext/target/scala-2.11/opaque-ext_2.11-0.1.jar,/home/hadoop/qshield/data-owner/target/scala-2.11/data-owner_2.11-0.1.jar', 'master': 'spark://SGX:7077'}}
# # PySNMP MIB module VLAN (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VLAN # Produced by pysmi-0.3.4 at Mon Apr 29 21:27:41 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:15) # Oc...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ...
def solution(A, B): tmp = '{0:b}'.format(A * B) return list(tmp).count('1')
def solution(A, B): tmp = '{0:b}'.format(A * B) return list(tmp).count('1')
""" Add the scientific notation to the axes label Adapted from: https://peytondmurray.github.io/coding/fixing-matplotlibs-scientific-notation/# """ def label_offset(ax, axis=None): if axis == "y" or not axis: fmt = ax.yaxis.get_major_formatter() ax.yaxis.offsetText.set_visible(False) set_...
""" Add the scientific notation to the axes label Adapted from: https://peytondmurray.github.io/coding/fixing-matplotlibs-scientific-notation/# """ def label_offset(ax, axis=None): if axis == 'y' or not axis: fmt = ax.yaxis.get_major_formatter() ax.yaxis.offsetText.set_visible(False) set_la...
class Action: """ This is the Action class. It is already in the test cases, so please don't put it in your solution. """ def __init__(self, object_, transaction, is_write): self.object_ = object_ self.transaction = transaction self.is_write = is_write def __str__(self): return f"Action({sel...
class Action: """ This is the Action class. It is already in the test cases, so please don't put it in your solution. """ def __init__(self, object_, transaction, is_write): self.object_ = object_ self.transaction = transaction self.is_write = is_write def __str__(self): ...
class WebPermissionAttribute(CodeAccessSecurityAttribute, _Attribute): """ Specifies permission to access Internet resources. This class cannot be inherited. WebPermissionAttribute(action: SecurityAction) """ def CreatePermission(self): """ CreatePermission(self: WebPermissionAttrib...
class Webpermissionattribute(CodeAccessSecurityAttribute, _Attribute): """ Specifies permission to access Internet resources. This class cannot be inherited. WebPermissionAttribute(action: SecurityAction) """ def create_permission(self): """ CreatePermission(self: WebPermissionAttribute) -> IP...
class Pagination: def __init__(self, offset, limit): self._offset = offset self._limit = limit def clean_offset(self): return self._offset >= 0 def clean_limit(self): return self._limit > 0 def clean(self): return self.clean_offset() and self.clean_limit() ...
class Pagination: def __init__(self, offset, limit): self._offset = offset self._limit = limit def clean_offset(self): return self._offset >= 0 def clean_limit(self): return self._limit > 0 def clean(self): return self.clean_offset() and self.clean_limit() ...
# Copyright (c) 2018-2021 Kaiyang Zhou # SPDX-License-Identifier: MIT # # Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # __version__ = '1.2.3'
__version__ = '1.2.3'
# # PySNMP MIB module E7-Fault-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/E7-Fault-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:58:57 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, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ...
def steps(number:int) -> int: if number <= 0: raise ValueError("Input must be a positive integer") steps = 0 while number != 1: if number % 2 == 0: number = int(number / 2) else: number = int(number * 3) + 1 steps += 1 return steps
def steps(number: int) -> int: if number <= 0: raise value_error('Input must be a positive integer') steps = 0 while number != 1: if number % 2 == 0: number = int(number / 2) else: number = int(number * 3) + 1 steps += 1 return steps
class Solution: def arrangeCoins(self, n: int) -> int: k = 0 while n > 0: k += 1 n -= k return k if not n else k - 1
class Solution: def arrange_coins(self, n: int) -> int: k = 0 while n > 0: k += 1 n -= k return k if not n else k - 1
coordinates_E0E1E1 = ((127, 91), (127, 93), (128, 92), (128, 94), (128, 142), (129, 93), (129, 95), (129, 134), (129, 135), (129, 141), (129, 142), (130, 94), (130, 133), (130, 136), (130, 140), (130, 142), (131, 95), (131, 102), (131, 133), (131, 135), (131, 138), (131, 139), (131, 142), (132, 96), (132, 98), (132, ...
coordinates_e0_e1_e1 = ((127, 91), (127, 93), (128, 92), (128, 94), (128, 142), (129, 93), (129, 95), (129, 134), (129, 135), (129, 141), (129, 142), (130, 94), (130, 133), (130, 136), (130, 140), (130, 142), (131, 95), (131, 102), (131, 133), (131, 135), (131, 138), (131, 139), (131, 142), (132, 96), (132, 98), (132, ...
l=[] n=int(input("enter the elements:")) for i in range(0,n): l.append(int(input())) i=0 for i in range(len(l)): for j in range(i+1,len(l)): if l[i]>l[j]: l[i],l[j]=l[j],l[i] print("sorted list is",l)
l = [] n = int(input('enter the elements:')) for i in range(0, n): l.append(int(input())) i = 0 for i in range(len(l)): for j in range(i + 1, len(l)): if l[i] > l[j]: (l[i], l[j]) = (l[j], l[i]) print('sorted list is', l)
class AbstractImporter(): """ Abstract class describing a file importer """ def __init__(self, file_string, file_name=None): self.file_string = file_string self.file_name = file_name def import_data(self): raise NotImplementedError("AbstractImporter is abstract.")
class Abstractimporter: """ Abstract class describing a file importer """ def __init__(self, file_string, file_name=None): self.file_string = file_string self.file_name = file_name def import_data(self): raise not_implemented_error('AbstractImporter is abstract.')
# Modifying 'value_error_numbers.py' program. # Using a while loop so that the user can continue to enter numbers even if # they make a mistake by entering a non-numerical input value. print("Enter two numbers, and we will add them together.") print("Enter 'q' to quit.") while True: first_number = input("\nFirst...
print('Enter two numbers, and we will add them together.') print("Enter 'q' to quit.") while True: first_number = input('\nFirst number: ') if first_number == 'q': break second_number = input('Second number: ') try: answer = int(first_number) + int(second_number) except ValueError: ...
######################################### # Servo01_stop.py # categories: intro # more info @: http://myrobotlab.org/service/Intro ######################################### # uncomment for virtual hardware # Platform.setVirtual(True) # Every settings like limits / port number / controller are saved after initial use #...
Runtime.releaseService('arduino') Runtime.releaseService('servo01') intro.broadcastState()
def anonymize(person_names, should_anonymize): """ Creates a map of person names. :param person_names: List of person names :param should_anonymize: If person names should be anonymized :return: """ person_name_dict = dict() person_counter = 1 for person_name in person_names: ...
def anonymize(person_names, should_anonymize): """ Creates a map of person names. :param person_names: List of person names :param should_anonymize: If person names should be anonymized :return: """ person_name_dict = dict() person_counter = 1 for person_name in person_names: ...
tout = np.linspace(0, 10) k_vals = 0.42, 0.17 # arbitrary in this case y0 = [1, 1, 0] yout = odeint(rhs, y0, tout, k_vals) # EXERCISE: rhs, y0, tout, k_vals
tout = np.linspace(0, 10) k_vals = (0.42, 0.17) y0 = [1, 1, 0] yout = odeint(rhs, y0, tout, k_vals)
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"Hline": "00_core.ipynb", "ImageBuffer": "00_core.ipynb", "grid_subsampling": "00_core.ipynb", "getDirctionVectorsByPCA": "00_core.ipynb", "pointsProjectAxis": "00_core.ipy...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'Hline': '00_core.ipynb', 'ImageBuffer': '00_core.ipynb', 'grid_subsampling': '00_core.ipynb', 'getDirctionVectorsByPCA': '00_core.ipynb', 'pointsProjectAxis': '00_core.ipynb', 'radiusOfCylinderByLeastSq': '00_core.ipynb', 'get_start_end_line': '00_...
# Single Line Comment print('this is code') # another comment print('another piece of code') """ Multiple Line Comments this is avery big function it retrieves data it is very important REPL Repeat Evaluate Print Loop """
print('this is code') print('another piece of code') '\nMultiple Line Comments\nthis is avery big function\nit retrieves data\nit is very important\n\nREPL\nRepeat Evaluate Print Loop\n'
class Verse: """A class used to represent a verse from the bible.""" def __init__(self, text: str, number: int): """ Initialize a `Verse` object. :Parameters: - `text`: sting containing the text of the verse. - `number`: integer with the number of the verse. ...
class Verse: """A class used to represent a verse from the bible.""" def __init__(self, text: str, number: int): """ Initialize a `Verse` object. :Parameters: - `text`: sting containing the text of the verse. - `number`: integer with the number of the verse. ...
# Enter your code here. Read input from STDIN. Print output to STDOUT a = list(map(int, input().split())) happy = 0 n = a[0] m = a[1] b = list(map(int, input().split())) b = b[0:n] c = list(map(int, input().split())) c = c[0:m] d = list(map(int, input().split())) d = d[0:m] for i in c: if b.count(i)!= 0: ha...
a = list(map(int, input().split())) happy = 0 n = a[0] m = a[1] b = list(map(int, input().split())) b = b[0:n] c = list(map(int, input().split())) c = c[0:m] d = list(map(int, input().split())) d = d[0:m] for i in c: if b.count(i) != 0: happy = happy + 1 for i in d: if b.count(i) != 0: happy = h...
# Small alphabet w using fucntion def for_w(): """ *'s printed in the shape of w """ for row in range(5): for col in range(9): if col% 8 ==0 or row+col ==4 or col -row ==4: print('*',end=' ') else: print(' ',end=' ') print() def...
def for_w(): """ *'s printed in the shape of w """ for row in range(5): for col in range(9): if col % 8 == 0 or row + col == 4 or col - row == 4: print('*', end=' ') else: print(' ', end=' ') print() def while_w(): """ *'s printed in t...
#Embedded file name: ACEStream\Video\defs.pyo PLAYBACKMODE_INTERNAL = 0 PLAYBACKMODE_EXTERNAL_DEFAULT = 1 PLAYBACKMODE_EXTERNAL_MIME = 2 OTHERTORRENTS_STOP_RESTART = 0 OTHERTORRENTS_STOP = 1 OTHERTORRENTS_CONTINUE = 2 MEDIASTATE_PLAYING = 1 MEDIASTATE_PAUSED = 2 MEDIASTATE_STOPPED = 3 BGP_STATE_IDLE = 0 BGP_STATE_PREBU...
playbackmode_internal = 0 playbackmode_external_default = 1 playbackmode_external_mime = 2 othertorrents_stop_restart = 0 othertorrents_stop = 1 othertorrents_continue = 2 mediastate_playing = 1 mediastate_paused = 2 mediastate_stopped = 3 bgp_state_idle = 0 bgp_state_prebuffering = 1 bgp_state_downloading = 2 bgp_stat...
src = Split(''' starterkitgui.c ''') component = aos_component('starterkitgui', src) component.add_comp_deps('kernel/yloop', 'tools/cli') component.add_global_macros('AOS_NO_WIFI')
src = split('\n starterkitgui.c\n') component = aos_component('starterkitgui', src) component.add_comp_deps('kernel/yloop', 'tools/cli') component.add_global_macros('AOS_NO_WIFI')
def saludar(): return "Hola mundo" saludar() print(saludar()) print('----------') m = saludar() print(m) print('------------') def saludo(nombre, mensaje='hola '): print(mensaje, nombre) saludo('roberto')
def saludar(): return 'Hola mundo' saludar() print(saludar()) print('----------') m = saludar() print(m) print('------------') def saludo(nombre, mensaje='hola '): print(mensaje, nombre) saludo('roberto')
# Not finished rows = int(input()) array = [[0 for x in range(3)] for y in range(rows)] for i in range(rows): line = [float(i) for i in input().split()] for j in range(3): array[i][j] = int(line[j]) totalcount = 0 for k in range(rows): counter=array[k][0] +array[k][1] +array[k][2] if(counter >= ...
rows = int(input()) array = [[0 for x in range(3)] for y in range(rows)] for i in range(rows): line = [float(i) for i in input().split()] for j in range(3): array[i][j] = int(line[j]) totalcount = 0 for k in range(rows): counter = array[k][0] + array[k][1] + array[k][2] if counter >= 2: ...
def find_ranges(nums): if not nums: return [] first = last = nums[0] ranges = [] def append_range(first, last): ranges.append('{}->{}'.format(first, last)) for num in nums: if abs(num - last) > 1: append_range(first, last) first = num last = num # Remaining append_range(fi...
def find_ranges(nums): if not nums: return [] first = last = nums[0] ranges = [] def append_range(first, last): ranges.append('{}->{}'.format(first, last)) for num in nums: if abs(num - last) > 1: append_range(first, last) first = num last = n...
# 77. Combinations # Time: k*nCk (Review: nCk combinations each of length k) # Space: k*nCk class Solution: def combine(self, n: int, k: int) -> List[List[int]]: if n==0: return [] if k==0: return [[]] if k==1: return [[i] for i in range(1,n+1)] ...
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: if n == 0: return [] if k == 0: return [[]] if k == 1: return [[i] for i in range(1, n + 1)] without_n = self.combine(n - 1, k) with_n = self.combine(n - 1, k - 1) ...
""" PASSENGERS """ numPassengers = 3190 passenger_arriving = ( (5, 7, 2, 5, 1, 0, 5, 10, 5, 3, 2, 0), # 0 (6, 14, 4, 3, 1, 0, 3, 11, 5, 4, 2, 0), # 1 (3, 6, 6, 4, 3, 0, 7, 7, 5, 3, 1, 0), # 2 (2, 1, 6, 3, 1, 0, 7, 8, 10, 3, 2, 0), # 3 (4, 4, 6, 2, 1, 0, 4, 6, 7, 2, 2, 0), # 4 (5, 12, 7, 4, 1, 0, 12, 7, 2,...
""" PASSENGERS """ num_passengers = 3190 passenger_arriving = ((5, 7, 2, 5, 1, 0, 5, 10, 5, 3, 2, 0), (6, 14, 4, 3, 1, 0, 3, 11, 5, 4, 2, 0), (3, 6, 6, 4, 3, 0, 7, 7, 5, 3, 1, 0), (2, 1, 6, 3, 1, 0, 7, 8, 10, 3, 2, 0), (4, 4, 6, 2, 1, 0, 4, 6, 7, 2, 2, 0), (5, 12, 7, 4, 1, 0, 12, 7, 2, 3, 1, 0), (4, 7, 4, 2, 4, 0, 6, 3...
class Animation: def __init__(self, anim_type): self.anim_type = anim_type self.frames = [] self.point = 0 self.forward = True self.speed = 0 self.dt = 0 def add_frame(self, frame): self.frames.append(frame) def get_frame(self, dt): if self...
class Animation: def __init__(self, anim_type): self.anim_type = anim_type self.frames = [] self.point = 0 self.forward = True self.speed = 0 self.dt = 0 def add_frame(self, frame): self.frames.append(frame) def get_frame(self, dt): if self....
class DataGridView( Control, IComponent, IDisposable, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject, IOleWindow, IViewObject, IViewObject2, IPersist, IPersistStreamInit, IPersistPropertyBag, IPersistStorage, IQuickActivate,...
class Datagridview(Control, IComponent, IDisposable, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject, IOleWindow, IViewObject, IViewObject2, IPersist, IPersistStreamInit, IPersistPropertyBag, IPersistStorage, IQuickActivate, ISupportOleDropSource, IDropTarget, ISynchronizeInvoke, IWin32Window, IArra...
# return masked string def maskify(cc): if len(cc) < 5: return cc return '#' * int(len(cc)-4) + cc[-4:]
def maskify(cc): if len(cc) < 5: return cc return '#' * int(len(cc) - 4) + cc[-4:]
""" Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1: Input: "bbbab" Output: 4 One possible longest palindromic subsequence is "bbbb". Example 2: Input: "cbbd" Output: 2 One possible longest palindromic subsequence is "bb". S...
""" Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1: Input: "bbbab" Output: 4 One possible longest palindromic subsequence is "bbbb". Example 2: Input: "cbbd" Output: 2 One possible longest palindromic subsequence is "bb". S...
class Solution(object): def topKFrequent(self, words, k): """ :type words: List[str] :type k: int :rtype: List[str] """ counter = collections.Counter(words) return [key for _, key in heapq.nsmallest(k, [(-cnt, key) for key, cnt in counter.items()])]
class Solution(object): def top_k_frequent(self, words, k): """ :type words: List[str] :type k: int :rtype: List[str] """ counter = collections.Counter(words) return [key for (_, key) in heapq.nsmallest(k, [(-cnt, key) for (key, cnt) in counter.items()])]
# This function gives number of notes required and remining in the database def number_of_notes(amount, c_value): global atm_amount multipal = amount // int(c_value) x = denomination[c_value] - multipal y = x + multipal updated_multi = None for i in range(multipal): if y >= 0 and denomi...
def number_of_notes(amount, c_value): global atm_amount multipal = amount // int(c_value) x = denomination[c_value] - multipal y = x + multipal updated_multi = None for i in range(multipal): if y >= 0 and denomination[c_value] > 0: denomination[c_value] = denomination[c_value...
modules = dict() def register(module_name): def decorate_action(func): if module_name in modules: modules[module_name][func.__name__] = func else: modules[module_name] = dict() modules[module_name][func.__name__] = func return func return de...
modules = dict() def register(module_name): def decorate_action(func): if module_name in modules: modules[module_name][func.__name__] = func else: modules[module_name] = dict() modules[module_name][func.__name__] = func return func return decorate_ac...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: hussein """ if distance > 0.2: with open('robot1.csv', 'a', newline='') as f: fieldnames = ['Data_X', 'Data_Y', 'Label_X', 'Label_Y'] thewriter = csv.DictWriter(f, fieldnames=fieldnames...
""" @author: hussein """ if distance > 0.2: with open('robot1.csv', 'a', newline='') as f: fieldnames = ['Data_X', 'Data_Y', 'Label_X', 'Label_Y'] thewriter = csv.DictWriter(f, fieldnames=fieldnames) if self.i1 == 0: thewriter.writeheader() self.i1 = 1 thewrit...
class Solution: def generateParenthesis(self, n: int) -> List[str]: res = [] self.helper(res, '', n, n) return res def helper(self, res, tempList, left, right): if left > right: return if left == 0 and right == 0: res.append(tempList) ...
class Solution: def generate_parenthesis(self, n: int) -> List[str]: res = [] self.helper(res, '', n, n) return res def helper(self, res, tempList, left, right): if left > right: return if left == 0 and right == 0: res.append(tempList) if...
#!/usr/bin/python # #Stores the configuration information that will be used across entire project # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License...
watch_folder = '/mnt/cluster-programs/watch-folder' conversion_types = ['iPod-LQ', 'iPod-HQ', 'Movie-Archive', 'Movie-LQ', 'TV-Show-Archive', 'TV-Show-LQ'] job_folder = '/mnt/cluster-programs/handbrake/jobs/' base_dir = '/mnt/cluster-programs/handbrake/' ftp_port = 2010 message_server = 'Chiana' vhost = 'cluster' messa...
class Solution: def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool: output = [] push = 0 pop = 0 while push < len(pushed) or pop < len(popped): if len(output) != 0 and pop < len(popped) and output[-1] == popped[pop]: output.pop(...
class Solution: def validate_stack_sequences(self, pushed: List[int], popped: List[int]) -> bool: output = [] push = 0 pop = 0 while push < len(pushed) or pop < len(popped): if len(output) != 0 and pop < len(popped) and (output[-1] == popped[pop]): output...
#!/usr/bin/env python """ Convenience methods for list comparison & manipulation Fast and useful, set/frozenset* only retain unique values, duplicates are automatically removed. lr_union union merge values, remove duplicates lr_diff difference left elements, subtracting any in common w...
""" Convenience methods for list comparison & manipulation Fast and useful, set/frozenset* only retain unique values, duplicates are automatically removed. lr_union union merge values, remove duplicates lr_diff difference left elements, subtracting any in common with right lr_intr...
PET_LEVELS = [ 100, 110, 120, 130, 145, 160, 175, 190, 210, 230, 250, 275, 300, 330, 360, 400, 440, 490, 540, 600, 660, 730, 800, 880, 960, 1050, 1150, 1260, 1380, 1510, 1650, 1800, 1960, ...
pet_levels = [100, 110, 120, 130, 145, 160, 175, 190, 210, 230, 250, 275, 300, 330, 360, 400, 440, 490, 540, 600, 660, 730, 800, 880, 960, 1050, 1150, 1260, 1380, 1510, 1650, 1800, 1960, 2130, 2310, 2500, 2700, 2920, 3160, 3420, 3700, 4000, 4350, 4750, 5200, 5700, 6300, 7000, 7800, 8700, 9700, 10800, 12000, 13300, 1470...
def sortarray(arr): total_len = len(arr) if total_len == 0 or total_len == 1: return 0 sorted_array = sorted(arr) ptr1 = 0 ptr2 = 0 counter = 0 idx = 0 while idx < total_len: if sorted_array[ptr1] == arr[ptr2]: ptr1 = ptr1 +1 counter = ...
def sortarray(arr): total_len = len(arr) if total_len == 0 or total_len == 1: return 0 sorted_array = sorted(arr) ptr1 = 0 ptr2 = 0 counter = 0 idx = 0 while idx < total_len: if sorted_array[ptr1] == arr[ptr2]: ptr1 = ptr1 + 1 counter = counter + 1...
#!/usr/bin/env python3 class MyRange: def __init__(self, start, end=None, step=1): if step == 0: raise if end == None: start, end = 0, start self._start = start self._end = end self._step = step self._pointer = start def __getitem__(...
class Myrange: def __init__(self, start, end=None, step=1): if step == 0: raise if end == None: (start, end) = (0, start) self._start = start self._end = end self._step = step self._pointer = start def __getitem__(self, key): res ...
N, K, S = map(int, input().split()) if S == 1: const = S + 1 else: const = S - 1 ans = [] for i in range(N): if i < K: ans.append(S) else: ans.append(const) print(*ans)
(n, k, s) = map(int, input().split()) if S == 1: const = S + 1 else: const = S - 1 ans = [] for i in range(N): if i < K: ans.append(S) else: ans.append(const) print(*ans)
def reverse_list(x): """Takes an list and returns the reverse of it. If x is empty, return []. >>> reverse_list([1, 2, 3, 4]) [4, 3, 2, 1] >>> reverse_list([]) [] """ return x[::-1] def sum_list(x): """Takes a list, and returns the sum of that list. If x is empty lis...
def reverse_list(x): """Takes an list and returns the reverse of it. If x is empty, return []. >>> reverse_list([1, 2, 3, 4]) [4, 3, 2, 1] >>> reverse_list([]) [] """ return x[::-1] def sum_list(x): """Takes a list, and returns the sum of that list. If x is empty list, ret...
num = int(input('Digite um numero : ')) tot=0 for c in range(1,num + 1): if num % c == 0 : print(' {} '.format(c)) tot +=1 else: print('{} '.format(c))
num = int(input('Digite um numero : ')) tot = 0 for c in range(1, num + 1): if num % c == 0: print(' {} '.format(c)) tot += 1 else: print('{} '.format(c))
def nb_year(p0, percent, aug, p): count = 0 while p0 < p: pop = p0 + p0 * (percent/100) + aug p0 = pop ###this is kinda gross...should have just done something like### ### p0 += p0 * percent/100 + aug #### count += 1 return count
def nb_year(p0, percent, aug, p): count = 0 while p0 < p: pop = p0 + p0 * (percent / 100) + aug p0 = pop count += 1 return count
########################################################################### # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/l...
dcm__field__lookup = {'Video_Unmutes': 'INTEGER', 'Zip_Postal_Code': 'STRING', 'Path_Length': 'INTEGER', 'Measurable_Impressions_For_Audio': 'INTEGER', 'Average_Interaction_Time': 'FLOAT', 'Invalid_Impressions': 'INTEGER', 'Floodlight_Variable_40': 'STRING', 'Floodlight_Variable_41': 'STRING', 'Floodlight_Variable_42':...
def factorial(n): # return base case if n == 1: return 1 return n * factorial(n - 1) def steps(n): # step 0 if n == 0: return [[0]] # step 1 if n == 1: return [[0, 1]] n_1 = [a_list + [n] for a_list in steps(n-1)] n_2 = [a_list + [n] for a_list in steps(n-...
def factorial(n): if n == 1: return 1 return n * factorial(n - 1) def steps(n): if n == 0: return [[0]] if n == 1: return [[0, 1]] n_1 = [a_list + [n] for a_list in steps(n - 1)] n_2 = [a_list + [n] for a_list in steps(n - 2)] return n_1 + n_2 def my_bad_max(my_list...
pkgname = "dash" pkgver = "0.5.11.3" pkgrel = 0 build_style = "gnu_configure" pkgdesc = "POSIX-compliant Unix shell, much smaller than GNU bash" maintainer = "q66 <daniel@octaforge.org>" license = "BSD-3-Clause" url = "http://gondor.apana.org.au/~herbert/dash" sources = [f"http://gondor.apana.org.au/~herbert/dash/files...
pkgname = 'dash' pkgver = '0.5.11.3' pkgrel = 0 build_style = 'gnu_configure' pkgdesc = 'POSIX-compliant Unix shell, much smaller than GNU bash' maintainer = 'q66 <daniel@octaforge.org>' license = 'BSD-3-Clause' url = 'http://gondor.apana.org.au/~herbert/dash' sources = [f'http://gondor.apana.org.au/~herbert/dash/files...
OCTICON_SYNC = """ <svg class="octicon octicon-sync" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 2.5a5.487 5.487 0 00-4.131 1.869l1.204 1.204A.25.25 0 014.896 6H1.25A.25.25 0 011 5.75V2.104a.25.25 0 01.427-.177l1.38 1.38A7.001 7.001 0 0114.95 7.16a.75.7...
octicon_sync = '\n<svg class="octicon octicon-sync" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 2.5a5.487 5.487 0 00-4.131 1.869l1.204 1.204A.25.25 0 014.896 6H1.25A.25.25 0 011 5.75V2.104a.25.25 0 01.427-.177l1.38 1.38A7.001 7.001 0 0114.95 7.16a.75.75 ...
class Movie: def __init__(self,name,genre,watched): self.name= name self.genre = genre self.watched = watched def __repr__(self): return 'Movie : {} and Genre : {}'.format(self.name,self.genre ) def json(self): return { 'name': self.name, ...
class Movie: def __init__(self, name, genre, watched): self.name = name self.genre = genre self.watched = watched def __repr__(self): return 'Movie : {} and Genre : {}'.format(self.name, self.genre) def json(self): return {'name': self.name, 'genre': self.genre, 'w...
f=0 for i in range(0,n): st=str(a[i]) rev=st[::-1] if(st==rev): f=1 else: f=0 if(f==0): return 0 else: return 1
f = 0 for i in range(0, n): st = str(a[i]) rev = st[::-1] if st == rev: f = 1 else: f = 0 if f == 0: return 0 else: return 1
class PresentationSettings(): def __init__(self, settings:dict = {}): self.title = settings['title'] if 'title' in settings else 'Presentation' self.theme = settings['theme'] if 'theme' in settings else 'black'
class Presentationsettings: def __init__(self, settings: dict={}): self.title = settings['title'] if 'title' in settings else 'Presentation' self.theme = settings['theme'] if 'theme' in settings else 'black'
# # PySNMP MIB module ZhoneProductRegistrations (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZhoneProductRegistrations # Produced by pysmi-0.3.4 at Wed May 1 15:52:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint, constraints_union) ...
class Solution: def solve(self, nums): # Write your code here if len(nums) == 0: return nums s = nums[0] flag = True for i in range(1,len(nums)): if flag: k = nums[i] nums[i] = s if k < s: ...
class Solution: def solve(self, nums): if len(nums) == 0: return nums s = nums[0] flag = True for i in range(1, len(nums)): if flag: k = nums[i] nums[i] = s if k < s: s = k fl...
A, B, K = map(int, input().rstrip().split()) for n in range(A, B + 1): if n < A + K or n > B - K: print(n)
(a, b, k) = map(int, input().rstrip().split()) for n in range(A, B + 1): if n < A + K or n > B - K: print(n)
# Attributes in different classes are isolated, changing one class does not # affected the other, the same way that changing an object does not modify # another. email = 'contact@redi-school.org' class Student: email = 'student@redi-school.org' def __init__(self, name, birthday, courses): # class p...
email = 'contact@redi-school.org' class Student: email = 'student@redi-school.org' def __init__(self, name, birthday, courses): self.full_name = name self.first_name = name.split(' ')[0] self.birthday = birthday self.courses = courses self.attendance = [] class Teacher...
""" this is a regional comment """ #print("hello world") #this is a single line comment #print(type("123")) #print('hello world') #print("It's our 2nd Python class") my_str = 'hello world' print(my_str) my_str = 'second str' print(my_str) my_int = 2 my_float = 2.0 print(my_int + 3) print(my_int ** 3) print...
""" this is a regional comment """ my_str = 'hello world' print(my_str) my_str = 'second str' print(my_str) my_int = 2 my_float = 2.0 print(my_int + 3) print(my_int ** 3) print(my_int + my_float)
class InvalidGroupError(Exception): pass class MaxInvalidIterationsError(Exception): pass
class Invalidgrouperror(Exception): pass class Maxinvaliditerationserror(Exception): pass
# Author: Mengmeng Tang # Date: March 2, 2021 # Course: CS 325 # Description: Portfolio Assignment - Sudoku Puzzle # Requirement 3: Implement a program that allows the user to solve the puzzle. def print_board(puzzle): """ Takes a sudoku puzzle as parameter Print the board to the console """ # Co...
def print_board(puzzle): """ Takes a sudoku puzzle as parameter Print the board to the console """ print('Column 0 1 2 3 4 5 6 7 8 ') print(' ' * 6 + '+' + '---+' * 9) for (i, row) in enumerate(puzzle): print('Row {}'.format(i), ('|' + ' {} {} {} |' * 3).format(...
friend_ages = {"Rolf": 25, "Anne": 37, "Charlie": 31, "Bob": 22} for name in friend_ages: print(name) for age in friend_ages.values(): print(age) for name, age in friend_ages.items(): print(f"{name} is {age} years old.")
friend_ages = {'Rolf': 25, 'Anne': 37, 'Charlie': 31, 'Bob': 22} for name in friend_ages: print(name) for age in friend_ages.values(): print(age) for (name, age) in friend_ages.items(): print(f'{name} is {age} years old.')
__author__ = "Matthew Wardrop" __author_email__ = "mpwardrop@gmail.com" __version__ = "1.2.3" __dependencies__ = []
__author__ = 'Matthew Wardrop' __author_email__ = 'mpwardrop@gmail.com' __version__ = '1.2.3' __dependencies__ = []
# -*- coding: utf-8 -*- """Top-level package for svmplus.""" __author__ = """Niharika Gauraha""" __email__ = 'niharika.gauraha@farmbio.uu.se' __version__ = '1.0.0' __all__ = ['svmplus']
"""Top-level package for svmplus.""" __author__ = 'Niharika Gauraha' __email__ = 'niharika.gauraha@farmbio.uu.se' __version__ = '1.0.0' __all__ = ['svmplus']
""" https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/ Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i]. Return the answer in an ...
""" https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/ Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i]. Return the answer in an ...
# Average the numbers from 1 to n n = int(input("Enter number:")) avg = 0 for i in range(n + 1): avg += i avg = avg/n print(avg)
n = int(input('Enter number:')) avg = 0 for i in range(n + 1): avg += i avg = avg / n print(avg)
# import math # from fractions import * # from exceptions import * # from point import * # from line import * # from ellipse import * # from polygon import * # from hyperbola import * # from triangle import * # from rectangle import * # from graph import * # from delaunay import * class Se...
class Segment: def __init__(self, p, q): self.p = p self.q = q @classmethod def find_intersection(cls, segment): return None
# -*- coding:utf-8 -*- PROXY_RAW_KEY = "proxy_raw" PROXY_VALID_KEY = "proxy_valid"
proxy_raw_key = 'proxy_raw' proxy_valid_key = 'proxy_valid'
# # PySNMP MIB module ALVARION-BANDWIDTH-CONTROL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-BANDWIDTH-CONTROL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:06:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ...
(alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2') (alvarion_priority_queue,) = mibBuilder.importSymbols('ALVARION-TC', 'AlvarionPriorityQueue') (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mib...
class Bat: species = 'Baty' def __init__(self, can_fly=True): self.fly = can_fly def say(self, msg): msg = ".." return msg def sonar(self): return "))..((" if __name__ == '__main__': b = Bat() b.say('w') b.sonar
class Bat: species = 'Baty' def __init__(self, can_fly=True): self.fly = can_fly def say(self, msg): msg = '..' return msg def sonar(self): return '))..((' if __name__ == '__main__': b = bat() b.say('w') b.sonar
l, r = map(int, input().split()) while(l != 0 and r != 0): print(l + r) l, r = map(int, input().split())
(l, r) = map(int, input().split()) while l != 0 and r != 0: print(l + r) (l, r) = map(int, input().split())
expected_output = { "slot": { "lc": { "1": { "16x400G Ethernet Module": { "hardware": "3.1", "mac_address": "bc-4a-56-ff-fa-5b to bc-4a-56-ff-fb-dd", "model": "N9K-X9716D-GX", "online_diag_status": "P...
expected_output = {'slot': {'lc': {'1': {'16x400G Ethernet Module': {'hardware': '3.1', 'mac_address': 'bc-4a-56-ff-fa-5b to bc-4a-56-ff-fb-dd', 'model': 'N9K-X9716D-GX', 'online_diag_status': 'Pass', 'ports': '16', 'serial_number': 'FOC24322RBW', 'slot': '1', 'slot/world_wide_name': 'LC1', 'software': '10.1(0.233)', '...
# # PySNMP MIB module SNIA-SML-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNIA-SML-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:08:07 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, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, single_value_constraint, value_range_constraint) ...
class Human(object): def __init__(self, first_name, last_name, age, gender): self.first_name = first_name self.last_name = last_name self.age = age self.gender = gender def as_dict(self): return { 'first_name': self.first_name, 'last_name': self....
class Human(object): def __init__(self, first_name, last_name, age, gender): self.first_name = first_name self.last_name = last_name self.age = age self.gender = gender def as_dict(self): return {'first_name': self.first_name, 'last_name': self.last_name, 'age': self.ag...
class Solution: def countConsistentStrings(self, allowed: str, words: List[str]) -> int: consistent_strings = 0 for word in words: consistent = True for c in word: if c not in allowed: consistent = False break ...
class Solution: def count_consistent_strings(self, allowed: str, words: List[str]) -> int: consistent_strings = 0 for word in words: consistent = True for c in word: if c not in allowed: consistent = False break ...
motorcycles = ['honda', 'yamaha','suzuki'] print(motorcycles) #motorcycles[0] = 'ducati' motorcycles.append('ducati') print(motorcycles) motorcycles = [] motorcycles.append('honda') motorcycles.append('yamaha') motorcycles.append('suzuki') motorcycles.insert(0, 'ducati') print(motorcycles) del mo...
motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles.append('ducati') print(motorcycles) motorcycles = [] motorcycles.append('honda') motorcycles.append('yamaha') motorcycles.append('suzuki') motorcycles.insert(0, 'ducati') print(motorcycles) del motorcycles[1] print(motorcycles)
# Requirements # Python 3.6+ # Torch 1.8+ class BertClassifier(nn.Module): def __init__(self, n): super(BertClassifier, self).__init__() self.bert = BertModel.from_pretrained('bert-base-cased') self.drop = nn.Dropout(p=0.3) self.out = nn.Linear(self.bert.config.hidden_size, n) def forward(self, ...
class Bertclassifier(nn.Module): def __init__(self, n): super(BertClassifier, self).__init__() self.bert = BertModel.from_pretrained('bert-base-cased') self.drop = nn.Dropout(p=0.3) self.out = nn.Linear(self.bert.config.hidden_size, n) def forward(self, input_ids, attention_mas...
# type: ignore def test_func(): assert True
def test_func(): assert True
""" Data format for jointed energy and reserve management problem """ ALPHA = 0 BETA = 1 IG = 2 PG = 3 RUG = 4 RDG = 5
""" Data format for jointed energy and reserve management problem """ alpha = 0 beta = 1 ig = 2 pg = 3 rug = 4 rdg = 5
# V0 # V1 # https://blog.csdn.net/fuxuemingzhu/article/details/79460546 class Solution(object): def arrayNesting(self, nums): """ :type nums: List[int] :rtype: int """ visited = [False] * len(nums) ans = 0 for i in range(len(nums)): road = 0 ...
class Solution(object): def array_nesting(self, nums): """ :type nums: List[int] :rtype: int """ visited = [False] * len(nums) ans = 0 for i in range(len(nums)): road = 0 while not visited[i]: road += 1 ...
class PropertyNotHoldsException(Exception): def __init__(self, property_text, last_proved_stacktrace): self.last_proved_stacktrace = last_proved_stacktrace message = "A property found not to hold:\n\t" message += property_text super().__init__(message) class ModelNotFoundException(...
class Propertynotholdsexception(Exception): def __init__(self, property_text, last_proved_stacktrace): self.last_proved_stacktrace = last_proved_stacktrace message = 'A property found not to hold:\n\t' message += property_text super().__init__(message) class Modelnotfoundexception(...
def range(minimo,maximo,step): lista=[] while minimo<maximo: lista+=[minimo] #lista.append(minimo) minimo+=step return lista print(range(2,10,2)) print(range(100,1000,100))
def range(minimo, maximo, step): lista = [] while minimo < maximo: lista += [minimo] minimo += step return lista print(range(2, 10, 2)) print(range(100, 1000, 100))