content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- """ Created on Sat Jun 13 17:56:31 2020 @author: super """
""" Created on Sat Jun 13 17:56:31 2020 @author: super """
#Collaborators: None def rerun(): #Function is here to rerun the program for total of two times y = 0 while y<2: yogurtshack() y += 1 def yogurtshack(): print("Welcome to Yogurt Shack! Please type your order below. ") #Introducing the store and asking for order print("\n") fla...
def rerun(): y = 0 while y < 2: yogurtshack() y += 1 def yogurtshack(): print('Welcome to Yogurt Shack! Please type your order below. ') print('\n') flavor = input('What would you like your yogurt flavor to be? ') topping1 = input('Topping 1? ') topping2 = input('Topping 2? ...
""" * Factorial of a Number * Create a program to find the factorial of an integer entered by the user. * The factorial of a positive integer n is equal to 1 * 2 * 3 * ... * n. For example, the factorial of 4 is 1 * 2 * * 3 * 4 which is 24. * Take an integer input from the user and assign it to the variable n. We w...
""" * Factorial of a Number * Create a program to find the factorial of an integer entered by the user. * The factorial of a positive integer n is equal to 1 * 2 * 3 * ... * n. For example, the factorial of 4 is 1 * 2 * * 3 * 4 which is 24. * Take an integer input from the user and assign it to the variable n. We w...
def print_fun(): print("Heloo") class bala: Name = "This is Shifat" def shit(self): print("Say my name !") print("I'm in a class") def __str__(self): return self.Name
def print_fun(): print('Heloo') class Bala: name = 'This is Shifat' def shit(self): print('Say my name !') print("I'm in a class") def __str__(self): return self.Name
""" Implements a dependency tree. Indices are 1-based. """ class Node: def __init__(self, pair, index): self.parent_index_, self.label_ = pair.split('/') self.parent_index_ = int(self.parent_index_) self.index_ = int(index) self.parent_ = None self.children_ = [] def pa...
""" Implements a dependency tree. Indices are 1-based. """ class Node: def __init__(self, pair, index): (self.parent_index_, self.label_) = pair.split('/') self.parent_index_ = int(self.parent_index_) self.index_ = int(index) self.parent_ = None self.children_ = [] def...
''' This module represents the time stamp when Arelle was last built @author: Mark V Systems Limited (c) Copyright 2013 Mark V Systems Limited, All rights reserved. ''' version = '2013-10-08 05:43 UTC'
""" This module represents the time stamp when Arelle was last built @author: Mark V Systems Limited (c) Copyright 2013 Mark V Systems Limited, All rights reserved. """ version = '2013-10-08 05:43 UTC'
pedidos = [] def adicionaPedidos(nome, sabor, observacao='None'): pedido = {} pedido['nome'] = nome pedido['sabor'] = sabor pedido['observacao'] = observacao return (pedido) pedidos.append(adicionaPedidos('mario', 'pepperoni')) pedidos.append(adicionaPedidos('marco', 'portuguesa', 'dobro de presu...
pedidos = [] def adiciona_pedidos(nome, sabor, observacao='None'): pedido = {} pedido['nome'] = nome pedido['sabor'] = sabor pedido['observacao'] = observacao return pedido pedidos.append(adiciona_pedidos('mario', 'pepperoni')) pedidos.append(adiciona_pedidos('marco', 'portuguesa', 'dobro de presun...
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftPAR_ABREPAR_CIERRArightIGUALleftORleftANDleftNO_IGUALnonassocMAYORMENORMAYOR_IGUALMENOR_IGUALleftMASMENOSleftASTERISCODIVISIONMODULOleftPOTENCIArightNOTleftLLAVE_AB...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftPAR_ABREPAR_CIERRArightIGUALleftORleftANDleftNO_IGUALnonassocMAYORMENORMAYOR_IGUALMENOR_IGUALleftMASMENOSleftASTERISCODIVISIONMODULOleftPOTENCIArightNOTleftLLAVE_ABRELLAVE_CIERRAABS ADD ALL ALTER AND AS ASC ASTERISCO AVG BETWEEN BIGINT BOOLEAN BY CADENA CASE...
# -*- coding: utf-8 -*- """ PMLB was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - William La Cava (lacava@upenn.edu) - Weixuan Fu (weixuanf@upenn.edu) - and many more generous open source contributors Permission is hereby granted, free of charge, ...
""" PMLB was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - William La Cava (lacava@upenn.edu) - Weixuan Fu (weixuanf@upenn.edu) - and many more generous open source contributors Permission is hereby granted, free of charge, to any person obtaining a...
""" Define exceptions and warnings for DyNe Created by: Ankit Khambhati Change Log ---------- 2016/03/10 - Generated __all__ definition """ __all__ = ['PipeTypeError', 'PipeLinkError'] class PipeTypeError(TypeError): """ Exception class if pipe type is not of a registered type """ class Pip...
""" Define exceptions and warnings for DyNe Created by: Ankit Khambhati Change Log ---------- 2016/03/10 - Generated __all__ definition """ __all__ = ['PipeTypeError', 'PipeLinkError'] class Pipetypeerror(TypeError): """ Exception class if pipe type is not of a registered type """ class Pipelinkerror(At...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2021-10-23 10:13:19 # @Author : iamwm class Store: """ global shared context """ def __init__(self, cls) -> None: self.class_type = cls self.context = {} def get(self, name: str, *args, **kwargs): """ get...
class Store: """ global shared context """ def __init__(self, cls) -> None: self.class_type = cls self.context = {} def get(self, name: str, *args, **kwargs): """ get a context item by name """ if name not in self.context: target_obj = se...
#pangram - sentence with all alphabets #example - The quick brown fox jumps over the lazy dog #read the input myStr = input("Enter a sentence: ").lower() #eliminating all the spaces myStr = myStr.replace(" ", "") #eliminating all commonly used special characters myStr = myStr.replace("," , "") myStr = myStr.replace("...
my_str = input('Enter a sentence: ').lower() my_str = myStr.replace(' ', '') my_str = myStr.replace(',', '') my_str = myStr.replace('.', '') my_str = myStr.replace('!', '') my_set = set(myStr) if len(mySet) == 26: print('Entered string is a Pangram String') else: print('Not a Pangram String')
class UnitGroup(Enum, IComparable, IFormattable, IConvertible): """ A group of related unit types,primarily classified by discipline. enum UnitGroup,values: Common (0),Electrical (3),Energy (5),HVAC (2),Piping (4),Structural (1) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx._...
class Unitgroup(Enum, IComparable, IFormattable, IConvertible): """ A group of related unit types,primarily classified by discipline. enum UnitGroup,values: Common (0),Electrical (3),Energy (5),HVAC (2),Piping (4),Structural (1) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx.__eq__(y) <...
__all__ = ["Roll"] class Roll: pass
__all__ = ['Roll'] class Roll: pass
class ApiHttpRequest: GET_METHOD = 'GET' POST_METHOD = 'POST' HTTP_METHODS = [GET_METHOD, POST_METHOD] def __init__(self, api_http_request_method: str, api_url: str, api_http_request_headers: dict = None, api_http_request_body: str = None) -> None: self._method = api_http_requ...
class Apihttprequest: get_method = 'GET' post_method = 'POST' http_methods = [GET_METHOD, POST_METHOD] def __init__(self, api_http_request_method: str, api_url: str, api_http_request_headers: dict=None, api_http_request_body: str=None) -> None: self._method = api_http_request_method sel...
# This code reads a text file from user input, finds words and sorts them by unique count then alphabetically. # C++ version is named "sortwords.cpp" and uses no built-in maps. # Dict is like std::map in C++ result = dict() # Count total number of words totalWords = 0 for line in open(input("Enter the filename:...
result = dict() total_words = 0 for line in open(input('Enter the filename: '), encoding='utf8'): for word in ''.join((c for c in line.rstrip().lower() if c == ' ' or c.isalpha())).split(' '): if word != '': result[word] = result[word] + 1 if word in result else 1 total_words += 1 re...
# Everything in this file is sampled by a Vivado 2019.2 # Recap of variables in this file for convenience parts = [] # help command stripped of everything except -directive paragraph place_directives_paragraph = "" route_directives_paragraph = "" synth_directives_paragraph = "" # full help command output help_synth...
parts = [] place_directives_paragraph = '' route_directives_paragraph = '' synth_directives_paragraph = '' help_synth_design = '' help_place_design = '' help_route_design = '' synth_directives = [] place_directives = [] route_directives = [] place_note = '' route_note = '' incremental_place_directives = [] incremental_...
# https://www.hackerrank.com/challenges/crush/problem?isFullScreen=true def reduce_x(a, b, c): mod = 1000000007 return a % mod, b % mod, c % mod # Main Method if __name__ == '__main__': n, m = map(int, input().split()) arr = [0] * (n + 2) for _ in range(m): a, b, k = map(int...
def reduce_x(a, b, c): mod = 1000000007 return (a % mod, b % mod, c % mod) if __name__ == '__main__': (n, m) = map(int, input().split()) arr = [0] * (n + 2) for _ in range(m): (a, b, k) = map(int, input().split()) (a, b, k) = reduce_x(a, b, k) arr[a] += k arr[b + 1] -...
#------------------------------------------------------------------------------- # # Project: EOxServer <http://eoxserver.org> # Authors: Stephan Krause <stephan.krause@eox.at> # Stephan Meissl <stephan.meissl@eox.at> # #------------------------------------------------------------------------------- # Copyrigh...
class Abstractstorageinterface(object): @property def name(self): """Name of the storage implementation.""" def validate(self, url): """ Validates the given storage locator and raises a ValidationError if errors occurred. """ class Filestorageinterface(AbstractStorageI...
# -*- coding: utf-8 -*- """ Created on Sat Nov 3 11:46:11 2018 @author: Simon """ def bubble_sort_reverse(array): bubble_sort(array, lambda x, y: x < y) def bubble_sort(array, comparator=lambda x, y: x>y): """ Sorts an array using a bubble sort algorithm Inputs: array: the list to sort ...
""" Created on Sat Nov 3 11:46:11 2018 @author: Simon """ def bubble_sort_reverse(array): bubble_sort(array, lambda x, y: x < y) def bubble_sort(array, comparator=lambda x, y: x > y): """ Sorts an array using a bubble sort algorithm Inputs: array: the list to sort comparator: functio...
def calcManhattanDist(x1, y1, x2, y2) -> float: return abs(x1 - x2) + abs(y1 - y2) def main(): print(calcManhattanDist(2, 5, 10, 14)) if __name__ == "__main__": main()
def calc_manhattan_dist(x1, y1, x2, y2) -> float: return abs(x1 - x2) + abs(y1 - y2) def main(): print(calc_manhattan_dist(2, 5, 10, 14)) if __name__ == '__main__': main()
class EventNotFound(Exception): """Handles invalid event type provided to publishers Attributes: event_type --> the event that's invalid message --> additional message to log or print """ def __init__(self, event_type: str, message: str ="invalid event"): ...
class Eventnotfound(Exception): """Handles invalid event type provided to publishers Attributes: event_type --> the event that's invalid message --> additional message to log or print """ def __init__(self, event_type: str, message: str='invalid event'): ...
def collatz(n): seq = [n] while n != 1: if n % 2 == 0: n = n / 2 seq.append(int(n)) else: n = 3 * n + 1 seq.append(int(n)) return len(seq) i = 1 seqs = [] dictich = {} while i < 1000000: length = collatz(i) dictich[le...
def collatz(n): seq = [n] while n != 1: if n % 2 == 0: n = n / 2 seq.append(int(n)) else: n = 3 * n + 1 seq.append(int(n)) return len(seq) i = 1 seqs = [] dictich = {} while i < 1000000: length = collatz(i) dictich[length] = i seqs....
# DEVELOPER NOTES: # Copy this file and rename it to config.py # Replace your client/secret/callback url for each environment below with your specific app details # (Note: local is mainly for BB2 internal developers) ConfigType = { 'production' : { 'bb2BaseUrl' : 'https://api.bluebutton.cms.gov', '...
config_type = {'production': {'bb2BaseUrl': 'https://api.bluebutton.cms.gov', 'bb2ClientId': '<client-id>', 'bb2ClientSecret': '<client-secret>', 'bb2CallbackUrl': '<only https is supported in prod>', 'port': 3001, 'host': 'Unk'}, 'sandbox': {'bb2BaseUrl': 'https://sandbox.bluebutton.cms.gov', 'bb2ClientId': '<client-i...
class prm: std = dict( field_color="mediumseagreen", field_markings_color="White", title_color="White", ) pc = dict( field_color="White", field_markings_color="black", title_color="black" ) field_width = 1000 field_height = 700 field_dim = (106.0, 68.0) ...
class Prm: std = dict(field_color='mediumseagreen', field_markings_color='White', title_color='White') pc = dict(field_color='White', field_markings_color='black', title_color='black') field_width = 1000 field_height = 700 field_dim = (106.0, 68.0) marker_border_color = 'white' marker_border...
assert gradiente('rojo', 'azul') == gradiente('rojo', 'azul') assert gradiente('rojo', 'azul', inicio='centro') == gradiente('rojo', 'azul') assert gradiente('rojo', 'azul', inicio='izquierda') == gradiente('rojo', 'azul', inicio='izquierda') assert gradiente('rojo', 'azul') != gradiente('rojo', 'azul', inicio='izquie...
assert gradiente('rojo', 'azul') == gradiente('rojo', 'azul') assert gradiente('rojo', 'azul', inicio='centro') == gradiente('rojo', 'azul') assert gradiente('rojo', 'azul', inicio='izquierda') == gradiente('rojo', 'azul', inicio='izquierda') assert gradiente('rojo', 'azul') != gradiente('rojo', 'azul', inicio='izquier...
def foo(y): x = 5 x / y def bar(): foo(0) bar()
def foo(y): x = 5 x / y def bar(): foo(0) bar()
class Error(Exception): def __init__(self, message, error): self.message = message self.error = error @property def code(self): return 503 @property def name(self): return self.__class__.__name__ @property def description(self): return self.message ...
class Error(Exception): def __init__(self, message, error): self.message = message self.error = error @property def code(self): return 503 @property def name(self): return self.__class__.__name__ @property def description(self): return self.message...
def sixIntegers(): print("Please enter 6 integers:") i = 0 even = 0 odd = 0 while i < 6: try: six = input(">") six = int(six) i += 1 if (six % 2) == 0: even = even + six elif (six % 2) == 1: odd = od...
def six_integers(): print('Please enter 6 integers:') i = 0 even = 0 odd = 0 while i < 6: try: six = input('>') six = int(six) i += 1 if six % 2 == 0: even = even + six elif six % 2 == 1: odd = odd + ...
class YLBaseServer(object): def name(self): pass def handle(self, args): pass def startup(self, *args): pass def stop(self, *args): pass
class Ylbaseserver(object): def name(self): pass def handle(self, args): pass def startup(self, *args): pass def stop(self, *args): pass
""" Status codes for Andor cameras. """ # Status code -> status message ANDOR_CODES = { 20001: "DRV_ERROR_CODES", 20002: "DRV_SUCCESS", 20003: "DRV_VXDNOTINSTALLED", 20004: "DRV_ERROR_SCAN", 20005: "DRV_ERROR_CHECK_SUM", 20006: "DRV_ERROR_FILELOAD", 20007: "DRV_UNKNOWN_FUNCTION", 20008...
""" Status codes for Andor cameras. """ andor_codes = {20001: 'DRV_ERROR_CODES', 20002: 'DRV_SUCCESS', 20003: 'DRV_VXDNOTINSTALLED', 20004: 'DRV_ERROR_SCAN', 20005: 'DRV_ERROR_CHECK_SUM', 20006: 'DRV_ERROR_FILELOAD', 20007: 'DRV_UNKNOWN_FUNCTION', 20008: 'DRV_ERROR_VXD_INIT', 20009: 'DRV_ERROR_ADDRESS', 20010: 'DRV_ER...
#!/usr/local/bin/python3 def checkDriverAge(age=0): # if not age: # age = int(input('What is your age?: ')) if int(age) < 18: print('Sorry, you are too young to drive this car ' 'Powering off!') elif int(age) > 18: print('Powering On. Enjoy the ride!') elif int(ag...
def check_driver_age(age=0): if int(age) < 18: print('Sorry, you are too young to drive this car Powering off!') elif int(age) > 18: print('Powering On. Enjoy the ride!') elif int(age) == 18: print('Congratulations on your first year ofdriving. Enjoy the ride') return age if __na...
#!/usr/bin/env python3 #encoding=utf-8 #--------------------------------------- # Usage: python3 5-tracer1.py # Description: Recall from Chapter 30 that the __call__ operator overloading # method implements a function-call interface for class instances. # The following code uses this to def...
class Tracer: def __init__(self, func): self.calls = 0 self.func = func def __call__(self, *args): self.calls += 1 print('call %s to %s' % (self.calls, self.func.__name__)) return self.func(*args) if __name__ == '__main__': '\n Because the spam function is run th...
class Artist: def __init__(self, name = 'None', birthYear = 0, deathYear = 0): self.name = name self.BirthYear = birthYear self.deathYear = deathYear def printInfo(self): if self.deathYear == str('alive'): print('Artist: {}, born {}'.format(self.name, self.BirthYear))...
class Artist: def __init__(self, name='None', birthYear=0, deathYear=0): self.name = name self.BirthYear = birthYear self.deathYear = deathYear def print_info(self): if self.deathYear == str('alive'): print('Artist: {}, born {}'.format(self.name, self.BirthYear)) ...
alert_failure_count = 0 MAX_TEMP_ALLOWED_IN_CELCIUS = 200 def network_alert_stub(celcius): print(f'ALERT: Temperature is {celcius} celcius') if(celcius <= MAX_TEMP_ALLOWED_IN_CELCIUS): # Return 200 for ok return 200 else: # Return 500 for not-ok return 500 def network_a...
alert_failure_count = 0 max_temp_allowed_in_celcius = 200 def network_alert_stub(celcius): print(f'ALERT: Temperature is {celcius} celcius') if celcius <= MAX_TEMP_ALLOWED_IN_CELCIUS: return 200 else: return 500 def network_alert_real(celcius): return 200 def farenheit2celcius(farenhe...
''' Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by 1. You may assume the array's length is at most 10,000. Example: Input: [1,2,3] Output: 2 Explanation: Only two...
""" Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by 1. You may assume the array's length is at most 10,000. Example: Input: [1,2,3] Output: 2 Explanation: Only two...
""" .. module:: reaction_message :platform: Unix :synopsis: A module that describes what the reaction should be when receiving a specific message. .. Copyright 2022 EDF .. moduleauthor:: Oscar RODRIGUEZ INFANTE, Tony ZHOU, Trang PHAM, Efflam OLLIVIER .. License:: This source code is licensed under the MIT Li...
""" .. module:: reaction_message :platform: Unix :synopsis: A module that describes what the reaction should be when receiving a specific message. .. Copyright 2022 EDF .. moduleauthor:: Oscar RODRIGUEZ INFANTE, Tony ZHOU, Trang PHAM, Efflam OLLIVIER .. License:: This source code is licensed under the MIT Li...
class Spam(object): def __init__(self, count): self.count = count def __eq__(self, other): return self.count == other.count
class Spam(object): def __init__(self, count): self.count = count def __eq__(self, other): return self.count == other.count
class Node: def __init__(self, data=None, pointer=None): self.data = data self.pointer = pointer def set_data(self, data): self.data = data def get_data(self): return self.data def set_pointer(self, pointer): self.pointer = pointer def get_pointer(self): ...
class Node: def __init__(self, data=None, pointer=None): self.data = data self.pointer = pointer def set_data(self, data): self.data = data def get_data(self): return self.data def set_pointer(self, pointer): self.pointer = pointer def get_pointer(self): ...
how_many_snakes = 1 snake_string = """ Bem-vindo ao Python3! ____ / . .\\ \ ---< \ / __________/ / -=:___________/ <3, Philip e Charlie """ print(snake_string * how_many_snakes)
how_many_snakes = 1 snake_string = '\nBem-vindo ao Python3!\n\n ____\n / . .\\\n \\ ---<\n \\ /\n __________/ /\n-=:___________/\n\n<3, Philip e Charlie\n' print(snake_string * how_many_snakes)
def open_group(group, path): """Creates or loads the subgroup defined by `path`.""" if path in group: return group[path] else: return group.create_group(path)
def open_group(group, path): """Creates or loads the subgroup defined by `path`.""" if path in group: return group[path] else: return group.create_group(path)
''' Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Input: S = "ADOBECODEBANC", T = "ABC" Output: "BANC" Note: If there is no such window in S that covers all characters in T, return the empty string "". If there is such w...
""" Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Input: S = "ADOBECODEBANC", T = "ABC" Output: "BANC" Note: If there is no such window in S that covers all characters in T, return the empty string "". If there is such w...
def test_message_create_list(test_client, version_header): payload = {"subject": "heyhey", "message": "testing"} create_response = test_client.post( "/messages", json=payload, headers=version_header ) assert create_response.status_code == 201 response = test_client.get("/me...
def test_message_create_list(test_client, version_header): payload = {'subject': 'heyhey', 'message': 'testing'} create_response = test_client.post('/messages', json=payload, headers=version_header) assert create_response.status_code == 201 response = test_client.get('/messages', headers=version_header)...
# 11. Write a program that asks the user to enter a word that contains the letter a. The program # should then print the following two lines: On the first line should be the part of the string up # to and including the the first a, and on the second line should be the rest of the string. Sample # output is shown below:...
word = input('Enter a word: ') idx = word.find('a') print(word[:idx + 1]) print(word[idx + 1:])
''' The floor number we can check given m moves and k eggs. dp[m][k] = dp[m - 1][k - 1] + dp[m - 1][k] + 1 ''' class Solution: def superEggDrop(self, K: int, N: int) -> int: dp = [0] * (K + 1) m = 0 while dp[K] < N: for k in range(K, 0, -1): dp[k] = dp[k - 1] + d...
""" The floor number we can check given m moves and k eggs. dp[m][k] = dp[m - 1][k - 1] + dp[m - 1][k] + 1 """ class Solution: def super_egg_drop(self, K: int, N: int) -> int: dp = [0] * (K + 1) m = 0 while dp[K] < N: for k in range(K, 0, -1): dp[k] = dp[k - 1] ...
def dfs(node,parent,ptaken): if dp[node][ptaken]!=-1: return dp[node][ptaken] taking,nottaking=1,0 total=0 tways for neig in graph[node]: if neig!=parent: taking+=dfs(neig,node,1) nottaking+=dfs(neig,node,0) if ptaken: dp[node][ptaken]=min(taking,nottaking) else: dp[node][ptaken]=taking return dp...
def dfs(node, parent, ptaken): if dp[node][ptaken] != -1: return dp[node][ptaken] (taking, nottaking) = (1, 0) total = 0 tways for neig in graph[node]: if neig != parent: taking += dfs(neig, node, 1) nottaking += dfs(neig, node, 0) if ptaken: dp[no...
# Vicfred # https://atcoder.jp/contests/abc154/tasks/abc154_a # simulation s, t = input().split() a, b = list(map(int, input().split())) u = input() balls = {} balls[s] = a balls[t] = b balls[u] = balls[u] - 1 print(balls[s], balls[t])
(s, t) = input().split() (a, b) = list(map(int, input().split())) u = input() balls = {} balls[s] = a balls[t] = b balls[u] = balls[u] - 1 print(balls[s], balls[t])
class Solution: def longestPalindrome(self, s: str) -> str: def expand(left:int, right:int) -> str: while left >= 0 and right <= len(s) and s[left] == s[right-1]: left -= 1 right += 1 return s[left+1 : right-1] if len(s) < 2 or s == s[...
class Solution: def longest_palindrome(self, s: str) -> str: def expand(left: int, right: int) -> str: while left >= 0 and right <= len(s) and (s[left] == s[right - 1]): left -= 1 right += 1 return s[left + 1:right - 1] if len(s) < 2 or s == ...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "David S. Batista" __email__ = "dsbatista@inesc-id.pt" class Seed(object): def __init__(self, _e1, _e2): self.e1 = _e1 self.e2 = _e2 def __hash__(self): return hash(self.e1) ^ hash(self.e2) def __eq__(self, other): ...
__author__ = 'David S. Batista' __email__ = 'dsbatista@inesc-id.pt' class Seed(object): def __init__(self, _e1, _e2): self.e1 = _e1 self.e2 = _e2 def __hash__(self): return hash(self.e1) ^ hash(self.e2) def __eq__(self, other): return self.e1 == other.e1 and self.e2 == ot...
CONFIG = { 'file_gdb': 'curb_geocoder.gdb', 'input': { 'address_pt': 'ADDRESS_CURB_20141105', 'address_fields': { 'address_id': 'OBJECTID', 'address_full': 'ADDRESS_ID', 'poly_id': 'OBJECTID_1', }, 'streets_lin': 'STREETS_LIN', 'streets_fields': { 'street_name': 'STNAME', 'left_from': 'L_F_...
config = {'file_gdb': 'curb_geocoder.gdb', 'input': {'address_pt': 'ADDRESS_CURB_20141105', 'address_fields': {'address_id': 'OBJECTID', 'address_full': 'ADDRESS_ID', 'poly_id': 'OBJECTID_1'}, 'streets_lin': 'STREETS_LIN', 'streets_fields': {'street_name': 'STNAME', 'left_from': 'L_F_ADD', 'left_to': 'L_T_ADD', 'right_...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findBottomLeftValue(self, root: Optional[TreeNode]) -> int: bottomleft=root.val stack=[(...
class Solution: def find_bottom_left_value(self, root: Optional[TreeNode]) -> int: bottomleft = root.val stack = [(root, 0)] prev_depth = 0 while stack: (cur, depth) = stack.pop(0) if depth != prev_depth: bottomleft = cur.val if cu...
# # PySNMP MIB module AISPY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AISPY-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:00: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, 09:23...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ...
class OrangeRicky(): def __init__(self, rotation): self.colour = "O" self.rotation = rotation if rotation == 0: self.coords = [[8, 0], [8, 1], [7, 1], [6, 1]] elif rotation == 1: self.coords = [[8, 2], [7, 2], [7, 1], [7, 0]] elif rotat...
class Orangericky: def __init__(self, rotation): self.colour = 'O' self.rotation = rotation if rotation == 0: self.coords = [[8, 0], [8, 1], [7, 1], [6, 1]] elif rotation == 1: self.coords = [[8, 2], [7, 2], [7, 1], [7, 0]] elif rotation == 2: ...
""" There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings. You are giving candies to these children subjected to the following requirements: -Each child must have at least one candy. -Children with a higher rating get more candies than their neighbors. Return ...
""" There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings. You are giving candies to these children subjected to the following requirements: -Each child must have at least one candy. -Children with a higher rating get more candies than their neighbors. Return ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def widthOfBinaryTree(self, root: TreeNode) -> int: if not root: return 0 queue=...
class Solution: def width_of_binary_tree(self, root: TreeNode) -> int: if not root: return 0 queue = [[root, 0]] max_width = 1 while queue: new_queue = [] for (node, node_id) in queue: if node.left: new_queue.ap...
class AppMetricsError(Exception): pass class InvalidMetricsBackend(AppMetricsError): pass class MetricError(AppMetricsError): pass class TimerError(AppMetricsError): pass
class Appmetricserror(Exception): pass class Invalidmetricsbackend(AppMetricsError): pass class Metricerror(AppMetricsError): pass class Timererror(AppMetricsError): pass
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
class Panosecontrast(object): """ Const Class See Also: `API PanoseContrast <https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1rendering_1_1PanoseContrast.html>`_ """ __ooo_ns__: str = 'com.sun.star.rendering' __ooo_full_ns__: str = 'com.sun.star.rendering.PanoseC...
def get_tensor_shape(tensor): shape = [] for s in tensor.shape: if s is None: shape.append(s) else: shape.append(s.value) return tuple(shape)
def get_tensor_shape(tensor): shape = [] for s in tensor.shape: if s is None: shape.append(s) else: shape.append(s.value) return tuple(shape)
class InstaloaderException(Exception): """Base exception for this script. :note: This exception should not be raised directly.""" pass class QueryReturnedBadRequestException(InstaloaderException): pass class QueryReturnedForbiddenException(InstaloaderException): pass class ProfileNotExistsExc...
class Instaloaderexception(Exception): """Base exception for this script. :note: This exception should not be raised directly.""" pass class Queryreturnedbadrequestexception(InstaloaderException): pass class Queryreturnedforbiddenexception(InstaloaderException): pass class Profilenotexistsexcept...
#!/usr/bin/python3 f = open("day8-input.txt", "r") finput = f.read().split("\n") finput.pop() def get_instruction_set(): instruction_set = [] for i in finput: instruction_set.append({ "instruction" : i.split(' ')[0], "value": int(i.split(' ')[1]), "order": [] ...
f = open('day8-input.txt', 'r') finput = f.read().split('\n') finput.pop() def get_instruction_set(): instruction_set = [] for i in finput: instruction_set.append({'instruction': i.split(' ')[0], 'value': int(i.split(' ')[1]), 'order': []}) return instruction_set def run_instruction_set(change, ch...
num = [] par = [] impar = [] for i in range(20): num.append(float(input())) print(num) for i in num: if i % 2 == 0: par.append(i) else: impar.append(i) print(par) print(impar)
num = [] par = [] impar = [] for i in range(20): num.append(float(input())) print(num) for i in num: if i % 2 == 0: par.append(i) else: impar.append(i) print(par) print(impar)
data = '/home/tong.wang001/data/TS/textsimp.train.pt' save_model = 'textsimp' train_from_state_dict = '' train_from = '' curriculum = True extra_shuffle = True batch_size = 64 gpus = [0] layers = 2 rnn_size = 500 word_vec_size = 500 input_feed = 1 brnn_merge = 'concat' max_generator_batches = 32 epochs = 13 start_epoch...
data = '/home/tong.wang001/data/TS/textsimp.train.pt' save_model = 'textsimp' train_from_state_dict = '' train_from = '' curriculum = True extra_shuffle = True batch_size = 64 gpus = [0] layers = 2 rnn_size = 500 word_vec_size = 500 input_feed = 1 brnn_merge = 'concat' max_generator_batches = 32 epochs = 13 start_epoch...
#!/usr/bin/python3 count = 0 with open('./input.txt', 'r') as input: list_lines = input.read().split('\n\n') for line in list_lines: count += len({i:line.replace("\n", "").count(i) for i in line.replace("\n", "")}) print(count) input.close()
count = 0 with open('./input.txt', 'r') as input: list_lines = input.read().split('\n\n') for line in list_lines: count += len({i: line.replace('\n', '').count(i) for i in line.replace('\n', '')}) print(count) input.close()
h, n = map(int, input().split()) a = [] b = [] for _ in range(n): ai, bi = map(int, input().split()) a.append(ai) b.append(bi) dp = [float("inf")] * (h + 1) dp[0] = 0 for i in range(h): for j in range(n): index = min(i + a[j], h) dp[index] = min(dp[index], dp[i] + b[j]) print(dp[h])
(h, n) = map(int, input().split()) a = [] b = [] for _ in range(n): (ai, bi) = map(int, input().split()) a.append(ai) b.append(bi) dp = [float('inf')] * (h + 1) dp[0] = 0 for i in range(h): for j in range(n): index = min(i + a[j], h) dp[index] = min(dp[index], dp[i] + b[j]) print(dp[h])
test = { 'name': 'q5', 'points': 3, 'suites': [ { 'cases': [ {'code': '>>> abs(kg_to_newtons(100) - 980) < 0.000001\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> abs(kg_to_newtons(3) - 29.4) < 0.000001\nTrue', 'hidden': False, 'locked': False}, ...
test = {'name': 'q5', 'points': 3, 'suites': [{'cases': [{'code': '>>> abs(kg_to_newtons(100) - 980) < 0.000001\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> abs(kg_to_newtons(3) - 29.4) < 0.000001\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> abs(kg_to_newtons(47) - 460.6) < 0.000001\nTrue', 'hid...
# 04 February 2018 Functions # Define function using def() def ratio(x,y): """The ratio of 'x' to 'y'.""" return x/y # Define function that always returns the same thing def IReturnOne(): """This returns 1""" return 1 print(ratio(4,2)) print(IReturnOne()) # Function without return argument def thin...
def ratio(x, y): """The ratio of 'x' to 'y'.""" return x / y def i_return_one(): """This returns 1""" return 1 print(ratio(4, 2)) print(i_return_one()) def think_too_much(): """Express Caesar's skepticism about Cassius """ print('Not too much...') think_too_much() return_val = think_too_much()...
PROCESS_NAME_SET = None PROCESS_DATA = None SERVICE_NAME_SET = None SYSPATH_STR = None SYSPATH_FILE_SET = None SYSTEMROOT_STR = None SYSTEMROOT_FILE_SET = None DRIVERPATH_STR = None DRIVERPATH_FILE_SET = None DRIVERPATH_DATA = None PROFILE_PATH = None USER_DIRS_LIST = None HKEY_USERS_DATA = None PROGRAM_FILES_STR = No...
process_name_set = None process_data = None service_name_set = None syspath_str = None syspath_file_set = None systemroot_str = None systemroot_file_set = None driverpath_str = None driverpath_file_set = None driverpath_data = None profile_path = None user_dirs_list = None hkey_users_data = None program_files_str = Non...
class ShoppingCartItem: def __init__(self, id, name, price, quantity): self.id = id self.name = name self.price = price self.quantity = quantity @property def total_price(self): return self.price * self.quantity
class Shoppingcartitem: def __init__(self, id, name, price, quantity): self.id = id self.name = name self.price = price self.quantity = quantity @property def total_price(self): return self.price * self.quantity
def sort_(arr, temporary=False, reverse=False): # Making copy of array if temporary is true if temporary: ar = arr[:] else: ar = arr # To blend every element # in correct position # length of total array is required length = len(ar) # After each iteration ...
def sort_(arr, temporary=False, reverse=False): if temporary: ar = arr[:] else: ar = arr length = len(ar) while length > 0: for i in range(0, length - 1): if reverse: if ar[i] < ar[i + 1]: tmp = ar[i] ar[i] = ar[...
def tagWithMostP(dom, tagMaxP=None): for child in dom.findChildren(recursive=False): if child and not child.get('name') == 'p': numMaxP = 0 if tagMaxP: numMaxP = len(tagMaxP.find_all('p', recursive=False)) numCurrentP = len(child.find_all('p', recursive=Fa...
def tag_with_most_p(dom, tagMaxP=None): for child in dom.findChildren(recursive=False): if child and (not child.get('name') == 'p'): num_max_p = 0 if tagMaxP: num_max_p = len(tagMaxP.find_all('p', recursive=False)) num_current_p = len(child.find_all('p', r...
a = [3, 8, 5, 1, 8, 9, 4, 9, 6, 4, 3, 7] b = list (set (a)) for i in range (len(b)): for j in range (i+1,len (b)): if b[i]>b[j]: b[i] , b[j] = b[j], b[i] print (b)
a = [3, 8, 5, 1, 8, 9, 4, 9, 6, 4, 3, 7] b = list(set(a)) for i in range(len(b)): for j in range(i + 1, len(b)): if b[i] > b[j]: (b[i], b[j]) = (b[j], b[i]) print(b)
class Solution(object): def getHint(self, secret, guess): """ :type secret: str :type guess: str :rtype: str """ bulls = 0 cows = 0 length = len(secret) indexCounted = [] for index in range(0, length): if secret[index] == g...
class Solution(object): def get_hint(self, secret, guess): """ :type secret: str :type guess: str :rtype: str """ bulls = 0 cows = 0 length = len(secret) index_counted = [] for index in range(0, length): if secret[index] ==...
def get_input(path): with open(path, 'r') as fh: return fh.read().splitlines() def isValid_part1(rule, password): (r, c) = rule.split(" ") (mini, maxi) = r.split("-") num_of_occur = password.count(c) if num_of_occur < int(mini) or num_of_occur > int(maxi): return False return T...
def get_input(path): with open(path, 'r') as fh: return fh.read().splitlines() def is_valid_part1(rule, password): (r, c) = rule.split(' ') (mini, maxi) = r.split('-') num_of_occur = password.count(c) if num_of_occur < int(mini) or num_of_occur > int(maxi): return False return T...
def default(): return { 'columns': [ {'name': 'id', 'type': 'string'}, {'name': 'sku', 'type': 'object'}, {'name': 'name', 'type': 'string'}, {'name': 'type', 'type': 'string'}, {'name': 'kind', 'type': 'string'}, {'name': 'plan', 'type...
def default(): return {'columns': [{'name': 'id', 'type': 'string'}, {'name': 'sku', 'type': 'object'}, {'name': 'name', 'type': 'string'}, {'name': 'type', 'type': 'string'}, {'name': 'kind', 'type': 'string'}, {'name': 'plan', 'type': 'object'}, {'name': 'tags', 'type': 'object'}, {'name': 'location', 'type': 'st...
"""Les ensembles en Python.""" X = set('abcd') Y = set('sbds') print("ensembles de depart".center(50, '-')) print("X=", X) print("Y=", Y) suite = input('\nTaper "Entree" pour la suite') print("appartenance".center(50, '-')) print("'c' appartient a X ?", 'c' in X) print("'a' appartient a Y ?", 'a' in Y) ...
"""Les ensembles en Python.""" x = set('abcd') y = set('sbds') print('ensembles de depart'.center(50, '-')) print('X=', X) print('Y=', Y) suite = input('\nTaper "Entree" pour la suite') print('appartenance'.center(50, '-')) print("'c' appartient a X ?", 'c' in X) print("'a' appartient a Y ?", 'a' in Y) suite = input('\...
numbers=[] while True: number=input("Enter a number:") if number=="done": break else: number=float(number) numbers.append(number) continue print("Maximum:",max(numbers)) print("Minimum:",min(numbers))
numbers = [] while True: number = input('Enter a number:') if number == 'done': break else: number = float(number) numbers.append(number) continue print('Maximum:', max(numbers)) print('Minimum:', min(numbers))
def g_load(file): print("file {} loaded as BMP v2".format(file)) return None if __name__ == "__main__": print("Test Bmp.py") print(g_load("test.bmp"))
def g_load(file): print('file {} loaded as BMP v2'.format(file)) return None if __name__ == '__main__': print('Test Bmp.py') print(g_load('test.bmp'))
# Description: Run the AODBW function from the pymolshortcuts.py file to generate photorealistic effect with carbons colored black and all other atoms colored in grayscale. # Source: placeHolder """ cmd.do('cmd.do("AODBW")') """ cmd.do('cmd.do("AODBW")')
""" cmd.do('cmd.do("AODBW")') """ cmd.do('cmd.do("AODBW")')
## Shorty ## Copyright 2009 Joshua Roesslein ## See LICENSE ## @url budurl.com class Budurl(Service): def __init__(self, apikey=None): self.apikey = apikey def _test(self): #prompt for apikey self.apikey = raw_input('budurl apikey: ') Service._test(self) def shrink(self, ...
class Budurl(Service): def __init__(self, apikey=None): self.apikey = apikey def _test(self): self.apikey = raw_input('budurl apikey: ') Service._test(self) def shrink(self, bigurl, notes=None): if self.apikey is None: raise shorty_error('Must set an apikey') ...
def validate_genome(genome, *args, **kwargs): if len(set(e.innov for e in genome.edges)) != len(genome.edges): raise ValueError('Non-unique edge in genome edges.') if len(set(n.innov for n in genome.nodes)) != len(genome.nodes): raise ValueError('Non-unique node in genome node.') for e in ...
def validate_genome(genome, *args, **kwargs): if len(set((e.innov for e in genome.edges))) != len(genome.edges): raise value_error('Non-unique edge in genome edges.') if len(set((n.innov for n in genome.nodes))) != len(genome.nodes): raise value_error('Non-unique node in genome node.') for e...
""" https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/ One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as #. _9_ / \ 3 2 / \ / \ ...
""" https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/ One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as #. _9_ / 3 2 / \\ / 4 ...
print("enter the two number") n1,n2=map(int,input().split()) print("press + for add") print("press - for subb") print("press * for mul") print("press / for div") e=input() if e == "+": print(n1+n2) elif e == "-": print(n1-n2) elif e == "*": print(n1*n2) elif e == "/": print(n1/n2) else: print("you e...
print('enter the two number') (n1, n2) = map(int, input().split()) print('press + for add') print('press - for subb') print('press * for mul') print('press / for div') e = input() if e == '+': print(n1 + n2) elif e == '-': print(n1 - n2) elif e == '*': print(n1 * n2) elif e == '/': print(n1 / n2) else: ...
class UndefinedMetricWarning(UserWarning): """Warning used when the metric is invalid .. versionchanged:: 0.18 Moved from sklearn.base. """ class ConvergenceWarning(UserWarning): """Custom warning to capture convergence problems Examples -------- >>> import numpy as np >>> im...
class Undefinedmetricwarning(UserWarning): """Warning used when the metric is invalid .. versionchanged:: 0.18 Moved from sklearn.base. """ class Convergencewarning(UserWarning): """Custom warning to capture convergence problems Examples -------- >>> import numpy as np >>> imp...
recipes,available = {'flour': 500, 'sugar': 200, 'eggs': 1}, {'flour': 1200, 'sugar': 1200, 'eggs': 5, 'milk': 200} print(min([available.get(k,0) // recipes[k] for k in recipes]))
(recipes, available) = ({'flour': 500, 'sugar': 200, 'eggs': 1}, {'flour': 1200, 'sugar': 1200, 'eggs': 5, 'milk': 200}) print(min([available.get(k, 0) // recipes[k] for k in recipes]))
# Program to calculate the gross pay of a worker hours_worked = input("Enter the hours worked:\n") rate = input("Enter the payment rate:\n ") pay = int(hours_worked)*float(rate) print(pay)
hours_worked = input('Enter the hours worked:\n') rate = input('Enter the payment rate:\n ') pay = int(hours_worked) * float(rate) print(pay)
# # PySNMP MIB module A3COM-HUAWEI-QINQ-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-QINQ-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:52:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constrain...
def handle_request(): print("hello world!") return "hello world!" if __name__ == '__main__': handle_request()
def handle_request(): print('hello world!') return 'hello world!' if __name__ == '__main__': handle_request()
# ShortTk DownlaodRealeses shell lib Copyright (c) Boubajoker 2021. All right reserved. Project under MIT License. __version__ = "0.0.1 Alpha A-1" __all__ = [ "librairy", "shell", "librairy shell", "downlaod shell lib" ]
__version__ = '0.0.1 Alpha A-1' __all__ = ['librairy', 'shell', 'librairy shell', 'downlaod shell lib']
class Solution(object): def productExceptSelf(self, nums): """ :type nums: List[int] :rtype: List[int] """ answer = [] _len = len(nums) prod = 1 for i in range(_len): answer.append(prod) prod *= nums[i] prod = 1 ...
class Solution(object): def product_except_self(self, nums): """ :type nums: List[int] :rtype: List[int] """ answer = [] _len = len(nums) prod = 1 for i in range(_len): answer.append(prod) prod *= nums[i] prod = 1 ...
string = "Emir Nazira Zarina Aijana Sultan Danil Adis" string = string.replace('Emir', 'Baizak') string = string.replace('Nazira', 'l') print(string)
string = 'Emir Nazira Zarina Aijana Sultan Danil Adis' string = string.replace('Emir', 'Baizak') string = string.replace('Nazira', 'l') print(string)
A, B, C = map(int, input().split()) if A == B: print(C) elif A == C: print(B) else: print(A)
(a, b, c) = map(int, input().split()) if A == B: print(C) elif A == C: print(B) else: print(A)
###### Birthday Cake Candles def birthdayCakeCandles(ar): blown_candle=0 maxi=max(ar) for i in ar: if i==maxi: blown_candle+=1 print(blown_candle) birthdayCakeCandles([3,2,1,3])
def birthday_cake_candles(ar): blown_candle = 0 maxi = max(ar) for i in ar: if i == maxi: blown_candle += 1 print(blown_candle) birthday_cake_candles([3, 2, 1, 3])
i = 1 j = 7 while(i<10): for x in range(3): print("I=%d J=%d" %(i,j)) j += -1 i += 2 j = i + 6
i = 1 j = 7 while i < 10: for x in range(3): print('I=%d J=%d' % (i, j)) j += -1 i += 2 j = i + 6
def check_matrix(mat): O_win = 0 X_win = 0 if mat[:3].count('O') == 3: O_win += 1 if mat[:3].count('X') == 3: X_win += 1 if mat[3:6].count('O') == 3: O_win += 1 if mat[3:6].count('X') == 3: X_win += 1 if mat[6:].count('O') == 3: O_win += 1 if mat[6...
def check_matrix(mat): o_win = 0 x_win = 0 if mat[:3].count('O') == 3: o_win += 1 if mat[:3].count('X') == 3: x_win += 1 if mat[3:6].count('O') == 3: o_win += 1 if mat[3:6].count('X') == 3: x_win += 1 if mat[6:].count('O') == 3: o_win += 1 if mat[6...
#!/usr/bin/env python3 class Error(Exception): '''Base class for exceptions''' def __init__(self, msg=''): self.message = msg Exception.__init__(self, msg) def __repr__(self): return self.message class InterpolationError(Error): '''Base class for interpolation-related excep...
class Error(Exception): """Base class for exceptions""" def __init__(self, msg=''): self.message = msg Exception.__init__(self, msg) def __repr__(self): return self.message class Interpolationerror(Error): """Base class for interpolation-related exceptions""" def __init__...
class ActionListener: def __init__(self, function): self.function = function def execute(self): if self.function is not None: self.function()
class Actionlistener: def __init__(self, function): self.function = function def execute(self): if self.function is not None: self.function()
""" Amazon Aurora Labs for MySQL AWS Lambda function to expand directory requests to an index.html file for CloudFront NOTICE: For testing only, the actual code is inline in the CloudFormation template (see ../../../template/site.yml). Dependencies: none License: This sample code is made available under the MIT-0 li...
""" Amazon Aurora Labs for MySQL AWS Lambda function to expand directory requests to an index.html file for CloudFront NOTICE: For testing only, the actual code is inline in the CloudFormation template (see ../../../template/site.yml). Dependencies: none License: This sample code is made available under the MIT-0 li...
class Ansvar: def __init__(self, id, name, strength, beskrivelse): self.id = id self.name = name self.strength = strength self.description = beskrivelse
class Ansvar: def __init__(self, id, name, strength, beskrivelse): self.id = id self.name = name self.strength = strength self.description = beskrivelse
""" time: c space: c """ class Solution: def groupStrings(self, strings: List[str]) -> List[List[str]]: ans = collections.defaultdict(list) for s in strings: tmp = [] for c in s: tmp.append((ord(s[0]) - ord(c))%26) ans[tuple(tmp)].append(s) ...
""" time: c space: c """ class Solution: def group_strings(self, strings: List[str]) -> List[List[str]]: ans = collections.defaultdict(list) for s in strings: tmp = [] for c in s: tmp.append((ord(s[0]) - ord(c)) % 26) ans[tuple(tmp)].append(s) ...
#!/bin/python3 # author: Jan Hybs def hex2rgb(hex): """ method will convert given hex color (#00AAFF) to a rgb tuple (R, G, B) """ h = hex.strip('#') return tuple(int(h[i:i + 2], 16) for i in (0, 2, 4)) def rgb2hex(rgb): """ method will convert given rgb tuple (or list) to a hex ...
def hex2rgb(hex): """ method will convert given hex color (#00AAFF) to a rgb tuple (R, G, B) """ h = hex.strip('#') return tuple((int(h[i:i + 2], 16) for i in (0, 2, 4))) def rgb2hex(rgb): """ method will convert given rgb tuple (or list) to a hex format (such as #00AAFF) """ ...