content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- encoding: utf-8 -*- # Copyright (c) 2020 Modist Team <admin@modist.io> # ISC License <https://choosealicense.com/licenses/isc> """Contains packaging information for the module.""" __name__ = "modist-client" __repo__ = "https://github.com/modist-io/modist-client" __version__ = "0.0.1" __description__ = "The loc...
"""Contains packaging information for the module.""" __name__ = 'modist-client' __repo__ = 'https://github.com/modist-io/modist-client' __version__ = '0.0.1' __description__ = 'The local client for managing Modist mods' __author__ = 'Modist Team' __contact__ = 'admin@modist.io' __license__ = 'ISC License'
def is_equivalent(str_a, str_b): if len(str_a) % 2 != 0 or len(str_b) % 2 != 0: if str_a == str_b: return True return False elif str_a == str_b: return True else: len_a = len(str_a) len_b = len(str_b) a1_i, a1_j = 0, (len_a // 2) a2_i, a2_...
def is_equivalent(str_a, str_b): if len(str_a) % 2 != 0 or len(str_b) % 2 != 0: if str_a == str_b: return True return False elif str_a == str_b: return True else: len_a = len(str_a) len_b = len(str_b) (a1_i, a1_j) = (0, len_a // 2) (a2_i, a...
def test_nogarbage_fixture(testdir): testdir.makepyfile(""" def test_fail(nogarbage): assert False def test_pass(nogarbage): pass def test_except(nogarbage): try: assert False except AssertionError: pass ...
def test_nogarbage_fixture(testdir): testdir.makepyfile('\n def test_fail(nogarbage):\n assert False\n\n def test_pass(nogarbage):\n pass\n\n def test_except(nogarbage):\n try:\n assert False\n except AssertionError:\n pa...
def main(): # Store the total sum of multiples of 3 and 5 sum_multiples = 0 # Loop through every number less than 1000 for num in range(1,1000): # Check if number is divisible by 3 or 5, i.e. a multiple if num % 3 == 0 or num % 5 == 0: sum_multiples += num p...
def main(): sum_multiples = 0 for num in range(1, 1000): if num % 3 == 0 or num % 5 == 0: sum_multiples += num print(sum_multiples) if __name__ == '__main__': main()
# 177 # 10 # print(divmod(177, 10)) user = int(input()) user2 = int(input()) a = divmod(user, user2) print(a[0]) print(a[1]) # for i in a: # print(''.join(a[i])) print(divmod(user,user2)) # print(divmod(user))
user = int(input()) user2 = int(input()) a = divmod(user, user2) print(a[0]) print(a[1]) print(divmod(user, user2))
''' Here we'll define exceptions to raise in the qtstyles package ''' class QtStylesError(Exception): """ Base-class for all exceptions raised by this module. """ class SheetPathTypeError(QtStylesError): ''' The style sheet path must be a string. ''' def __init__(self): super(SheetPa...
""" Here we'll define exceptions to raise in the qtstyles package """ class Qtstyleserror(Exception): """ Base-class for all exceptions raised by this module. """ class Sheetpathtypeerror(QtStylesError): """ The style sheet path must be a string. """ def __init__(self): super(SheetPathTypeError, ...
{ "targets": [{ "target_name": "node_hge", "sources": [ "src/entry.cpp" ], "include_dirs": [ "src/hge181/include", "<!(node -e \"require('nan')\")" ], "libraries": [ "../src/hge181/lib/vc/hge.lib", "../src/hge181/lib/vc/hgehelp.lib" ], "libra...
{'targets': [{'target_name': 'node_hge', 'sources': ['src/entry.cpp'], 'include_dirs': ['src/hge181/include', '<!(node -e "require(\'nan\')")'], 'libraries': ['../src/hge181/lib/vc/hge.lib', '../src/hge181/lib/vc/hgehelp.lib'], 'libraries!': ['libc.lib'], 'defines': ['WIN32_LEAN_AND_MEAN'], 'VCLinkerTool': {'IgnoreSpec...
question_replaceable_special_characters = {',', "'", '"', ';', '?', ':', '-', '(', ')', '[', ']', '{', '}'} special_characters = ['*', '$'] punctuations = set() pickled_questions_dir = "bin/data/questions" pickle_files_extension = ".pickle" questions_per_segment = 100 debug_print_len = 25
question_replaceable_special_characters = {',', "'", '"', ';', '?', ':', '-', '(', ')', '[', ']', '{', '}'} special_characters = ['*', '$'] punctuations = set() pickled_questions_dir = 'bin/data/questions' pickle_files_extension = '.pickle' questions_per_segment = 100 debug_print_len = 25
"""This problem was asked by Google. Implement a key value store, where keys and values are integers, with the following methods: update(key, vl): updates the value at key to val, or sets it if doesn't exist get(key): returns the value with key, or None if no such value exists max_key(val): returns the largest key wi...
"""This problem was asked by Google. Implement a key value store, where keys and values are integers, with the following methods: update(key, vl): updates the value at key to val, or sets it if doesn't exist get(key): returns the value with key, or None if no such value exists max_key(val): returns the largest key wi...
class LoopiaError(Exception): _exceptions = {} code = None message = None def __init__(self, response=None): super(LoopiaError, self).__init__(self.message) self.response = response @classmethod def register(cls, exception): if exception.code in cls._exceptions: ...
class Loopiaerror(Exception): _exceptions = {} code = None message = None def __init__(self, response=None): super(LoopiaError, self).__init__(self.message) self.response = response @classmethod def register(cls, exception): if exception.code in cls._exceptions: ...
def paperwork(n, m): if n < 0 or m < 0 : return 0 else: return n * m print(paperwork(5,0))
def paperwork(n, m): if n < 0 or m < 0: return 0 else: return n * m print(paperwork(5, 0))
def clocks(x, y, a, b, x2, y2): a = a - x b = b - y if b < 0: b = 60 + b a = a - 1 if a < 0: a = 24 + a a2 = x2 + a b2 = y2 + b if b2 >= 60: b2 = b2 - 60 a2 = a2 + 1 if a2 >= 24: a2 = a2 - 24 print(a2, b2) clocks(int(input()), int(input...
def clocks(x, y, a, b, x2, y2): a = a - x b = b - y if b < 0: b = 60 + b a = a - 1 if a < 0: a = 24 + a a2 = x2 + a b2 = y2 + b if b2 >= 60: b2 = b2 - 60 a2 = a2 + 1 if a2 >= 24: a2 = a2 - 24 print(a2, b2) clocks(int(input()), int(input...
#!/usr/bin/env python3 # # Copyright (c) 2015, Roberto Riggio # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, t...
"""Image Class.""" class Image(object): """Image object representing a VNF template. Attributes: nb_ports: Number of ports (Integer) vnf: The virtual network function as a click script (str) handlers: the list of handlers supported by the vnf state_handlers: the list of state h...
#_*_ coding: utf-8 -*- { 'name': "Project Management", 'summary': """ It allows to manage the projects to be carried out in a company and jobs.""", 'description': """ This module allows you to manage the projects of a company from departments, employees and projects. """, 'author': "Carlos Morale...
{'name': 'Project Management', 'summary': '\n\t\tIt allows to manage the projects to be carried out in a company and jobs.', 'description': '\n\t\tThis module allows you to manage the projects of a company from departments, employees and projects.\n\t', 'author': 'Carlos Morales Aguilera', 'website': 'http://www.exampl...
n=6 a,b=0,0 arr=[1,2,4,4,5,6] for i in range(int(n-1)): if arr[i-1]>=arr[i]<=arr[i+1]: a=a+1 if arr[i-1]<=arr[i]>=arr[i+1]: b=b+1 print(b if a>b else a) def howMany(sentence): i = 0 ans = 0 n = len(sentence) while (i < n): c = 0 c2 = 0 c3 = 0 ...
n = 6 (a, b) = (0, 0) arr = [1, 2, 4, 4, 5, 6] for i in range(int(n - 1)): if arr[i - 1] >= arr[i] <= arr[i + 1]: a = a + 1 if arr[i - 1] <= arr[i] >= arr[i + 1]: b = b + 1 print(b if a > b else a) def how_many(sentence): i = 0 ans = 0 n = len(sentence) while i < n: c = ...
def currency(x, pos): """The two args are the value and tick position""" if x >= 1e6: s = '${:1.1f}M'.format(x*1e-6) else: s = '${:1.0f}K'.format(x*1e-3) return s
def currency(x, pos): """The two args are the value and tick position""" if x >= 1000000.0: s = '${:1.1f}M'.format(x * 1e-06) else: s = '${:1.0f}K'.format(x * 0.001) return s
# Parameters for compute_reference.py # mpmath maximum precision when computing hypergeometric function values. MAXPREC = 100000 # Range of a and b. PTS should be an odd number, since # a = 0 and b = 0 are included in addition to positive and negative values. UPPER = 2.3 PTS = 401 # Range of the logarithm of z valu...
maxprec = 100000 upper = 2.3 pts = 401 lower_z = -2 upper_z = 3 pts_z = 31
''' 09 - Dictionary of lists Some more data just came in! This time, you'll use the dictionary of lists method, parsing the data column by column. |date | small_sold | large_sold | |-------------+---------------+------------| |"2019-11-17" | 10859987 | 7674135 | |"2019-12-01" | 9291631 | 6238096 ...
""" 09 - Dictionary of lists Some more data just came in! This time, you'll use the dictionary of lists method, parsing the data column by column. |date | small_sold | large_sold | |-------------+---------------+------------| |"2019-11-17" | 10859987 | 7674135 | |"2019-12-01" | 9291631 | 6238096 ...
# -*- coding: utf-8 -*- """rackio/exception.py This module defines all exceptions handle by Rackio. """ class RackioError(Exception): """Base class for other exceptions""" pass class InvalidTagNameError(RackioError): """Raised when an invalid tag name is defined""" pass class TagNotFoundError(Rack...
"""rackio/exception.py This module defines all exceptions handle by Rackio. """ class Rackioerror(Exception): """Base class for other exceptions""" pass class Invalidtagnameerror(RackioError): """Raised when an invalid tag name is defined""" pass class Tagnotfounderror(RackioError): """Raised wh...
n = int(input()) friends = list(input().split()) sum = 0 for i in friends: sum += int(i) ways = 0 for i in range(1,6): if (sum+i)%(n+1) != 1: ways += 1 print(ways)
n = int(input()) friends = list(input().split()) sum = 0 for i in friends: sum += int(i) ways = 0 for i in range(1, 6): if (sum + i) % (n + 1) != 1: ways += 1 print(ways)
# Rotate Array class Solution: def rotate(self, nums, k): """ Do not return anything, modify nums in-place instead. """ length = len(nums) k = k % length if k == 0: return front = nums[length - k:] index = length - k - 1 while ind...
class Solution: def rotate(self, nums, k): """ Do not return anything, modify nums in-place instead. """ length = len(nums) k = k % length if k == 0: return front = nums[length - k:] index = length - k - 1 while index >= 0: ...
""" Main TACA module """ __version__ = '0.9.3'
""" Main TACA module """ __version__ = '0.9.3'
tanya_list = [ 'kenapa', 'bila', 'siapa', 'mengapa', 'apa', 'bagaimana', 'berapa', 'mana'] perintah_list = [ 'jangan', 'sila', 'tolong', 'harap', 'usah', 'jemput', 'minta'] pangkal_list = [ 'maka', 'alkisah', 'arakian', 'syahdah', 'adapun',...
tanya_list = ['kenapa', 'bila', 'siapa', 'mengapa', 'apa', 'bagaimana', 'berapa', 'mana'] perintah_list = ['jangan', 'sila', 'tolong', 'harap', 'usah', 'jemput', 'minta'] pangkal_list = ['maka', 'alkisah', 'arakian', 'syahdah', 'adapun', 'bermula', 'kalakian'] bantu_list = ['akan', 'telah', 'boleh', 'mesti', 'belum', '...
# International morse code (sample) Morse = { # Letters "a": ".-", "b": "-...", "c": "-.-.", "d": "-..", "e": ".", "f": "..-.", "g": "--.", "h": "....", "i": "..", "j": ".---", "k": "-.-", "l": ".-..", "m": "--", "n": "-.", "o": "---", "p": ".--.", ...
morse = {'a': '.-', 'b': '-...', 'c': '-.-.', 'd': '-..', 'e': '.', 'f': '..-.', 'g': '--.', 'h': '....', 'i': '..', 'j': '.---', 'k': '-.-', 'l': '.-..', 'm': '--', 'n': '-.', 'o': '---', 'p': '.--.', 'q': '--.-', 'r': '.-.', 's': '...', 't': '-', 'u': '..-', 'v': '...-', 'w': '.--', 'x': '-..-', 'y': '-.--', 'z': '--...
N = int(input()) result = 0 for i in range(1, N + 1): if i % 3 == 0 or i % 5 == 0: continue result += i print(result)
n = int(input()) result = 0 for i in range(1, N + 1): if i % 3 == 0 or i % 5 == 0: continue result += i print(result)
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education # {"feature": "Education", "instances": 127, "metric_value": 0.987, "depth": 1} if obj[1]<=2: # {"feature": "Coupon", "instances": 91, "metric_value": 0.9355, "depth": 2} if obj[0]>1: return 'True' elif obj[0]<=1: return 'True' else: return 'True...
def find_decision(obj): if obj[1] <= 2: if obj[0] > 1: return 'True' elif obj[0] <= 1: return 'True' else: return 'True' elif obj[1] > 2: if obj[0] <= 3: return 'False' elif obj[0] > 3: return 'False' els...
class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: n = len(triangle) if n == 1: return min(triangle[0]) row_curr = triangle[n-1] for row in range(n-2, -1, -1): row_up = triangle[row] for ind in range(len(row_up)): ...
class Solution: def minimum_total(self, triangle: List[List[int]]) -> int: n = len(triangle) if n == 1: return min(triangle[0]) row_curr = triangle[n - 1] for row in range(n - 2, -1, -1): row_up = triangle[row] for ind in range(len(row_up)): ...
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 if(!missing(fold_column)){ parms$ignored_columns <- setdif...
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 if(!missing(fold_column)){\n parms$ignored_columns <- setdiff(parms$ig...
#Accessing specific elemnts from a dictionary Breakfast={ "Name":"dosa", "cost": 45, "Proteins": 4, "Fat":2 } #Finding the cost of Breakfast p=Breakfast.get("cost") print(p)
breakfast = {'Name': 'dosa', 'cost': 45, 'Proteins': 4, 'Fat': 2} p = Breakfast.get('cost') print(p)
NPKT = 100000 # def getselfaddr(): # return socket.getaddrinfo(None, PORT, socket.AF_INET6, socket.SOCK_DGRAM,socket.IPPROTO_IP)[0]
npkt = 100000
""" Configuration of flask application. Everything that could be different between running on your development platform or on ix.cs.uoregon.edu (or on a different deployment target) shoudl be here. """ DEBUG = True # Cookie key was obtained by: # import uuid # str(uuid.uuid4()) # We do it just once so that multiple...
""" Configuration of flask application. Everything that could be different between running on your development platform or on ix.cs.uoregon.edu (or on a different deployment target) shoudl be here. """ debug = True cookie_key = '48436e9a-ca70-451d-8e28-010c7787de40' port = 5000 dict = 'data/dict.txt'
deliver_states = { 'DEFAULT': ['1', 'PENDING_ORDERS', 'ACCEPT_PENDING_JOLLOF', 'ACCEPT_PENDING_DELICACY', 'TO_PICKUP', 'PICKED_UP_JOLLOF', 'PICKED_UP_DELICACY', 'TO_DROPOFF', 'DROPPED_OFF_JOLLOF', 'DROPPED_OFF_DELICACY'], 'CANCELLED': ['DEFAULT'], 'FLASH_LOCATION': ['FLASH_LOCATION', 'CANCELLED'], 'REQ...
deliver_states = {'DEFAULT': ['1', 'PENDING_ORDERS', 'ACCEPT_PENDING_JOLLOF', 'ACCEPT_PENDING_DELICACY', 'TO_PICKUP', 'PICKED_UP_JOLLOF', 'PICKED_UP_DELICACY', 'TO_DROPOFF', 'DROPPED_OFF_JOLLOF', 'DROPPED_OFF_DELICACY'], 'CANCELLED': ['DEFAULT'], 'FLASH_LOCATION': ['FLASH_LOCATION', 'CANCELLED'], 'REQUEST_PHONE': ['REQ...
class Synonym: def __init__(self, taxon_id, name_id, id='', name_phrase='', according_to_id='', status='synonym', reference_id='', page_reference_id='', link='',...
class Synonym: def __init__(self, taxon_id, name_id, id='', name_phrase='', according_to_id='', status='synonym', reference_id='', page_reference_id='', link='', remarks='', needs_review=''): self.id = id self.taxon_id = taxon_id self.name_id = name_id self.name_phrase = name_phrase...
# ---------------------------------------------------------------------- # CISCO-VPDN-MGMT-MIB # Compiled MIB # Do not modify this file directly # Run ./noc mib make-cmib instead # ---------------------------------------------------------------------- # Copyright (C) 2007-2020 The NOC Project # See LICENSE for details ...
name = 'CISCO-VPDN-MGMT-MIB' last_updated = '2009-06-16' compiled = '2020-01-19' mib = {'CISCO-VPDN-MGMT-MIB::ciscoVpdnMgmtMIB': '1.3.6.1.4.1.9.10.24', 'CISCO-VPDN-MGMT-MIB::ciscoVpdnMgmtMIBNotifs': '1.3.6.1.4.1.9.10.24.0', 'CISCO-VPDN-MGMT-MIB::cvpdnNotifSessionID': '1.3.6.1.4.1.9.10.24.0.1', 'CISCO-VPDN-MGMT-MIB::cvp...
N = int(input()) positions = [] for x in range(N): input_line = input().split() positions.append([int(input_line[0]), int(input_line[1])]) sorted_positions = sorted(positions) minRadius = 1000000 for x in range(len(sorted_positions)-1): if sorted_positions[x][1] == 0 and sorted_positions[x-1...
n = int(input()) positions = [] for x in range(N): input_line = input().split() positions.append([int(input_line[0]), int(input_line[1])]) sorted_positions = sorted(positions) min_radius = 1000000 for x in range(len(sorted_positions) - 1): if sorted_positions[x][1] == 0 and sorted_positions[x - 1][1] == 1: ...
# Implementation of a simple "Calculator" program # The calculator consists of four functions: add, subtract, multiply and divide def add(x, y): """ Function to add two numbers Parameters ---------- x : int/float First number to be added y : int/float Second number to b...
def add(x, y): """ Function to add two numbers Parameters ---------- x : int/float First number to be added y : int/float Second number to be added Returns ------- sum : int/float Sum of the two numbers """ return x + y def subtract(x, y):...
"""Modules handling environment data. For example: types for transitions/trajectories; methods to compute rollouts; buffers to store transitions; helpers for these modules. """
"""Modules handling environment data. For example: types for transitions/trajectories; methods to compute rollouts; buffers to store transitions; helpers for these modules. """
# Payable-related constants PAYABLE_FIRST_ROW = 20 PAYABLE_FIRST_COL = 2 PAYABLE_LAST_COL = 25 PAYABLE_SORT_BY = 3 PAYABLE_PAYPAL_ID_COL = 18 PAYABLE_FIELDS = [ 'timestamp', 'requester', 'department', 'item', 'detail', 'event_date', 'payment_type', 'use_of_funds', 'notes', ...
payable_first_row = 20 payable_first_col = 2 payable_last_col = 25 payable_sort_by = 3 payable_paypal_id_col = 18 payable_fields = ['timestamp', 'requester', 'department', 'item', 'detail', 'event_date', 'payment_type', 'use_of_funds', 'notes', 'type', 'name', 'paypal', 'address', 'amount', 'driving_reimbursement'] pay...
# -*- coding: utf-8 -*- """ Paraxial optical calculations """
""" Paraxial optical calculations """
operadores = ('+', '-', '*', '/', '%', '=', '>', '<', '>=', '<=', '!', '!=', '==', '&', '|', '++', '--', '+=', '-=', '/=', '*=') comentario = '//' comentario_inicio = '/*' comentario_fim = '*/' aspas = '"' aspasSimples = "'" delimitadores = (';', '{', '}', '(', ')', '[', ']', comentario, comentario_inic...
operadores = ('+', '-', '*', '/', '%', '=', '>', '<', '>=', '<=', '!', '!=', '==', '&', '|', '++', '--', '+=', '-=', '/=', '*=') comentario = '//' comentario_inicio = '/*' comentario_fim = '*/' aspas = '"' aspas_simples = "'" delimitadores = (';', '{', '}', '(', ')', '[', ']', comentario, comentario_inicio, comentario_...
class TestLinkController(object): def test_create_shortlink_with_correct_request_body(self, client): """create_shortlink() with a correct request body should respond with a success 200. """ form = {"provider": "tinyurl", "url": "http://example.com"} response = client....
class Testlinkcontroller(object): def test_create_shortlink_with_correct_request_body(self, client): """create_shortlink() with a correct request body should respond with a success 200. """ form = {'provider': 'tinyurl', 'url': 'http://example.com'} response = client.post('/...
class pycacheNotFoundError(Exception): def __init__(self, msg): self.msg = msg super().__init__(self.msg) class installModulesFailedError(Exception): def __init__(self): self.msg = "The modules could not be installed! Some error occurred!" super().__init__(self.msg)
class Pycachenotfounderror(Exception): def __init__(self, msg): self.msg = msg super().__init__(self.msg) class Installmodulesfailederror(Exception): def __init__(self): self.msg = 'The modules could not be installed! Some error occurred!' super().__init__(self.msg)
# Auto-generated pytest file class TestInit: def test___init__(self): fail() class TestEnter: def test___enter__(self): fail() class TestExit: def test___exit__(self): fail() class TestGetSearchResultCount: def test_get_search_result_count(self): fail() class Tes...
class Testinit: def test___init__(self): fail() class Testenter: def test___enter__(self): fail() class Testexit: def test___exit__(self): fail() class Testgetsearchresultcount: def test_get_search_result_count(self): fail() class Testgetsearchresultlinks: de...
""" flask_konch ~~~~~~~~~~~ An improved shell commmand for the Flask CLI. """ __version__ = "2.0.0" __all__ = ["EXTENSION_NAME"] EXTENSION_NAME = "flask-konch"
""" flask_konch ~~~~~~~~~~~ An improved shell commmand for the Flask CLI. """ __version__ = '2.0.0' __all__ = ['EXTENSION_NAME'] extension_name = 'flask-konch'
# https://baike.baidu.com/item/%E5%BF%AB%E9%80%9F%E5%B9%82 # 11 = 2^0 + 2^! + 2^3 # a^11 = a^(2^0) + a^(2^1) + a^(2^3) class Solution: def myPow(self, x: float, n: int) -> float: N = n if N < 0: x = 1/x N = -N ans = 1 current_product = x while N > 0: ...
class Solution: def my_pow(self, x: float, n: int) -> float: n = n if N < 0: x = 1 / x n = -N ans = 1 current_product = x while N > 0: if N % 2 == 1: ans = ans * current_product current_product = current_product...
# time Complexity: O(n^2) # space Complexity: O(1) def bubble_sort(arr): current = 0 next = 1 last_index = len(arr) while last_index >= next: if arr[current] > arr[next]: arr[current], arr[next] = arr[next], arr[current] current += 1 next += 1 if next == ...
def bubble_sort(arr): current = 0 next = 1 last_index = len(arr) while last_index >= next: if arr[current] > arr[next]: (arr[current], arr[next]) = (arr[next], arr[current]) current += 1 next += 1 if next == last_index: current = 0 next...
class Solution: def isIsomorphic(self, s: str, t: str) -> bool: # Copy / paste from the "fastest" solution. # It's sort of beautiful in its simplicity, if wildly esoteric. # Basically the same thing as the hacky failsafe in my first solution; # compare the number of unique characters...
class Solution: def is_isomorphic(self, s: str, t: str) -> bool: return len(set(zip(s, t))) == len(set(s)) == len(set(t))
# # PySNMP MIB module APDNSALG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APDNSALG-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:23:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(acmepacket_mgmt,) = mibBuilder.importSymbols('ACMEPACKET-SMI', 'acmepacketMgmt') (ap_transport_type, ap_hardware_module_family, ap_redundancy_state) = mibBuilder.importSymbols('ACMEPACKET-TC', 'ApTransportType', 'ApHardwareModuleFamily', 'ApRedundancyState') (sys_mgmt_percentage,) = mibBuilder.importSymbols('APSYSMGMT...
''' /****************************************************************** * * Copyright 2018 Samsung Electronics All Rights Reserved. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * htt...
""" /****************************************************************** * * Copyright 2018 Samsung Electronics All Rights Reserved. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * htt...
hpp = 'AL-Import' # Specify the name of the hpp to print the graph graph_title='EM- Total Impact of the energy maximization scenario on '+ hpp df_em2 = df_em1.groupby(['scenario'])['value'].sum().round(2).reset_index() fig5c = px.bar(df_em2, x='scenario', y='value', text= 'value', color='scenario',barmode='group', ...
hpp = 'AL-Import' graph_title = 'EM- Total Impact of the energy maximization scenario on ' + hpp df_em2 = df_em1.groupby(['scenario'])['value'].sum().round(2).reset_index() fig5c = px.bar(df_em2, x='scenario', y='value', text='value', color='scenario', barmode='group', labels={'value': 'GWh', 'tech': 'HPP'}, title=grap...
class MyModule(): def my_function(): pass def main(): """The main entrypoint for this script Used in the setup.py file """ MyModule.my_function() if __name__ == '__main__': main()
class Mymodule: def my_function(): pass def main(): """The main entrypoint for this script Used in the setup.py file """ MyModule.my_function() if __name__ == '__main__': main()
class MessageTypeNotSupported(Exception): pass class MessageDoesNotExist(Exception): pass
class Messagetypenotsupported(Exception): pass class Messagedoesnotexist(Exception): pass
# https://www.codechef.com/problems/RAINBOWA for T in range(int(input())): n,l=int(input()),list(map(int,input().split())) print("no") if(set(l)!=set(list(range(1,8))) or l[0]!=1 or l[-1]!=1 or l!=l[::-1]) else print("yes")
for t in range(int(input())): (n, l) = (int(input()), list(map(int, input().split()))) print('no') if set(l) != set(list(range(1, 8))) or l[0] != 1 or l[-1] != 1 or (l != l[::-1]) else print('yes')
# -*- encoding:utf-8 -*- __version__ = (1, 2, 11) __version_str__ = ".".join(map(str, __version__)) __version_core__ = (3, 0, 4)
__version__ = (1, 2, 11) __version_str__ = '.'.join(map(str, __version__)) __version_core__ = (3, 0, 4)
def to_camel_case(s): return ('' if not s else s[0] + ''.join(c.upper() if s[::-1][i + 1] in '-_' else '' if c in '-_' else c for i, c in enumerate(s[::-1][:-1]))[::-1])
def to_camel_case(s): return '' if not s else s[0] + ''.join((c.upper() if s[::-1][i + 1] in '-_' else '' if c in '-_' else c for (i, c) in enumerate(s[::-1][:-1])))[::-1]
##NIM, Umur, Tinggi = (211080200045, 18, 170) ##print(NIM, Umur, Tinggi) angka_positif = 1,2,3,4,5,6,7,8,9 print(angka_positif)
angka_positif = (1, 2, 3, 4, 5, 6, 7, 8, 9) print(angka_positif)
GOLD = ["7374", "7857", "7990", "8065", "8250"] ANNOTATORS = ["01", "02", "03", "04", "05", "06"] DOC_HEADER = ["order", "doc_id", "assigned", "nr_sens_calculated", "nr_sens", "annotator_1", "annotator_2", "assigned_2"] CYCLE_FILE = "../input/batch_cycles.csv" CYCLE_COL = "cycle" ASSIGNMENT_TXT = "assig...
gold = ['7374', '7857', '7990', '8065', '8250'] annotators = ['01', '02', '03', '04', '05', '06'] doc_header = ['order', 'doc_id', 'assigned', 'nr_sens_calculated', 'nr_sens', 'annotator_1', 'annotator_2', 'assigned_2'] cycle_file = '../input/batch_cycles.csv' cycle_col = 'cycle' assignment_txt = 'assignment.txt' assig...
""" Item 29: Avoid Repeated Work in Comprehensions by Using Assignment Expressions """ stock = { 'nails': 125, 'screws': 35, 'wingnuts': 8, 'washers': 24, } order = ['screws', 'wingnuts', 'clips'] def get_batches(count, size): return count // size result = {} for name in order: count = stock.get(name, 0) ...
""" Item 29: Avoid Repeated Work in Comprehensions by Using Assignment Expressions """ stock = {'nails': 125, 'screws': 35, 'wingnuts': 8, 'washers': 24} order = ['screws', 'wingnuts', 'clips'] def get_batches(count, size): return count // size result = {} for name in order: count = stock.get(name, 0) ba...
""" >>> 'dir/bar.py:2' """
""" >>> 'dir/bar.py:2' """
class IntegerField: def __str__(self): return "integer"
class Integerfield: def __str__(self): return 'integer'
class AdministrativeDivision: def __init__(self, level): self.level = level pass class Province(AdministrativeDivision): type = 'Province' area = 0 center = '' def __init__(self, name): self.name = name self.level = 1 def __str__(self): return f"{self.name} {self.type}" pas...
class Administrativedivision: def __init__(self, level): self.level = level pass class Province(AdministrativeDivision): type = 'Province' area = 0 center = '' def __init__(self, name): self.name = name self.level = 1 def __str__(self): return f'{self.name...
# Binary Tree implemented using python list class BinaryTree: def __init__(self,size) -> None: self.cl=size*[None] self.lastUsedIndex=0 self.maxSize=size def insertNode(self,value): if self.lastUsedIndex+1==self.maxSize: return "BT is full" self.cl[self.last...
class Binarytree: def __init__(self, size) -> None: self.cl = size * [None] self.lastUsedIndex = 0 self.maxSize = size def insert_node(self, value): if self.lastUsedIndex + 1 == self.maxSize: return 'BT is full' self.cl[self.lastUsedIndex + 1] = value ...
num1 = int(input()) count1 = 0 while 1 <= num1 <= 5: if num1 == 5: count1 += 1 num1 = int(input()) print(count1)
num1 = int(input()) count1 = 0 while 1 <= num1 <= 5: if num1 == 5: count1 += 1 num1 = int(input()) print(count1)
class Label(object): def __eq__(self, other): assert(isinstance(other, Label)) return type(self) == type(other) def __ne__(self, other): assert(isinstance(other, Label)) return type(self) != type(other) def __hash__(self): return hash(self.to_class_str()) def ...
class Label(object): def __eq__(self, other): assert isinstance(other, Label) return type(self) == type(other) def __ne__(self, other): assert isinstance(other, Label) return type(self) != type(other) def __hash__(self): return hash(self.to_class_str()) def to...
#Function to insert a string in the middle of a string def string_in(): string=str(input("Enter a string :")) mid=len(string)//2 word=str(input("Enter a word to insert in middle :")) new_string=string[:mid]+word+string[mid:] print(new_string) string_in()
def string_in(): string = str(input('Enter a string :')) mid = len(string) // 2 word = str(input('Enter a word to insert in middle :')) new_string = string[:mid] + word + string[mid:] print(new_string) string_in()
# # This file contains "references" to unreferenced code that should be kept and not considered dead code # not_used_but_whitelisted
not_used_but_whitelisted
""" Contains exception classes. """ class KRDictException(Exception): """ Contains information about an API error. This exception is only thrown if the argument passed to the ``raise_api_errors`` parameter is True. - ``message``: The error message associated with the error. - ``error_code``: T...
""" Contains exception classes. """ class Krdictexception(Exception): """ Contains information about an API error. This exception is only thrown if the argument passed to the ``raise_api_errors`` parameter is True. - ``message``: The error message associated with the error. - ``error_code``: T...
# Copyright 2018 TNG Technology Consulting GmbH, Unterfoehring, Germany # Licensed under the Apache License, Version 2.0 - see LICENSE.md in project root directory # TODO IT-1: give this function some great functionality def great_function(): pass # TODO: give this function some greater functionality def greate...
def great_function(): pass def greater_function(): pass
class Stats:# pragma: no cover """Abstract class defining the basis of all Stats """ def get_keys(self): """Return the keys of the Stats Returns ------- keys : tuple of strings Key for the Stats """ return () def get...
class Stats: """Abstract class defining the basis of all Stats """ def get_keys(self): """Return the keys of the Stats Returns ------- keys : tuple of strings Key for the Stats """ return () def get_manager(self): ""...
n = 0 for i in range(999, 100, -1): for j in range(i, 100, -1): x = i * j if x > n: s = str(i * j) if s == s[::-1]: n = i * j print(n)
n = 0 for i in range(999, 100, -1): for j in range(i, 100, -1): x = i * j if x > n: s = str(i * j) if s == s[::-1]: n = i * j print(n)
class DictSerializable: @classmethod def from_dict(cls, data: dict) -> 'DictSerializable': return cls(**data) def to_dict(self) -> dict: return vars(self)
class Dictserializable: @classmethod def from_dict(cls, data: dict) -> 'DictSerializable': return cls(**data) def to_dict(self) -> dict: return vars(self)
known = {} def ack(m, n): if m == 0: return n + 1 if m > 0 and n == 0: return ack(m-1, 1) if m > 0 and n > 0: if (m,n) in known: print('Cache hit') return known[(m, n)] else: known[(m, n)] = ack(m - 1, ack(m , n - 1)) retu...
known = {} def ack(m, n): if m == 0: return n + 1 if m > 0 and n == 0: return ack(m - 1, 1) if m > 0 and n > 0: if (m, n) in known: print('Cache hit') return known[m, n] else: known[m, n] = ack(m - 1, ack(m, n - 1)) return know...
# # @lc app=leetcode id=450 lang=python3 # # [450] Delete Node in a BST # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def deleteNode(s...
class Solution: def delete_node(self, root: TreeNode, key: int) -> TreeNode: if not root: return None if root.val == key: if not root.right: left = root.left return left right = root.right while root.left: ...
__title__ = 'pairing-functions' __description__ = 'A collection of pairing functions' __url__ = 'https://github.com/ConvertGroupLabs/pairing-functions' __version__ = '0.2.1' __author__ = 'Convert Group Labs' __author_email__ = 'tools@convertgroup.com' __license__ = 'MIT License' __copyright__ = 'Copyright 2020 Convert ...
__title__ = 'pairing-functions' __description__ = 'A collection of pairing functions' __url__ = 'https://github.com/ConvertGroupLabs/pairing-functions' __version__ = '0.2.1' __author__ = 'Convert Group Labs' __author_email__ = 'tools@convertgroup.com' __license__ = 'MIT License' __copyright__ = 'Copyright 2020 Convert ...
def deleteMid(head): # check if the list contains 1 or more nodes if head is None or head.next is None: return None #assign pointers to their respective positions prev, i, j = None, head, head while j and j.next: j = j.next.next;# j pointer moves 2 nodes ahead ...
def delete_mid(head): if head is None or head.next is None: return None (prev, i, j) = (None, head, head) while j and j.next: j = j.next.next prev = i i = i.next prev.next = i.next return head class Node: def __init__(self, data): self.data = data ...
"""Contains ascii-art project related logos.""" # http://patorjk.com/software/taag/#p=display&f=Varsity&t=PnP PNP = r""" _______ _______ |_ __ \ |_ __ \ | |__) |_ .--. | |__) | | ___/[ `.-. | | ___/ _| |_ | | | | _| | |_____| [___||__]|_____| """
"""Contains ascii-art project related logos.""" pnp = ' _______ _______\n|_ __ \\ |_ __ \\\n | |__) |_ .--. | |__) |\n | ___/[ `.-. | | ___/\n _| |_ | | | | _| |\n|_____| [___||__]|_____|\n'
N = int(input()) a = N % 1000 if a == 0: print(0) else: print(1000 - a)
n = int(input()) a = N % 1000 if a == 0: print(0) else: print(1000 - a)
# -*- coding: utf-8 -*- f = open("dico.txt", "r") contrasenia = "hola" contador = 0 linea = f.readline() while linea: contador += 1 if linea.strip() == contrasenia.strip(): print('Contrasenia encontrada: ' + linea) print('en ' + str(contador) + ' intentos') break linea = f.readline(...
f = open('dico.txt', 'r') contrasenia = 'hola' contador = 0 linea = f.readline() while linea: contador += 1 if linea.strip() == contrasenia.strip(): print('Contrasenia encontrada: ' + linea) print('en ' + str(contador) + ' intentos') break linea = f.readline() f.close()
first = "Murat" last = "Aksoy" name = f"Welcome to pyhton '{last}', {first}" print(name)
first = 'Murat' last = 'Aksoy' name = f"Welcome to pyhton '{last}', {first}" print(name)
class Solution: def frequencySort(self, s): """ :type s: str :rtype: str """ dic = {} for item in s: if item in dic: dic[item] += 1 else: dic[item] = 1 ans = [0 for x in range(len(dic))] i = 0 ...
class Solution: def frequency_sort(self, s): """ :type s: str :rtype: str """ dic = {} for item in s: if item in dic: dic[item] += 1 else: dic[item] = 1 ans = [0 for x in range(len(dic))] i = 0 ...
AUTHOR="Zawadi Done" DESCRIPTION="This module wil install/update MassDNS" INSTALL_TYPE="GIT" REPOSITORY_LOCATION="https://github.com/blechschmidt/massdns" INSTALL_LOCATION="massdns" DEBIAN="" AFTER_COMMANDS="cd {INSTALL_LOCATION},make,cp bin/massdns /usr/local/bin/" LAUNCHER="massdns"
author = 'Zawadi Done' description = 'This module wil install/update MassDNS' install_type = 'GIT' repository_location = 'https://github.com/blechschmidt/massdns' install_location = 'massdns' debian = '' after_commands = 'cd {INSTALL_LOCATION},make,cp bin/massdns /usr/local/bin/' launcher = 'massdns'
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): # # Iterative (accepted), Time: O(m + n), Space: O(1) # def insert(self, pos_node, node): # node.next = pos_node.next ...
class Solution(object): def merge_two_lists(self, l1, l2): dummy = cur = list_node(0) while l1 and l2: if l1.val < l2.val: cur.next = l1 l1 = l1.next else: cur.next = l2 l2 = l2.next cur = cur.next ...
''' This module declares constants needed for this solution. This is to remove magic numbers ''' CRATER_CHANGE_WHEN_SUNNY = 0.9 CRATER_CHANGE_WHEN_RAINY = 1.2 CRATER_CHANGE_WHEN_WINDY = 0.0 ORBIT1_ORBIT_DISTANCE = 18 ORBIT1_CRATERS_COUNT = 20 ORBIT2_ORBIT_DISTANCE = 20 ORBIT2_CRATERS_COUNT = 10
""" This module declares constants needed for this solution. This is to remove magic numbers """ crater_change_when_sunny = 0.9 crater_change_when_rainy = 1.2 crater_change_when_windy = 0.0 orbit1_orbit_distance = 18 orbit1_craters_count = 20 orbit2_orbit_distance = 20 orbit2_craters_count = 10
class Solution: def singleNumber(self, nums: List[int]) -> int: ret = 0 for n in nums: ret ^= n return ret
class Solution: def single_number(self, nums: List[int]) -> int: ret = 0 for n in nums: ret ^= n return ret
#! /usr/bin/env python3 """Sort a list and store previous indices of values""" # enumerate is a great but little-known tool for writing nice code l = [4, 2, 3, 5, 1] print("original list: ", l) values, indices = zip(*sorted((a, b) for (b, a) in enumerate(l))) # now values contains the sorted list and indices contai...
"""Sort a list and store previous indices of values""" l = [4, 2, 3, 5, 1] print('original list: ', l) (values, indices) = zip(*sorted(((a, b) for (b, a) in enumerate(l)))) print('sorted list: ', values) print('original indices: ', indices)
#!/usr/bin/env python3 # https://www.urionlinejudge.com.br/judge/en/problems/view/1020 def decompose(total, value): decomposed = total // value return total - decomposed * value, decomposed def main(): DAYS = int(input()) DAYS, YEARS = decompose(DAYS, 365) DAYS, MONTHS = decompose(DAYS, 30)...
def decompose(total, value): decomposed = total // value return (total - decomposed * value, decomposed) def main(): days = int(input()) (days, years) = decompose(DAYS, 365) (days, months) = decompose(DAYS, 30) print(YEARS, 'ano(s)') print(MONTHS, 'mes(es)') print(DAYS, 'dia(s)') if __n...
''' Creating a very basic module in Python ''' languages = {'Basic', 'QBasic', 'Cobol', 'Pascal', 'Assembly', 'C/C++', 'Java', 'Python', 'Ruby'} values = 10, 50, 60, 11, 98, 75, 65, 32 def add(*args: float) -> float: sum = 0.0 for value in args: sum += value return sum def multiply(*args: float) -> flo...
""" Creating a very basic module in Python """ languages = {'Basic', 'QBasic', 'Cobol', 'Pascal', 'Assembly', 'C/C++', 'Java', 'Python', 'Ruby'} values = (10, 50, 60, 11, 98, 75, 65, 32) def add(*args: float) -> float: sum = 0.0 for value in args: sum += value return sum def multiply(*args: fl...
__author__ = 'roland' class HandlerResponse(object): def __init__(self, content_processed, outside_html_action=None, tester_error_description=None, cookie_jar=None, urllib_request=None, urllib_response=None): """ :param content_processed: bool set to True if a sc...
__author__ = 'roland' class Handlerresponse(object): def __init__(self, content_processed, outside_html_action=None, tester_error_description=None, cookie_jar=None, urllib_request=None, urllib_response=None): """ :param content_processed: bool set to True if a scripted ContentHandler matc...
#Config, Reference, and configure provided in globals cards = Config( hd_audio=Config( match=dict(), name='Auto-%(id)s-%(label)s', restart=-1, input=dict( label="input", subdevice='0', channels=2, buffer_size=512, buffer_count=4, sample_rate=48000, quality=4 ), output=dict(...
cards = config(hd_audio=config(match=dict(), name='Auto-%(id)s-%(label)s', restart=-1, input=dict(label='input', subdevice='0', channels=2, buffer_size=512, buffer_count=4, sample_rate=48000, quality=4), output=dict(label='output', subdevice='0', channels=2, buffer_size=512, buffer_count=4, sample_rate=48000, quality=4...
#!/usr/bin/env python3 # Copyright 2018, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
tripleo_mapping_group = {'hosts': ['undercloud', 'overcloud', 'Undercloud', 'Overcloud'], 'all': ['hosts'], 'shared-infra_hosts': ['Controller', 'controller'], 'rabbitmq_all': ['Controller', 'controller'], 'memcached_all': ['Controller', 'controller'], 'galera_all': ['Controller', 'controller'], 'galera': ['Controller'...
def make_bio_dict(tags, start_idx=0): d = dict() i = start_idx for tag in tags: for pre_tag in ['B-', 'I-']: d[pre_tag + tag] = i i += 1 d['O'] = i return d
def make_bio_dict(tags, start_idx=0): d = dict() i = start_idx for tag in tags: for pre_tag in ['B-', 'I-']: d[pre_tag + tag] = i i += 1 d['O'] = i return d
# -*- coding: utf-8 -*- __author__ = "Sergey Aganezov" __email__ = "aganezov(at)cs.jhu.edu" __status__ = "production" version = "1.10" __all__ = ["grimm", "breakpoint_graph", "graphviz", "utils", "edge", "genome", "kbreak", "multicolor", ...
__author__ = 'Sergey Aganezov' __email__ = 'aganezov(at)cs.jhu.edu' __status__ = 'production' version = '1.10' __all__ = ['grimm', 'breakpoint_graph', 'graphviz', 'utils', 'edge', 'genome', 'kbreak', 'multicolor', 'tree', 'vertices', 'utils', 'distances']
size(200, 200) stroke(0) strokeWidth(10) fill(1, 0.3, 0) polygon((40, 40), (40, 160)) polygon((60, 40), (60, 160), (130, 160)) polygon((100, 40), (160, 160), (160, 40), close=False)
size(200, 200) stroke(0) stroke_width(10) fill(1, 0.3, 0) polygon((40, 40), (40, 160)) polygon((60, 40), (60, 160), (130, 160)) polygon((100, 40), (160, 160), (160, 40), close=False)
# imdb sortBy functions def sortMoviesBy(movies_names_wl, args): """ This module is used to sortMovies by the dict(arg.sortBy) :param list movies_names_wl: a list of movie_names_with_links movie : [Rank, Link, Title, Year, Rating, Number of Ratings, Runtime, Director] Rank : int L...
def sort_movies_by(movies_names_wl, args): """ This module is used to sortMovies by the dict(arg.sortBy) :param list movies_names_wl: a list of movie_names_with_links movie : [Rank, Link, Title, Year, Rating, Number of Ratings, Runtime, Director] Rank : int Link : str Title : str Y...
# flake8: noqa _base_ = [ './coco.py' ] data = dict( samples_per_gpu=2, workers_per_gpu=2, train=dict(classes=('person',)), val=dict(classes=('person',)), test=dict(classes=('person',)) )
_base_ = ['./coco.py'] data = dict(samples_per_gpu=2, workers_per_gpu=2, train=dict(classes=('person',)), val=dict(classes=('person',)), test=dict(classes=('person',)))
######################################################## # Copyright (c) 2015-2017 by European Commission. # # All Rights Reserved. # ######################################################## extends("BaseKPI.py") """ Expected Unserved Demand (%) ----------------------------- Inde...
extends('BaseKPI.py') "\nExpected Unserved Demand (%)\n-----------------------------\n\nIndexed by\n\t* scope\n\t* delivery point\n\t* energy\n\t* test case\n\nThe Expected Unserved Demand is a metric used to measure security of supply. This is the amount of electricity, gas or reserve demand that is expected not to be...
x = int(input()) n = int(input()) pool = x for _ in range(n): pool += x - int(input()) print(pool)
x = int(input()) n = int(input()) pool = x for _ in range(n): pool += x - int(input()) print(pool)
def reject_outliers(data, m = 2.): d = np.abs(data - np.median(data)) mdev = np.median(d) s = d/mdev if mdev else 0. return (s < m) def mean_dup(x_): global reject_outliers if 1==len(np.unique(x_.values)): return x_.values[0] else: x = x_....
def reject_outliers(data, m=2.0): d = np.abs(data - np.median(data)) mdev = np.median(d) s = d / mdev if mdev else 0.0 return s < m def mean_dup(x_): global reject_outliers if 1 == len(np.unique(x_.values)): return x_.values[0] else: x = x_.values[reject_outliers(x_.values.c...
class MyList: class _Node: __slots__ = ('value', 'next') def __init__(self, value, next=None): self.value = value self.next = next class _NodeIterator: def __init__(self, first): self._next_node = first def __iter__(self): retur...
class Mylist: class _Node: __slots__ = ('value', 'next') def __init__(self, value, next=None): self.value = value self.next = next class _Nodeiterator: def __init__(self, first): self._next_node = first def __iter__(self): retu...
number = 10 array = '64630 11735 14216 99233 14470 4978 73429 38120 51135 67060' array = list(map(int, array.split())) def find_mean(a): return round(sum(a)/number, 1) def find_median(a): a = sorted(a) if len(a) % 2 == 0: return round((a[number//2 - 1] + a[number//2])/2, 1) else: ret...
number = 10 array = '64630 11735 14216 99233 14470 4978 73429 38120 51135 67060' array = list(map(int, array.split())) def find_mean(a): return round(sum(a) / number, 1) def find_median(a): a = sorted(a) if len(a) % 2 == 0: return round((a[number // 2 - 1] + a[number // 2]) / 2, 1) else: ...