content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def sortNums(nums): # constant space solution i = 0 j = len(nums) - 1 index = 0 while index <= j: if nums[index] == 1: nums[index], nums[i] = nums[i], nums[index] index += 1 i += 1 if nums[index] == 2: index += 1 if nums[index] ...
def sort_nums(nums): i = 0 j = len(nums) - 1 index = 0 while index <= j: if nums[index] == 1: (nums[index], nums[i]) = (nums[i], nums[index]) index += 1 i += 1 if nums[index] == 2: index += 1 if nums[index] == 3: (nums[i...
#!/usr/bin/env python def num_digits(k): c = 0 while k > 0: c += 1 k /= 10 return c def is_kaprekar(k): k2 = pow(k, 2) p10ndk = pow(10, num_digits(k)) if k == (k2 // p10ndk) + (k2 % p10ndk): return True else: return False if __name__ == '__main__': for ...
def num_digits(k): c = 0 while k > 0: c += 1 k /= 10 return c def is_kaprekar(k): k2 = pow(k, 2) p10ndk = pow(10, num_digits(k)) if k == k2 // p10ndk + k2 % p10ndk: return True else: return False if __name__ == '__main__': for k in range(1, 1001): ...
def citerator(data: list, x: int, y: int, layer = False) -> list: """Bi-dimensional matrix iterator starting from any point (i, j), iterating layer by layer around the starting coordinates. Args: data (list): Data set to iterate over. x (int): X starting coordinate. y (int): Y start...
def citerator(data: list, x: int, y: int, layer=False) -> list: """Bi-dimensional matrix iterator starting from any point (i, j), iterating layer by layer around the starting coordinates. Args: data (list): Data set to iterate over. x (int): X starting coordinate. y (int): Y startin...
def decorating_fun(func): def wrapping_function(): print("this is wrapping function and get func start") func() print("func end") return wrapping_function @decorating_fun def decorated_func(): print("i`m decoraed") decorated_func()
def decorating_fun(func): def wrapping_function(): print('this is wrapping function and get func start') func() print('func end') return wrapping_function @decorating_fun def decorated_func(): print('i`m decoraed') decorated_func()
class CannotAssignValueFromParentCategory(Exception): def __init__(self): super().__init__("422 Cannot assign value from parent category")
class Cannotassignvaluefromparentcategory(Exception): def __init__(self): super().__init__('422 Cannot assign value from parent category')
# read file f=open("funny.txt","r") for line in f: print(line) f.close() # readlines() f=open("funny.txt","r") lines = f.readlines() print(lines) # write file f=open("love.txt","w") f.write("I love python") f.close() # same file when you write i love javascript the previous line goes away f=open("love.txt","w") ...
f = open('funny.txt', 'r') for line in f: print(line) f.close() f = open('funny.txt', 'r') lines = f.readlines() print(lines) f = open('love.txt', 'w') f.write('I love python') f.close() f = open('love.txt', 'w') f.write('I love javascript') f.close() f = open('love.txt', 'a') f.write('I love javascript') f.close()...
class NoKeywordsException(Exception): """Website does not contains any keywords in <meta> tag""" pass class BadURLException(Exception): """Website does not exists in a given URL""" pass
class Nokeywordsexception(Exception): """Website does not contains any keywords in <meta> tag""" pass class Badurlexception(Exception): """Website does not exists in a given URL""" pass
# -*- coding: utf-8 -*- """ This software is licensed under the License (MIT) located at https://github.com/ephreal/rollbot/Licence Please see the license for any restrictions or rights granted to you by the License. """ # A mock guild object for testing class MockGuild(): def __init__(self, name=None, text_chan...
""" This software is licensed under the License (MIT) located at https://github.com/ephreal/rollbot/Licence Please see the license for any restrictions or rights granted to you by the License. """ class Mockguild: def __init__(self, name=None, text_channels=None, users=None): self.name = name sel...
def get_first_matching_attr(obj, *attrs, default=None): for attr in attrs: if hasattr(obj, attr): return getattr(obj, attr) return default def get_error_message(exc) -> str: if hasattr(exc, 'message_dict'): return exc.message_dict error_msg = get_first_matching_attr(exc, '...
def get_first_matching_attr(obj, *attrs, default=None): for attr in attrs: if hasattr(obj, attr): return getattr(obj, attr) return default def get_error_message(exc) -> str: if hasattr(exc, 'message_dict'): return exc.message_dict error_msg = get_first_matching_attr(exc, 'me...
class Batcher(object): """ Batcher enables developers to batch multiple retrieval requests. Example usage #1:: from pycacher import Cacher cacher = Cacher() batcher = cacher.create_batcher() batcher.add('testkey') batcher.add('testkey1') batcher.add('test...
class Batcher(object): """ Batcher enables developers to batch multiple retrieval requests. Example usage #1:: from pycacher import Cacher cacher = Cacher() batcher = cacher.create_batcher() batcher.add('testkey') batcher.add('testkey1') batcher.add('test...
''' Implement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST): BSTIterator(TreeNode root) Initializes an object of the BSTIterator class. The root of the BST is given as part of the constructor. The pointer should be initialized to a non-existent number small...
""" Implement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST): BSTIterator(TreeNode root) Initializes an object of the BSTIterator class. The root of the BST is given as part of the constructor. The pointer should be initialized to a non-existent number small...
c = input().strip() fr = input().split() n = 0 for i in fr: if c in i: n += 1 print('{:.1f}'.format(n*100/len(fr)))
c = input().strip() fr = input().split() n = 0 for i in fr: if c in i: n += 1 print('{:.1f}'.format(n * 100 / len(fr)))
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 applicable law or agree...
_base_ = ['../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'] model = dict(rpn_head=dict(anchor_generator=dict(type='LegacyAnchorGenerator', center_offset=0.5), bbox_coder=dict(type='LegacyDeltaXYWHBBoxCoder'), loss_bbox=d...
raw_data = [ b'\x1cT#01 61.01,\r\nT#03 88.07,90.78,90.17,29.48,14.41\r\n \r\n \xae$\xe2\x02\xe0D\x143P\x02\xe0', b'T#01 56.92,\r\nT#03 88.10,90.62,90.42,29.68,14.39\r\n \r\n C \xfc', b'T#01 63.51,\r\nT#03 87.98,90.36,90.15,29.30,14.41\r\n \r\n \x03\x82\x01\x80$\x9f\xd8\xbc\x0f\x08', b'T#01 56.05,\r\nT#0...
raw_data = [b'\x1cT#01 61.01,\r\nT#03 88.07,90.78,90.17,29.48,14.41\r\n \r\n \xae$\xe2\x02\xe0D\x143P\x02\xe0', b'T#01 56.92,\r\nT#03 88.10,90.62,90.42,29.68,14.39\r\n \r\n C \xfc', b'T#01 63.51,\r\nT#03 87.98,90.36,90.15,29.30,14.41\r\n \r\n \x03\x82\x01\x80$\x9f\xd8\xbc\x0f\x08', b'T#01 56.05,\r\nT#03 87.99,90.66,90....
# -*- coding: utf-8 -*- # # Unless explicitly stated otherwise all files in this repository are licensed # under the Apache 2 License. # # This product includes software developed at Datadog # (https://www.datadoghq.com/). # # Copyright 2018 Datadog, Inc. # """crud_service.py Service-helpers for creating and updatin...
"""crud_service.py Service-helpers for creating and updating data. """ class Crudservice(object): """CRUD persistent storage service. An abstract class for creating and mutating data. """ def create(self): """Creates and persists a new record to the database.""" pass def update(...
# # @lc app=leetcode id=1299 lang=python3 # # [1299] Replace Elements with Greatest Element on Right Side # # @lc code=start class Solution: def replaceElements(self, arr: List[int]) -> List[int]: index = 0 result = [] for i,v in enumerate(arr): if i+1 == len(arr): ...
class Solution: def replace_elements(self, arr: List[int]) -> List[int]: index = 0 result = [] for (i, v) in enumerate(arr): if i + 1 == len(arr): result.append(-1) break result.append(max(arr[i + 1:len(arr)])) index = inde...
class Solution: def findNumberOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 dp = [1 for i in range(len(nums))] c = [1 for i in range(len(nums))] for i in range(1, len(nums)): for j in range(...
class Solution: def find_number_of_lis(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 dp = [1 for i in range(len(nums))] c = [1 for i in range(len(nums))] for i in range(1, len(nums)): for j in ran...
def rotate(cur_direction, rotation_command): # Assumes there are only R/L 90/180/270 invert_rl = { "R": "L", "L": "R", } if int(rotation_command[1:]) == 270: rotation_command = f"{invert_rl[rotation_command[0]]}90" elif int(rotation_command[1:]) == 180: flip ...
def rotate(cur_direction, rotation_command): invert_rl = {'R': 'L', 'L': 'R'} if int(rotation_command[1:]) == 270: rotation_command = f'{invert_rl[rotation_command[0]]}90' elif int(rotation_command[1:]) == 180: flip = {'N': 'S', 'E': 'W', 'S': 'N', 'W': 'E'} return flip[cur_direction...
#------------------------------------------------------------------------------- # Name: module2 # Purpose: # # Author: user # # Created: 28/03/2019 # Copyright: (c) user 2019 # Licence: <your licence> #------------------------------------------------------------------------------- pri...
print('LISTS') print('Working with LISTS') print('\nlists=[], this is an epty list\n') list = ['kevin', 5, 7.9, True] friend = ['kevin', 'KAren', 'Jim', 'Toddy', 'Frog'] print('\nlist=["kevin", 5, 7.9, True]\n# list values are indexed\n\nfriend=["kevin", "KAren", "Jim", "Toddy", "Frog"]\n# 0 1 2 ...
# https://codeforces.com/problemsets/acmsguru/problem/99999/100 A, B = map(int, input().split()) print(A+B)
(a, b) = map(int, input().split()) print(A + B)
""" Check if items are in list """ def has_invalid_fields(fields): for field in fields: if field not in ['foo', 'bar']: return True return False def has_invalid_fields2(fields): return bool(set(fields) - set(['foo', 'bar'])) """ set eliminates duplicates """ """ Code is valid but...
""" Check if items are in list """ def has_invalid_fields(fields): for field in fields: if field not in ['foo', 'bar']: return True return False def has_invalid_fields2(fields): return bool(set(fields) - set(['foo', 'bar'])) ' set eliminates duplicates ' ' Code is valid but it will a v...
# Hand decompiled day 19 part 2 a,b,c,d,e,f = 1,0,0,0,0,0 c += 2 c *= c c *= 209 b += 2 b *= 22 b += 7 c += b if a == 1: b = 27 b *= 28 b += 29 b *= 30 b *= 14 b *= 32 c += b a = 0 for d in range(1, c+1): if c % d == 0: a += d print(a)
(a, b, c, d, e, f) = (1, 0, 0, 0, 0, 0) c += 2 c *= c c *= 209 b += 2 b *= 22 b += 7 c += b if a == 1: b = 27 b *= 28 b += 29 b *= 30 b *= 14 b *= 32 c += b a = 0 for d in range(1, c + 1): if c % d == 0: a += d print(a)
class test_result(): """Log the performance on the test set""" def __init__(self, autonet, X_test, Y_test): self.autonet = autonet self.X_test = X_test self.Y_test = Y_test def __call__(self, model, epochs): if self.Y_test is None or self.X_test is None: retu...
class Test_Result: """Log the performance on the test set""" def __init__(self, autonet, X_test, Y_test): self.autonet = autonet self.X_test = X_test self.Y_test = Y_test def __call__(self, model, epochs): if self.Y_test is None or self.X_test is None: return fl...
'''Crow/AAP Alarm IP Module Feedback Class for alarm state''' class StatusState: # Zone State @staticmethod def get_initial_zone_state(maxZones): """Builds the proper zone state collection.""" _zoneState = {} for i in range (1, maxZones+1): _zoneState[i] = {'status': {'o...
"""Crow/AAP Alarm IP Module Feedback Class for alarm state""" class Statusstate: @staticmethod def get_initial_zone_state(maxZones): """Builds the proper zone state collection.""" _zone_state = {} for i in range(1, maxZones + 1): _zoneState[i] = {'status': {'open': False, '...
def go(o, a, b): if o == '+': return a + b return a * b def main(): a, o, b = int(input()), input(), int(input()) return go(o, a, b) if __name__ == '__main__': print(main())
def go(o, a, b): if o == '+': return a + b return a * b def main(): (a, o, b) = (int(input()), input(), int(input())) return go(o, a, b) if __name__ == '__main__': print(main())
"""Migration for a given Submitty course database.""" def up(config, database, semester, course): if not database.table_has_column('teams', 'last_viewed_time'): database.execute('ALTER TABLE teams ADD COLUMN last_viewed_time timestamp with time zone') def down(config, database, semester, course): pass...
"""Migration for a given Submitty course database.""" def up(config, database, semester, course): if not database.table_has_column('teams', 'last_viewed_time'): database.execute('ALTER TABLE teams ADD COLUMN last_viewed_time timestamp with time zone') def down(config, database, semester, course): pass
def cube(a): """Cube the number a. Args: a (float): The number to be squared. """ return a**3
def cube(a): """Cube the number a. Args: a (float): The number to be squared. """ return a ** 3
# # This file contains the Python code from Program 14.14 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm14_14.txt # class SimpleRV(Ra...
class Simplerv(RandomVariable): def get_next(self): return RandomNumberGenerator.next
def test_list(client, seeder, utils): user_id, admin_unit_id = seeder.setup_base() seeder.create_event(admin_unit_id) url = utils.get_url("planing") utils.get_ok(url) url = utils.get_url("planing", keyword="name") utils.get_ok(url)
def test_list(client, seeder, utils): (user_id, admin_unit_id) = seeder.setup_base() seeder.create_event(admin_unit_id) url = utils.get_url('planing') utils.get_ok(url) url = utils.get_url('planing', keyword='name') utils.get_ok(url)
class Solution: def to_hex(self, num: int) -> str: if num == 0: return "0" prefix, ans = "0123456789abcdef", "" num = 2 ** 32 + num if num < 0 else num while num: item = num & 15 # num % 16 ans = prefix[item] + ans num >>= 4 # num //=...
class Solution: def to_hex(self, num: int) -> str: if num == 0: return '0' (prefix, ans) = ('0123456789abcdef', '') num = 2 ** 32 + num if num < 0 else num while num: item = num & 15 ans = prefix[item] + ans num >>= 4 return an...
classifiers = """ License :: OSI Approved :: BSD License Operating System :: POSIX Intended Audience :: Developers Intended Audience :: Science/Research Programming Language :: C Programming Language :: C++ Programming Language :: Cython Programming Language :: Python Programming Language :: Python :: 2 Programming Lan...
classifiers = '\nLicense :: OSI Approved :: BSD License\nOperating System :: POSIX\nIntended Audience :: Developers\nIntended Audience :: Science/Research\nProgramming Language :: C\nProgramming Language :: C++\nProgramming Language :: Cython\nProgramming Language :: Python\nProgramming Language :: Python :: 2\nProgram...
def partTwo(instr: str) -> int: # This is the parsing section service_list = instr.strip().split("\n")[-1].split(",") eqns = [] for i, svc in enumerate(service_list): if svc == "x": continue svc = int(svc) v = 0 if i != 0: v = svc - i # This is ...
def part_two(instr: str) -> int: service_list = instr.strip().split('\n')[-1].split(',') eqns = [] for (i, svc) in enumerate(service_list): if svc == 'x': continue svc = int(svc) v = 0 if i != 0: v = svc - i eqns.append((v, svc)) n = 1 ...
''' Motion Event Provider ===================== Abstract class for the implemention of a :class:`~kivy.input.motionevent.MotionEvent` provider. The implementation must support the :meth:`~MotionEventProvider.start`, :meth:`~MotionEventProvider.stop` and :meth:`~MotionEventProvider.update` methods. ''' __all__ = ('Mot...
""" Motion Event Provider ===================== Abstract class for the implemention of a :class:`~kivy.input.motionevent.MotionEvent` provider. The implementation must support the :meth:`~MotionEventProvider.start`, :meth:`~MotionEventProvider.stop` and :meth:`~MotionEventProvider.update` methods. """ __all__ = ('Moti...
class Model(object): def __init__(self, xml): self.raw_data = xml def __str__(self): return self.raw_data.toprettyxml( ) def _get_attribute(self, attr): val = self.raw_data.getAttribute(attr) if val == '': return None return val def _get_eleme...
class Model(object): def __init__(self, xml): self.raw_data = xml def __str__(self): return self.raw_data.toprettyxml() def _get_attribute(self, attr): val = self.raw_data.getAttribute(attr) if val == '': return None return val def _get_element(sel...
# cook your dish here a=int(input()) b=int(input()) while(1): if a%b==0: print(a) break else: a-=1
a = int(input()) b = int(input()) while 1: if a % b == 0: print(a) break else: a -= 1
""" 1. **kwargs usage """ def test(**kwargs): # Do not use **kwargs # Print key serials print(*kwargs) _dict = kwargs for k in _dict.keys(): print("Key=", k) print("Value=", _dict[k]) print() test(a=1, b=2, c=3) """ 1. * -> unpack container type """ list1 = [1, 2,...
""" 1. **kwargs usage """ def test(**kwargs): print(*kwargs) _dict = kwargs for k in _dict.keys(): print('Key=', k) print('Value=', _dict[k]) print() test(a=1, b=2, c=3) '\n 1. * -> unpack container type\n' list1 = [1, 2, 3] tuple1 = (3, 4, 5) set1 = {5, 6, 7} dict1 = {'aa': ...
# -*- coding: utf-8 -*- AUCTIONS = { 'simple': 'openprocurement.auction.esco.auctions.simple', 'multilot': 'openprocurement.auction.esco.auctions.multilot', }
auctions = {'simple': 'openprocurement.auction.esco.auctions.simple', 'multilot': 'openprocurement.auction.esco.auctions.multilot'}
# python3 def max_pairwise_product(numbers): x = sorted(numbers) n = len(numbers) return x[n-1] * x[n-2] if __name__ == '__main__': input_n = int(input()) input_numbers = [int(x) for x in input().split()] print(max_pairwise_product(input_numbers))
def max_pairwise_product(numbers): x = sorted(numbers) n = len(numbers) return x[n - 1] * x[n - 2] if __name__ == '__main__': input_n = int(input()) input_numbers = [int(x) for x in input().split()] print(max_pairwise_product(input_numbers))
#!/usr/bin/env python3 """ Custom errors for Seisflows """ class ParameterError(ValueError): """ A new ValueError class which explains the Parameter's that threw the error """ def __init__(self, *args): if len(args) == 0: msg = "Bad parameter." super(ParameterError, sel...
""" Custom errors for Seisflows """ class Parametererror(ValueError): """ A new ValueError class which explains the Parameter's that threw the error """ def __init__(self, *args): if len(args) == 0: msg = 'Bad parameter.' super(ParameterError, self).__init__(msg) ...
''' Homework assignment for the 'Python is easy' course by Pirple. Written by Ed Yablonsky. It pprints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". It also a...
""" Homework assignment for the 'Python is easy' course by Pirple. Written by Ed Yablonsky. It pprints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". It also a...
""" 1309. Decrypt String from Alphabet to Integer Mapping Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: Characters ('a' to 'i') are represented by ('1' to '9') respectively. Characters ('j' to 'z') are represented by ('10#' to '26#') respectively. ...
""" 1309. Decrypt String from Alphabet to Integer Mapping Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: Characters ('a' to 'i') are represented by ('1' to '9') respectively. Characters ('j' to 'z') are represented by ('10#' to '26#') respectively. ...
a=input() print(a) print(a) print(a)
a = input() print(a) print(a) print(a)
load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetLibrary", ) def collect_transitive_info(deps): """Collects transitive information. Args: deps: Dependencies that the DotnetLibrary depends on. Returns: A depsets of the references, runfiles and deps. References and d...
load('@io_bazel_rules_dotnet//dotnet/private:providers.bzl', 'DotnetLibrary') def collect_transitive_info(deps): """Collects transitive information. Args: deps: Dependencies that the DotnetLibrary depends on. Returns: A depsets of the references, runfiles and deps. References and deps also in...
# ================================================================================ # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not...
"""contants of policy-handler""" policy_id = 'policy_id' policy_body = 'policy_body' catch_up = 'catch_up' auto_catch_up = 'auto catch_up' auto_reconfigure = 'auto reconfigure' latest_policies = 'latest_policies' removed_policies = 'removed_policies' errored_policies = 'errored_policies' policy_filter = 'policy_filter'...
# Fancy-pants method for getting a where clause that groups adjacent image keys # using "BETWEEN X AND Y" ... unfortunately this usually takes far more # characters than using "ImageNumber IN (X,Y,Z...)" since we don't run into # queries asking for consecutive image numbers very often (except when we do it # deli...
def get_where_clause_for_images(keys, is_sorted=False): """ takes a list of keys and returns a (hopefully) short where clause that includes those keys. """ def in_sequence(k1, k2): if len(k1) > 1: if k1[:-1] != k2[:-1]: return False return k1[-1] == k2[-1...
# A module for class Restaurant """A set of classes that can be used to represent a restaurant.""" class Restaurant(): """A model of a restaurant.""" def __init__(self, name, cuisine): """Initialize name and age attributes.""" self.name = name self.cuisine = cuisine def describe...
"""A set of classes that can be used to represent a restaurant.""" class Restaurant: """A model of a restaurant.""" def __init__(self, name, cuisine): """Initialize name and age attributes.""" self.name = name self.cuisine = cuisine def describe_restaurant(self): """Simula...
g = int(input().strip()) for _ in range(g): n = int(input().strip()) s = [int(x) for x in input().strip().split(' ')] x = 0 for i in s: x ^= i if len(set(s))==1 and 1 in s: #here x=0 or 1 if x:#odd no. of ones print("Second") else:#even no. of...
g = int(input().strip()) for _ in range(g): n = int(input().strip()) s = [int(x) for x in input().strip().split(' ')] x = 0 for i in s: x ^= i if len(set(s)) == 1 and 1 in s: if x: print('Second') else: print('First') elif x: print('First')...
class SerializerNotFound(Exception): """ Serializer not found """
class Serializernotfound(Exception): """ Serializer not found """
class A(object): def do_this(self): print('do_this() in A') class B(A): pass class C(A): def do_this(self): print('do_this() in C') class D(B, C): pass D_instance = D() D_instance.do_this() print(D.mro()) # Method resolution order
class A(object): def do_this(self): print('do_this() in A') class B(A): pass class C(A): def do_this(self): print('do_this() in C') class D(B, C): pass d_instance = d() D_instance.do_this() print(D.mro())
a, b = 0, 1 while b < 10: print(b) a, b = b, a + b # 1 # 1 # 2 # 3 # 5 # 8 a, b = 0, 1 while b < 1000: print(b, end='->') a, b = b, a + b # 1->1->2->3->5->8->13->21->34->55->89->144->233->377->610->987->%
(a, b) = (0, 1) while b < 10: print(b) (a, b) = (b, a + b) (a, b) = (0, 1) while b < 1000: print(b, end='->') (a, b) = (b, a + b)
class AutoScaleSettingVO: def __init__(self, mini_size=1, max_size=1, mem_exc=0, deploy_name = ""): self.miniSize = mini_size self.maxSize = max_size self.memExc = mem_exc self.deployName = deploy_name self.operationResult = ""
class Autoscalesettingvo: def __init__(self, mini_size=1, max_size=1, mem_exc=0, deploy_name=''): self.miniSize = mini_size self.maxSize = max_size self.memExc = mem_exc self.deployName = deploy_name self.operationResult = ''
#Date: 031622 #Difficulty: Easy class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ write=0 for read in range(len(nums)): if nums[read]!=val: nums[write]=nums[read] ...
class Solution(object): def remove_element(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ write = 0 for read in range(len(nums)): if nums[read] != val: nums[write] = nums[read] write += 1...
# # PySNMP MIB module STN-ATM-VPN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-ATM-VPN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:03:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
class MenuItem: # Definiskan method info def info(self): print('Tampilkan nama dan harga dari menu item') menu_item1 = MenuItem() menu_item1.name = 'Roti Lapis' menu_item1.price = 5 # Panggil method info dari menu_item1 menu_item1.info() menu_item2 = MenuItem() menu_item2.name = 'Kue Coklat' menu_i...
class Menuitem: def info(self): print('Tampilkan nama dan harga dari menu item') menu_item1 = menu_item() menu_item1.name = 'Roti Lapis' menu_item1.price = 5 menu_item1.info() menu_item2 = menu_item() menu_item2.name = 'Kue Coklat' menu_item2.price = 4 menu_item2.info()
#!/user/bin/python '''Number of Inversions '''
"""Number of Inversions """
class HideX(object): # def x(): # def fget(self): # return ~self.__x # def fset(self, x): # assert isinstance(x, int), 'x must be int' # self.__x = ~x # return locals() # x = property(**x()) @property def x(self): return ~self.__x @x.setter def x(self, x): assert isinstance(x, int), 'x must be...
class Hidex(object): @property def x(self): return ~self.__x @x.setter def x(self, x): assert isinstance(x, int), 'x must be int' self.__x = ~x o = hide_x() o.x = 5 print(o.x) print(o._HideX__x)
#coding=utf-8 ''' Created on 2015-10-10 @author: Devuser ''' class HomeTaskPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="task/home_task_leftsub_nav.html" task_index_path="task/home_task_index.html" class HomeProjectPath(object): left_nav_template_path="home/ho...
""" Created on 2015-10-10 @author: Devuser """ class Hometaskpath(object): left_nav_template_path = 'home/home_left_nav.html' sub_nav_template_path = 'task/home_task_leftsub_nav.html' task_index_path = 'task/home_task_index.html' class Homeprojectpath(object): left_nav_template_path = 'home/home_left...
#Link Class is given! class Link: """A linked list. >>> s = Link(1, Link(2, Link(3))) >>> s.first 1 >>> s.rest Link(2, Link(3)) """ empty = () def __init__(self, first, rest=empty): assert rest is Link.empty or isinstance(rest, Link) self.first = first self...
class Link: """A linked list. >>> s = Link(1, Link(2, Link(3))) >>> s.first 1 >>> s.rest Link(2, Link(3)) """ empty = () def __init__(self, first, rest=empty): assert rest is Link.empty or isinstance(rest, Link) self.first = first self.rest = rest def _...
class Reccomandation: def __init__(self, input_text): self.text = input_text def __get__(self, name ): return self.name
class Reccomandation: def __init__(self, input_text): self.text = input_text def __get__(self, name): return self.name
""" https://leetcode.com/problems/count-primes/ """ class Solution: # @param {integer} n # @return {integer} def countPrimes(self, n): if n <=2: return 0 if n == 3: return 1 count = n-2 d = [True for i in xrange(n)] for i in...
""" https://leetcode.com/problems/count-primes/ """ class Solution: def count_primes(self, n): if n <= 2: return 0 if n == 3: return 1 count = n - 2 d = [True for i in xrange(n)] for i in xrange(2, int(n ** 0.5) + 1): if d[i]: ...
__author__ = 'nickbortolotti' """ Parte 1 1.utilizar un arreglo que almacene 2 cadenas y 2 valores enteros 2.mostrar en pantalla el la ubicacion 1 mostrar desde el 0-2 mostrar del 2 en adelante mostrar del 1 en reversa mostrar el ultimo elemento del arreglo en reversa """
__author__ = 'nickbortolotti' '\nParte 1\n1.utilizar un arreglo que almacene 2 cadenas y 2 valores enteros\n2.mostrar en pantalla el la ubicacion 1\nmostrar desde el 0-2\nmostrar del 2 en adelante\nmostrar del 1 en reversa\nmostrar el ultimo elemento del arreglo en reversa\n'
def error_output(number_of_parameters): """Write the optimized error values into the params file near the corresponding parameter identicator""" try: file2 = open("parameters", "r+") file2.seek(0) position2 = file2.tell() file = open("fort.13","r") ...
def error_output(number_of_parameters): """Write the optimized error values into the params file near the corresponding parameter identicator""" try: file2 = open('parameters', 'r+') file2.seek(0) position2 = file2.tell() file = open('fort.13', 'r') file.seek(0) p...
num_classes = 81 # model settings model = dict( type='SOLOv2', #pretrained='torchvision://resnet50', # The backbone weights will be overwritten when using load_from or resume_from. # https://github.com/open-mmlab/mmdetection/issues/7817#issuecomment-1108503826 backbone=dict( type='ResNet', ...
num_classes = 81 model = dict(type='SOLOv2', backbone=dict(type='ResNet', depth=50, in_channels=3, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=-1, style='pytorch'), neck=dict(type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, start_level=0, num_outs=5), bbox_head=dict(type='SOLOv2Head', num_cla...
#!/usr/bin/env prey async def main(): word = input("Give me a word: ") await x(f"echo {word}")
async def main(): word = input('Give me a word: ') await x(f'echo {word}')
class ToolConfig (): def __init__ (self): self.one = './data/onetwothree1.wav' self.two = './data/onetwothree8.wav' self.digits_path = './data/digits'
class Toolconfig: def __init__(self): self.one = './data/onetwothree1.wav' self.two = './data/onetwothree8.wav' self.digits_path = './data/digits'
# # PySNMP MIB module SW-DES3x50-ACLMGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SW-DES3x50-ACLMGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:12:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
""" Augment 3D images of a focal lesion with 3D rotation, flip, and translation. import_mhd: Prepare patches from lung CT scan images and annotations. (See readme.md - Installation for details.) datasets: Retrieve patches after augmentation for training. classify_patch: Demonstrate the use of dataset...
""" Augment 3D images of a focal lesion with 3D rotation, flip, and translation. import_mhd: Prepare patches from lung CT scan images and annotations. (See readme.md - Installation for details.) datasets: Retrieve patches after augmentation for training. classify_patch: Demonstrate the use of dataset...
# Michael O'Regan 05/May/2019 # https://www.sanfoundry.com/python-program-implement-bucket-sort/ def bucketSort(alist): largest = max(alist) length = len(alist) size = largest/length buckets = [[] for _ in range(length)] for i in range(length): j = int(alist[i]/size) if j != lengt...
def bucket_sort(alist): largest = max(alist) length = len(alist) size = largest / length buckets = [[] for _ in range(length)] for i in range(length): j = int(alist[i] / size) if j != length: buckets[j].append(alist[i]) else: buckets[length - 1].append...
""" It is commonly said that one human year is equivalent to 7 dog years. However this simple conversion fails to recognize that dogs reach adulthood in approximately two years. As a result, some people believe that it is better to count each of the first two human years as 10.5 dog years, and then count each additiona...
""" It is commonly said that one human year is equivalent to 7 dog years. However this simple conversion fails to recognize that dogs reach adulthood in approximately two years. As a result, some people believe that it is better to count each of the first two human years as 10.5 dog years, and then count each additiona...
divs = {} def sm(x): s = 0 for i in range(2,int(x**0.5)): if x%i == 0: s += i s += x/i if i*i == x: s -= i return s+1 for i in range(10001): divs[i] = sm(i) ans = 0 for i in range(10001): for j in range(10001): if divs[i] == j and divs[j] == i and i!=j: ans += i print(ans)
divs = {} def sm(x): s = 0 for i in range(2, int(x ** 0.5)): if x % i == 0: s += i s += x / i if i * i == x: s -= i return s + 1 for i in range(10001): divs[i] = sm(i) ans = 0 for i in range(10001): for j in range(10001): if divs[i...
####################### # MaudeMiner Settings # ####################### # Database settings DATABASE_PATH = '/Users/tklovett/maude/' DATABASE_NAME = 'maude' # These setting control where the text files and zip files retrieved from the FDA website are stored DATA_PATH = '/Users/tklovett/maude/data/' ZIPS_PATH = DATA_P...
database_path = '/Users/tklovett/maude/' database_name = 'maude' data_path = '/Users/tklovett/maude/data/' zips_path = DATA_PATH + 'zips/' txts_path = DATA_PATH + 'txts/' maude_data_origin = 'http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/PostmarketRequirements/ReportingAdverseEvents/ucm127891.htm' lines...
# https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ # 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 sortedArrayToBST(self, nums:...
class Solution: def sorted_array_to_bst(self, nums: List[int]) -> TreeNode: return self.generateTree(nums, 0, len(nums) - 1) def generate_tree(self, nums, left, right): if left > right: return None mid = (left + right) // 2 cur_node = tree_node(nums[mid]) cu...
class _LinearWithBias(Module): __parameters__ = ["weight", "bias", ] __buffers__ = [] weight : Tensor bias : Tensor training : bool
class _Linearwithbias(Module): __parameters__ = ['weight', 'bias'] __buffers__ = [] weight: Tensor bias: Tensor training: bool
count = 0 current_group = set() with open('in', 'r') as f: for line in f.readlines(): l = line.strip() if len(l) == 0: # this is end of the last group count += len(current_group) current_group = set() else: # add answers to the current group ...
count = 0 current_group = set() with open('in', 'r') as f: for line in f.readlines(): l = line.strip() if len(l) == 0: count += len(current_group) current_group = set() else: for chr in l: current_group.add(chr) count += len(current_group) ...
stim_positions = { "double": [ [(0.4584, 0.2575, 0.2038), (0.4612, 0.2690, -0.0283)], # 3d location [(0.4601, 0.1549, 0.1937), (0.4614, 0.1660, -0.0358)], ], "double_20070301": [ [(0.4538, 0.2740, 0.1994), (0.4565, 0.2939, -0.0531)], # top highy [(0.4516, 0.1642, 0.1872), (...
stim_positions = {'double': [[(0.4584, 0.2575, 0.2038), (0.4612, 0.269, -0.0283)], [(0.4601, 0.1549, 0.1937), (0.4614, 0.166, -0.0358)]], 'double_20070301': [[(0.4538, 0.274, 0.1994), (0.4565, 0.2939, -0.0531)], [(0.4516, 0.1642, 0.1872), (0.4541, 0.1767, -0.0606)]], 'half': [[(0.4567, 0.2029, 0.1958), (0.4581, 0.2166,...
class Node(object): def __init__(self): super().__init__() self.__filename = '' self.__children = [] self.__line_number = 0 self.__column_number = 0 def get_children(self) -> list: return self.__children def add_child(self, child: 'Node') -> None: a...
class Node(object): def __init__(self): super().__init__() self.__filename = '' self.__children = [] self.__line_number = 0 self.__column_number = 0 def get_children(self) -> list: return self.__children def add_child(self, child: 'Node') -> None: a...
"""TO BE EDITED. """ # from easyml import def test_foo(): assert 1 == 1
"""TO BE EDITED. """ def test_foo(): assert 1 == 1
def binary_search(nums, target): low = 0 high = len(nums) - 1 while low <= high: mid = low + ((high - low) // 2) if nums[mid] > target: high = mid-1 elif nums[mid] < target: low = mid+1 else: return mid return -1 if __name__ == "__mai...
def binary_search(nums, target): low = 0 high = len(nums) - 1 while low <= high: mid = low + (high - low) // 2 if nums[mid] > target: high = mid - 1 elif nums[mid] < target: low = mid + 1 else: return mid return -1 if __name__ == '__mai...
# # PySNMP MIB module ALVARION-USER-ACCOUNT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-USER-ACCOUNT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:06:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2') (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range...
class Solution: def superPow(self, a: int, b: List[int]) -> int: if (a % 1337 == 0): return 0 return pow(a, reduce(lambda x, y: x * 10 + y, b), 1337)
class Solution: def super_pow(self, a: int, b: List[int]) -> int: if a % 1337 == 0: return 0 return pow(a, reduce(lambda x, y: x * 10 + y, b), 1337)
print("Hello, world!") x = "Hello World" print(x) y = 42 print(y)
print('Hello, world!') x = 'Hello World' print(x) y = 42 print(y)
def StringToDict(s): RES = dict() for e in set(s): RES[e] = 0 for e in s: RES[e] += 1 return RES
def string_to_dict(s): res = dict() for e in set(s): RES[e] = 0 for e in s: RES[e] += 1 return RES
""" Master list of constants for logger Mostly logger keys, but some other constants as well. """ # loggerkey - header HEADER = "header" # loggerkey - timing info EPOCH_START = "epoch_start" EPOCH_STOP = "epoch_stop" RUN_START = "run_start" RUN_STOP = "run_stop" BATCH_START = "batch_start" BATCH_STOP = "batch_stop" ...
""" Master list of constants for logger Mostly logger keys, but some other constants as well. """ header = 'header' epoch_start = 'epoch_start' epoch_stop = 'epoch_stop' run_start = 'run_start' run_stop = 'run_stop' batch_start = 'batch_start' batch_stop = 'batch_stop' num_batches = 'num_batches' batch_size = 'batch_si...
DO_RUN_BIAS_TEST=False DEBUG = False INPUT_CSV=False ROOT_FOLDER="/home/jupyter/forms-ocr" OUTPUT_FOLDER= ROOT_FOLDER + "/sample_images" GEN_FOLDER = OUTPUT_FOLDER + "/img" LOCALE = "en_GB" DUMMY_GENERATOR=0 FIELD_DICT_3FIELDS= {'Name':(0,0),'Tax':(0,0), 'Address':(0,0) } FIELD_DICT_7FIELDS= {'N...
do_run_bias_test = False debug = False input_csv = False root_folder = '/home/jupyter/forms-ocr' output_folder = ROOT_FOLDER + '/sample_images' gen_folder = OUTPUT_FOLDER + '/img' locale = 'en_GB' dummy_generator = 0 field_dict_3_fields = {'Name': (0, 0), 'Tax': (0, 0), 'Address': (0, 0)} field_dict_7_fields = {'Name':...
class Student: studentLevel = 'first year computer science 2020/2021 session' studentCounter = 0 def __init__(self, thename, thematricno, thesex, thehostelname , theage,thecsc102examscore): self.name = thename self.matricno = thematricno self.sex = thesex self.hostelname = t...
class Student: student_level = 'first year computer science 2020/2021 session' student_counter = 0 def __init__(self, thename, thematricno, thesex, thehostelname, theage, thecsc102examscore): self.name = thename self.matricno = thematricno self.sex = thesex self.hostelname =...
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 19:32:39 2020 @author: abcdk """ # 5 Data types # Int, Float, Boolean, String, Null
""" Created on Sun Apr 19 19:32:39 2020 @author: abcdk """
# success values # sql.h SQL_INVALID_HANDLE = -2 SQL_ERROR = -1 SQL_SUCCESS = 0 SQL_SUCCESS_WITH_INFO = 1 SQL_STILL_EXECUTING = 2 SQL_NEED_DATA = 99 SQL_NO_DATA_FOUND = 100 sql_errors = [SQL_ERROR, SQL_INVALID_HANDLE] # sqlext.h SQL_FETCH_NEXT = 0x01 SQL_FETCH_FIRST = 0x02 SQL_FETCH_LAST ...
sql_invalid_handle = -2 sql_error = -1 sql_success = 0 sql_success_with_info = 1 sql_still_executing = 2 sql_need_data = 99 sql_no_data_found = 100 sql_errors = [SQL_ERROR, SQL_INVALID_HANDLE] sql_fetch_next = 1 sql_fetch_first = 2 sql_fetch_last = 4 sql_fetch_prior = 8 sql_fetch_absolute = 16 sql_fetch_relative = 32 s...
class Solution: # @param A : list of integers # @return an integer def perfectPeak(self, A): n = len(A) left = [0] * n right = [0] * n left[0] = A[0] right[n-1] = A[n-1] for i in range(1, n) : left[i] = max(left[i-1], A[i]) for i in rang...
class Solution: def perfect_peak(self, A): n = len(A) left = [0] * n right = [0] * n left[0] = A[0] right[n - 1] = A[n - 1] for i in range(1, n): left[i] = max(left[i - 1], A[i]) for i in range(n - 2, -1, -1): right[i] = min(right[i + ...
class Matrix: def __init__(self, matrix_string: str): # Split matrix_string into lines, split lines on whitespace and cast elements as integers. self.matrix = [[int(j) for j in i.split()] for i in matrix_string.splitlines()] def row(self, index: int) -> list[int]: return self.matrix[ind...
class Matrix: def __init__(self, matrix_string: str): self.matrix = [[int(j) for j in i.split()] for i in matrix_string.splitlines()] def row(self, index: int) -> list[int]: return self.matrix[index - 1] def column(self, index: int) -> list[int]: return [i[index - 1] for i in self...
Colors = {'snow': ('255', '250', '250'), 'ghostwhite': ('248', '248', '255'), 'GhostWhite': ('248', '248', '255'), 'whitesmoke': ('245', '245', '245'), 'WhiteSmoke': ('245', '245', '245'), 'gainsboro': ('220', '220', '220'), 'floralwhite': ('255', '250', '240'), 'FloralWhite': ('255', '250', '240'), 'oldlace': ('253', ...
colors = {'snow': ('255', '250', '250'), 'ghostwhite': ('248', '248', '255'), 'GhostWhite': ('248', '248', '255'), 'whitesmoke': ('245', '245', '245'), 'WhiteSmoke': ('245', '245', '245'), 'gainsboro': ('220', '220', '220'), 'floralwhite': ('255', '250', '240'), 'FloralWhite': ('255', '250', '240'), 'oldlace': ('253', ...
class Student: def __init__(self, id: str, name: str) -> None: self.id = id self.name = name class Course: def __init__(self, id: str, name: str, hours: int, grades = None) -> None: self.id = id self.name = name self.hours = hours self.grades = grades or {} ...
class Student: def __init__(self, id: str, name: str) -> None: self.id = id self.name = name class Course: def __init__(self, id: str, name: str, hours: int, grades=None) -> None: self.id = id self.name = name self.hours = hours self.grades = grades or {} ...
class WebServerDefinitions: name = None root = None template = None https = False default_template = 'laravel' def __init__(self, name, root, template=None, https=False): self.name = name self.root = root self.https = https if not template: template ...
class Webserverdefinitions: name = None root = None template = None https = False default_template = 'laravel' def __init__(self, name, root, template=None, https=False): self.name = name self.root = root self.https = https if not template: template =...
class GraphReprBase(object): @staticmethod def read_from_file(input_file): raise NotImplemented()
class Graphreprbase(object): @staticmethod def read_from_file(input_file): raise not_implemented()
STATUS_MAP = { 'RECEIVED_UNREAD': b'0', 'RECEIVED_READ': b'1', 'STORED_UNSENT': b'2', 'STORED_SENT': b'3', 'ALL': b'4' } STATUS_MAP_R = { b'0': 'RECEIVED_UNREAD', b'1': 'RECEIVED_READ', b'2': 'STORED_UNSENT', b'3': 'STORED_SENT', b'4': 'ALL' } DELETE_FLAG = { 'ALL_READ': b...
status_map = {'RECEIVED_UNREAD': b'0', 'RECEIVED_READ': b'1', 'STORED_UNSENT': b'2', 'STORED_SENT': b'3', 'ALL': b'4'} status_map_r = {b'0': 'RECEIVED_UNREAD', b'1': 'RECEIVED_READ', b'2': 'STORED_UNSENT', b'3': 'STORED_SENT', b'4': 'ALL'} delete_flag = {'ALL_READ': b'1', 'READ_AND_SENT': b'2', 'READ_AND_UNSENT': b'3',...
def collatz(n, count): if n == 1: return count else: count = count + 1 if n % 2 == 0: n = n /2 else: n = 3 * n + 1 return collatz(n, count) max_collatz = 1 iteration = 1 for i in range(1, 1000000): count = 1 contesting = collatz(i, 1) ...
def collatz(n, count): if n == 1: return count else: count = count + 1 if n % 2 == 0: n = n / 2 else: n = 3 * n + 1 return collatz(n, count) max_collatz = 1 iteration = 1 for i in range(1, 1000000): count = 1 contesting = collatz(i, 1) ...
# -*- coding: utf-8 -*- """ Actually, i want to design a django model-like with fields and inline validators, of course time is against me, so i wrote this; close enough (not really) xD If 'f' is None means that validator generate the content of the field """ MAIN_FIELDS = [ { 'f': None, # From JSO...
""" Actually, i want to design a django model-like with fields and inline validators, of course time is against me, so i wrote this; close enough (not really) xD If 'f' is None means that validator generate the content of the field """ main_fields = [{'f': None, 't': 'offer-id', 'type': 'uuid', 'required': True},...
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ # Functions allow variable-length argument lists def main(): kitten('meow', 'grrr', 'purr') # We treat it as a sequence, actually a tuple def kitten(*args): # It's denoted as *args. args is the conventional name if len(args): # If the length of ar...
def main(): kitten('meow', 'grrr', 'purr') def kitten(*args): if len(args): for s in args: print(s) else: print('Meow.') if __name__ == '__main__': main() x = ('hiss', 'howl', 'roar', 'screech') kitten(*x)
for i in range(5): for j in range(5): if i==j: print('#',end='') else: print("+",end='') print("")
for i in range(5): for j in range(5): if i == j: print('#', end='') else: print('+', end='') print('')
DATA_URL = 'http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data' DATA_COLUMNS = ['MPG', 'Cylinders', 'Displacement', 'Horsepower', 'Weight', 'Acceleration', 'Model Year', 'Origin'] NORMALIZE = False TARGET_VARIABLE = 'MPG' # FEATURES_TO_USE = [ 'Cylinders', 'Displacement', 'H...
data_url = 'http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data' data_columns = ['MPG', 'Cylinders', 'Displacement', 'Horsepower', 'Weight', 'Acceleration', 'Model Year', 'Origin'] normalize = False target_variable = 'MPG' features_to_use = ['MPG', 'Horsepower', 'Displacement'] normalize_hor...
# question : https://quera.ir/problemset/contest/8901 x_n = input().split(' ') x = x_n[1] n = int(x_n[0]) default_value = { 'L': 0, 'M': 0, 'R': 0, } movements = [] for one_input in range(n): movements.append(input().split(' ')) default_value[x] = 1 for one_movement in movements: temp = default_va...
x_n = input().split(' ') x = x_n[1] n = int(x_n[0]) default_value = {'L': 0, 'M': 0, 'R': 0} movements = [] for one_input in range(n): movements.append(input().split(' ')) default_value[x] = 1 for one_movement in movements: temp = default_value.get(one_movement[0]) default_value[one_movement[0]] = default_v...