content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Pizza: def __init__(self, ingredients): self.ingredients = ingredients def __repr__(self): return f"Pizza({self.ingredients!r})" print(Pizza(["cheese", "tomatoes"]))
class Pizza: def __init__(self, ingredients): self.ingredients = ingredients def __repr__(self): return f'Pizza({self.ingredients!r})' print(pizza(['cheese', 'tomatoes']))
#setting RPPpath = r"D:\document\python projects\Autolipsync\scripttest2.rpp" TEMPLATEPath = r"D:\document\python projects\Autolipsync\template.exo" LIPPath = r"D:\document\python projects\Autolipsync\*.avi" ExportPath = "RPPtoEXO(Lyric).exo" FPS = 60
rp_ppath = 'D:\\document\\python projects\\Autolipsync\\scripttest2.rpp' template_path = 'D:\\document\\python projects\\Autolipsync\\template.exo' lip_path = 'D:\\document\\python projects\\Autolipsync\\*.avi' export_path = 'RPPtoEXO(Lyric).exo' fps = 60
# %% def isprime(n): if n == 1: return False i = 2 while i*i <= n: if n % i == 0: return False i += 1 return True def solution(n, k): enc = [] while n != 0: enc.append(n % k) n = n // k curr = enc[-1] answer = 0 for v in enc[-2::-...
def isprime(n): if n == 1: return False i = 2 while i * i <= n: if n % i == 0: return False i += 1 return True def solution(n, k): enc = [] while n != 0: enc.append(n % k) n = n // k curr = enc[-1] answer = 0 for v in enc[-2::-1]: ...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftANDleftGLOBALUNTILleftNEGleftLPARENRPARENATOMICLBRACKRBRACKNUMBER COMMA LPAREN RPAREN LBRACK RBRACK AND NEG ATOMIC GLOBAL UNTIL\n\texpression \t: expression AND expression\n\t\t\t\t| NEG e...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftANDleftGLOBALUNTILleftNEGleftLPARENRPARENATOMICLBRACKRBRACKNUMBER COMMA LPAREN RPAREN LBRACK RBRACK AND NEG ATOMIC GLOBAL UNTIL\n\texpression \t: expression AND expression\n\t\t\t\t| NEG expression\n\t\t\t\t| GLOBAL LBRACK NUMBER RBRACK expression\n\t\t\t\t|...
''' Polynomials are given as a list i.e. 2x^3 - 6x^2 + 2x - 1 = [2, -6, 2, -1] ''' def polynomial(): coefficients = [] n = int(input("Enter number of coefficients: \n")) print("Enter coefficients: \n") for i in range(0, n): element = int(input()) coefficients.append(element) x = float(input("Value to eval...
""" Polynomials are given as a list i.e. 2x^3 - 6x^2 + 2x - 1 = [2, -6, 2, -1] """ def polynomial(): coefficients = [] n = int(input('Enter number of coefficients: \n')) print('Enter coefficients: \n') for i in range(0, n): element = int(input()) coefficients.append(element) x = fl...
class Router(object): def db_for_read(self, model, **hints): return 'read' def db_for_write(self, model, **hints): return 'default'
class Router(object): def db_for_read(self, model, **hints): return 'read' def db_for_write(self, model, **hints): return 'default'
state_data = [{'id': 'AL', 'name': 'Alabama', 'code': 'AL', 'electoral_votes': 9, 'campaign_cost': 18, 'popular_vote': 2.1, 'groups': ['AA', 'OS']}, {'id': 'AK', 'name': 'Alaska', 'code'...
state_data = [{'id': 'AL', 'name': 'Alabama', 'code': 'AL', 'electoral_votes': 9, 'campaign_cost': 18, 'popular_vote': 2.1, 'groups': ['AA', 'OS']}, {'id': 'AK', 'name': 'Alaska', 'code': 'AK', 'electoral_votes': 3, 'campaign_cost': 10, 'popular_vote': 0.3, 'groups': ['OG']}, {'id': 'AZ', 'name': 'Arizona', 'code': 'AZ...
#!/usr/bin/python # function def my_function(): print("Hello world!") # call function def call_function(): print("Hello world!") call_function() # output: # Hello world! # parameters def pa_function(param): print("Hello", param) pa_function("Emily") pa_function("John") # output: # Hello Emily # Hello Jo...
def my_function(): print('Hello world!') def call_function(): print('Hello world!') call_function() def pa_function(param): print('Hello', param) pa_function('Emily') pa_function('John') def de_function(name='Cat'): print('Hello' + name) de_function() de_function('Dog') def ret_function(x): retu...
words=['Wednesday', 'a lot', 'absence', 'accept', 'acceptable', 'accessible', 'accidentally', 'accommodate', 'accompanied', 'accomplish', 'accumulate', 'accuracy', 'achievement', 'acknowledgment', 'acquaintance', 'acquire', 'acquitted', 'across', 'actually', 'address', 'admission', 'adolescent', 'advice', 'advise', 'ad...
words = ['Wednesday', 'a lot', 'absence', 'accept', 'acceptable', 'accessible', 'accidentally', 'accommodate', 'accompanied', 'accomplish', 'accumulate', 'accuracy', 'achievement', 'acknowledgment', 'acquaintance', 'acquire', 'acquitted', 'across', 'actually', 'address', 'admission', 'adolescent', 'advice', 'advise', '...
#-*- coding:utf-8 class Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_restaurant(self): print(self.restaurant_name.title() + "'s cuisine type is " + self.cuisine_type + ".") def...
class Restaurant: def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_restaurant(self): print(self.restaurant_name.title() + "'s cuisine type is " + self.cuisine_type + '.') def open_restaurant(sel...
# -*- coding: utf-8 -*- # @Time : 2021/1/3 # @Author : handsomezhou #start:setting table_setting="setting" INDEX_ID=int(0) INDEX_KEY=int(1) INDEX_VALUE=int(2) INDEX_CREATE_TIME=int(3) INDEX_UPDATE_TIME=int(4) id = "id" key = "key" value = "value" create_time = "create_time" update_time = "update_time" CREATE_TABL...
table_setting = 'setting' index_id = int(0) index_key = int(1) index_value = int(2) index_create_time = int(3) index_update_time = int(4) id = 'id' key = 'key' value = 'value' create_time = 'create_time' update_time = 'update_time' create_table_setting = 'CREATE TABLE IF NOT EXISTS ' + table_setting + '(' + id + ' INTE...
def convert(num): num = int(num) new = bin(num)[2:] new = ((32 - len(new)) * '0') + new return new def maping_one(num, indexs): for i in range(len(num)): if (i not in indexs): indexs[i] = [0, []] if (num[i] == '1'): indexs[i][0] += 1 indexs[i][1]....
def convert(num): num = int(num) new = bin(num)[2:] new = (32 - len(new)) * '0' + new return new def maping_one(num, indexs): for i in range(len(num)): if i not in indexs: indexs[i] = [0, []] if num[i] == '1': indexs[i][0] += 1 indexs[i][1].append...
def add_up(a, b): return a + b def test_add_up_succeed(): assert add_up(1, 2) == 3 def test_add_up_fail(): assert add_up(1, 2) == 4 def ignore_me(): assert "I will be" == "completely ignored"
def add_up(a, b): return a + b def test_add_up_succeed(): assert add_up(1, 2) == 3 def test_add_up_fail(): assert add_up(1, 2) == 4 def ignore_me(): assert 'I will be' == 'completely ignored'
destination = input() while destination != "End": needed_money = float(input()) saved_money = 0 while saved_money < needed_money: saved_money += float(input()) print(f"Going to {destination}!") destination = input()
destination = input() while destination != 'End': needed_money = float(input()) saved_money = 0 while saved_money < needed_money: saved_money += float(input()) print(f'Going to {destination}!') destination = input()
while True: try: # get an integer for age age = int(input('What is your age? ')) 10/age print('You are',age, 'years old.') except ValueError as err: #if anything accept an int is enter print following error print(f''' please enter a number for your age. Error 10001 {err} '''...
while True: try: age = int(input('What is your age? ')) 10 / age print('You are', age, 'years old.') except ValueError as err: print(f'\n please enter a number for your age.\n Error 10001\n {err}\n ') continue except ArithmeticError as err: print(f...
# Return the remainder def remainder(x: int, y: int) -> int: return x % y # remainder_lambda = lambda x, y: x % y if __name__ == "__main__": print(remainder(1, 3))
def remainder(x: int, y: int) -> int: return x % y if __name__ == '__main__': print(remainder(1, 3))
nombreFichero = "fases.txt"; print("Ingresa los datos solicitados"); f1 = input("Ingresa la primera frase: "); f2 = input("Ingresa la segunda frase: "); f3 = input("Ingresa la tercera frase: "); fichero = open(nombreFichero, "w"); fichero.write("%s\n" % f1); fichero.write("%s\n" % f2); fichero.write("%s\n" % f3); fic...
nombre_fichero = 'fases.txt' print('Ingresa los datos solicitados') f1 = input('Ingresa la primera frase: ') f2 = input('Ingresa la segunda frase: ') f3 = input('Ingresa la tercera frase: ') fichero = open(nombreFichero, 'w') fichero.write('%s\n' % f1) fichero.write('%s\n' % f2) fichero.write('%s\n' % f3) fichero.close...
expected_output = { "rollback_timer_reason": "no ISSU operation is in progress", "rollback_timer_state": "inactive", }
expected_output = {'rollback_timer_reason': 'no ISSU operation is in progress', 'rollback_timer_state': 'inactive'}
class VerificateInterface: def __init__(self, inputfile, outputfile, correctoutput): self.inputfile = inputfile self.outputfile = outputfile self.correctoutput = correctoutput self._status = None self._message = None def verificate(self, isolator): raise NotImple...
class Verificateinterface: def __init__(self, inputfile, outputfile, correctoutput): self.inputfile = inputfile self.outputfile = outputfile self.correctoutput = correctoutput self._status = None self._message = None def verificate(self, isolator): raise NotImpl...
haarcascade_frontalface_Path = "./faceApi/models/OpenCV/haarcascade_frontalface_default.xml" # for cascade method # 8 bit Quantized version using Tensorflow ( 2.7 MB ) TFmodelFile = "./faceApi/models/OpenCV/tensorflow/TF_faceDetectorModel_uint8.pb" TFconfigFile = "./faceApi/models/OpenCV/tensorflow/TF_faceDetectorCon...
haarcascade_frontalface__path = './faceApi/models/OpenCV/haarcascade_frontalface_default.xml' t_fmodel_file = './faceApi/models/OpenCV/tensorflow/TF_faceDetectorModel_uint8.pb' t_fconfig_file = './faceApi/models/OpenCV/tensorflow/TF_faceDetectorConfig.pbtxt' caff_emodel_file = './faceApi/models/OpenCV/caffe/FaceDetect_...
# Series data tune_series = ["open", "high", "low", "close", "volume"] # Parameters to tune tune_params = [ "acceleration", "accelerationlong", "accelerationshort", "atr_length", "atr_period", "average_lenght", "average_length", "bb_length", "channel_lenght", "channel_length", ...
tune_series = ['open', 'high', 'low', 'close', 'volume'] tune_params = ['acceleration', 'accelerationlong', 'accelerationshort', 'atr_length', 'atr_period', 'average_lenght', 'average_length', 'bb_length', 'channel_lenght', 'channel_length', 'chikou_period', 'd', 'ddof', 'ema_fast', 'ema_slow', 'er', 'fast', 'fast_peri...
class UltrasonicRegisterTypes: CONFIG = 0 DATA = 1 UltrasonicA1 = { UltrasonicRegisterTypes.CONFIG: 0x0C, UltrasonicRegisterTypes.DATA: 0x0E, } UltrasonicA3 = { UltrasonicRegisterTypes.CONFIG: 0x0D, UltrasonicRegisterTypes.DATA: 0x0F, } UltrasonicRegisters = { "A1": UltrasonicA1, "A...
class Ultrasonicregistertypes: config = 0 data = 1 ultrasonic_a1 = {UltrasonicRegisterTypes.CONFIG: 12, UltrasonicRegisterTypes.DATA: 14} ultrasonic_a3 = {UltrasonicRegisterTypes.CONFIG: 13, UltrasonicRegisterTypes.DATA: 15} ultrasonic_registers = {'A1': UltrasonicA1, 'A3': UltrasonicA3} ultrasonic_config_setti...
expected_output = { 'vrf': { 'default': { 'address_family': { 'ipv6': { 'routes': { '2001:db8:1234::8/128': { 'active': True, 'metric': 1, 'next_hop':...
expected_output = {'vrf': {'default': {'address_family': {'ipv6': {'routes': {'2001:db8:1234::8/128': {'active': True, 'metric': 1, 'next_hop': {'next_hop_list': {1: {'index': 1, 'next_hop': 'fe80::5054:ff:fef2:a625', 'outgoing_interface': 'GigabitEthernet0/0/0/1', 'updated': '00:03:00'}}}, 'route': '2001:db8:1234::8/1...
DNA_TO_RNA_MAPPER = { 'G' : 'C', 'C' : 'G', 'T' : 'A', 'A' : 'U' } def to_rna(dna_strand): return ''.join([DNA_TO_RNA_MAPPER[letter] for letter in dna_strand])
dna_to_rna_mapper = {'G': 'C', 'C': 'G', 'T': 'A', 'A': 'U'} def to_rna(dna_strand): return ''.join([DNA_TO_RNA_MAPPER[letter] for letter in dna_strand])
#program to check whether a given integer is a palindrome or not. def is_Palindrome(n): return str(n) == str(n)[::-1] print(is_Palindrome(100)) print(is_Palindrome(252)) print(is_Palindrome(-838)) print(is_Palindrome('swims')) print(is_Palindrome(1001))
def is__palindrome(n): return str(n) == str(n)[::-1] print(is__palindrome(100)) print(is__palindrome(252)) print(is__palindrome(-838)) print(is__palindrome('swims')) print(is__palindrome(1001))
class CardType(object): NUMBER_CARD = 'number_card' PLUS = 'plus' PLUS_2 = 'plus_2' STOP = 'stop' CHANGE_DIRECTION = 'change_direction' CHANGE_COLOR = 'change_color' TAKI = 'taki' SUPER_TAKI = 'super_taki'
class Cardtype(object): number_card = 'number_card' plus = 'plus' plus_2 = 'plus_2' stop = 'stop' change_direction = 'change_direction' change_color = 'change_color' taki = 'taki' super_taki = 'super_taki'
#Define Class class Student: __name = "" __math = 0 __science = 0 __english = 0 __grade_average = 0 __grade_status = "" __status = True def __init__(self, name, math, science, english): try: self.__name = str(name) self.__math = float(math) ...
class Student: __name = '' __math = 0 __science = 0 __english = 0 __grade_average = 0 __grade_status = '' __status = True def __init__(self, name, math, science, english): try: self.__name = str(name) self.__math = float(math) self.__science =...
def sync_consume(): while True: print(q.get()) q.task_done() def sync_produce(): consumer = Thread(target=sync_consume, daemon=True) consumer.start() for i in range(10): q.put(i) q.join() sync_produce()
def sync_consume(): while True: print(q.get()) q.task_done() def sync_produce(): consumer = thread(target=sync_consume, daemon=True) consumer.start() for i in range(10): q.put(i) q.join() sync_produce()
list1 = [15, -1, 11, -5, -5, 5, 3, -1, -7, 13, -11, -11, 7, 13] # Base list even_list = [] # Creates blank list # Problem 3 code for i in list1: # Iterates through list1 assigning i to the next value each time through if i % 2 == 0: # If 'i' is divisible by 2 (even) then: even_list.append(i) # Add the...
list1 = [15, -1, 11, -5, -5, 5, 3, -1, -7, 13, -11, -11, 7, 13] even_list = [] for i in list1: if i % 2 == 0: even_list.append(i) print(even_list) smallest = even_list[0] for x in even_list: if x < smallest: smallest = x else: pass print(smallest)
#* Asked in Microsoft #? You 2 integers n and m representing an n by m grid, determine the number of ways you can get #? from the top-left to the bottom-right of the matrix y going only right or down. #? Example: #? n = 2, m = 2 #? This should return 2, since the only possible routes are: #? Right, down ...
def num_ways(n, m): if n == 1 or m == 1: return 1 else: count = 0 count += num_ways(n - 1, m) count += num_ways(n, m - 1) return count def num_ways_hm(n, m): hash = [[0 for i in range(m + 1)] for j in range(n + 1)] return nw(n, m, hash) def nw(n, m, hash): i...
# # PySNMP MIB module Juniper-IPsec-Tunnel-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-IPsec-Tunnel-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:03:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection) ...
n = int(input()) give = list(map(int, input().split())) take = [0]*n for i in range(n): take[i] = give.index(i+1) + 1 print(*take, sep = " ")
n = int(input()) give = list(map(int, input().split())) take = [0] * n for i in range(n): take[i] = give.index(i + 1) + 1 print(*take, sep=' ')
count = 0 while True: index = int(input()) if index == 0: break aldo, beto = 0, 0 count += 1 for i in range(index): x, y = map(int, input().split(' ')) beto += y aldo += x print("Teste %d" % count) if beto > aldo: print("Beto\n") else: print("Aldo\n")
count = 0 while True: index = int(input()) if index == 0: break (aldo, beto) = (0, 0) count += 1 for i in range(index): (x, y) = map(int, input().split(' ')) beto += y aldo += x print('Teste %d' % count) if beto > aldo: print('Beto\n') else: ...
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Pearl.Atom') def gem(): require_gem('Pearl.ClassOrder') require_gem('Pearl.Method') require_gem('Pearl.Nub') lookup_atom = lookup_normal_token provide_atom = provide_normal_token def count_newlines__zero(t): as...
@gem('Pearl.Atom') def gem(): require_gem('Pearl.ClassOrder') require_gem('Pearl.Method') require_gem('Pearl.Nub') lookup_atom = lookup_normal_token provide_atom = provide_normal_token def count_newlines__zero(t): assert t.ends_in_newline is t.line_marker is false and t.newlines is 0 ...
routes = [] def list_gizmos(): return 'Listing Gizmos' routes.append(dict( rule='/gizmos', view_func=list_gizmos)) def add_gizmo(): return 'Add Gizmo' routes.append(dict( rule='/gizmo', view_func=add_gizmo, options=dict(methods=['POST']))) def update_gizmo(): return 'Update Gizmo' rou...
routes = [] def list_gizmos(): return 'Listing Gizmos' routes.append(dict(rule='/gizmos', view_func=list_gizmos)) def add_gizmo(): return 'Add Gizmo' routes.append(dict(rule='/gizmo', view_func=add_gizmo, options=dict(methods=['POST']))) def update_gizmo(): return 'Update Gizmo' routes.append(dict(rule='...
SOFTWARE_DEVELOPMENT = "Software Development" ELECTRICAL_ENGINEERING = "Electrical Engineering" IT_OPERATIONS = "IT Operations & Helpdesk" INFORMATION_DESIGN_AND_DOCUMENTATION = "Information Design & Documentation" PROJECT_MANAGEMENT = "Project Management"
software_development = 'Software Development' electrical_engineering = 'Electrical Engineering' it_operations = 'IT Operations & Helpdesk' information_design_and_documentation = 'Information Design & Documentation' project_management = 'Project Management'
N, *p = map(int, open(0).read().split()) for x in p: if x == 2: print(2) else: print((x - 1) * (x - 1))
(n, *p) = map(int, open(0).read().split()) for x in p: if x == 2: print(2) else: print((x - 1) * (x - 1))
def parse_cds_header(header_str): data = header_str.split('|') data_count = len(data) data_dict = dict(zip(data[0:data_count:2], data[1:data_count:2])) return data_dict def parse_nt_header(header_str): data = header_str.split('|') data_dict = {} data_dict['gi'] = int(data[1]) data_dict['accession'] = data[3] ...
def parse_cds_header(header_str): data = header_str.split('|') data_count = len(data) data_dict = dict(zip(data[0:data_count:2], data[1:data_count:2])) return data_dict def parse_nt_header(header_str): data = header_str.split('|') data_dict = {} data_dict['gi'] = int(data[1]) data_dict[...
# Count Binary Substrings: https://leetcode.com/problems/count-binary-substrings/ # Give a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively. # Substrings that occur multiple times are count...
class Solution: def count_binary_substrings(self, s: str) -> int: (prev_count, result, cur_count) = (0, 0, 1) for index in range(1, len(s)): if s[index - 1] != s[index]: result += min(curCount, prevCount) (prev_count, cur_count) = (curCount, 1) ...
# create he following pattern # ['h'] # ['h', 'e'] # ['h', 'e', 'l'] # ['h', 'e', 'l', 'l'] # ['h', 'e', 'l', 'l', 'o'] text='hello' my_list=[] for char in text: my_list.append(char) print(my_list)
text = 'hello' my_list = [] for char in text: my_list.append(char) print(my_list)
# Basic Addition Calculator Program # Takes input from the user and outputs the sum of those two numbers. num1 = input("Enter a number: ") num2 = input("Enter another number: ") # Python by default converts inputs into strings a function is used to convert them into numbers. # Float is used to allow the use of decimal...
num1 = input('Enter a number: ') num2 = input('Enter another number: ') result = float(num1) + float(num2) print(result)
def append_file(password, file_path): try: password_file = open(file_path, "a+") password_file.write(password + "\r\n") password_file.close() except PermissionError as Err: print("Error creating file: {}".format(Err))
def append_file(password, file_path): try: password_file = open(file_path, 'a+') password_file.write(password + '\r\n') password_file.close() except PermissionError as Err: print('Error creating file: {}'.format(Err))
LANGUAGES = ['cs', 'da', 'de', 'en', 'es', 'et', 'fi', 'fr', 'it', 'nl', 'ro', 'pt', 'el', 'lt', 'lv'] LANGUAGE_DICTIONARY = {'cs' : 'Czech', 'da' : 'Danish', 'de' : 'German', 'en' : 'English', 'es' : 'Spanis...
languages = ['cs', 'da', 'de', 'en', 'es', 'et', 'fi', 'fr', 'it', 'nl', 'ro', 'pt', 'el', 'lt', 'lv'] language_dictionary = {'cs': 'Czech', 'da': 'Danish', 'de': 'German', 'en': 'English', 'es': 'Spanish', 'et': 'Estonian', 'fi': 'Finnish', 'fr': 'French', 'it': 'Italian', 'nl': 'Dutch', 'ro': 'Romanian', 'pt': 'Portu...
class MacOsJob: def __init__(self, os_version, is_build=False, is_test=False, extra_props=tuple()): # extra_props is tuple type, because mutable data structures for argument defaults # is not recommended. self.os_version = os_version self.is_build = is_build self.is_test = is...
class Macosjob: def __init__(self, os_version, is_build=False, is_test=False, extra_props=tuple()): self.os_version = os_version self.is_build = is_build self.is_test = is_test self.extra_props = dict(extra_props) def gen_tree(self): non_phase_parts = ['pytorch', 'macos...
__all__ = [ "job_poll", "single_job", ]
__all__ = ['job_poll', 'single_job']
class Solution: def generateTheString(self, n): ans=[] if n%2==0: ans=['a' for i in range(n-1)] ans.append('b') else: ans=['a' for i in range(n)] return ans
class Solution: def generate_the_string(self, n): ans = [] if n % 2 == 0: ans = ['a' for i in range(n - 1)] ans.append('b') else: ans = ['a' for i in range(n)] return ans
# singleton tuple <- singleton tuple x, = 0, print(x) # singleton tuple <- singleton list x, = [-1] print(x) # binary tuple <- binary tuple x,y = 1,2 print(x,y) # binary tuple swap x,y = y,x print(x,y) # ternary tuple <- ternary tuple x,y,z = 3,4,5 print(x,y,z) # singleton list <- singleton list [x] = [42] print(x) # s...
(x,) = (0,) print(x) (x,) = [-1] print(x) (x, y) = (1, 2) print(x, y) (x, y) = (y, x) print(x, y) (x, y, z) = (3, 4, 5) print(x, y, z) [x] = [42] print(x) [x] = (43,) print(x) [x, y] = [6, 7] [x, y] = [44, 45] print(x, y) (x, y) = [7, 8] print(x, y) (x, y) = (lambda : (9, 10))() print(x, y) ((x, y), z) = ((11, 12), 13)...
def f1(): pass def f2(): pass def f3(): def f35(): pass
def f1(): pass def f2(): pass def f3(): def f35(): pass
n = int(input()) print('*'*n) for _ in range(n-2): print(f'*{" " * (n - 2)}*') print('*'*n)
n = int(input()) print('*' * n) for _ in range(n - 2): print(f"*{' ' * (n - 2)}*") print('*' * n)
# Copyright (c) 2010 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': 'ceee_ie_all', 'type': 'none', 'dependencies': [ 'common/common.gyp:*', 'broker/b...
{'targets': [{'target_name': 'ceee_ie_all', 'type': 'none', 'dependencies': ['common/common.gyp:*', 'broker/broker.gyp:*', 'plugin/bho/bho.gyp:*', 'plugin/scripting/scripting.gyp:*', 'plugin/toolband/toolband.gyp:*', 'ie_unittests', 'mediumtest_ie']}, {'target_name': 'testing_invoke_executor', 'type': 'executable', 'so...
expected_output = { "fsol_packet_drop": 0, "cac_status": "Not Dropping", "cac_state": "ACTIVE", "total_call_session_charges": 0, "cac_duration": 372898, "calls_accepted": 48667, "current_actual_cpu": 3, "call_limit": 350, "cpu_limit": 80, "calls_rejected": 3381, "cac_events":...
expected_output = {'fsol_packet_drop': 0, 'cac_status': 'Not Dropping', 'cac_state': 'ACTIVE', 'total_call_session_charges': 0, 'cac_duration': 372898, 'calls_accepted': 48667, 'current_actual_cpu': 3, 'call_limit': 350, 'cpu_limit': 80, 'calls_rejected': 3381, 'cac_events': {'reject_reason': {'low_platform_resources':...
# TODO Introduce DesignViolation escalation system class DictAttrs(object): def __init__(self, **dic): self.__dict__.update(dic) def __iter__(self): return self.__dict__.__iter__() def __getitem__(self, item): return self.__dict__.__getitem__(item) def __getattr__(self, item): if not item in self.__dic...
class Dictattrs(object): def __init__(self, **dic): self.__dict__.update(dic) def __iter__(self): return self.__dict__.__iter__() def __getitem__(self, item): return self.__dict__.__getitem__(item) def __getattr__(self, item): if not item in self.__dict__: ...
class Solution: def uniqueOccurrences(self, arr: List[int]) -> bool: occ = {} for num in arr: if num not in occ: occ[num] = 1 else: occ[num] += 1 x = list(occ.values()) return len(set(x)) == len(x)
class Solution: def unique_occurrences(self, arr: List[int]) -> bool: occ = {} for num in arr: if num not in occ: occ[num] = 1 else: occ[num] += 1 x = list(occ.values()) return len(set(x)) == len(x)
n = int(input()) class Tree: left_node = None right_node = None node_dict = dict([]) for i in range(n): root, left, right = input().split() node_dict[root] = Tree() node_dict[root].left_node = left node_dict[root].right_node = right def prefix(root): left = node_dict[root].left_n...
n = int(input()) class Tree: left_node = None right_node = None node_dict = dict([]) for i in range(n): (root, left, right) = input().split() node_dict[root] = tree() node_dict[root].left_node = left node_dict[root].right_node = right def prefix(root): left = node_dict[root].left_node ...
class Solution: def rob(self, nums: List[int]) -> int: if len(nums) == 0: return 0 if len(nums) <= 2: return max(nums) cache = [0] * len(nums) cache[0] = nums[0] cache[1] = max(nums[1], nums[0]) for i in range(2, len(nums) - 1...
class Solution: def rob(self, nums: List[int]) -> int: if len(nums) == 0: return 0 if len(nums) <= 2: return max(nums) cache = [0] * len(nums) cache[0] = nums[0] cache[1] = max(nums[1], nums[0]) for i in range(2, len(nums) - 1): ca...
class Solution: def maxLengthBetweenEqualCharacters(self, s: str) -> int: char_dict = {} max = 0 for i in range(len(s)): t = char_dict.get(s[i],-1) if t==-1: char_dict[s[i]] = i else: if i-t>max: ...
class Solution: def max_length_between_equal_characters(self, s: str) -> int: char_dict = {} max = 0 for i in range(len(s)): t = char_dict.get(s[i], -1) if t == -1: char_dict[s[i]] = i elif i - t > max: max = i - t ...
def make_car(manufacturer, model_name, **arguments): new_car = { 'manufacturer': manufacturer, 'model_name': model_name, } for key, value in arguments.items(): new_car[key] = value return new_car car = make_car('subaru', 'outback', color='blue', tow_package=True) print(car...
def make_car(manufacturer, model_name, **arguments): new_car = {'manufacturer': manufacturer, 'model_name': model_name} for (key, value) in arguments.items(): new_car[key] = value return new_car car = make_car('subaru', 'outback', color='blue', tow_package=True) print(car)
################################################################################ # Design Automation # ################################################################################ ''' Author: Sean Lam Contact: seanlm@student.ubc.ca '''
""" Author: Sean Lam Contact: seanlm@student.ubc.ca """
# # below is Okceg v0.1 # # def is_num(jerry): # try: # int(jerry) # except: # try: # float(jerry) # except: # return False # else: # return True # else: # return True # # print('\nInteractive Okceg Shell!\npowered by python\n') # #...
__author__ = 'Vibius Vibidius Zosimus' __version__ = '.2' print('\n') print('Okceg IS: interactive shell of Okceg, based on python\n') print("now i am going to say 'hello_world!'.\nhello_world!\n") print("help:\n\tinput anything and hit 'enter';\n\tinput '1' and hit 'enter' to quit;\n") while 1: user_input = input(...
c.Authenticator.admin_users = {'jupyterhub'} c.JupyterHub.services = [ { 'command': [ '/opt/conda/bin/comsoljupyter', 'web', '-s', '/srv/jupyterhub', '12345', 'http://jupyter.radiasoft.org:8000', ], 'name': 'comsol', 'url': 'http://127.0.0.1:12345...
c.Authenticator.admin_users = {'jupyterhub'} c.JupyterHub.services = [{'command': ['/opt/conda/bin/comsoljupyter', 'web', '-s', '/srv/jupyterhub', '12345', 'http://jupyter.radiasoft.org:8000'], 'name': 'comsol', 'url': 'http://127.0.0.1:12345'}]
''' Aim: Given a base-10 integer, n, convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in n's binary representation. ''' n = int(input()) # getting input remainder = [] while n > 0: rm = n % 2 n = n//2 ...
""" Aim: Given a base-10 integer, n, convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in n's binary representation. """ n = int(input()) remainder = [] while n > 0: rm = n % 2 n = n // 2 remainder.append(rm) (count, result) = (0, 0) for...
class node: def __init__(self,key): self.left=self.right=None self.val=key def printlevel(root,level): if root==None: return if level==0: print(root.val,end=' ') else: printlevel(root.left,level-1) printlevel(root.right,level-1) root=node(1) roo...
class Node: def __init__(self, key): self.left = self.right = None self.val = key def printlevel(root, level): if root == None: return if level == 0: print(root.val, end=' ') else: printlevel(root.left, level - 1) printlevel(root.right, level - 1) root =...
n=int(input()) for i in range(n): x=input() l=len(x);li=[] for i in range(l): li.append(x[i]) j=0 sum=0 while j<len(li): if li[j]=='4': sum+=1 else: pass j+=1 print(sum)
n = int(input()) for i in range(n): x = input() l = len(x) li = [] for i in range(l): li.append(x[i]) j = 0 sum = 0 while j < len(li): if li[j] == '4': sum += 1 else: pass j += 1 print(sum)
__title__ = 'aiolo' __version__ = '4.1.1' __description__ = 'asyncio-friendly Python bindings for liblo' __url__ = 'https://github.com/elijahr/aiolo' __author__ = 'Elijah Shaw-Rutschman' __author_email__ = 'elijahr+aiolo@gmail.com'
__title__ = 'aiolo' __version__ = '4.1.1' __description__ = 'asyncio-friendly Python bindings for liblo' __url__ = 'https://github.com/elijahr/aiolo' __author__ = 'Elijah Shaw-Rutschman' __author_email__ = 'elijahr+aiolo@gmail.com'
customers = { "name": "Taen Ahammed", "age": 20, "is_verified": True } print(customers["name"]) # print(customers["birthdate"]) # print(customers["Name"]) customers["name"] = "Taen" print(customers.get("name")) print(customers.get("birthdate")) print(customers.get("birthdate", "Dec 12 1998")) customers[...
customers = {'name': 'Taen Ahammed', 'age': 20, 'is_verified': True} print(customers['name']) customers['name'] = 'Taen' print(customers.get('name')) print(customers.get('birthdate')) print(customers.get('birthdate', 'Dec 12 1998')) customers['isMarried'] = False print(customers['isMarried'])
def correct_sentence(text): ''' For the input of your function, you will be given one sentence. You have to return a corrected version, that starts with a capital letter and ends with a period (dot). Pay attention to the fact that not all of the fixes are necessary. If a sentence already ends with a period (do...
def correct_sentence(text): """ For the input of your function, you will be given one sentence. You have to return a corrected version, that starts with a capital letter and ends with a period (dot). Pay attention to the fact that not all of the fixes are necessary. If a sentence already ends with a period (do...
def get_arrangement_count(free_spaces): if not free_spaces: return 1 elif free_spaces < 2: return 0 arrangements = 0 if free_spaces >= 3: arrangements += (2 + get_arrangement_count(free_spaces - 3)) arrangements += (2 + get_arrangement_count(free_spaces - 2)) return arr...
def get_arrangement_count(free_spaces): if not free_spaces: return 1 elif free_spaces < 2: return 0 arrangements = 0 if free_spaces >= 3: arrangements += 2 + get_arrangement_count(free_spaces - 3) arrangements += 2 + get_arrangement_count(free_spaces - 2) return arrangeme...
# ------------------------------ # 397. Integer Replacement # # Description: # Given a positive integer n and you can do operations as follow: # # If n is even, replace n with n/2. # If n is odd, you can replace n with either n + 1 or n - 1. # What is the minimum number of replacements needed for n to become 1? # # ...
class Solution: def integer_replacement(self, n: int) -> int: if n == 1: return 0 replace_count = {1: 0} def dp(n: int) -> int: if n in replaceCount: return replaceCount[n] if n % 2 == 0: res = dp(n / 2) + 1 el...
__copyright__ = "Copyright (C) 2020 shimakaze-git" __version__ = "0.0.1" __license__ = "MIT" __author__ = "shimakaze-git" __author_email__ = "shimakaze.soft+github@googlemail.com" __url__ = "http://github.com/shimakaze-git/django-jp-birthday" __all__ = ["fields", "managers", "models"]
__copyright__ = 'Copyright (C) 2020 shimakaze-git' __version__ = '0.0.1' __license__ = 'MIT' __author__ = 'shimakaze-git' __author_email__ = 'shimakaze.soft+github@googlemail.com' __url__ = 'http://github.com/shimakaze-git/django-jp-birthday' __all__ = ['fields', 'managers', 'models']
blist = [ 1, 2, 3, 255 ] # byte is immutable the_bytes = bytes( blist ) # b'\x01\x02\x03\xff' print( the_bytes ) the_byte_array = bytearray( blist ) # bytearray(b'\x01\x02\x03\xff') print( the_byte_array ) # bytearray is mutable the_byte_array = bytearray( blist ) print( the_byte_array ) the_byte_array[0] = 127 p...
blist = [1, 2, 3, 255] the_bytes = bytes(blist) print(the_bytes) the_byte_array = bytearray(blist) print(the_byte_array) the_byte_array = bytearray(blist) print(the_byte_array) the_byte_array[0] = 127 print(the_byte_array) the_bytes = bytes(range(0, 256)) the_byte_array = bytearray(range(0, 256)) '\nb\'\x00\x01\x02\x03...
total=0 n=int(input()) for i in range(9): t=int(input()) total+=t print(n-total)
total = 0 n = int(input()) for i in range(9): t = int(input()) total += t print(n - total)
matrix_line_color = '#fff' matrix_background_color = '#eee' matrix_border_color = '#888' matrix_border_width = 0.18 cc = { # cycle colors 'axis': 'ff0000', 'maindiag': '00438a', 'bigcyc': 'ba1000', 'with0': 'ff5500', 'without0': 'e23287', 'lighttetra': 'da691e', 'darktetra': '7b2e13' } id...
matrix_line_color = '#fff' matrix_background_color = '#eee' matrix_border_color = '#888' matrix_border_width = 0.18 cc = {'axis': 'ff0000', 'maindiag': '00438a', 'bigcyc': 'ba1000', 'with0': 'ff5500', 'without0': 'e23287', 'lighttetra': 'da691e', 'darktetra': '7b2e13'} id_colors_dict = {'white': '#ffffff', 'yellow': '#...
# http://59.23.150.58/30stair/q_r/q_r.php?pname=q_r a, b = map(int, input().split()) print(int(a/b), a%b)
(a, b) = map(int, input().split()) print(int(a / b), a % b)
# # PySNMP MIB module HPN-ICF-LswRSTP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-LswRSTP-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:40:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
{ "variables": { "base_path": "C:/msys64/mingw64" }, "targets": [ { "target_name": "expand", "sources": [ "src/expand.cc" ], "libraries": ["-llibpostal"], "library_dirs": ["<(base_path)/bin"], "include_di...
{'variables': {'base_path': 'C:/msys64/mingw64'}, 'targets': [{'target_name': 'expand', 'sources': ['src/expand.cc'], 'libraries': ['-llibpostal'], 'library_dirs': ['<(base_path)/bin'], 'include_dirs': ['<!(node -e "require(\'nan\')")', '<(base_path)/include']}, {'target_name': 'parser', 'sources': ['src/parser.cc'], '...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': name = input('please input your name:') print('hello,', name)
if __name__ == '__main__': name = input('please input your name:') print('hello,', name)
s: str = "" se: str = "" l: [int] = None le: int = 0 k: bool = False def f(): 1+"2" for k in l: 1+"2" for g in l: 1+"2" for f in l: 1+"2" for se in l: 1+"2" for l in s: 1+"2" for f in k: 1+"2"
s: str = '' se: str = '' l: [int] = None le: int = 0 k: bool = False def f(): 1 + '2' for k in l: 1 + '2' for g in l: 1 + '2' for f in l: 1 + '2' for se in l: 1 + '2' for l in s: 1 + '2' for f in k: 1 + '2'
# coding=utf8 SthWrong = (-1, 'Something Wrong') ArgMis = (-1000, 'Args Missing') ArgFormatInvalid = (-1001, 'Args Format Invalid') DataNotExists = (-2000, 'Data Not Exists')
sth_wrong = (-1, 'Something Wrong') arg_mis = (-1000, 'Args Missing') arg_format_invalid = (-1001, 'Args Format Invalid') data_not_exists = (-2000, 'Data Not Exists')
# Directory and File locations DATASETDIR = "driving_dataset/" MODELDIR = "save" MODELFILE = MODELDIR + "/model.ckpt" LOGDIR = "logs"
datasetdir = 'driving_dataset/' modeldir = 'save' modelfile = MODELDIR + '/model.ckpt' logdir = 'logs'
side1 = 12 side2 = 14 side3 = 124 if side1 == side2 and side2 == side3: print(1) elif side1 == side2 or side2 == side3 or side1 == side3: print(2) else: print(3)
side1 = 12 side2 = 14 side3 = 124 if side1 == side2 and side2 == side3: print(1) elif side1 == side2 or side2 == side3 or side1 == side3: print(2) else: print(3)
class RPCError(Exception): pass class ConsistencyError(Exception): pass class TermConsistencyError(ConsistencyError): def __init__(self, term: int): self.term = term class LeaderConsistencyError(ConsistencyError): def __init__(self, leader_id: bytes): self.leader_id = leader_id c...
class Rpcerror(Exception): pass class Consistencyerror(Exception): pass class Termconsistencyerror(ConsistencyError): def __init__(self, term: int): self.term = term class Leaderconsistencyerror(ConsistencyError): def __init__(self, leader_id: bytes): self.leader_id = leader_id cla...
#Card class to be imported by every program in repository #Ace value initialized to 11, can be changed to 1 in-game class Card: def __init__(self, suit_id, rank_id): self.suit_id = suit_id self.rank_id = rank_id if self.rank_id == 1: self.rank = "Ace" self.value = 1...
class Card: def __init__(self, suit_id, rank_id): self.suit_id = suit_id self.rank_id = rank_id if self.rank_id == 1: self.rank = 'Ace' self.value = 11 elif self.rank_id == 11: self.rank = 'Jack' self.value = 10 elif self.rank_...
# find the maximum path sum. The path may start and end at any node in the tree. class Node: def __init__(self, data): self.data = data self.left = None self.right = None def max_sum_path(root): max_sum_path_util.res = -float('inf') max_sum_path_util(root) return max_sum_pat...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def max_sum_path(root): max_sum_path_util.res = -float('inf') max_sum_path_util(root) return max_sum_path_util.res def max_sum_path_util(root): if root is None: return 0 l...
def buildGraphFromInput(): n = int(input()) graph = [] for i in range(n): x, y = [int(j) for j in input().split()] graph.append((x,y)) return graph def computeNumberOfNeighbors(graph): numberOfNeighbors = {} for x,y in graph: if not x in numberOfNeighbors: ...
def build_graph_from_input(): n = int(input()) graph = [] for i in range(n): (x, y) = [int(j) for j in input().split()] graph.append((x, y)) return graph def compute_number_of_neighbors(graph): number_of_neighbors = {} for (x, y) in graph: if not x in numberOfNeighbors: ...
MES_LEVEL_INFO = 0 MES_LEVEL_WARN = 1 MES_LEVEL_ERROR = 2 _level = 0 _message = "" def set_mes(level, message): global _level global _message if message != "": _level = level _message = message def get_mes(): ...
mes_level_info = 0 mes_level_warn = 1 mes_level_error = 2 _level = 0 _message = '' def set_mes(level, message): global _level global _message if message != '': _level = level _message = message def get_mes(): return (_level, _message)
# # PySNMP MIB module IBM-INTERFACE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBM-INTERFACE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:51:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
name = "btclib" __version__ = "2020.12" __author__ = "The btclib developers" __author_email__ = "devs@btclib.org" __copyright__ = "Copyright (C) 2017-2020 The btclib developers" __license__ = "MIT License"
name = 'btclib' __version__ = '2020.12' __author__ = 'The btclib developers' __author_email__ = 'devs@btclib.org' __copyright__ = 'Copyright (C) 2017-2020 The btclib developers' __license__ = 'MIT License'
# # PySNMP MIB module RARITANCCv2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RARITANCCv2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:43:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ...
age=input("How old are you? 38") height=input("How tall are you? `120") weight=input("How much do you weight? 129") print(f"So, you're {age} old, {height} tall, and {weight} heavy.")
age = input('How old are you? 38') height = input('How tall are you? `120') weight = input('How much do you weight? 129') print(f"So, you're {age} old, {height} tall, and {weight} heavy.")
# Homeserver address homeserver = "https://phuks.co" # Homeserver credentials. Not required if using a .token file username = "jenny" password = "nice&secure" # Display name nick = "Jenny" # Prefix for commands prefix = '.' # List of admins using full matrix usernames admins = ['@polsaker:phuks.co'] # If this lis...
homeserver = 'https://phuks.co' username = 'jenny' password = 'nice&secure' nick = 'Jenny' prefix = '.' admins = ['@polsaker:phuks.co'] whitelistonly_modules = [] disabled_modules = ['steam', 'phuks'] wolframalpha_apikey = '123456-7894561234' google_apikey = 'PutItInHere' darksky_apikey = 'GibMeTheWeather' cleverbot_ap...
# table definition table = { 'table_name' : 'db_view_cols', 'module_id' : 'db', 'short_descr' : 'Db view columns', 'long_descr' : 'Database view column definitions', 'sub_types' : None, 'sub_trans' : None, 'sequence' : ['seq', ['view_id', 'col_type'], None], 'tre...
table = {'table_name': 'db_view_cols', 'module_id': 'db', 'short_descr': 'Db view columns', 'long_descr': 'Database view column definitions', 'sub_types': None, 'sub_trans': None, 'sequence': ['seq', ['view_id', 'col_type'], None], 'tree_params': None, 'roll_params': None, 'indexes': None, 'ledger_col': None, 'defn_com...
f = open('input.txt', 'r') values = [] for line in f: values.append(int(line)) counter = 0 # Part 1: for x in range(len(values)-1): if values[x+1] > values[x]: counter += 1 print(f"part 1: {counter}") # Part 2: counter = 0 for x in range(2, len(values)-1): lsum = sum([values[i] for i in range...
f = open('input.txt', 'r') values = [] for line in f: values.append(int(line)) counter = 0 for x in range(len(values) - 1): if values[x + 1] > values[x]: counter += 1 print(f'part 1: {counter}') counter = 0 for x in range(2, len(values) - 1): lsum = sum([values[i] for i in range(x - 2, x + 1)]) ...
# # PySNMP MIB module ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:49:38 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # U...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ...
class Solution(object): def fizzBuzz(self, n): # Scaleable hash dict = {3:"Fizz", 5:"Buzz"} res = [] # Iterate through 1-n+1 for i in range(1, n+1): # app represents what to append of not the number app = "" # iterate throug...
class Solution(object): def fizz_buzz(self, n): dict = {3: 'Fizz', 5: 'Buzz'} res = [] for i in range(1, n + 1): app = '' for j in [3, 5]: if not i % j: app += dict[j] if app != '': res.append(app) ...
# MAJOR_VER = 20 # MINOR_VER = 11 # REVISION_VER = 0 # CONTROL_VER = 6 # OFFICIAL = False # MAJOR_VER = 20 # MINOR_VER = 12 # REVISION_VER = 5 # CONTROL_VER = 6 # OFFICIAL = True MAJOR_VER = 21 MINOR_VER = 6 REVISION_VER = 0 CONTROL_VER = 6 OFFICIAL = False
major_ver = 21 minor_ver = 6 revision_ver = 0 control_ver = 6 official = False
#https://www.hackerrank.com/challenges/array-left-rotation length, rotations = map(int, input().strip().split()) array = list(map(int, input().strip().split())) displacement = rotations % length lower = [] for i in range(displacement, length): lower.append(array[i]) upper = [] for i in range(displacement): ...
(length, rotations) = map(int, input().strip().split()) array = list(map(int, input().strip().split())) displacement = rotations % length lower = [] for i in range(displacement, length): lower.append(array[i]) upper = [] for i in range(displacement): upper.append(array[i]) array = lower + upper print(' '.join(m...
DWI_ENTITIES = dict(suffix="dwi", extension=".nii.gz") TENSOR_DERIVED_ENTITIES = dict(suffix="dwiref", resolution="dwi") TENSOR_DERIVED_METRICS = dict( diffusion_tensor=[ "fa", "ga", "rgb", "md", "ad", "rd", "mode", "evec", "eval", "t...
dwi_entities = dict(suffix='dwi', extension='.nii.gz') tensor_derived_entities = dict(suffix='dwiref', resolution='dwi') tensor_derived_metrics = dict(diffusion_tensor=['fa', 'ga', 'rgb', 'md', 'ad', 'rd', 'mode', 'evec', 'eval', 'tensor'], restore_tensor=['fa', 'ga', 'rgb', 'md', 'ad', 'rd', 'mode', 'evec', 'eval', 't...
#!/usr/bin/env python3 t = sorted([float(x) for x in input().split()]) o = float(input()) best = (t[0] + t[1] + t[2])/3 worst = (t[1] + t[2] + t[3])/3 if o < best: print('impossible') elif o >= worst: print('infinite') else: print(f'{3*o-t[1]-t[2]:.2f}')
t = sorted([float(x) for x in input().split()]) o = float(input()) best = (t[0] + t[1] + t[2]) / 3 worst = (t[1] + t[2] + t[3]) / 3 if o < best: print('impossible') elif o >= worst: print('infinite') else: print(f'{3 * o - t[1] - t[2]:.2f}')
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test") def gen_tests(srcs): for src in srcs: name = src.replace("s/","_").replace(".ts","") nodejs_test(name=name, entry_point = src, data=[":tsc","@npm//big-integer"])
load('@build_bazel_rules_nodejs//:index.bzl', 'nodejs_test') def gen_tests(srcs): for src in srcs: name = src.replace('s/', '_').replace('.ts', '') nodejs_test(name=name, entry_point=src, data=[':tsc', '@npm//big-integer'])
class Generator(object): def __init__(self, number, factor): self.number = number self.factor = factor def next(self): self.number = (self.number * self.factor) % 2147483647 return self.number class Judge(object): def __init__(self): self.A = Generator(512, 16807) ...
class Generator(object): def __init__(self, number, factor): self.number = number self.factor = factor def next(self): self.number = self.number * self.factor % 2147483647 return self.number class Judge(object): def __init__(self): self.A = generator(512, 16807) ...