content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Conditionals # Allows for decision making based on the values of our variables def main(): x = 1000 y = 10 if (x < y): st = " x is less than y" elif (x == y): st = " x is the same as y" else: st = "x is greater than y" print(st) print("\nAlternatively:...") ...
def main(): x = 1000 y = 10 if x < y: st = ' x is less than y' elif x == y: st = ' x is the same as y' else: st = 'x is greater than y' print(st) print('\nAlternatively:...') statement = 'x is less than y' if x < y else 'x is greater than or the same as' print...
#!/usr/bin/env python # # Class implementing a serial (console) user interface for the Manchester Baby (SSEM) # #------------------------------------------------------------------------------ # # Class construction. # #----------------------------------------------------------------------------...
class Consoleuserinterface: """This object will implement a console user interface for the Manchester Baby (SSEM).""" def __init__(self): pass def update_display_tube(self, storeLines): """Update the display tube with the current contents od the store lines. @param: storeL...
a,b=map(str,input().split()) z=[] x,c="","" if a[0].islower(): x=x+a[0].upper() if b[0].islower(): c=c+b[0].upper() for i in range(1,len(a)): if a[i].isupper() or a[i].islower(): x=x+a[i].lower() for i in range(1,len(b)): if b[i].isupper() or b[i].islower(): c=c+b[i].lower(...
(a, b) = map(str, input().split()) z = [] (x, c) = ('', '') if a[0].islower(): x = x + a[0].upper() if b[0].islower(): c = c + b[0].upper() for i in range(1, len(a)): if a[i].isupper() or a[i].islower(): x = x + a[i].lower() for i in range(1, len(b)): if b[i].isupper() or b[i].islower(): ...
#tutorials 3: Execute the below instructions in the interpreter #execute the below command "Hello World!" print("Hello World!") #execute using single quote 'Hello World!' print('Hello World!') #use \' to escape single quote 'can\'t' print('can\'t') #or use double quotes "can't" print("can't") #more examples 1-...
"""Hello World!""" print('Hello World!') 'Hello World!' print('Hello World!') "can't" print("can't") "can't" print("can't") print('" I won\'t," she said.') a = 'First Line. \n Second Line' print(a) print('\n-->string concatenation example without using +') print('Python') print('\n-->string concatenation: concatenating...
k = int(input("k: ")) array = [10,2,3,6,18] fulfilled = False i = 0 while i < len(array): if k-array[i] in array: fulfilled = True i += 1 if fulfilled == True: print("True") else: print("False")
k = int(input('k: ')) array = [10, 2, 3, 6, 18] fulfilled = False i = 0 while i < len(array): if k - array[i] in array: fulfilled = True i += 1 if fulfilled == True: print('True') else: print('False')
# https://www.codewars.com/kata/570ac43a1618ef634000087f/train/python ''' Instructions: Nova polynomial add This kata is from a series on polynomial handling. ( #1 #2 #3 #4 ) Consider a polynomial in a list where each element in the list element corresponds to a factor. The factor order is the position in the list. ...
""" Instructions: Nova polynomial add This kata is from a series on polynomial handling. ( #1 #2 #3 #4 ) Consider a polynomial in a list where each element in the list element corresponds to a factor. The factor order is the position in the list. The first element is the zero order factor (the constant). p = [a0, a1...
# https://leetcode.com/problems/simplify-path/ class Solution: def simplifyPath(self, path: str) -> str: directories = path.split('/') directory_stack = list() for directory in directories: if not directory == '' and not directory == '.': if not directory == '..'...
class Solution: def simplify_path(self, path: str) -> str: directories = path.split('/') directory_stack = list() for directory in directories: if not directory == '' and (not directory == '.'): if not directory == '..': directory_stack.append...
#------------------------------------------------------------------------------- # Name: misc_python # Purpose: misc python utilities # # Author: matthewl9 # # Version: 1.0 # # Contains: write to file, quicksort, import_list # # Created: 21/02/2018 # Copyright: (c) matthewl9 2018 # Licence:...
def write(filepath, list1): filepath = str(filepath) file = open(filepath, 'w') for count in range(len(list1)): file.write(list1[count]) if count < len(list1) - 1: file.write('\n') file.close def partition(data): pivot = data[0] (less, equal, greater) = ([], [], []) ...
NONE = 0 HALT = 1 << 0 FAULT = 1 << 1 BREAK = 1 << 2 def VMStateStr(_VMState): if _VMState == NONE: return "NONE" state = [] if _VMState & HALT: state.append("HALT") if _VMState & FAULT: state.append("FAULT") if _VMState & BREAK: state.append("BREAK") return ...
none = 0 halt = 1 << 0 fault = 1 << 1 break = 1 << 2 def vm_state_str(_VMState): if _VMState == NONE: return 'NONE' state = [] if _VMState & HALT: state.append('HALT') if _VMState & FAULT: state.append('FAULT') if _VMState & BREAK: state.append('BREAK') return ',...
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ # { # 'target_name': 'byte_reader', # 'includes': ['../../../../compile_js2.gypi'], # }, # { # 'target_name': 'conten...
{'targets': []}
#!/usr/bin/env python3 ''' lib/subl/constants.py Constants for use in sublime apis, including plugin-specific settings. ''' ''' Settings file name. This name is passed to sublime when loading the settings. ''' # pylint: disable=pointless-string-statement SUBLIME_SETTINGS_FILENAME = 'sublime-ycmd.sublime-setting...
""" lib/subl/constants.py Constants for use in sublime apis, including plugin-specific settings. """ '\nSettings file name.\n\nThis name is passed to sublime when loading the settings.\n' sublime_settings_filename = 'sublime-ycmd.sublime-settings' '\nSettings keys.\n\nThe "watch" key is used to register an on-change e...
class Method: BEGIN = 'calling.begin' ANSWER = 'calling.answer' END = 'calling.end' CONNECT = 'calling.connect' DISCONNECT = 'calling.disconnect' PLAY = 'calling.play' RECORD = 'calling.record' RECEIVE_FAX = 'calling.receive_fax' SEND_FAX = 'calling.send_fax' SEND_DIGITS = 'calling.send_digits' TA...
class Method: begin = 'calling.begin' answer = 'calling.answer' end = 'calling.end' connect = 'calling.connect' disconnect = 'calling.disconnect' play = 'calling.play' record = 'calling.record' receive_fax = 'calling.receive_fax' send_fax = 'calling.send_fax' send_digits = 'calli...
construction = ['Owner Authorization', 'Bidding & Contract Documents', 'Plans', 'Spedifications', 'Addenda', 'Submittals', 'Shop Drawings', 'Bonds', 'Insurance Certificates', 'Design Clarifications', 'Baseline Schedule', 'Schedule Revisions', 'Permits', 'Meeting Minutes', 'Payment Requests', 'Correspondence', 'Progres...
construction = ['Owner Authorization', 'Bidding & Contract Documents', 'Plans', 'Spedifications', 'Addenda', 'Submittals', 'Shop Drawings', 'Bonds', 'Insurance Certificates', 'Design Clarifications', 'Baseline Schedule', 'Schedule Revisions', 'Permits', 'Meeting Minutes', 'Payment Requests', 'Correspondence', 'Progress...
#python program to display odd numbers print("Odd numbers are as follows") for i in range(1,100,2): print(i) print("End of the program")
print('Odd numbers are as follows') for i in range(1, 100, 2): print(i) print('End of the program')
#!/usr/bin/python3 def img_splitter(img): img_lines = img.splitlines() longest = 0 for ind, line in enumerate(img_lines): if line == "": img_lines.pop(ind) if len(line) > longest: longest = len(line) for line in img_lines: if len(line) < longest: ...
def img_splitter(img): img_lines = img.splitlines() longest = 0 for (ind, line) in enumerate(img_lines): if line == '': img_lines.pop(ind) if len(line) > longest: longest = len(line) for line in img_lines: if len(line) < longest: line.format(n=...
class BinaryMatrix(object): def __init__(self, mat): self.mat = mat def get(self, x: int, y: int) -> int: return self.mat[x][y] def dimensions(self): n = len(self.mat) m = len(self.mat[0]) return n, m class Solution: def leftMostColumnWithOne(self, binaryMatri...
class Binarymatrix(object): def __init__(self, mat): self.mat = mat def get(self, x: int, y: int) -> int: return self.mat[x][y] def dimensions(self): n = len(self.mat) m = len(self.mat[0]) return (n, m) class Solution: def left_most_column_with_one(self, bina...
USER_AGENTS = [ ( "Mozilla/5.0 (X11; Linux x86_64) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/57.0.2987.110 " "Safari/537.36" ), # chrome ( "Mozilla/5.0 (X11; Linux x86_64) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/61.0.3163.79 " ...
user_agents = ['Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0', 'Mozilla...
# Block No 99997 # Block Bits 453281356 # Difficulty 14,484.16 _bits = input("* block's BITS ? : "); hexBits = hex(int(_bits)); _hexHead = hexBits[:4]; _hexTail = '0x'+hexBits[4:]; print("- BITS in hexadecimal : ", hexBits); print(" ", _hexHead); print(" ", _...
_bits = input("* block's BITS ? : ") hex_bits = hex(int(_bits)) _hex_head = hexBits[:4] _hex_tail = '0x' + hexBits[4:] print('- BITS in hexadecimal : ', hexBits) print(' ', _hexHead) print(' ', _hexTail) max_difficulty = hex(2695953529101130949315647634472399133...
class BaseConfig: SECRET_KEY = None class DevelopmentConfig(BaseConfig): FLASK_ENV="development" class ProductionConfig(BaseConfig): FLASK_ENV="production"
class Baseconfig: secret_key = None class Developmentconfig(BaseConfig): flask_env = 'development' class Productionconfig(BaseConfig): flask_env = 'production'
class Analyzer(): ''' Analyzer holds image data, hooks to pre-processed and intermediate data and the methods to analyze and output visualizations start: 2017-05-27, Nathan Ing ''' def __init__(self): pass
class Analyzer: """ Analyzer holds image data, hooks to pre-processed and intermediate data and the methods to analyze and output visualizations start: 2017-05-27, Nathan Ing """ def __init__(self): pass
arr = [] for i in range(5): dum = list(map(int, input().split())) arr.append(dum) def sol(arr): for i in range(5): for j in range(5): if arr[i][j] == 1: return abs(2-i) + abs(2-j) print(sol(arr))
arr = [] for i in range(5): dum = list(map(int, input().split())) arr.append(dum) def sol(arr): for i in range(5): for j in range(5): if arr[i][j] == 1: return abs(2 - i) + abs(2 - j) print(sol(arr))
# coding: utf-8 # This example is the python implementation of nowait.1.f from OpenMP 4.5 examples n = 100 m = 100 a = zeros(n, double) b = zeros(n, double) y = zeros(m, double) z = zeros(m, double) #$ omp parallel #$ omp do schedule(runtime) for i in range(0, m): z[i] = i*1.0 #$ omp end do nowait #$ omp do fo...
n = 100 m = 100 a = zeros(n, double) b = zeros(n, double) y = zeros(m, double) z = zeros(m, double) for i in range(0, m): z[i] = i * 1.0 for i in range(1, n): b[i] = (a[i] + a[i - 1]) / 2.0 for i in range(1, m): y[i] = sqrt(z[i])
#!/usr/bin/env python3v ## create file object in "r"ead mode filename = input("Name of file: ") with open(f"{filename}", "r") as configfile: ## readlines() creates a list by reading target ## file line by line configlist = configfile.readlines() ## file was just auto closed (no more indenting) ## each i...
filename = input('Name of file: ') with open(f'{filename}', 'r') as configfile: configlist = configfile.readlines() print(configlist) num_lines = len(configlist) print(f'Using the len() function, we see there are: {num_lines} line')
execfile('ex-3.02.py') assert dtype.size == MPI.DOUBLE.size + MPI.CHAR.size assert dtype.extent >= dtype.size dtype.Free()
execfile('ex-3.02.py') assert dtype.size == MPI.DOUBLE.size + MPI.CHAR.size assert dtype.extent >= dtype.size dtype.Free()
class Solution: def largestBSTSubtree(self, root: TreeNode) -> int: return self._post_order(root)[0] def _post_order(self, root): if not root: return 0, True, None, None if not root.left and not root.right: return 1, True, root.val, root.val ln, l...
class Solution: def largest_bst_subtree(self, root: TreeNode) -> int: return self._post_order(root)[0] def _post_order(self, root): if not root: return (0, True, None, None) if not root.left and (not root.right): return (1, True, root.val, root.val) (ln,...
# print function range value for value in range(1, 5): print(value) numbers = list(range(1, 6)) print(numbers) even_numbers = list(range(2, 11)) print(even_numbers)
for value in range(1, 5): print(value) numbers = list(range(1, 6)) print(numbers) even_numbers = list(range(2, 11)) print(even_numbers)
def is_odd(n): return n % 2 == 1 def is_weird(n): if is_odd(n): return True else: # n is even if 2 <= n <= 5: return False elif 6 <= n <= 20: return True elif 20 < n: return False n = int(input()) if (is_weird(n)): print("W...
def is_odd(n): return n % 2 == 1 def is_weird(n): if is_odd(n): return True elif 2 <= n <= 5: return False elif 6 <= n <= 20: return True elif 20 < n: return False n = int(input()) if is_weird(n): print('Weird') else: print('Not Weird')
class calculos(): def __init__(self): self.funcoes = { "soma": self.soma, "subtracao": self.subtracao, "multiplicacao": self.multiplicacao, "divisao": self.divisao, "quadrado": self.quadrado, "raiz_quadrada": self.raiz_quadrada, ...
class Calculos: def __init__(self): self.funcoes = {'soma': self.soma, 'subtracao': self.subtracao, 'multiplicacao': self.multiplicacao, 'divisao': self.divisao, 'quadrado': self.quadrado, 'raiz_quadrada': self.raiz_quadrada, 'porcentagem': self.porcentagem} def soma(self, x, y): return x + y ...
# Print the list created by using list comprehension names = ['George', 'Harry', 'Weasely', 'Ron', 'Potter', 'Hermione'] best_list = [name for name in names if len(name) >= 6] print(best_list) # Range Objects # Create a range object that goes from 0 to 5 nums = range(6) print(type(nums)) # Convert nums to a list nums...
names = ['George', 'Harry', 'Weasely', 'Ron', 'Potter', 'Hermione'] best_list = [name for name in names if len(name) >= 6] print(best_list) nums = range(6) print(type(nums)) nums_list = list(nums) print(nums_list) nums_list2 = [*range(1, 12, 2)] print(nums_list2) names = ['Jerry', 'Kramer', 'Elaine', 'George', 'Newman'...
# -*- coding:utf-8 -*- def read_files(path): file = open(path, 'r+') str_ = file.read() print(str_) file.close()
def read_files(path): file = open(path, 'r+') str_ = file.read() print(str_) file.close()
for a in range (2,21): if a > 1: for i in range(2,a): if (a % i) == 0: break else: print(a)
for a in range(2, 21): if a > 1: for i in range(2, a): if a % i == 0: break else: print(a)
#!/usr/bin/env python3 # Simple data processing, extraction of GPGGA and GPRMC entries # Source filename FILENAME = "../data/GNSS_34_2020-02-23_16-20-44.txt" # Output filename OUTFILE = "../output/track.nmea" if __name__ == "__main__": outfile = open(OUTFILE, 'w') with open(FILENAME, 'r') as f: for...
filename = '../data/GNSS_34_2020-02-23_16-20-44.txt' outfile = '../output/track.nmea' if __name__ == '__main__': outfile = open(OUTFILE, 'w') with open(FILENAME, 'r') as f: for line in f.readlines(): try: data = line.split(';')[1].strip() if data.startswith('$...
registry = {} def unmarshal(typestr, x): try: unmarshaller = registry[typestr] except KeyError: raise TypeError("No unmarshaller registered for '{}'".format(typestr)) return unmarshaller(x) def register(typestr, unmarshaller): if typestr in registry: raise NameError( ...
registry = {} def unmarshal(typestr, x): try: unmarshaller = registry[typestr] except KeyError: raise type_error("No unmarshaller registered for '{}'".format(typestr)) return unmarshaller(x) def register(typestr, unmarshaller): if typestr in registry: raise name_error("An unmar...
def play(n=None): if n is None: while True: try: n = int(input('Input the grid size: ')) except ValueError: print('Invalid input') continue if n <= 0: print('Invalid input') continue ...
def play(n=None): if n is None: while True: try: n = int(input('Input the grid size: ')) except ValueError: print('Invalid input') continue if n <= 0: print('Invalid input') continue ...
def get_rate(numbers, is_o2): nb_bits = len(numbers[0]) assert all([len(n) == nb_bits for n in numbers]) current_numbers = [n for n in numbers] i = 0 while len(current_numbers) > 1: nb_ones = sum([elem[i] == '1' for elem in current_numbers]) nb_zeros = sum([elem[i] ==...
def get_rate(numbers, is_o2): nb_bits = len(numbers[0]) assert all([len(n) == nb_bits for n in numbers]) current_numbers = [n for n in numbers] i = 0 while len(current_numbers) > 1: nb_ones = sum([elem[i] == '1' for elem in current_numbers]) nb_zeros = sum([elem[i] == '0' for elem in...
# Returns the sum of all multipliers of x for numbers from 1 to end. def sumOfMultipliers(end, x): n = end / x return (n * (n + 1) / 2) * x end = 999 # below 1000 x = 3 y = 5 # We have to subtract one sum of the multipliers of x * y because these multipliers take part in both of the sums of the multipliers of x an...
def sum_of_multipliers(end, x): n = end / x return n * (n + 1) / 2 * x end = 999 x = 3 y = 5 sum = sum_of_multipliers(end, x) + sum_of_multipliers(end, y) - sum_of_multipliers(end, x * y) print(sum)
def cmdissue(toissue, activesession): ssh_stdin, ssh_stdout, ssh_stderr = activesession.exec_command(toissue) return ssh_stdout.read().decode('UTF-8') def commands_list(sshsession, commands): for x in commands: ## call our imported function and save the value returned resp = cmdissue(x, ...
def cmdissue(toissue, activesession): (ssh_stdin, ssh_stdout, ssh_stderr) = activesession.exec_command(toissue) return ssh_stdout.read().decode('UTF-8') def commands_list(sshsession, commands): for x in commands: resp = cmdissue(x, sshsession) if resp != '': print(resp)
List1 = [] List2 = [] List3 = [] List4 = [] List5 = [13,31,2,19,96] statusList1 = 0 while statusList1 < 13: inputList1 = str(input("Masukkan hewan bersayap : ")) statusList1 += 1 List1.append(inputList1) print() statusList2 = 0 while statusList2 < 5: inputList2 = str(input("Masukkan hewan berkaki 2 : ")...
list1 = [] list2 = [] list3 = [] list4 = [] list5 = [13, 31, 2, 19, 96] status_list1 = 0 while statusList1 < 13: input_list1 = str(input('Masukkan hewan bersayap : ')) status_list1 += 1 List1.append(inputList1) print() status_list2 = 0 while statusList2 < 5: input_list2 = str(input('Masukkan hewan berka...
class dataStore: dataList=[] symbolList=[] optionList=[] def __init__(self): self.dataList=[] self.symbolList=[] self.optionList=[] def reset(self): self.dataList=[] self.symbolList=[] ...
class Datastore: data_list = [] symbol_list = [] option_list = [] def __init__(self): self.dataList = [] self.symbolList = [] self.optionList = [] def reset(self): self.dataList = [] self.symbolList = [] self.optionList = []
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # @author jsbxyyx # @since 1.0 class MessageType(object): TYPE_GLOBAL_BEGIN = 1 TYPE_GLOBAL_BEGIN_RESULT = 2 TYPE_GLOBAL_COMMIT = 7 TYPE_GLOBAL_COMMIT_RESULT = 8 TYPE_GLOBAL_ROLLBACK = 9 TYPE_GLOBAL_ROLLBACK_RESULT = 10 TYPE_GLOBAL_STATUS...
class Messagetype(object): type_global_begin = 1 type_global_begin_result = 2 type_global_commit = 7 type_global_commit_result = 8 type_global_rollback = 9 type_global_rollback_result = 10 type_global_status = 15 type_global_status_result = 16 type_global_report = 17 type_global_...
def scoreOfParentheses(S): total = 0 cur = 0 for i in range(len(S)): if S[i] == "(": cur += 1 elif S[i] == ")": cur -= 1 if S[i-1] == "(": total += 2**cur return total print(scoreOfParentheses("()")) # 1 print(scoreOfP...
def score_of_parentheses(S): total = 0 cur = 0 for i in range(len(S)): if S[i] == '(': cur += 1 elif S[i] == ')': cur -= 1 if S[i - 1] == '(': total += 2 ** cur return total print(score_of_parentheses('()')) print(score_of_parentheses('...
c = input().split() W, H, x, y, r = int(c[0]), int(c[1]), int(c[2]), int(c[3]), int(c[4]) if r <= x <= W - r and r <= y <= H - r: print("Yes") else: print("No")
c = input().split() (w, h, x, y, r) = (int(c[0]), int(c[1]), int(c[2]), int(c[3]), int(c[4])) if r <= x <= W - r and r <= y <= H - r: print('Yes') else: print('No')
# -*- coding: utf-8 -*- numeros = [] for x in range(100): numeros.append(int(input())) print(max(numeros)) print(numeros.index(max(numeros))+1)
numeros = [] for x in range(100): numeros.append(int(input())) print(max(numeros)) print(numeros.index(max(numeros)) + 1)
# Python Program to Differentiate Between type() and isinstance() class Polygon: def sides_no(self): pass class Triangle(Polygon): def area(self): pass obj_polygon = Polygon() obj_triangle = Triangle() print(type(obj_triangle) == Triangle) # true print(type(obj_triangle) == Polygon) #...
class Polygon: def sides_no(self): pass class Triangle(Polygon): def area(self): pass obj_polygon = polygon() obj_triangle = triangle() print(type(obj_triangle) == Triangle) print(type(obj_triangle) == Polygon) print(isinstance(obj_polygon, Polygon)) print(isinstance(obj_triangle, Polygon))
s1 = (2, 1.3, 'love', 5.6, 9, 12, False) s2 = [True, 5, 'smile'] print('s1=',s1) print('s1[:5]=',s1[:5]) print('s1[2:]=',s1[2:]) print('s1[0:5:2]=',s1[0:5:2]) print('s1[2:0:-1]=',s1[2:0:-1]) print('s1[-1]=',s1[-1]) print('s1[-3]=',s1[-3])
s1 = (2, 1.3, 'love', 5.6, 9, 12, False) s2 = [True, 5, 'smile'] print('s1=', s1) print('s1[:5]=', s1[:5]) print('s1[2:]=', s1[2:]) print('s1[0:5:2]=', s1[0:5:2]) print('s1[2:0:-1]=', s1[2:0:-1]) print('s1[-1]=', s1[-1]) print('s1[-3]=', s1[-3])
r = requests.get('https://api.github.com/user', auth=('user', 'pass')) r.status_code # -> 200 r.headers['content-type'] # -> 'application/json; charset=utf8' r.encoding # -> 'utf-8' r.text # -> u'{"type":"User"...' r.json() # -> {u'private_gists': 419, u'total_private_repos': 77, ...}
r = requests.get('https://api.github.com/user', auth=('user', 'pass')) r.status_code r.headers['content-type'] r.encoding r.text r.json()
class Joint: def __init__(self, name, min_angle: float, max_angle: float): self.name = name self.min_angle = min_angle self.max_angle = max_angle
class Joint: def __init__(self, name, min_angle: float, max_angle: float): self.name = name self.min_angle = min_angle self.max_angle = max_angle
# # PySNMP MIB module SONOMASYSTEMS-SONOMA-ATM-E3-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SONOMASYSTEMS-SONOMA-ATM-E3-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:09:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pytho...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
def shift(a): last = a[-1] a.insert(0, last) a.pop() return a def f(a,b): a = list(a) b = list(b) for i in range(len(a)): a = shift(a) if a == b: return True return False f('abcde', 'abced')
def shift(a): last = a[-1] a.insert(0, last) a.pop() return a def f(a, b): a = list(a) b = list(b) for i in range(len(a)): a = shift(a) if a == b: return True return False f('abcde', 'abced')
class BaloneyInterpreter(object): def __init__(self, prog): self.prog = prog def run(self): self.vars = {} # All variables self.lists = {} # List variables self.error = 0 # Indicates program error self.stat = list(self.prog) # Ord...
class Baloneyinterpreter(object): def __init__(self, prog): self.prog = prog def run(self): self.vars = {} self.lists = {} self.error = 0 self.stat = list(self.prog) self.stat.sort() print(self.stat)
def ascii(arg): pass def filter(pred, iterable): pass def hex(arg): pass def map(func, *iterables): pass def oct(arg): pass
def ascii(arg): pass def filter(pred, iterable): pass def hex(arg): pass def map(func, *iterables): pass def oct(arg): pass
#!/usr/bin/python3 '''General Class which is used for all the class ''' class GeneralSeller: def __init__(self,mechant_i): pass def start_product(self): pass class WishSeller(GeneralSeller): ''' ''' class AmazonSeller(GeneralSeller): pass class AlibabaSeller(GeneralSeller): pa...
"""General Class which is used for all the class """ class Generalseller: def __init__(self, mechant_i): pass def start_product(self): pass class Wishseller(GeneralSeller): """ """ class Amazonseller(GeneralSeller): pass class Alibabaseller(GeneralSeller): pass class Ebays...
upTo = int(input()) res = 0 for i in range(upTo): res += i print(res)
up_to = int(input()) res = 0 for i in range(upTo): res += i print(res)
class Solution(object): def intersect(self, nums1, nums2): nums1_counter = collections.Counter(nums1) nums2_counter = collections.Counter(nums2) result = [] for k in nums1_counter.keys(): if k in nums2_counter: result.extend([k] * min(nums...
class Solution(object): def intersect(self, nums1, nums2): nums1_counter = collections.Counter(nums1) nums2_counter = collections.Counter(nums2) result = [] for k in nums1_counter.keys(): if k in nums2_counter: result.extend([k] * min(nums1_counter[k], nu...
class CandidateViewer: def __init__(self, df): self.df = df def show_candidates(self): best_players_selections = ['2 players', '3 players', '4 players', '5 or more players'] weight_selections = [(1, 1.4), (1.5, 1.9), (1.9, 2.5), (2.5, 3.1), (3.1, 4)] cols = ['title', 'year', 'w...
class Candidateviewer: def __init__(self, df): self.df = df def show_candidates(self): best_players_selections = ['2 players', '3 players', '4 players', '5 or more players'] weight_selections = [(1, 1.4), (1.5, 1.9), (1.9, 2.5), (2.5, 3.1), (3.1, 4)] cols = ['title', 'year', 'w...
def main(): q = int(input()) pre = [ 3, 5, 13, 37, 61, 73, 157, 193, 277, 313, 397, 421, 457, 541, 613, 661, 673, 733, 757, 877, 997, 1093, 1153, 1201, 1213, 1237, 1321, 1381, 1453, 1621, 1657, 1753, 1873, 1933, 1993, 2017, 2137, 2341, 2473, 2557, 2593, 2797, 2857, 2917, 3061, 3217, 3253, 3313, ...
def main(): q = int(input()) pre = [3, 5, 13, 37, 61, 73, 157, 193, 277, 313, 397, 421, 457, 541, 613, 661, 673, 733, 757, 877, 997, 1093, 1153, 1201, 1213, 1237, 1321, 1381, 1453, 1621, 1657, 1753, 1873, 1933, 1993, 2017, 2137, 2341, 2473, 2557, 2593, 2797, 2857, 2917, 3061, 3217, 3253, 3313, 3517, 3733, 4021,...
class FileListing: dictionary: dict def __init__(self, dictionary: dict): self.dictionary = dictionary def __eq__(self, other): return self.dictionary == other.dictionary def __repr__(self): return {'dictionary': self.dictionary} @property def tenant(self): re...
class Filelisting: dictionary: dict def __init__(self, dictionary: dict): self.dictionary = dictionary def __eq__(self, other): return self.dictionary == other.dictionary def __repr__(self): return {'dictionary': self.dictionary} @property def tenant(self): re...
# Builds #T# Table of contents #C# Compiling to bytecode #C# Building a project to binary #T# Beginning of content #C# Compiling to bytecode # |------------------------------------------------------------- #T# Python code is compiled from .py source code files, to .pyc bytecode files #T# in the operating syste...
print('Built')
def get_profile(name, age: int, *sports, **awards): if type(age) != int: raise ValueError if len(sports) > 5: raise ValueError if sports and not awards: sports = sorted(list(sports)) return {'name': name, 'age': age, 'sports': sports} if not sports and award...
def get_profile(name, age: int, *sports, **awards): if type(age) != int: raise ValueError if len(sports) > 5: raise ValueError if sports and (not awards): sports = sorted(list(sports)) return {'name': name, 'age': age, 'sports': sports} if not sports and awards: r...
a = int(input("a= ")) b = int(input("b= ")) c = int(input("c= ")) if a == 0: if b != 0: print("La solution est", -c / b) else: if c == 0: print("INF") else: print("Aucune solution") else: delta = (b ** 2) - 4 * a * c if delta > 0: print( ...
a = int(input('a= ')) b = int(input('b= ')) c = int(input('c= ')) if a == 0: if b != 0: print('La solution est', -c / b) elif c == 0: print('INF') else: print('Aucune solution') else: delta = b ** 2 - 4 * a * c if delta > 0: print('Les deux solutions sont ', (-b - del...
class Solution: def checkIfExist(self, arr: List[int]) -> bool: s = set() for v in arr: if v * 2 in s or (v % 2 == 0 and v / 2 in s): return True s.add(v) return False
class Solution: def check_if_exist(self, arr: List[int]) -> bool: s = set() for v in arr: if v * 2 in s or (v % 2 == 0 and v / 2 in s): return True s.add(v) return False
n = int(input("Dame un numero entero: ")) def factorial( n ): if n == 1: return n else: #llamada recursiva return n * factorial( n - 1 ) print("El factorial de: ",n,"es", factorial(n))
n = int(input('Dame un numero entero: ')) def factorial(n): if n == 1: return n else: return n * factorial(n - 1) print('El factorial de: ', n, 'es', factorial(n))
#!/bin/python3 rd = open("06.input", "r") fullSum = 0 validLetters = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" } while True: letters = {} count = 0 while True: line = rd.readline().strip() if not li...
rd = open('06.input', 'r') full_sum = 0 valid_letters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'} while True: letters = {} count = 0 while True: line = rd.readline().strip() if not line or line == '': ...
''' done ''' ipAddress = '127.0.0.1' port = 21 name = "Pustakalupi" pi = 3.14 #tidak ada constant dalam Python 3 print("ipAddress bertipe :", type(ipAddress)) print("port bertipe :", type(port)) print("name bertipe :", type(name)) print("pi bertipe :", type(pi)) print(pi) del pi print(pi)
""" done """ ip_address = '127.0.0.1' port = 21 name = 'Pustakalupi' pi = 3.14 print('ipAddress bertipe :', type(ipAddress)) print('port bertipe :', type(port)) print('name bertipe :', type(name)) print('pi bertipe :', type(pi)) print(pi) del pi print(pi)
class Originator: _state = None class Memento: def __init__(self, state): self._state = state def setState(self, state): self._state = state def getState(self): return self._state def __init__(self, state = None): self._state = state ...
class Originator: _state = None class Memento: def __init__(self, state): self._state = state def set_state(self, state): self._state = state def get_state(self): return self._state def __init__(self, state=None): self._state = state ...
# please excuse me, I'm a C# and Rust developer with only minor Python experience :D # let's give it a go though! MAP = { 'a': "100000", 'n': "101110", 'b': "110000", 'o': "101010", 'c': "100100", 'p': "111100", 'd': "100110", 'q': "111110", 'e': "100010", 'r': "111010", 'f': "110100", 's': "01...
map = {'a': '100000', 'n': '101110', 'b': '110000', 'o': '101010', 'c': '100100', 'p': '111100', 'd': '100110', 'q': '111110', 'e': '100010', 'r': '111010', 'f': '110100', 's': '011100', 'g': '110110', 't': '011110', 'h': '110010', 'u': '101001', 'i': '010100', 'v': '111001', 'j': '010110', 'w': '010111', 'k': '101000'...
# Desafio066: Desafio criar um programa que leia varios numeros de o valor total digitado e pare quando digitado 999. nu = int (0) controle = int(0) print('Se precisar sair digite 999') while True: nu = int(input('Digite um numero ')) if nu == 999: break controle = controle + nu print(controle)
nu = int(0) controle = int(0) print('Se precisar sair digite 999') while True: nu = int(input('Digite um numero ')) if nu == 999: break controle = controle + nu print(controle)
__author__ = 'tony petrov' DEFAULT_SOCIAL_MEDIA_CYCLE = 3600 # 1 hour since most social media websites have a 1 hour timeout # tasks TASK_EXPLORE = 0 TASK_BULK_RETRIEVE = 1 TASK_FETCH_LISTS = 2 TASK_FETCH_USER = 3 TASK_UPDATE_WALL = 4 TASK_FETCH_STREAM = 5 TASK_GET_DASHBOARD = 6 TASK_GET_TAGGED = 7 TASK_GET_BLOG_POST...
__author__ = 'tony petrov' default_social_media_cycle = 3600 task_explore = 0 task_bulk_retrieve = 1 task_fetch_lists = 2 task_fetch_user = 3 task_update_wall = 4 task_fetch_stream = 5 task_get_dashboard = 6 task_get_tagged = 7 task_get_blog_posts = 8 task_get_facebook_wall = 9 task_fetch_facebook_users = 10 task_twitt...
class Professor: def __init__(self, nome): self.__nome = nome #conceito de encapusulamento self.__salaDeAula = None def nome(self): return self.__nome def salaDeAula(self, sala): self.__salaDeAula = sala def EmAula(self): return 'Em aula' class Sala: ...
class Professor: def __init__(self, nome): self.__nome = nome self.__salaDeAula = None def nome(self): return self.__nome def sala_de_aula(self, sala): self.__salaDeAula = sala def em_aula(self): return 'Em aula' class Sala: def __init__(self, numero): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- def init(): pass def servers(): return {}
def init(): pass def servers(): return {}
def processArray(l2): loss=[];mloss=0 for i in range(0,len(l2)): loss.append(l2[i][0]-l2[i][len(l2[i])-1]) if(len(loss)>0): mloss=loss.index(max(loss)) print(len(l2[mloss])) l=[] while True: a=int(input()) if(a<0): break l.append(a) ans=[] i=0 while(i<len(l)): k=l[i] tmp=[...
def process_array(l2): loss = [] mloss = 0 for i in range(0, len(l2)): loss.append(l2[i][0] - l2[i][len(l2[i]) - 1]) if len(loss) > 0: mloss = loss.index(max(loss)) print(len(l2[mloss])) l = [] while True: a = int(input()) if a < 0: break l.append(a) ans = [] i = ...
class Solution: def hammingWeight(self, n: int) -> int: n = bin(n)[2:] str_n = str(n) return str_n.count("1")
class Solution: def hamming_weight(self, n: int) -> int: n = bin(n)[2:] str_n = str(n) return str_n.count('1')
def coordinate_input(): x, y = input("X, Y Coordinates ==> ").strip().split(",") return float(x), float(y) def main(): coordinates = [] print("Type the coordinates in order; it means A,B,C...") while True: try: point = coordinate_input() coordinates.append(point) ...
def coordinate_input(): (x, y) = input('X, Y Coordinates ==> ').strip().split(',') return (float(x), float(y)) def main(): coordinates = [] print('Type the coordinates in order; it means A,B,C...') while True: try: point = coordinate_input() coordinates.append(point)...
''' Exemplo 1 c = 1 while c < 11: print(c) c += 1 print('Fim') ''' '''eXEMPLO 2 n = 1 while n!= 0: n = int(input('Digite um valor: ')) print('Fim') ''' ''' Exemplo 3 r = 'S' while r == 'S': n = int(input('Digite um valor: ')) r = str(input('Quer continuar? [S/N] ')).upper() print('Fim')''' ''' Exem...
""" Exemplo 1 c = 1 while c < 11: print(c) c += 1 print('Fim') """ "eXEMPLO 2 \nn = 1\nwhile n!= 0:\n n = int(input('Digite um valor: '))\nprint('Fim') " " Exemplo 3\nr = 'S'\nwhile r == 'S':\n n = int(input('Digite um valor: '))\n r = str(input('Quer continuar? [S/N] ')).upper()\nprint('Fim')" " Exemp...
#!/home/user/code/Django-Sample/django_venv/bin/python2.7 # EASY-INSTALL-SCRIPT: 'Django==1.11.3','django-admin.py' __requires__ = 'Django==1.11.3' __import__('pkg_resources').run_script('Django==1.11.3', 'django-admin.py')
__requires__ = 'Django==1.11.3' __import__('pkg_resources').run_script('Django==1.11.3', 'django-admin.py')
def LB2idx(lev, band, nlevs, nbands): ''' convert level and band to dictionary index ''' # reset band to match matlab version band += (nbands-1) if band > nbands-1: band = band - nbands if lev == 0: idx = 0 elif lev == nlevs-1: # (Nlevels - ends)*Nbands + ends -1 (becaus...
def lb2idx(lev, band, nlevs, nbands): """ convert level and band to dictionary index """ band += nbands - 1 if band > nbands - 1: band = band - nbands if lev == 0: idx = 0 elif lev == nlevs - 1: idx = (nlevs - 2) * nbands + 2 - 1 else: idx = nbands * lev - band - ...
# https://www.hackerrank.com/challenges/s10-standard-deviation/problem # Enter your code here. Read input from STDIN. Print output to STDOUT n = int(input().strip()) all1 = [int(i) for i in input().strip().split()] u = sum(all1) / n v = sum(((i - u) ** 2) for i in all1)/n sd = v ** 0.5 print("{0:0.1f}".forma...
n = int(input().strip()) all1 = [int(i) for i in input().strip().split()] u = sum(all1) / n v = sum(((i - u) ** 2 for i in all1)) / n sd = v ** 0.5 print('{0:0.1f}'.format(sd))
context_mapping = { "schema": "http://www.w3.org/2001/XMLSchema#", "brick": "http://brickschema.org/schema/1.0.3/Brick#", "brickFrame": "http://brickschema.org/schema/1.0.3/BrickFrame#", "BUDO-M": "https://git.rwth-aachen.de/EBC/Team_BA/misc/Machine-Learning/tree/MA_fst-bll/building_ml_p...
context_mapping = {'schema': 'http://www.w3.org/2001/XMLSchema#', 'brick': 'http://brickschema.org/schema/1.0.3/Brick#', 'brickFrame': 'http://brickschema.org/schema/1.0.3/BrickFrame#', 'BUDO-M': 'https://git.rwth-aachen.de/EBC/Team_BA/misc/Machine-Learning/tree/MA_fst-bll/building_ml_platform/BUDO-M/Platform_Applicati...
OBJECT( 'VALUE', attributes = [ A( 'ANY', 'value' ), ] )
object('VALUE', attributes=[a('ANY', 'value')])
# Reading Error Messages # Read the Python code and the resulting traceback below, # and answer the following questions: # How many levels does the traceback have? # What is the function name where the error occurred? # On which line number in this function did the error occur? # What is the type of error? # What is...
def print_message(day): messages = {'monday': 'Hello, world!', 'tuesday': 'Today is Tuesday!', 'wednesday': 'It is the middle of the week.', 'thursday': 'Today is Donnerstag in German!', 'friday': 'Last day of the week!', 'saturday': 'Hooray for the weekend!', 'sunday': 'Aw, the weekend is almost over.'} print(...
def cons(a, b): def pair(f): return f(a, b) return pair def car(pair): return pair((lambda a, b: a)) def cdr(pair): return pair((lambda a, b: a))
def cons(a, b): def pair(f): return f(a, b) return pair def car(pair): return pair(lambda a, b: a) def cdr(pair): return pair(lambda a, b: a)
# Testing site base_url = 'http://localhost:80/demo' # Login account admin_auth_data = {'name': 'admin', 'password': 'admin'} login_url = base_url + '/api/auth' header = dict()
base_url = 'http://localhost:80/demo' admin_auth_data = {'name': 'admin', 'password': 'admin'} login_url = base_url + '/api/auth' header = dict()
def add(x,y): '''Add two nos''' return x+y def subtract(x,y): '''Subtract two nos''' return y-x
def add(x, y): """Add two nos""" return x + y def subtract(x, y): """Subtract two nos""" return y - x
def word2features(sent, i): word = sent[i][0] postag = sent[i][1] features = [ 'bias', 'word.lower=' + word.lower(), 'word[-3:]=' + word[-3:], 'word[-2:]=' + word[-2:], 'word.isupper=%s' % word.isupper(), 'word.istitle=%s' % word.istitle(), 'word.isdigit=%s' % word.isdigit(), 'postag=' + postag, 'p...
def word2features(sent, i): word = sent[i][0] postag = sent[i][1] features = ['bias', 'word.lower=' + word.lower(), 'word[-3:]=' + word[-3:], 'word[-2:]=' + word[-2:], 'word.isupper=%s' % word.isupper(), 'word.istitle=%s' % word.istitle(), 'word.isdigit=%s' % word.isdigit(), 'postag=' + postag, 'postag[:2]=...
words_single = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] words_teens = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] words_tens = ['','ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety...
words_single = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] words_teens = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] words_tens = ['', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninet...
def test_Compare(): a: bool a = 5 > 4 a = 5 <= 4 a = 5 < 4 a = 5.6 >= 5.59999 a = 3.3 == 3.3 a = 3.3 != 3.4 a = complex(3, 4) == complex(3., 4.)
def test__compare(): a: bool a = 5 > 4 a = 5 <= 4 a = 5 < 4 a = 5.6 >= 5.59999 a = 3.3 == 3.3 a = 3.3 != 3.4 a = complex(3, 4) == complex(3.0, 4.0)
def spaces(n, i): countSpace= n-i spaces = " "*countSpace return spaces def staircase(n): for i in range(1, n+1): cadena = spaces(n,i) steps = "#"*i cadena = cadena+steps print(cadena) if __name__ == "__main__": tamanio = int(input("Ingresa el numero de esc...
def spaces(n, i): count_space = n - i spaces = ' ' * countSpace return spaces def staircase(n): for i in range(1, n + 1): cadena = spaces(n, i) steps = '#' * i cadena = cadena + steps print(cadena) if __name__ == '__main__': tamanio = int(input('Ingresa el numero de ...
''' QUESTION: 344. Reverse String Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. You may assume all the characters consist of printable a...
""" QUESTION: 344. Reverse String Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. You may assume all the characters consist of printable a...
{ "targets":[ { "target_name":"stp", "sources":["calc_grid.cc"] } ] }
{'targets': [{'target_name': 'stp', 'sources': ['calc_grid.cc']}]}
s = input() hachi = set() if len(s) < 3: if int(s) % 8 == 0 or int(s[::-1]) % 8 == 0: print("Yes") else: print("No") exit() t = 104 while t < 1000: hachi.add(str(t)) t += 8 counter = [0 for _ in range(10)] for i in s: counter[int(i)] += 1 for h in hachi: count = [0 for _ in r...
s = input() hachi = set() if len(s) < 3: if int(s) % 8 == 0 or int(s[::-1]) % 8 == 0: print('Yes') else: print('No') exit() t = 104 while t < 1000: hachi.add(str(t)) t += 8 counter = [0 for _ in range(10)] for i in s: counter[int(i)] += 1 for h in hachi: count = [0 for _ in r...
# # PySNMP MIB module DLINK-3100-BRIDGEMIBOBJECTS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-BRIDGEMIBOBJECTS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:33:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pytho...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ...
def has_doi(bib_info): return "doi" in bib_info def get_doi(bib_info): return bib_info["doi"] def has_title(bib_info): return "title" in bib_info def get_title(bib_info): return bib_info["title"] def has_url(bib_info): return "url" in bib_info def get_url(bib_info): if "url" in bib_inf...
def has_doi(bib_info): return 'doi' in bib_info def get_doi(bib_info): return bib_info['doi'] def has_title(bib_info): return 'title' in bib_info def get_title(bib_info): return bib_info['title'] def has_url(bib_info): return 'url' in bib_info def get_url(bib_info): if 'url' in bib_info: ...
payload_mass=5 payload_fairing_height=1 stage1_height=7.5 stage1_burnTime=74 stage1_propellant_mass=15000 stage1_engine_mass=1779 stage1_thrust=469054 stage1_isp=235.88175331294596 stage1_coastTime=51 stage2_height=3.35 stage2_burnTime=64 stage2_propellant_mass=5080 stage2_engine_mass=527 stag...
payload_mass = 5 payload_fairing_height = 1 stage1_height = 7.5 stage1_burn_time = 74 stage1_propellant_mass = 15000 stage1_engine_mass = 1779 stage1_thrust = 469054 stage1_isp = 235.88175331294596 stage1_coast_time = 51 stage2_height = 3.35 stage2_burn_time = 64 stage2_propellant_mass = 5080 stage2_engine_mass = 527 s...
digit1 = 999 digit2 = 999 largestpal = 0 #always save the largest palindrome #nested loop for 3digit product while digit1 >= 1: while digit2 >= 1: #get string from int p1 = str(digit1 * digit2) #check string for palindrome by comparing first-last, etc. for i in range(0, (len(p1) - 1)): #no pal?...
digit1 = 999 digit2 = 999 largestpal = 0 while digit1 >= 1: while digit2 >= 1: p1 = str(digit1 * digit2) for i in range(0, len(p1) - 1): if p1[i] != p1[len(p1) - i - 1]: break elif i >= (len(p1) - 1) / 2: if largestpal < int(p1): ...
class InvalidMoveException(Exception): pass class InvalidPlayerException(Exception): pass class InvalidGivenBallsException(Exception): pass class GameIsOverException(Exception): pass
class Invalidmoveexception(Exception): pass class Invalidplayerexception(Exception): pass class Invalidgivenballsexception(Exception): pass class Gameisoverexception(Exception): pass
while True: try: dinheiro = [] nota = input() cent = input() if(len(cent) < 2): cent += '0' cent = cent[::-1] dinheiro += '.' + cent print(dinheiro) except EOFError: break
while True: try: dinheiro = [] nota = input() cent = input() if len(cent) < 2: cent += '0' cent = cent[::-1] dinheiro += '.' + cent print(dinheiro) except EOFError: break
''' Design a HashSet without using any built-in hash table libraries. To be specific, your design should include these functions: add(value): Insert a value into the HashSet. contains(value) : Return whether the value exists in the HashSet or not. remove(value): Remove a value in the HashSet. If the value doe...
""" Design a HashSet without using any built-in hash table libraries. To be specific, your design should include these functions: add(value): Insert a value into the HashSet. contains(value) : Return whether the value exists in the HashSet or not. remove(value): Remove a value in the HashSet. If the value does not e...
# -*- coding: UTF-8 -*- class MyClass(object): def __init__(self): pass def __eq__(self, other): return type(self) == type(other) if __name__ == '__main__': print (MyClass()) print (MyClass()) print (MyClass() == MyClass()) print (MyClass() == 42)
class Myclass(object): def __init__(self): pass def __eq__(self, other): return type(self) == type(other) if __name__ == '__main__': print(my_class()) print(my_class()) print(my_class() == my_class()) print(my_class() == 42)
# 2020.08.02 # Problem Statement: # https://leetcode.com/problems/substring-with-concatenation-of-all-words/ class Solution: def findSubstring(self, s: str, words: List[str]) -> List[int]: # check if s is empty or words is empty if len(s) * len(words) == 0: return [] # length is th...
class Solution: def find_substring(self, s: str, words: List[str]) -> List[int]: if len(s) * len(words) == 0: return [] length = len(words) * len(words[0]) word_length = len(words[0]) word_dict = {} for word in words: word_dict[word] = 0 for w...
print("hello") print("hello") print("hello") print("hello") print("It's me") print("I'm here")
print('hello') print('hello') print('hello') print('hello') print("It's me") print("I'm here")