content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def convert(number): map_ = { 3: 'Pling', 5: 'Plang', 7: 'Plong' } r_str = [v for k, v in map_.items() if number % k == 0] return ''.join(r_str) if r_str else str(number)
def convert(number): map_ = {3: 'Pling', 5: 'Plang', 7: 'Plong'} r_str = [v for (k, v) in map_.items() if number % k == 0] return ''.join(r_str) if r_str else str(number)
response.title = settings.title response.subtitle = settings.subtitle response.meta.author = '%(author)s <%(author_email)s>' % settings response.meta.keywords = settings.keywords response.meta.description = settings.description response.menu = [ (T('Index'),URL('default','index')==URL(),URL('default','index'),[]), (T('...
response.title = settings.title response.subtitle = settings.subtitle response.meta.author = '%(author)s <%(author_email)s>' % settings response.meta.keywords = settings.keywords response.meta.description = settings.description response.menu = [(t('Index'), url('default', 'index') == url(), url('default', 'index'), [])...
class Accumulator(object): def __init__(self, writer): self.writer = writer self.cache = [] def writeInstruction(self, name, opCode, flag, maxFlag): self.flush() self.writer.writeInstruction(name, opCode, flag, maxFlag) def writeArgument(self, argument): self.cache.append(argument) def flush(self): ...
class Accumulator(object): def __init__(self, writer): self.writer = writer self.cache = [] def write_instruction(self, name, opCode, flag, maxFlag): self.flush() self.writer.writeInstruction(name, opCode, flag, maxFlag) def write_argument(self, argument): self.cac...
HTTP_METHOD_VIEWS = { "post": "create", "put": "update", "delete": "delete", }
http_method_views = {'post': 'create', 'put': 'update', 'delete': 'delete'}
""" print out the numbers 1 through 7. """ i = 1 while i <= 7: print(i, end=" ") i += 1
""" print out the numbers 1 through 7. """ i = 1 while i <= 7: print(i, end=' ') i += 1
# input_lines = '''\ # cpy 41 a # inc a # inc a # dec a # jnz a 2 # dec a'''.splitlines() input_lines = open('input.txt') regs = {r:0 for r in 'abcd'} pc = 0 program = list(input_lines) regs['c'] = 1 while pc < len(program): ins, *data = program[pc].split() if ins == 'cpy': regs[data[1]] = int(regs....
input_lines = open('input.txt') regs = {r: 0 for r in 'abcd'} pc = 0 program = list(input_lines) regs['c'] = 1 while pc < len(program): (ins, *data) = program[pc].split() if ins == 'cpy': regs[data[1]] = int(regs.get(data[0], data[0])) elif ins == 'inc': regs[data[0]] += 1 elif ins == 'd...
############################################################################## # Copyright (c) 2016 Juan Qiu # juan_ qiu@tongji.edu.cn # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is ...
def buildshellparams(param): i = 0 values = [] result = '/bin/bash -s' for key in param.keys(): values.append(param[key]) result += ' {%d}' % i i = i + 1 return result
def roman_to_int(roman): values = [ {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}[c] for c in roman ] return sum( +n if n >= next else -n for n, next in zip(values, values[1:] + [0]) ) with open('roman.txt', 'r') as f: msg = f.read().strip().repla...
def roman_to_int(roman): values = [{'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}[c] for c in roman] return sum((+n if n >= next else -n for (n, next) in zip(values, values[1:] + [0]))) with open('roman.txt', 'r') as f: msg = f.read().strip().replace('\n', ' ').split(' ') roman = [] for w...
def test_database_creation_request(client): out = client.post( "/api/v1/database/request", json={ "superuser_fullname": "Charlie Brown", "superuser_email": "test@firstuser.com", "superuser_password": "asdf", "database_name": "test_database_endpoints", ...
def test_database_creation_request(client): out = client.post('/api/v1/database/request', json={'superuser_fullname': 'Charlie Brown', 'superuser_email': 'test@firstuser.com', 'superuser_password': 'asdf', 'database_name': 'test_database_endpoints', 'alembic_revisions': ['compchem@head']}) assert out.status_cod...
# lec10memo1.py # Code shown in Lecture 10, memo 1 # An iterative "Pythonic" search procedure: def search(list, element): for e in list: if e == element: return True return False # The recursive way: def rSearch(list,element): if element == list[0]: return True if len(lis...
def search(list, element): for e in list: if e == element: return True return False def r_search(list, element): if element == list[0]: return True if len(list) == 1: return False return r_search(list[1:], element) def r_binary_search(list, element): if len(...
def test_bulkload(O): errors = [] bulk = O.bulkAdd() bulk.addVertex("1", "Person", {"name": "marko", "age": "29"}) bulk.addVertex("2", "Person", {"name": "vadas", "age": "27"}) bulk.addVertex("3", "Software", {"name": "lop", "lang": "java"}) bulk.addVertex("4", "Person", {"name": "josh", "ag...
def test_bulkload(O): errors = [] bulk = O.bulkAdd() bulk.addVertex('1', 'Person', {'name': 'marko', 'age': '29'}) bulk.addVertex('2', 'Person', {'name': 'vadas', 'age': '27'}) bulk.addVertex('3', 'Software', {'name': 'lop', 'lang': 'java'}) bulk.addVertex('4', 'Person', {'name': 'josh', 'age': ...
extensions = dict( required_params=['training_frame', 'x'], validate_required_params="", set_required_params=""" parms$training_frame <- training_frame if(!missing(x)) parms$ignored_columns <- .verify_datacols(training_frame, x)$cols_ignore """, ) doc = dict( preamble=""" Trains an Extended Isolation...
extensions = dict(required_params=['training_frame', 'x'], validate_required_params='', set_required_params='\nparms$training_frame <- training_frame\nif(!missing(x))\n parms$ignored_columns <- .verify_datacols(training_frame, x)$cols_ignore\n') doc = dict(preamble='\nTrains an Extended Isolation Forest model\n', para...
def brute_force(numbers: list) -> int: """ Brute force for counting invertions This aproach not work for a large n :param numbers: list of numbers :return: number of invertions """ count = 0 for i, number in enumerate(numbers[:-1]): for compare in numbers[i+1:]: if...
def brute_force(numbers: list) -> int: """ Brute force for counting invertions This aproach not work for a large n :param numbers: list of numbers :return: number of invertions """ count = 0 for (i, number) in enumerate(numbers[:-1]): for compare in numbers[i + 1:]: ...
# # PySNMP MIB module TPLINK-PORTISOLATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-PORTISOLATION-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:25:32 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
finput ='./AdventOfCode/Day05/invalid.txt' finput = './AdventOfCode/Day05/valid.txt' finput = './AdventOfCode/Day05/Input.txt' seats =[] def get_loc(seat): directions = list(seat) start = 0 stop = 0 if "R" in directions or "L" in directions: stop = 7 else: stop = 127 what = ...
finput = './AdventOfCode/Day05/invalid.txt' finput = './AdventOfCode/Day05/valid.txt' finput = './AdventOfCode/Day05/Input.txt' seats = [] def get_loc(seat): directions = list(seat) start = 0 stop = 0 if 'R' in directions or 'L' in directions: stop = 7 else: stop = 127 what = 1 ...
def votes(params): for vote in params: print("Possible option:" + vote) votes(['yes', 'no', 'maybe'])
def votes(params): for vote in params: print('Possible option:' + vote) votes(['yes', 'no', 'maybe'])
def max_cluster(clusters): size=len(clusters) max_current = clusters[0] max_finish_flag = 0 for i in range(0, size): max_finish_flag = max_finish_flag + clusters[i] if max_finish_flag < 0: max_finish_flag = 0 elif (max_current < max_finish_flag): ...
def max_cluster(clusters): size = len(clusters) max_current = clusters[0] max_finish_flag = 0 for i in range(0, size): max_finish_flag = max_finish_flag + clusters[i] if max_finish_flag < 0: max_finish_flag = 0 elif max_current < max_finish_flag: max_curre...
class TaskDefinition: """ The information necessary to run a task. Subclass with different values for different performers and / parameters The command will look something like: ssh -i ~/.ssh/pemfile.pem ubuntu@ec2.24342.compute.amazon.com "ENV=XYZ performerscript.sh" where performerscript.sh ru...
class Taskdefinition: """ The information necessary to run a task. Subclass with different values for different performers and / parameters The command will look something like: ssh -i ~/.ssh/pemfile.pem ubuntu@ec2.24342.compute.amazon.com "ENV=XYZ performerscript.sh" where performerscript.sh ru...
#Write a function that accepts a filename(string) of a CSV file which contains the information about student's names #and their grades for four courses and returns a dictionary of the information. The keys of the dictionary should be #the name of the students and the values should be a list of floating point numbers ...
def file_to_dictionary(file_name): file_pointer = open(file_name, 'r') data = file_pointer.readlines() no_return_list = [] for x in data: no_return_list.append(x.strip('\n')) list_of_list = [] for element in no_return_list: list_of_list.append(element.split(',')) dictionary =...
report_config = { 'domain' : 'athagroup.in', } email_config = { 'email_server' : 'mail.groots.in', 'email_port' : 587, 'email_fromaddr' : 'kalpak@groots.in', 'email_toaddr' : ['email.reports@athagroup.in', 'sawkat.ali@athagroup.in', 'brijesh@groots.in', 'kalpak@groots.in'], 'email_...
report_config = {'domain': 'athagroup.in'} email_config = {'email_server': 'mail.groots.in', 'email_port': 587, 'email_fromaddr': 'kalpak@groots.in', 'email_toaddr': ['email.reports@athagroup.in', 'sawkat.ali@athagroup.in', 'brijesh@groots.in', 'kalpak@groots.in'], 'email_password': 'mcs@groots@23', 'email_subject': 'a...
# Default constants for the generic installation of `JAVA` on production systems. # Please alter the below configurations to suit your environment needs. BASE_URL = 'http://www.oracle.com' JAVA_PACKAGE = 'server-jre' JAVA_VERSION = 8 ARCHITECTURE_SET = 'linux-x64' PACKAGE_EXTENSION = '.ta...
base_url = 'http://www.oracle.com' java_package = 'server-jre' java_version = 8 architecture_set = 'linux-x64' package_extension = '.tar.gz' downloads_url = BASE_URL + '/technetwork/java/javase/downloads/index.html' download_pattern = '/technetwork/java/javase/downloads/' + JAVA_PACKAGE + str(JAVA_VERSION) + '-download...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Bit and bit array helpers """ def get_bit(data, bit_index): """ Get bit as integer at index bit_index from bytes array. Order is from left to right, so bit_index=0 is MSB. """ if bit_index < 8 * len(data): cur_byte = data[bit_index // 8] ...
""" Bit and bit array helpers """ def get_bit(data, bit_index): """ Get bit as integer at index bit_index from bytes array. Order is from left to right, so bit_index=0 is MSB. """ if bit_index < 8 * len(data): cur_byte = data[bit_index // 8] return cur_byte >> 7 - bit_index % 8 & 1 ...
"""\ historybuffer.py : fixed-length buffer for a time-series of objects Copyright (c) 2016, Garth Zeglin. All rights reserved. Licensed under the terms of the BSD 3-clause license. """ class History(object): """Implement a fixed-length buffer for keeping the recent history of a time-series of objects. This ...
"""historybuffer.py : fixed-length buffer for a time-series of objects Copyright (c) 2016, Garth Zeglin. All rights reserved. Licensed under the terms of the BSD 3-clause license. """ class History(object): """Implement a fixed-length buffer for keeping the recent history of a time-series of objects. This is...
#!/usr/bin/env python # coding: utf-8 # /*########################################################################## # # Copyright (c) 2017 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the ...
"""This module contains library wide configuration. """ __authors__ = ['V. Valls'] __license__ = 'MIT' __date__ = '26/04/2018' class Config(object): """ Class containing shared global configuration for the silx library. .. versionadded:: 0.8 """ default_plot_backend = 'matplotlib' "Default plo...
#!/usr/bin/env python # coding: utf-8 # # Min Operations # Starting from the number `0`, find the minimum number of operations required to reach a given positive `target number`. You can only use the following two operations: # # 1. Add 1 # 2. Double the number # # ### Example: # # 1. For `Target = 18`...
def min_operations(): """ Return number of steps taken to reach a target number input: target number (as an integer) output: number of steps (as an integer) """ def test_function(test_case): target = test_case[0] solution = test_case[1] output = min_operations(target) if output == s...
n1 = int(input('digite um numero: ')) d = n1 * 2 t = n1 * 3 r = n1 **(1/2) print('o dobro de {} e {}\no triplo de {} e {}\na raiz quadrada de {} e {:.2f}.'.format(n1, d, n1, t, n1, r))
n1 = int(input('digite um numero: ')) d = n1 * 2 t = n1 * 3 r = n1 ** (1 / 2) print('o dobro de {} e {}\no triplo de {} e {}\na raiz quadrada de {} e {:.2f}.'.format(n1, d, n1, t, n1, r))
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres...
# 30.01.2021 # level Beginner # The point of the game is to find the water in the deser to escape Mr. Death print(''' ********************************************************************** ### #### ...
print('\n**********************************************************************\n ### \n #### \n # ### \n #### ### \n #...
def calc(should_print=False): print(""" Name: LCM(Least common multiple) Operation : LCM of 2 numbers Inputs : a->int , b->int Outputs: c=>lcm(a,b) ->int Author : suyashsonawane \n """) a = float(input("Enter a >>")) b = float(input("Enter b >>")) if(a > b ): # Use If con...
def calc(should_print=False): print('\n Name: LCM(Least common multiple)\n Operation : LCM of 2 numbers\n Inputs : a->int , b->int\n Outputs: c=>lcm(a,b) ->int\n Author : suyashsonawane\n \n\n ') a = float(input('Enter a >>')) b = float(input('Enter b >>')) if a > b: max = a...
""" hello,world! Version: 0.1 Author: gongyuandaye """ print('hello,world!') #print('hello',',','world!') print('hello','world','haha',sep=',',end='!\n') print('hello, world',end='!\n')
""" hello,world! Version: 0.1 Author: gongyuandaye """ print('hello,world!') print('hello', 'world', 'haha', sep=',', end='!\n') print('hello, world', end='!\n')
def calculater(num1,num2,oprater): if oprater=="add": return num1+num2 elif oprater=="subtrate": return num1-num2 elif oprater=="multiple": return num1*num2 elif oprater=="divite": return num1/num2 sum=calculater(3,4,"add") print(sum) print(calculater(4,4,"multiple"))
def calculater(num1, num2, oprater): if oprater == 'add': return num1 + num2 elif oprater == 'subtrate': return num1 - num2 elif oprater == 'multiple': return num1 * num2 elif oprater == 'divite': return num1 / num2 sum = calculater(3, 4, 'add') print(sum) print(calculate...
john_wick = {"Drink": 12, "Popcorn": 15, "Menu": 19} star_wars = {"Drink": 18, "Popcorn": 25, "Menu": 30} jumanji = {"Drink": 9, "Popcorn": 11, "Menu": 14} movie = input() package = input() count = int(input()) total_bill = 0 if movie == "John Wick": total_bill = john_wick[package] * count elif movie == "Star War...
john_wick = {'Drink': 12, 'Popcorn': 15, 'Menu': 19} star_wars = {'Drink': 18, 'Popcorn': 25, 'Menu': 30} jumanji = {'Drink': 9, 'Popcorn': 11, 'Menu': 14} movie = input() package = input() count = int(input()) total_bill = 0 if movie == 'John Wick': total_bill = john_wick[package] * count elif movie == 'Star Wars'...
books = ['frankenstein.txt', 'heartofdarkness.txt', 'prideandprejudice.txt'] for book in books: with open(book) as content: words = content.read() lowers = words.lower() amount = lowers.count('the') print(amount)
books = ['frankenstein.txt', 'heartofdarkness.txt', 'prideandprejudice.txt'] for book in books: with open(book) as content: words = content.read() lowers = words.lower() amount = lowers.count('the') print(amount)
string = '0123456789012345678901234567890123456789' cont = 10 controle = [string[i: i+cont] for i in range(0, len(string), cont)] retorno = '.'.join(controle) print(controle) print(retorno)
string = '0123456789012345678901234567890123456789' cont = 10 controle = [string[i:i + cont] for i in range(0, len(string), cont)] retorno = '.'.join(controle) print(controle) print(retorno)
restconf_map = { 'openconfig_network_instance_network_instances_network_instance_protocols_protocol_bgp' : '/restconf/data/openconfig-network-instance:network-instances/network-instance={name}/protocols/protocol={identifier},{name1}/bgp', 'openconfig_network_instance_network_instances_network_instance_p...
restconf_map = {'openconfig_network_instance_network_instances_network_instance_protocols_protocol_bgp': '/restconf/data/openconfig-network-instance:network-instances/network-instance={name}/protocols/protocol={identifier},{name1}/bgp', 'openconfig_network_instance_network_instances_network_instance_protocols_protocol_...
class Vehicle: licenseNumber = "" serialCode = "" face = "" def turnOnAirCon(self): print("Turn on : Air") class Car(Vehicle): def sayHello(self): print("Hello World") class Pickup(Vehicle): pass class Van(Vehicle): pass class EstateCar(Vehicle): pass car1 = Car() car1....
class Vehicle: license_number = '' serial_code = '' face = '' def turn_on_air_con(self): print('Turn on : Air') class Car(Vehicle): def say_hello(self): print('Hello World') class Pickup(Vehicle): pass class Van(Vehicle): pass class Estatecar(Vehicle): pass car1 = c...
naqt_basic_front = """ <h1>NAQT You Gotta Know</h1> <div class='qcard'> {{#Category}}<h2>{{Category}}</h2><br/>{{/Category}} {{Prompt}} <br/><br/> <span class="answer-hidden">{{Answer}}</span> </div> <div class="source"> <span class="label">Source:</span> <span class="content">{{Source}}</span> </div> """ naqt_bas...
naqt_basic_front = '\n<h1>NAQT You Gotta Know</h1>\n\n<div class=\'qcard\'>\n{{#Category}}<h2>{{Category}}</h2><br/>{{/Category}}\n\n{{Prompt}}\n\n<br/><br/>\n\n<span class="answer-hidden">{{Answer}}</span>\n</div>\n<div class="source">\n<span class="label">Source:</span> <span class="content">{{Source}}</span>\n</div>...
def is_prime(k: int) -> bool: if isinstance(k, int) and k > 1: for i in range(2, int((k / 2) + 1)): if k % i == 0: return False else: return True else: raise ValueError("Argument must be positive integer greater than 1") def prime_unti...
def is_prime(k: int) -> bool: if isinstance(k, int) and k > 1: for i in range(2, int(k / 2 + 1)): if k % i == 0: return False else: return True else: raise value_error('Argument must be positive integer greater than 1') def prime_until(n: int) -> ...
# Recursion Exercise 2 # Write a recursive function called list_sum that takes a list of numbers as a parameter. # Return the sum of all of the numbers in the list. # Hint, the slice operator will be helpful in solving this problem. # Expected Output # If the function call is list_sum([1, 2, 3, 4, 5]), then the functio...
def list_sum(num_list): """Returns the sum of all of the numbers in the list""" if len(num_list) == 1: return num_list[0] else: return num_list[0] + list_sum(num_list[1:]) if __name__ == '__main__': print(list_sum([1, 2, 3, 4, 5])) print(list_sum([10, 12.5, 10, 7]))
## ## readfile.py ## def readFile(filename): try: f = open(filename) fullFile = f.read() print(fullFile.strip()) except FileNotFoundError as fileError: print('Error Caught: ---> ', fileError) finally: print('WE ARE IN THE FINALLY BLOCK OF CODE!!!') try: f.close() except UnboundLocalError as localErr...
def read_file(filename): try: f = open(filename) full_file = f.read() print(fullFile.strip()) except FileNotFoundError as fileError: print('Error Caught: ---> ', fileError) finally: print('WE ARE IN THE FINALLY BLOCK OF CODE!!!') try: f.close() ...
""" Convex Contracts for Starfish """ __version__ = '0.0.2'
""" Convex Contracts for Starfish """ __version__ = '0.0.2'
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 27 19:09:43 2019 @author: florian """ i = 1 while (i<15): print(i) i+=1 print("--------") suma = 0 for x in (2**p for p in range(1,7)): print(x) suma +=x print("--------") print(suma)
""" Created on Tue Aug 27 19:09:43 2019 @author: florian """ i = 1 while i < 15: print(i) i += 1 print('--------') suma = 0 for x in (2 ** p for p in range(1, 7)): print(x) suma += x print('--------') print(suma)
class NoScorePartException(BaseException): """ERROR! NO SCORE PART ID FOUND""" class NoPartCreatedException(BaseException): """ERROR! PART NOT CREATED""" class NoMeasureIDException(BaseException): """ERROR! NO MEASURE FOUND""" class TabNotImplementedException(BaseException): """ERROR: this app...
class Noscorepartexception(BaseException): """ERROR! NO SCORE PART ID FOUND""" class Nopartcreatedexception(BaseException): """ERROR! PART NOT CREATED""" class Nomeasureidexception(BaseException): """ERROR! NO MEASURE FOUND""" class Tabnotimplementedexception(BaseException): """ERROR: this applicatio...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class BitVector: def __init__(self, bits, value): self.bits = bits self.mask = (2 ** self.bits) - 1 self.value = value if self.value is not None: assert self.mask & self.value == self.value def __getitem__(self, index): assert self.value is not None, "this...
class Bitvector: def __init__(self, bits, value): self.bits = bits self.mask = 2 ** self.bits - 1 self.value = value if self.value is not None: assert self.mask & self.value == self.value def __getitem__(self, index): assert self.value is not None, 'this bit...
class IterableHelper: @staticmethod def find_single(iterable,func): for item in iterable: if func(item): return item @staticmethod def select(iterable,func): for item in iterable: yield func(item)
class Iterablehelper: @staticmethod def find_single(iterable, func): for item in iterable: if func(item): return item @staticmethod def select(iterable, func): for item in iterable: yield func(item)
# These dictionaries are applied to the generated enums dictionary at build time # Any changes to the API should be made here. attributes.py is code generated # We are not code genning enums that have been marked as obsolete prior to the initial # Python API bindings release # We also do not codegen enums associated w...
enums_codegen_method = {}
""" Expanding Nebula ================ You've escaped Commander Lambda's exploding space station along with numerous escape pods full of bunnies. But - oh no! - one of the escape pods has flown into a nearby nebula, causing you to lose track of it. You start monitoring the nebula, but unfortunately, just a moment too...
""" Expanding Nebula ================ You've escaped Commander Lambda's exploding space station along with numerous escape pods full of bunnies. But - oh no! - one of the escape pods has flown into a nearby nebula, causing you to lose track of it. You start monitoring the nebula, but unfortunately, just a moment too...
# -------------------------------------------------- # Copyright The IETF Trust 2011-2019, All Rights Reserved # -------------------------------------------------- # Static values __version__ = '0.6.1' NAME = 'rfctools_common' VERSION = [ int(i) if i.isdigit() else i for i in __version__.split('.') ]
__version__ = '0.6.1' name = 'rfctools_common' version = [int(i) if i.isdigit() else i for i in __version__.split('.')]
# # PySNMP MIB module H3C-EPON-DEVICE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-EPON-DEVICE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:09:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint) ...
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None self.tail = None def append(self, data): current = self.head if self.head is None: self.head = Node(data...
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None self.tail = None def append(self, data): current = self.head if self.head is None: self.head = node(data) ...
""" Car class to demonstrate Single Responsibility Principle. The single responsibility principle says that a class should be responsible for just one thing. """ # Before class Car: def __init__(self, name): self.name = name def get_car_name(self): return self.name def save_car(self, fil...
""" Car class to demonstrate Single Responsibility Principle. The single responsibility principle says that a class should be responsible for just one thing. """ class Car: def __init__(self, name): self.name = name def get_car_name(self): return self.name def save_car(self, file_name):...
SELECTION_TESTS = { 'id': 'S', 'caption': 'Selection Tests', 'checkAttrs': True, 'checkStyle': True, 'styleWithCSS': False, 'Proposed': [ { 'desc': '', 'command': '', 'tests': [ ] }, { 'desc': 'selectall', 'command': 'sele...
selection_tests = {'id': 'S', 'caption': 'Selection Tests', 'checkAttrs': True, 'checkStyle': True, 'styleWithCSS': False, 'Proposed': [{'desc': '', 'command': '', 'tests': []}, {'desc': 'selectall', 'command': 'selectall', 'tests': [{'id': 'SELALL_TEXT-1_SI', 'desc': 'select all, text only', 'pad': 'foo [bar] baz', 'e...
if __name__ == '__main__': number = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627661...
if __name__ == '__main__': number = '731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511125406987471585238630507156932909632952274430435576689664895044524452316173185640309871112172238311362229893423380308135336276614...
with open ( "data1.txt" ) as f: data = f.readline() f.close() print ( "->{}<-".format(data))
with open('data1.txt') as f: data = f.readline() f.close() print('->{}<-'.format(data))
self.description = "Query ownership of file in root" sp = pmpkg("dummy") sp.files = ["etc/config"] self.addpkg2db("local", sp) self.filesystem = ["config"] self.args = "-Qo /config" self.addrule("PACMAN_RETCODE=1")
self.description = 'Query ownership of file in root' sp = pmpkg('dummy') sp.files = ['etc/config'] self.addpkg2db('local', sp) self.filesystem = ['config'] self.args = '-Qo /config' self.addrule('PACMAN_RETCODE=1')
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class ActiveOperationEnum(object): """Implementation of the 'ActiveOperation' enum. Specifies the active operation on the Node if there is one. 'kNone' specifies that there is no active operation on the Node. 'kDestroyCluster' specifies that the ...
class Activeoperationenum(object): """Implementation of the 'ActiveOperation' enum. Specifies the active operation on the Node if there is one. 'kNone' specifies that there is no active operation on the Node. 'kDestroyCluster' specifies that the Cluster which the Node is a part of is currently bein...
CACHE={} def battle(hp, bosshp, boss_damage, mana, shield_turns=0, poison_turns=0, recharge_turns=0, mana_spent=0, player_turn=True): armor = 7 if shield_turns else 0 poison = 3 if poison_turns else 0 recharge = 101 if recharge_turns else 0 assert poison_turns <= 6 assert recharge_turns <= 5 a...
cache = {} def battle(hp, bosshp, boss_damage, mana, shield_turns=0, poison_turns=0, recharge_turns=0, mana_spent=0, player_turn=True): armor = 7 if shield_turns else 0 poison = 3 if poison_turns else 0 recharge = 101 if recharge_turns else 0 assert poison_turns <= 6 assert recharge_turns <= 5 ...
#!/usr/bin/env python # This is a single-line comment print("Comments are useful.") """ This is a multi-line Comment which spans many lines """ print("You should comment your code.")
print('Comments are useful.') ' \n This is a multi-line Comment\n which spans many lines\n' print('You should comment your code.')
class Fish: small_fish ='''${33} ${333} ${333} __ \/ o\\ /\\__/ '''
class Fish: small_fish = '${33}\n${333}\n${333}\n __ \n\\/ o\\\n/\\__/\n'
# LeetCode 469. Convex Polygon # Given a list of points that form a polygon when joined sequentially, find if this polygon is convex (Convex polygon definition). # Note: # There are at least 3 and at most 10,000 points. # Coordinates are in the range -10,000 to 10,000. # You may assume the polygon formed by given p...
class Solution(object): def is_convex(self, points): """ :type points: List[List[int]] :rtype: bool """ def cross_product(p0, p1, p2): (x0, y0) = p0 (x1, y1) = p1 (x2, y2) = p2 return (x2 - x0) * (y1 - y0) - (x1 - x0) * (y2 - ...
#Antonio Karlo Mijares class BaseCharacter (object): def __init__(self): self.health = 100 def printName (self): print (self.name) class NonPlayable (BaseCharacter): pass class Enemy (NonPlayable): def __init__(self): self.attack -= 5 class Friend (NonPlayable): pass cla...
class Basecharacter(object): def __init__(self): self.health = 100 def print_name(self): print(self.name) class Nonplayable(BaseCharacter): pass class Enemy(NonPlayable): def __init__(self): self.attack -= 5 class Friend(NonPlayable): pass class Playable(BaseCharacter)...
# Discriminator # Probably a VGG16 or VGG19 for Simple Image Classification pretrained on ImageNet # Discriminator # Probably a VGG16 or VGG19 for Simple Image Classification pretrained on ImageNet class Discriminator(nn.Module): def __init__(self, c1_channels=64, c2_channels=128, c3_channels=256, ...
class Discriminator(nn.Module): def __init__(self, c1_channels=64, c2_channels=128, c3_channels=256, c4_channels=512): """ The constructor method for the Discriminator class Arguments: - c1_channels : the number of output channels from the first Conv...
# Program : Check whether the number is positve or negative number. # Input : number = -3 # Output : Negative # Explanation : -3 is less than zero, so it is a negative number. # Language : Python3 # O(1) time | O(1) space def positive_or_negative(number): # If the number is equal to zero, then it is neither posit...
def positive_or_negative(number): if number == 0: return 'Neither positve nor negative.' elif number > 0: return 'Positve' else: return 'Negative' if __name__ == '__main__': number = -3 answer = positive_or_negative(number) print(answer)
def summarize(di, n_pa=8): print("{} keys and {} unique values:\n".format(len(di), len(set(di.values())))) for ke, va in list(di.items())[:n_pa]: print("{} => {}".format(ke, va)) print("...")
def summarize(di, n_pa=8): print('{} keys and {} unique values:\n'.format(len(di), len(set(di.values())))) for (ke, va) in list(di.items())[:n_pa]: print('{} => {}'.format(ke, va)) print('...')
# This pythong script contains a function to lookup product prices for passed products and a function sum these up to return the total. # # This is a dictionary of product prices. It is not part of any specific function below and can therefore be accessed from anywhere in the script. productPriceDict = {'apples':1.50,'...
product_price_dict = {'apples': 1.5, 'doggeFood': 2.99, 'myPhone18': 99999.99, 'freedomFromCapitalism': 0.0} def lookup_price(product): price = productPriceDict[product] return price def calculate_total(productList): total = 0.0 for i in range(len(productList)): total = total + lookup_price(pr...
class Solution: def subsets(self, nums): # res=[[]] # self.dfs([],res,nums) # return res return self.recurse(nums) # def dfs(self,path,res,nums): # for n in nums: # if n not in path: # res.append(path+[n]) # if len(path)+1<len(...
class Solution: def subsets(self, nums): return self.recurse(nums) def recurse(self, nums): if len(nums) == 0: return [[]] res = self.recurse(nums[:-1]) temp = [] for r in res: temp.append(r + [nums[-1]]) return res + temp if __name__ == ...
# # PySNMP MIB module CONTIVITY-ID-V1-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONTIVITY-ID-V1-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:10:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) ...
# Approach 1: def Second_Largest(Arr): Arr.remove(max(Arr)) return max(Arr) a = [] n = int(input("How Many Elements: ")) print("Enter The Elements: ") for i in range(0, n): element = int(input()) a.append(element) print(f"Second Largest: {Second_Largest(a)}") # Approach 2: def Se...
def second__largest(Arr): Arr.remove(max(Arr)) return max(Arr) a = [] n = int(input('How Many Elements: ')) print('Enter The Elements: ') for i in range(0, n): element = int(input()) a.append(element) print(f'Second Largest: {second__largest(a)}') def second__largest(Arr): return sorted(Arr)[-2] a ...
class DOVError(Exception): """General error within PyDOV.""" pass class OWSError(DOVError): """Error regarding the OGC web services.""" pass class LayerNotFoundError(OWSError): """Error that occurs when a specific layer could not be found.""" pass class MetadataNotFoundError(OWSError): ...
class Doverror(Exception): """General error within PyDOV.""" pass class Owserror(DOVError): """Error regarding the OGC web services.""" pass class Layernotfounderror(OWSError): """Error that occurs when a specific layer could not be found.""" pass class Metadatanotfounderror(OWSError): ""...
# Variables to be used for developing and testing the program INTERVALS = [[1, 2], [1, 7], [8, 11], [11, 14], [8, 10], [32, 36], [33, 35], [105, 108]] """ INTERVALS = [[1, 2], [1, 7], [8, 11], [11, 14], [8, 10], [32, 326], [33, 345], [105, 1038], [ 1, 2], [1, 7], [8, 11], [1...
intervals = [[1, 2], [1, 7], [8, 11], [11, 14], [8, 10], [32, 36], [33, 35], [105, 108]] '\n INTERVALS = [[1, 2], [1, 7], [8, 11], [11, 14],\n [8, 10], [32, 326], [33, 345], [105, 1038], [\n 1, 2], [1, 7], [8, 11], [11, 14],\n [8, 103], [32, 336], [33, 355], [105, 1038], [\n ...
with open("2021-12-01.txt") as input_file: increasing_lines = 0 last_ints = [None, None, None] for input_line in input_file: if (None not in last_ints): last_ints_sum = sum(last_ints) else: last_ints_sum = None input_int = int(input_line) _ = ...
with open('2021-12-01.txt') as input_file: increasing_lines = 0 last_ints = [None, None, None] for input_line in input_file: if None not in last_ints: last_ints_sum = sum(last_ints) else: last_ints_sum = None input_int = int(input_line) _ = last_ints.p...
class instagram(): scheme = 'https' url = 'instagram.com' headers = {'user-agent': 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)'} def getHandleUrl(self, handle): return "{}://{}/{}".format(instagram.schem...
class Instagram: scheme = 'https' url = 'instagram.com' headers = {'user-agent': 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)'} def get_handle_url(self, handle): return '{}://{}/{}'.format(instagram.scheme...
jibun, kimi, kanojyo = 5, 3, 2 if (kimi < jibun and jibun < kanojyo): print(jibun) elif (kanojyo < jibun and jibun < kimi): print(jibun) elif (kanojyo < kimi and kimi < jibun): print(kimi) elif (jibun < kimi and kimi < kanojyo): print(kimi) else: print(kanjyo)
(jibun, kimi, kanojyo) = (5, 3, 2) if kimi < jibun and jibun < kanojyo: print(jibun) elif kanojyo < jibun and jibun < kimi: print(jibun) elif kanojyo < kimi and kimi < jibun: print(kimi) elif jibun < kimi and kimi < kanojyo: print(kimi) else: print(kanjyo)
RUNNING_PODS = """ NAME READY STATUS RESTARTS AGE\n anaconda-enterprise-ap-auth-68c4f864f8-x8trs 1/1 Running 0 30m\n anaconda-enterprise-ap-auth-api-6cb6f9595d-9c774 1/1 Running 0 30m\n anacond...
running_pods = '\nNAME READY\nSTATUS RESTARTS AGE\n\nanaconda-enterprise-ap-auth-68c4f864f8-x8trs 1/1\nRunning 0 30m\n\nanaconda-enterprise-ap-auth-api-6cb6f9595d-9c774 1/1\nRunning 0 30m\n\nana...
# WARNING: Do not edit by hand, this file was generated by Crank: # # https://github.com/gocardless/crank # class PayerAuthorisation(object): """A thin wrapper around a payer_authorisation, providing easy access to its attributes. Example: payer_authorisation = client.payer_authorisations.get() ...
class Payerauthorisation(object): """A thin wrapper around a payer_authorisation, providing easy access to its attributes. Example: payer_authorisation = client.payer_authorisations.get() payer_authorisation.id """ def __init__(self, attributes, api_response): self.attributes =...
for _ in range(int(input())): n=int(input()) ans=0 while n>0: ans+=n n=n//2 print(ans)
for _ in range(int(input())): n = int(input()) ans = 0 while n > 0: ans += n n = n // 2 print(ans)
def convert(numerator, denominator): integer = numerator // denominator numerator -= integer * denominator if 0 == numerator: return str(integer)+"." elif len(str(numerator/denominator)) <= 10: return str(integer)+"."+str(numerator/denominator)[2:] else: dlist = [] n...
def convert(numerator, denominator): integer = numerator // denominator numerator -= integer * denominator if 0 == numerator: return str(integer) + '.' elif len(str(numerator / denominator)) <= 10: return str(integer) + '.' + str(numerator / denominator)[2:] else: dlist = [] ...
class User: def __init__(self, id_, name, email, photo): self.id = id_ self.name = name self.email = email self.photo = photo @classmethod def from_dict(cls, dict_): return User( id_=dict_["id"], name=dict_["name"], email=dict_["em...
class User: def __init__(self, id_, name, email, photo): self.id = id_ self.name = name self.email = email self.photo = photo @classmethod def from_dict(cls, dict_): return user(id_=dict_['id'], name=dict_['name'], email=dict_['email'], photo=dict_['photo']) de...
class Solution: def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ n = len(matrix) for i in range(n // 2): for j in range(i, n - 1 - i): tmp = matrix[i][j] ...
class Solution: def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ n = len(matrix) for i in range(n // 2): for j in range(i, n - 1 - i): tmp = matrix[i][j] ...
# This file is Copyright 2007, 2009 Dean Hall. # # This file is part of the Python-on-a-Chip program. # Python-on-a-Chip is free software: you can redistribute it and/or modify # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. # # Python-on-a-Chip is distributed in the hope that it will be use...
"""__NATIVE__ #include <pic24_all.h> #include "pyFuncsInC.h" """ class Digital_Io(object): def __init__(self, port, pin, isInput, isOpenDrain=False, pullDir=0): """__NATIVE__ return configDigitalPinPy(ppframe); """ pass def set(self, isHigh): """__NATIVE__ retu...
# Difficulty Level: Beginner # Question: Calculate the sum of the values of keys a and b . # d = {"a": 1, "b": 2, "c": 3} # Expected output: # 3 # Program d = {"a": 1, "b": 2, "c": 3} print(d["a"] + d["b"]) # Output # shubhamvaishnav:python-bootcamp$ python3 17_dictionary_items_sum_up.py # 3
d = {'a': 1, 'b': 2, 'c': 3} print(d['a'] + d['b'])
class PizzaGrid: def __init__(self, rows, cols, toppings): n = len(toppings) assert(rows * cols == n) self._num_mushrooms = toppings.count('M') self._num_tomatoes = toppings.count('T') self._rows = rows self._cols = cols self._rowcols = [] k = 0 ...
class Pizzagrid: def __init__(self, rows, cols, toppings): n = len(toppings) assert rows * cols == n self._num_mushrooms = toppings.count('M') self._num_tomatoes = toppings.count('T') self._rows = rows self._cols = cols self._rowcols = [] k = 0 ...
""" Clausius desing to create common models accorss the messaging and database services 4 main components - Models - Messangers - Storage - Configuration """
""" Clausius desing to create common models accorss the messaging and database services 4 main components - Models - Messangers - Storage - Configuration """
#!/usr/bin/python3 # this script reads gene annotations from the UniProtKB database input_file = "./data/idmapping_selected.tab" output_file = "pmid_annotations.txt" results_file = "annotation_counts_per_gene.txt" print("Processing UniProtKB annotations") # open the data input file f = open(input_file, 'r') pmids_...
input_file = './data/idmapping_selected.tab' output_file = 'pmid_annotations.txt' results_file = 'annotation_counts_per_gene.txt' print('Processing UniProtKB annotations') f = open(input_file, 'r') pmids_per_gene_id = {} gene_ids_per_pmid = {} gene_id_list = {} total_annotations = 0 pmids = {} print('Reading annotation...
''' Created on Sep 27, 2019 @author: ballance ''' class CompoundSuite(): def __init__(self, name=None): self.name = name self.suite_l = [] pass def add_compound_suite(self, suite_file): pass def add_suite(self, suite_file): pass
""" Created on Sep 27, 2019 @author: ballance """ class Compoundsuite: def __init__(self, name=None): self.name = name self.suite_l = [] pass def add_compound_suite(self, suite_file): pass def add_suite(self, suite_file): pass
#!usr/bin/env python3 def character_frequency(filename): """counts the frequency of each character in the given file""" #first try open the file characters={} try: f=open(filename) except FileNotFoundError: # first most detailed exception print("File not found") characters=...
def character_frequency(filename): """counts the frequency of each character in the given file""" characters = {} try: f = open(filename) except FileNotFoundError: print('File not found') characters = None except OSError: print('Other error raised by OS. Maybe disk fu...
def actg_numbers(sub_gene): numbers = [0, 0, 0, 0] for letter in sub_gene: if letter == 'A': numbers[0] += 1 elif letter == 'C': numbers[1] += 1 elif letter == 'T': numbers[2] += 1 elif letter == 'G': numbers[3] += 1 return nu...
def actg_numbers(sub_gene): numbers = [0, 0, 0, 0] for letter in sub_gene: if letter == 'A': numbers[0] += 1 elif letter == 'C': numbers[1] += 1 elif letter == 'T': numbers[2] += 1 elif letter == 'G': numbers[3] += 1 return numb...
""" Useful items that allow the observable pattern to be implemented on a class. """ class _ListenerInfo: """ Information on listeners. Listeners is the set of listeners which should be informed on trigger. last_value: the last value that was sent to the listeners pre_trigger_function: an optional...
""" Useful items that allow the observable pattern to be implemented on a class. """ class _Listenerinfo: """ Information on listeners. Listeners is the set of listeners which should be informed on trigger. last_value: the last value that was sent to the listeners pre_trigger_function: an optional ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
Test.Summary = '\nTest command: traffic_ctl config describe proxy.config.http.background_fill_completed_threshold (YTSATS-3309)\n' Test.testName = 'Float in conf_remap Config Test' ts = Test.MakeATSProcess('ts', command='traffic_manager', select_ports=True) ts.Disk.MakeConfigFile('conf_remap.config').AddLines(['CONFIG ...
# Exact copy of global values in extensions.tg_filters SPA = "spa" WEBAPP = "webapp" ALPINE = "alpine" DEBIAN = "debian" YES = 'yes' NO = 'no' S3 = 'S3' GCS = 'GCS'
spa = 'spa' webapp = 'webapp' alpine = 'alpine' debian = 'debian' yes = 'yes' no = 'no' s3 = 'S3' gcs = 'GCS'
GRPC_SERVER_PORT = 50051 GRPC_MAX_WORKERS = 2 WEB_SERVER_PORT = 8080 SQLITE_DATABASE_PATH = 'data/db.sqlite' AUTHENTICATION_TOKEN = 'abc' COMMAND_PASSPHRASE = 'abc' NUMBER_OF_DAYS_TO_KEEP_STATUS = 7 TEMPLATE_FILE = 'index.html' PORT_SSH = 11734 PORT_VIDEO = 11735 WATER_DURATION_EQUAL_100_PERCENT = 120 WEB_SERVER_NEW_CO...
grpc_server_port = 50051 grpc_max_workers = 2 web_server_port = 8080 sqlite_database_path = 'data/db.sqlite' authentication_token = 'abc' command_passphrase = 'abc' number_of_days_to_keep_status = 7 template_file = 'index.html' port_ssh = 11734 port_video = 11735 water_duration_equal_100_percent = 120 web_server_new_co...
def max_profit(price_list): values = [] min_number = price_list[0] for i in range(len(price_list)): if price_list[i]<min_number: min_number=price_list[i] values.append(0) else: values.append(price_list[i]-min_number) return max(values) a = max_profit([7, 1, 5, 3, 6, 4]) print(a)
def max_profit(price_list): values = [] min_number = price_list[0] for i in range(len(price_list)): if price_list[i] < min_number: min_number = price_list[i] values.append(0) else: values.append(price_list[i] - min_number) return max(values) a = max_pr...
class Child: def __init__(self): pass def __str__(self): return "c" def __hash__(self): return self.x ** self.y class Cradle: def __init__(self): self.child = None @property def with_child(self): return self.child != None def __str__(self): ...
class Child: def __init__(self): pass def __str__(self): return 'c' def __hash__(self): return self.x ** self.y class Cradle: def __init__(self): self.child = None @property def with_child(self): return self.child != None def __str__(self): ...
""" @file : binheap.py @brief : Binary Heap @details : BinHeap @author : Ernest Yeung ernestyalumni@gmail.com @date : 20170918 @ref : cf. http://interactivepython.org/runestone/static/pythonds/Trees/SearchTreeImplementation.html https://github.com/bnmnetp/pythonds/blob/master/tre...
""" @file : binheap.py @brief : Binary Heap @details : BinHeap @author : Ernest Yeung ernestyalumni@gmail.com @date : 20170918 @ref : cf. http://interactivepython.org/runestone/static/pythonds/Trees/SearchTreeImplementation.html https://github.com/bnmnetp/pythonds/blob/master/tre...
def main(): # input x, y = map(int, input().split()) # compute # output print('Better' if x<y else 'Worse') if __name__ == '__main__': main()
def main(): (x, y) = map(int, input().split()) print('Better' if x < y else 'Worse') if __name__ == '__main__': main()
class Enum1(set): def __getattr__(self, name): if name in self: return name raise AttributeError Token = Enum1(['Error', 'End', 'Id', 'Integer', 'Keyword', 'Operator', 'Other', ...
class Enum1(set): def __getattr__(self, name): if name in self: return name raise AttributeError token = enum1(['Error', 'End', 'Id', 'Integer', 'Keyword', 'Operator', 'Other']) class Enum2(set): def __getattr__(self, name): if name[0].lower() + name[1:] in self: ...
"""***************************************************************************** * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
"""***************************************************************************** * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
names = dict() while True: inp = input() if inp == 'end': break name, value = inp.split(' = ') if value in names: names[name] = names[value] elif value.isdigit(): names[name] = int(value) for key, value in names.items(): print(f'{key} === {value}')
names = dict() while True: inp = input() if inp == 'end': break (name, value) = inp.split(' = ') if value in names: names[name] = names[value] elif value.isdigit(): names[name] = int(value) for (key, value) in names.items(): print(f'{key} === {value}')
class color: BOLD = '\033[1m\033[48m' END = '\033[0m' ORANGE = '\033[38;5;202m' BLACK = '\033[38;5;240m' def print_logo(subtitle="", option=2): print() print(color.BOLD + color.ORANGE + " .8. " + color.BLACK + " 8 888888888o " + color.ORANGE + "8 8888888888 `8.`8888....
class Color: bold = '\x1b[1m\x1b[48m' end = '\x1b[0m' orange = '\x1b[38;5;202m' black = '\x1b[38;5;240m' def print_logo(subtitle='', option=2): print() print(color.BOLD + color.ORANGE + ' .8. ' + color.BLACK + ' 8 888888888o ' + color.ORANGE + "8 8888888888 `8.`8888. ,8...
class TemperatureFactory: """ Returns a formula to use to do the required temperature conversion. Given how simple these conversions are, an alternative approach would have been to just make a lookup table and a generic function (similar to what was done in temperature_service_test,...
class Temperaturefactory: """ Returns a formula to use to do the required temperature conversion. Given how simple these conversions are, an alternative approach would have been to just make a lookup table and a generic function (similar to what was done in temperature_service_test,...