content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python3 # -*- coding=utf-8 -*- __title__ = "TotalPass" __description__ = "Defualt password scanner and searcher" __url__ = "https://github.com/0xHJK/TotalPass" __version__ = "0.0.2" __author__ = "HJK" __author_email__ = "HJKdev@gmail.com" __license__ = "MIT License" __copyright__ = "Copyright 2020 HJK"...
__title__ = 'TotalPass' __description__ = 'Defualt password scanner and searcher' __url__ = 'https://github.com/0xHJK/TotalPass' __version__ = '0.0.2' __author__ = 'HJK' __author_email__ = 'HJKdev@gmail.com' __license__ = 'MIT License' __copyright__ = 'Copyright 2020 HJK'
#!/usr/bin/env python # T. Carman Spring 2020 # Script to make a few adjustments to the Makefile to allow it # to work on macOS Catalina (10.15) using macports as a package manager. def swap_boost_mt(x): # checking for '-mt' allows script to be run multiple times # without problems. if ('-lboost_' in x) and ('-...
def swap_boost_mt(x): if '-lboost_' in x and '-mt' not in x: return x + '-mt' else: return x def swap_lapacke(x): if '-llapacke' in x: return '-lopenblas' else: return x def apply_fixes(x): x = ' '.join([swap_boost_mt(i) for i in x.split(' ')]) x = ' '.join([swa...
def process_train_val_file(split_file_path): with open(split_file_path) as f: train_lines = f.readlines() for i in range(len(train_lines)): train_lines[i] = train_lines[i].strip() return train_lines
def process_train_val_file(split_file_path): with open(split_file_path) as f: train_lines = f.readlines() for i in range(len(train_lines)): train_lines[i] = train_lines[i].strip() return train_lines
def c(): for row in range(7): for col in range(5): if (col==0 and (row!=0 and row!=6)) or ((row==0 or row==6) and (col>0)): print("*",end=" ") else: print(end=" ") print()
def c(): for row in range(7): for col in range(5): if col == 0 and (row != 0 and row != 6) or ((row == 0 or row == 6) and col > 0): print('*', end=' ') else: print(end=' ') print()
# Given an array target and integer n, a function to return the list of operations need to meet the target array. # The following are the operations which can be performed on the stack: push and pop. class Solution: def buildArray(self, target: List[int], n: int) -> List[str]: stack = [] ops = [] ...
class Solution: def build_array(self, target: List[int], n: int) -> List[str]: stack = [] ops = [] for i in range(1, n + 1): if stack == target: break if i in target: stack.append(i) ops.append('Push') if i ...
api_key = '' secret_key = '' passphrase = ''
api_key = '' secret_key = '' passphrase = ''
# problem name: A+B Problem # problem link: https://acm.timus.ru/problem.aspx?space=1&num=1000 # contest link: (?) # time: (?) # author: reyad # other tags: (?) # difficulty level: beginner a, b = map(int, input().split()) print(a + b)
(a, b) = map(int, input().split()) print(a + b)
# V0 class Solution(object): def buildTree(self, inorder, postorder): if len(inorder) == 0: return None if len(inorder) == 1: return TreeNode(inorder[0]) root = TreeNode(postorder[len(postorder) - 1]) # get the value of "root" via postorder index = inorder.in...
class Solution(object): def build_tree(self, inorder, postorder): if len(inorder) == 0: return None if len(inorder) == 1: return tree_node(inorder[0]) root = tree_node(postorder[len(postorder) - 1]) index = inorder.index(postorder[len(postorder) - 1]) ...
__all__ = ['get_result_list'] def get_result_list(data): if isinstance(data, list): return data elif isinstance(data, dict): results = data.get('results', None) if isinstance(results, list): return results raise ValueError("Data is not list api result: {}".format(data)...
__all__ = ['get_result_list'] def get_result_list(data): if isinstance(data, list): return data elif isinstance(data, dict): results = data.get('results', None) if isinstance(results, list): return results raise value_error('Data is not list api result: {}'.format(data))
class Odometry(): def __init__(self): self._dst_traveled_angle_turned = None,None self._moved = None self._grasp = None def get_dst_traveled_angle_turned(self): return self._dst_traveled_angle_turned def set_dst_traveled_angle_turned(self,value): ...
class Odometry: def __init__(self): self._dst_traveled_angle_turned = (None, None) self._moved = None self._grasp = None def get_dst_traveled_angle_turned(self): return self._dst_traveled_angle_turned def set_dst_traveled_angle_turned(self, value): self._dst_travel...
''' Kattis - bossbattle Just look at the pattern, draw if necessary. Time: O(1), Space: O(1) ''' x = int(input()) if x <= 3: print(1) else: print(x-2)
""" Kattis - bossbattle Just look at the pattern, draw if necessary. Time: O(1), Space: O(1) """ x = int(input()) if x <= 3: print(1) else: print(x - 2)
"""Example adapters package.""" class EmailSender: """Abstract email sender.""" def send(self, to, body): """Send email to specified email.""" raise NotImplementedError() class SmtpEmailSender: """SMTP email sender uses SMTP protocol for sending emails.""" def send(self, to, body):...
"""Example adapters package.""" class Emailsender: """Abstract email sender.""" def send(self, to, body): """Send email to specified email.""" raise not_implemented_error() class Smtpemailsender: """SMTP email sender uses SMTP protocol for sending emails.""" def send(self, to, body):...
# -*- coding: utf-8 -*- """ Created on Sat Feb 20 21:03:29 2021 @author: Lakhan Kumawat """ #Sorted keyword in python #lets sort a tuple tup=("c","a","b") print(sorted(tup)) #when we use sorted in dictionary it will by default sort by keys dic={3:"c",2:"b",1:"a"} print(sorted(dic)) print(dic) #lets...
""" Created on Sat Feb 20 21:03:29 2021 @author: Lakhan Kumawat """ tup = ('c', 'a', 'b') print(sorted(tup)) dic = {3: 'c', 2: 'b', 1: 'a'} print(sorted(dic)) print(dic) l = ['aaaa', 'bbb', 'cc'] print(sorted(L, key=len))
class Node: """ Represent a node in binary tree """ def __init__(self, string,left=None,right=None): self.left = left self.right = right self.string = string def __str__(self): return "("+str(self.left)+str(self.string)+str(self.right)+")"
class Node: """ Represent a node in binary tree """ def __init__(self, string, left=None, right=None): self.left = left self.right = right self.string = string def __str__(self): return '(' + str(self.left) + str(self.string) + str(self.right) + ')'
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}} INSTALLED_APPS = [ "beam", "beam.themes.bootstrap4", "testapp", "crispy_forms", "django.contrib.contenttypes", # "django.contrib.admin", "django.contrib.sessions", "django.contrib.auth", # contrib....
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} installed_apps = ['beam', 'beam.themes.bootstrap4', 'testapp', 'crispy_forms', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.auth', 'reversion', 'beam.contrib.reversion', 'dal', 'beam.contrib.autocomplete_l...
# # PySNMP MIB module PDN-BRIDGE-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-BRIDGE-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:38:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ...
""" LeetCode Problem: 856. Score of Parentheses Link: https://leetcode.com/problems/score-of-parentheses/ Language: Python Written by: Mostofa Adib Shakib """ # Optimal Solution # Time Complexity: O(n) # Space Complexity: O(1) class Solution(object): def scoreOfParentheses(self, S): ans = bal = 0 ...
""" LeetCode Problem: 856. Score of Parentheses Link: https://leetcode.com/problems/score-of-parentheses/ Language: Python Written by: Mostofa Adib Shakib """ class Solution(object): def score_of_parentheses(self, S): ans = bal = 0 for (i, x) in enumerate(S): if x == '(': ...
# problem 16 # Project Euler __author__ = 'Libao Jin' __date__ = 'July 13, 2015' def PowerDigitSum(powerOrder): power = 2 ** powerOrder strPower = str(power) intPower = [] for i in strPower: intPower.append(int(i)) # pds: PowerDigitSum pds = sum(intPower) return [pds, power, intPower] def test(): powerOrde...
__author__ = 'Libao Jin' __date__ = 'July 13, 2015' def power_digit_sum(powerOrder): power = 2 ** powerOrder str_power = str(power) int_power = [] for i in strPower: intPower.append(int(i)) pds = sum(intPower) return [pds, power, intPower] def test(): power_order = 1000 pds = p...
#!/usr/bin/python3 KEY = "" MATRIX = [[None for _ in range(5)] for _ in range(5)] cols = [[None for _ in range(5)] for _ in range(5)] def initialize(): # alphabet set alphabet_set = [ "A", "B", "C", "D", "E", "F", "G", "H", "I", ...
key = '' matrix = [[None for _ in range(5)] for _ in range(5)] cols = [[None for _ in range(5)] for _ in range(5)] def initialize(): alphabet_set = ['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'] (k, c) = (0, 0) for i in ran...
class Solution: def findMinArrowShots(self, points): """ :type points: List[List[int]] :rtype: int """ points = sorted(points) if len(points) == 0: return 0 a = points[0][0] b = points[0][1] arrows = 1 for point in points:...
class Solution: def find_min_arrow_shots(self, points): """ :type points: List[List[int]] :rtype: int """ points = sorted(points) if len(points) == 0: return 0 a = points[0][0] b = points[0][1] arrows = 1 for point in point...
''' Author: ZHAO Zinan Created: 26-Oct-2018 best time to buy and sell stock 2 ''' class Solution: def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ if (len(prices) == 1 or len(prices) == 0): return 0 buy = -prices...
""" Author: ZHAO Zinan Created: 26-Oct-2018 best time to buy and sell stock 2 """ class Solution: def max_profit(self, prices): """ :type prices: List[int] :rtype: int """ if len(prices) == 1 or len(prices) == 0: return 0 buy = -prices[0] sel...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @created: 30.09.19 @author: felix """ def split_nums(num: str) -> tuple: nums = num.split('-') start = int(nums[0]) try: end = int(nums[1]) except (IndexError, ValueError): end = start return start, end def parse_ranges(args: str...
""" @created: 30.09.19 @author: felix """ def split_nums(num: str) -> tuple: nums = num.split('-') start = int(nums[0]) try: end = int(nums[1]) except (IndexError, ValueError): end = start return (start, end) def parse_ranges(args: str): ranges = args.split(',') for num in ...
""" AllyMessages are things which are said to allies AllyMessages are said to either all, or certain specific people. This is represented by the "target". Types of message: * <CHAR> SHOULD ATTACK * <CHAR> SHOULD RETREAT * <CHAR> SHOULD WAIT * <CHAR_A> SHOULD SUPPORT <CHAR_B> * <ALL> SHOULD SUPPORT <CHAR_B>...
""" AllyMessages are things which are said to allies AllyMessages are said to either all, or certain specific people. This is represented by the "target". Types of message: * <CHAR> SHOULD ATTACK * <CHAR> SHOULD RETREAT * <CHAR> SHOULD WAIT * <CHAR_A> SHOULD SUPPORT <CHAR_B> * <ALL> SHOULD SUPPORT <CHAR_B>...
def CantOpenHospital(Exception): pass def CantCloseHospital(Exception): pass def CantOpenPharmacy(Exception): pass def CantClosePharmacy(Exception): pass def DoesntHavePharmacy(Exception): pass def InvalidNumberOfEmployees(Exception): pass def TooMuchEmployees(Exception): pass
def cant_open_hospital(Exception): pass def cant_close_hospital(Exception): pass def cant_open_pharmacy(Exception): pass def cant_close_pharmacy(Exception): pass def doesnt_have_pharmacy(Exception): pass def invalid_number_of_employees(Exception): pass def too_much_employees(Exception): ...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- INC = 2.54 XPAD = 8.89 YPAD = 96.52 RECT_WIDTH = 0.508 PAD=("<pad name=\"%i\" x=\"%f\" y=\"%f\" drill=\"1.016\" shape=\"octagon\"/>") RECT=("<rectangle x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" layer=\"51\"/>") NR = 1 for i in range(0, 33): print(PAD % (NR, XPAD, YPAD-...
inc = 2.54 xpad = 8.89 ypad = 96.52 rect_width = 0.508 pad = '<pad name="%i" x="%f" y="%f" drill="1.016" shape="octagon"/>' rect = '<rectangle x1="%f" y1="%f" x2="%f" y2="%f" layer="51"/>' nr = 1 for i in range(0, 33): print(PAD % (NR, XPAD, YPAD - i * INC)) print(RECT % (XPAD - RECT_WIDTH / 2, YPAD - i * INC -...
X = 0 while True: X = input() if X != '2002': print('Senha Invalida') else: print('Acesso Permitido') break
x = 0 while True: x = input() if X != '2002': print('Senha Invalida') else: print('Acesso Permitido') break
"""Schevo base classes.""" # Copyright (c) 2001-2009 ElevenCraft Inc. # See LICENSE for details. class Database(object): pass class Entity(object): __slots__ = [] class Extent(object): pass class Field(object): __slots__ = [] class Query(object): pass class Results(object): pass c...
"""Schevo base classes.""" class Database(object): pass class Entity(object): __slots__ = [] class Extent(object): pass class Field(object): __slots__ = [] class Query(object): pass class Results(object): pass class Transaction(object): pass class View(object): pass classes = (Da...
SPECTATOR_TEAM = 0 RED_TEAM = 1 BLUE_TEAM = 2 NUM_ACTIONS = 3
spectator_team = 0 red_team = 1 blue_team = 2 num_actions = 3
# # PySNMP MIB module CXVR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXVR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:18:08 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, 09:23:1...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ...
age = int(input('Enter age: ')) if age < 13: print('You are a preteen.') elif age < 20: print('You are a teenager') elif age <= 30: print('You are still young.') else: print('You are one of the oldies')
age = int(input('Enter age: ')) if age < 13: print('You are a preteen.') elif age < 20: print('You are a teenager') elif age <= 30: print('You are still young.') else: print('You are one of the oldies')
class SQErzoException(Exception): pass class SQErzoElementExistException(Exception): pass __all__ = ("SQErzoException", "SQErzoElementExistException")
class Sqerzoexception(Exception): pass class Sqerzoelementexistexception(Exception): pass __all__ = ('SQErzoException', 'SQErzoElementExistException')
class Yaku: name = None english = None japanese = None chinese = None han_open = None han_closed = None is_yakuman = None def __init__(self): self.set_attributes() def __str__(self): return self.name def __repr__(self): # for calls in array retu...
class Yaku: name = None english = None japanese = None chinese = None han_open = None han_closed = None is_yakuman = None def __init__(self): self.set_attributes() def __str__(self): return self.name def __repr__(self): return self.__str__() def is...
#!/usr/bin/env python def get_objects(s3_client, *, bucket, prefix): """ Generates every object in an S3 bucket. """ paginator = s3_client.get_paginator("list_objects_v2") for page in paginator.paginate(Bucket=bucket, Prefix=prefix): yield from page["Contents"] def get_object_versions(s3...
def get_objects(s3_client, *, bucket, prefix): """ Generates every object in an S3 bucket. """ paginator = s3_client.get_paginator('list_objects_v2') for page in paginator.paginate(Bucket=bucket, Prefix=prefix): yield from page['Contents'] def get_object_versions(s3_client, *, bucket, prefi...
# -*- coding: utf-8 -*- # # This file is part of BridgeDB, a Tor bridge distribution system. # # :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org> # please also see AUTHORS file # :copyright: (c) 2013 Isis Lovecruft # (c) 2007-2013, The Tor Project, Inc. # (c) 2007-2013...
"""Parsers for HTTP and Email headers. .. py:module:: bridgedb.parse.headers :synopsis: Parsers for HTTP and Email headers. bridgedb.parse.headers ======================= :: parseAcceptLanguage - Parse the contents of a client 'Accept-Language' header .. """ def parse_accept_language(header): """Parse the ...
__author__ = 'MN' def foo(): print('\ncalling foo()...') aString = 'bar' anInt = 42 print('foo()\'s globals: {}'.format(globals().keys())) print('foo()\'s locals: {}'.format(locals().keys())) print('__main__\'s globals: {}'.format(globals().keys())) print('__main__\'s locals: {}'.format(locals().k...
__author__ = 'MN' def foo(): print('\ncalling foo()...') a_string = 'bar' an_int = 42 print("foo()'s globals: {}".format(globals().keys())) print("foo()'s locals: {}".format(locals().keys())) print("__main__'s globals: {}".format(globals().keys())) print("__main__'s locals: {}".format(locals().keys...
load("//tensorflow:tensorflow.bzl", "tf_custom_op_library_additional_deps", "tf_copts", "clean_dep", "if_cuda", "cuda_default_copts", "check_deps") def _cuda_copts_(): """Gets the appropriate set of copts for (maybe) CUDA compilation. If we're doing CUDA compilation, returns copts for our particular CUDA c...
load('//tensorflow:tensorflow.bzl', 'tf_custom_op_library_additional_deps', 'tf_copts', 'clean_dep', 'if_cuda', 'cuda_default_copts', 'check_deps') def _cuda_copts_(): """Gets the appropriate set of copts for (maybe) CUDA compilation. If we're doing CUDA compilation, returns copts for our particular CUDA ...
class Solution: def _binary_search(self, nums, left, right, val): """ both of left and right is included index """ if left > right: return None else: mid = (left + right) // 2 if nums[mid] == val: return mid elif...
class Solution: def _binary_search(self, nums, left, right, val): """ both of left and right is included index """ if left > right: return None else: mid = (left + right) // 2 if nums[mid] == val: return mid eli...
PAD = 0 UNK = 1 SEP = 2 CLS = 3 MASK = 4 WORD = { UNK: '<unk>', PAD: '<pad>', SEP: '<sep>', CLS: '<cls>', MASK: '<mask>', } RANDOM_MARK = 0.8 RANDOM_WORD = 0.5 RANDOM_WORD_SAMPLE = 0.15 RANDOM_SENT = 0.5 NEXT = 1 NOT_NEXT = 0 SEGMENTA = 1 SEGMENTB = 2 INIT_RANGE = 0.02 NOT_USE_WEIGHT_DECAY =...
pad = 0 unk = 1 sep = 2 cls = 3 mask = 4 word = {UNK: '<unk>', PAD: '<pad>', SEP: '<sep>', CLS: '<cls>', MASK: '<mask>'} random_mark = 0.8 random_word = 0.5 random_word_sample = 0.15 random_sent = 0.5 next = 1 not_next = 0 segmenta = 1 segmentb = 2 init_range = 0.02 not_use_weight_decay = ['bias', 'gamma', 'beta'] spli...
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 """Partition. A partition is a group of AWS Regions. This module provides a helper function to help determine the proper partition given a region name. For more details on partitions, see: https://docs.aws.amazo...
"""Partition. A partition is a group of AWS Regions. This module provides a helper function to help determine the proper partition given a region name. For more details on partitions, see: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces """ def get_partition(re...
__author__ = 'cody' class AlreadyExistsException(Exception): pass class UserAlreadyExistsException(Exception): pass class NotFoundException(Exception): pass class UnauthorisedException(Exception): pass class AuthenticationFailureException(Exception): pass class ForbiddenException(Exception): ...
__author__ = 'cody' class Alreadyexistsexception(Exception): pass class Useralreadyexistsexception(Exception): pass class Notfoundexception(Exception): pass class Unauthorisedexception(Exception): pass class Authenticationfailureexception(Exception): pass class Forbiddenexception(Exception): ...
# Copyright 2017 Intel Corporation. # # 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 agreed to in writ...
"""Generic class to hold sotware version information shown in the report """ class Version(object): """Container to keep software version details """ def __init__(self, name, version, git_tag='NA'): """Create Version object with given data """ self._version = {'name': name, 'versio...
"""function Reset local encounters, reverting back to level-wide encounters. Reverts back to level-wide encounters. Typically only used within the **encounter** region. in: None """ class ResetLocalEncounters: def __init__(self, act, src, user): act.funcs.append(self) self.init_time = act.curre...
"""function Reset local encounters, reverting back to level-wide encounters. Reverts back to level-wide encounters. Typically only used within the **encounter** region. in: None """ class Resetlocalencounters: def __init__(self, act, src, user): act.funcs.append(self) self.init_time = act.curre...
def fatorial (n): n_fatorial = 1 i = 0 pi = 1 while i < n: pi = (n - i) i = i + 1 n_fatorial = n_fatorial * pi return n_fatorial print (n_fatorial) def coef_binomial (n, k): return fatorial (n) / (fatorial (k)* fatorial(n - k))
def fatorial(n): n_fatorial = 1 i = 0 pi = 1 while i < n: pi = n - i i = i + 1 n_fatorial = n_fatorial * pi return n_fatorial print(n_fatorial) def coef_binomial(n, k): return fatorial(n) / (fatorial(k) * fatorial(n - k))
SECRET_KEY = 'NotVerySecretKey' INSTALLED_APPS = ( 'djabout', ) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', }, } USE_TZ = True ROOT_URLCONF = 'djabout.urls' APP_VERSION = 'To override'
secret_key = 'NotVerySecretKey' installed_apps = ('djabout',) databases = {'default': {'ENGINE': 'django.db.backends.sqlite3'}} use_tz = True root_urlconf = 'djabout.urls' app_version = 'To override'
### DO NOT EDIT THIS FILE!!! ### DO NOT TRY TO COMMIT THIS FILE TO CVS REPOSITORY!!! cvs_version = (1,34,76,586) cvs_date = (2005,3,24,9,22,43) # GMT
cvs_version = (1, 34, 76, 586) cvs_date = (2005, 3, 24, 9, 22, 43)
#!/usr/bin/env python # # Copyright 2007 Google 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 applicable law o...
"""Socket exception classes. These exception classes are used instead of those provided by the system. They are in a separate file to avoid circular dependencies. """ class Error(IOError): """Base error class.""" class Gaierror(error): pass class Herror(error): pass class Timeout(error): pass
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage command += testshade("-t 1 -g 64 64 -od uint8 test -o cout rt_out.tif") command += testshade("-t 1 -g 64 64 -od uint8 raytype_...
command += testshade('-t 1 -g 64 64 -od uint8 test -o cout rt_out.tif') command += testshade('-t 1 -g 64 64 -od uint8 raytype_all -o cout rta_out.tif') command += testshade('-t 1 -g 64 64 -od uint8 raytype_varying_result -o cout rtvr_out.tif') command += testshade('-batched -t 1 -g 64 64 -od uint8 raytype_varying_name ...
# Given a two list of ints create a third list such that should contain only odd numbers from the first list # and even numbers from the second list # My Solution def mergeList(list1, list2): result = [] for num1 in list1: if num1 % 2 != 0: result.append(num1) for num2 in list2: ...
def merge_list(list1, list2): result = [] for num1 in list1: if num1 % 2 != 0: result.append(num1) for num2 in list2: if num2 % 2 == 0: result.append(num2) return result list_one = [10, 20, 23, 11, 17] list_two = [13, 43, 24, 36, 12] print('Merged List is') print(...
def get_bounds(grid): return len(grid), len(grid[0]) def iter_positions(grid): maxi, maxj = get_bounds(grid) for i in range(maxi): for j in range(maxj): yield i, j def make_slice(position, direction, length): for _ in range(length): yield position i, j = position ...
def get_bounds(grid): return (len(grid), len(grid[0])) def iter_positions(grid): (maxi, maxj) = get_bounds(grid) for i in range(maxi): for j in range(maxj): yield (i, j) def make_slice(position, direction, length): for _ in range(length): yield position (i, j) = pos...
def HTML(content, title): return ''' <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js" integrity="sha512-F/gIMdDfda6OD2rnzt/Iyp2V9J...
def html(content, title): return '\n\t<!DOCTYPE html>\n\t<html lang="en">\n\t\t<head>\n\t\t\t<meta charset="UTF-8">\n\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1.0">\n\t\t\t<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js"\n\t\t\t\tintegrity="sha512-F/...
# -*- coding: utf-8 -*- """ Ax_Metrics - Common pytest configuration. Main tests and conftest.py are in tests/ directory. This is a top level conftest to allow more flexible running of tests, e.g. by executing "tests/RUN.py" from this directory. Note: 'conftest.py' is a magic filename used by py.test. --------------...
""" Ax_Metrics - Common pytest configuration. Main tests and conftest.py are in tests/ directory. This is a top level conftest to allow more flexible running of tests, e.g. by executing "tests/RUN.py" from this directory. Note: 'conftest.py' is a magic filename used by py.test. --------------------------------------...
def ncr(n,r): c=[[0]*(r+1) for x in range (n+1)] for i in range (n+1): for j in range (r+1): if j==0: c[i][j]=1 elif i==j: c[i][j]=1 elif i>j: c[i][j]=c[i-1][j-1]+c[i-1][j] return c[n][r] n=int(input("Ente...
def ncr(n, r): c = [[0] * (r + 1) for x in range(n + 1)] for i in range(n + 1): for j in range(r + 1): if j == 0: c[i][j] = 1 elif i == j: c[i][j] = 1 elif i > j: c[i][j] = c[i - 1][j - 1] + c[i - 1][j] return c[n][r...
# # PySNMP MIB module RADLAN-CPU-COUNTERS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-CPU-COUNTERS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:37:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ...
# Copyright 2021, Evula A. S., All rights reserved. # IC8-63 BMSTU class NN: def __init__(self, rate): self.W = [0] * 3 self.Rate = rate self.X = [ [0, 0], [0, 1], [1, 0], [1, 1] ] self.t = [0, 1, 1, 0] self.border = 0 def work(self): self.epoch = 0 E = 1 while (E > 0 and self.epoch < ...
class Nn: def __init__(self, rate): self.W = [0] * 3 self.Rate = rate self.X = [[0, 0], [0, 1], [1, 0], [1, 1]] self.t = [0, 1, 1, 0] self.border = 0 def work(self): self.epoch = 0 e = 1 while E > 0 and self.epoch < 101: print(f'\n---...
class MNIST: def __init__(self): self.n = 60000 self.qn = 1000 self.d = 50 # [293.8953705 328.277313 348.174515 360.718002 370.533325 377.599426 # 384.100876 390.465744 396.036606 401.089386 ] self.r = 401 self.name = 'Mnist' class MNIST784: d...
class Mnist: def __init__(self): self.n = 60000 self.qn = 1000 self.d = 50 self.r = 401 self.name = 'Mnist' class Mnist784: def __init__(self): self.n = 60000 self.qn = 1000 self.d = 784 self.r = 1270 self.name = 'Mnist784' clas...
# -------------- # Code starts here # Create the lists class_1 = ['Geoffrey','Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] class_2 = ['Hilary Mason','Carla Gentry','Corinna Cortes'] # Concatenate both the strings new_class = class_1 + class_2 print(new_class) # Append the list new_class.append('Peter Ward...
class_1 = ['Geoffrey', 'Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio'] class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes'] new_class = class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_class) courses = {'Math': 65, 'Engl...
''' Logging Library : For neat logging Author: Vignesh Natarajan (a) Viki viki@vikilabs.org ''' class logger(): def __init__(self): self._st = "[ STARTED ] " self._ed = "[ COMPLETED ] " self._if = "[ INFO ] " self._wr = "[ WARNING ] " ...
""" Logging Library : For neat logging Author: Vignesh Natarajan (a) Viki viki@vikilabs.org """ class Logger: def __init__(self): self._st = '[ STARTED ] ' self._ed = '[ COMPLETED ] ' self._if = '[ INFO ] ' self._wr = '[ WARNING ] ' se...
"""lejon The main package for the Lejon Packer/Linker utility. """ # This module should be kept compatible with Python 2.1. __revision__ = "$Id:$" __version__ = "1.0"
"""lejon The main package for the Lejon Packer/Linker utility. """ __revision__ = '$Id:$' __version__ = '1.0'
#dervied from http://farsitools.sf.net #Copyright (C) 2003-2011 Parspooyesh Fanavar (http://parspooyesh.com/) #see LICENSE.txt g_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] j_days_in_month = [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29] class GregorianToJalali: def __init__(self,gyear,gm...
g_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] j_days_in_month = [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29] class Gregoriantojalali: def __init__(self, gyear, gmonth, gday): """ Convert gregorian date to jalali date gmonth: number of month in range 1-12 ...
# -*- coding: utf-8 -*- """ Created on Mon Feb 13 18:37:30 2017 @author: coskun Midterm Exam - Problem 5 (10 points possible) Write a Python function that returns the sum of the pairwise products of listA and listB. You should assume that listA and listB have the same length and are two lists of integer numbers. For...
""" Created on Mon Feb 13 18:37:30 2017 @author: coskun Midterm Exam - Problem 5 (10 points possible) Write a Python function that returns the sum of the pairwise products of listA and listB. You should assume that listA and listB have the same length and are two lists of integer numbers. For example, if listA = [1,...
""" Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and left...
""" Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and left...
class Solution: def specialArray(self, nums: List[int]) -> int: check = [-1 for _ in range(1000)] for num in nums: for i in range(0, num): check[i] += 1 for i in range(len(check)): if i == check[i]: return che...
class Solution: def special_array(self, nums: List[int]) -> int: check = [-1 for _ in range(1000)] for num in nums: for i in range(0, num): check[i] += 1 for i in range(len(check)): if i == check[i]: return check[i] + 1 return ...
# # PySNMP MIB module CISCO-FIREWALL-TC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FIREWALL-TC # Produced by pysmi-0.3.4 at Wed May 1 11:58:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, single_value_constraint, value_range_constraint, constraints_intersection) ...
# Copyright 2017 Become Corp. 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
"""Errors used by the Yahoo Promotional Ads Client Library.""" class Yahooadserror(Exception): """Base error class""" pass class Webfaulterror(YahooAdsError): """"Wrapper for error thrown by the web service""" pass class Servicelocationerror(YahooAdsError): """"Error in LocationService when reque...
# Define a function that recieves a list of all primes < n, and a # number n for which you are checking for primality def is_prime(primes, n): # Iterate over all prime values in the prime list for prime in primes: # If n is evenly divisble by a prime value # then it is not itself a prime value...
def is_prime(primes, n): for prime in primes: if n % prime == 0: return False return True def is_truncatable(primes, n): for i in range(0, len(str(n))): subvalue = str(n)[i:len(str(n))] if int(subvalue) not in primes: return False for i in range(1, len(st...
''' Test basic views ''' def test_swagger(auth_client): rv = auth_client.get('/swagger/') assert rv.status_code == 200
""" Test basic views """ def test_swagger(auth_client): rv = auth_client.get('/swagger/') assert rv.status_code == 200
for i in range(0, int(input())): n = int(input()) try: while True: if n>0: if n%2==0: print("YES") break elif ((3*n)+1)%2==0: print("YES") break else: ...
for i in range(0, int(input())): n = int(input()) try: while True: if n > 0: if n % 2 == 0: print('YES') break elif (3 * n + 1) % 2 == 0: print('YES') break else: ...
def solution(answers): answer = [] score = [0, 0, 0] sol1 = [1, 2, 3, 4, 5] sol2 = [2, 1, 2, 3, 2, 4, 2, 5] sol3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5] for i in range(len(answers)) : if sol1[i % len(sol1)] == answers[i] : score[0] += 1 if sol2[i % len(sol2)] == answers...
def solution(answers): answer = [] score = [0, 0, 0] sol1 = [1, 2, 3, 4, 5] sol2 = [2, 1, 2, 3, 2, 4, 2, 5] sol3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5] for i in range(len(answers)): if sol1[i % len(sol1)] == answers[i]: score[0] += 1 if sol2[i % len(sol2)] == answers[i]: ...
class Duplicate_Cell_Value_In_Group_Exception(Exception): """Exception raised when code tries to remove all values from a Cell. Attributes: repeated_candidate -- Cell trying to blank group -- reason for exception """ def __init__(self, group_candidates, group_name): self.group_...
class Duplicate_Cell_Value_In_Group_Exception(Exception): """Exception raised when code tries to remove all values from a Cell. Attributes: repeated_candidate -- Cell trying to blank group -- reason for exception """ def __init__(self, group_candidates, group_name): self.group_...
''' URL: https://leetcode.com/problems/lucky-numbers-in-a-matrix/ Difficulty: Easy Description: Lucky Numbers in a Matrix Given a m * n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it is the minimum element in its row and maxim...
""" URL: https://leetcode.com/problems/lucky-numbers-in-a-matrix/ Difficulty: Easy Description: Lucky Numbers in a Matrix Given a m * n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it is the minimum element in its row and maxim...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 23 15:43:25 2022 @author: qcao """
""" Created on Wed Mar 23 15:43:25 2022 @author: qcao """
def phoneCall(min1, min2_10, min11, s): minutes = 0 if s - min1 < 0: return minutes minutes += 1 s -= min1 while s > 0: minutes += 1 if 1 <= minutes <= 10: s -= min2_10 elif minutes > 10: s -= min11 if s < 0: minutes -= 1 return...
def phone_call(min1, min2_10, min11, s): minutes = 0 if s - min1 < 0: return minutes minutes += 1 s -= min1 while s > 0: minutes += 1 if 1 <= minutes <= 10: s -= min2_10 elif minutes > 10: s -= min11 if s < 0: minutes -= 1 retur...
b = int(input("Enter the base of triangle:")) h = int(input("Enter the height of triangle:")) print("The area of the triangle is",round(0.5*b*h,2))
b = int(input('Enter the base of triangle:')) h = int(input('Enter the height of triangle:')) print('The area of the triangle is', round(0.5 * b * h, 2))
def preprocess(data, lang): if data.get("xccdf_variable") and data.get("embedded_data") == "true": values = data.get("values", [{}]) if len(values) > 1: raise ValueError( "Only a single value can be checked when querying " "for a 'xccdf_value' that return...
def preprocess(data, lang): if data.get('xccdf_variable') and data.get('embedded_data') == 'true': values = data.get('values', [{}]) if len(values) > 1: raise value_error("Only a single value can be checked when querying for a 'xccdf_value' that returns an embedded value. Rule ID: {}".fo...
f = open ('test.txt', 'w') f.write ('first line of file \n') f.write ('second line of file \n') f.close() f = open ('test.txt') content = f.read() print (content) f.close()
f = open('test.txt', 'w') f.write('first line of file \n') f.write('second line of file \n') f.close() f = open('test.txt') content = f.read() print(content) f.close()
"""Top-level package for hiproc.""" __author__ = """Ross A. Beyer""" __email__ = 'rbeyer@seti.org' __version__ = '0.7.1'
"""Top-level package for hiproc.""" __author__ = 'Ross A. Beyer' __email__ = 'rbeyer@seti.org' __version__ = '0.7.1'
""" Handling of PSD data ==================== The :code:`artssat.scattering.psd.data` subpackage provides the :class:`PSDData` class for the handling of numeric PSD data. Numeric PSD data here refers to a PSD that is not given in a parametrized form but instead by an array of particle density values over a given size ...
""" Handling of PSD data ==================== The :code:`artssat.scattering.psd.data` subpackage provides the :class:`PSDData` class for the handling of numeric PSD data. Numeric PSD data here refers to a PSD that is not given in a parametrized form but instead by an array of particle density values over a given size ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def helper(self, num, first, last): if last < first: return None mid = first + (last - first) // 2 ...
class Solution: def helper(self, num, first, last): if last < first: return None mid = first + (last - first) // 2 root = tree_node(num[mid]) root.left = self.helper(num, first, mid - 1) root.right = self.helper(num, mid + 1, last) return root def so...
class Solution(object): def complexNumberMultiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ ai = num1.index("+") bi = num2.index("+") x1, y1 = int(num1[:ai]), int(num1[ai+1:-1]) x2, y2 = int(num2[:bi]), int(num2[bi+...
class Solution(object): def complex_number_multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ ai = num1.index('+') bi = num2.index('+') (x1, y1) = (int(num1[:ai]), int(num1[ai + 1:-1])) (x2, y2) = (int(num2[:bi]), ...
expected_output = { 'vrf': { 'default': { 'peers': { '10.16.0.2': { 'label_space_id': { 0: { 'tcp_connection': '10.16.0.2:646 - 10.16.0.9:38143', 'graceful_restart': 'No', ...
expected_output = {'vrf': {'default': {'peers': {'10.16.0.2': {'label_space_id': {0: {'tcp_connection': '10.16.0.2:646 - 10.16.0.9:38143', 'graceful_restart': 'No', 'session_holdtime': 180, 'state': 'Oper', 'msg_sent': 24710, 'msg_rcvd': 24702, 'neighbor': 'Downstream-Unsolicited', 'uptime': '2w0d', 'address_family': {...
enums = ['paragraph', 'division', 'chapter', 'section', 'clause', 'article', 'part', 'rule'] enums += ['sub' + s for s in enums] regex = r'(%s)' % '|'.join(sorted(enums, key=len, reverse=True))
enums = ['paragraph', 'division', 'chapter', 'section', 'clause', 'article', 'part', 'rule'] enums += ['sub' + s for s in enums] regex = '(%s)' % '|'.join(sorted(enums, key=len, reverse=True))
def f(): x = 42 f()
def f(): x = 42 f()
# Question: If we list all the natural numbers below 10 that are the multiples of 3 or 5, we get 3, 5, 6, 9. The sum of these is 23 Find the sum of all the multiples of 3 or 5 # This won't work because there are terms alike in multiples of 3 and 5 answer_3 = 0 answer_5 = 0 for char3 in range(0,1000,3): answer_3 ...
answer_3 = 0 answer_5 = 0 for char3 in range(0, 1000, 3): answer_3 = answer_3 + char3 for char5 in range(0, 1000, 5): answer_5 = answer_5 + char5 print(answer_3) print(answer_5) print(answer_3 + answer_5)
""" A decorator for adding memoization to functions. """ __author__ = 'Claus Martinsen' def memoize(func): """ A decorator to add the dynamic programming principle memoization to a function. """ memory = dict() def memoize_func(arg): if arg in memory: return memory[arg] el...
""" A decorator for adding memoization to functions. """ __author__ = 'Claus Martinsen' def memoize(func): """ A decorator to add the dynamic programming principle memoization to a function. """ memory = dict() def memoize_func(arg): if arg in memory: return memory[arg] else: ...
# Python - 2.7.6 Test.describe('Basic tests') Test.assert_equals(shorten_to_date('Monday February 2, 8pm'), 'Monday February 2') Test.assert_equals(shorten_to_date('Tuesday May 29, 8pm'), 'Tuesday May 29') Test.assert_equals(shorten_to_date('Wed September 1, 3am'), 'Wed September 1') Test.assert_equals(shorten_to_date...
Test.describe('Basic tests') Test.assert_equals(shorten_to_date('Monday February 2, 8pm'), 'Monday February 2') Test.assert_equals(shorten_to_date('Tuesday May 29, 8pm'), 'Tuesday May 29') Test.assert_equals(shorten_to_date('Wed September 1, 3am'), 'Wed September 1') Test.assert_equals(shorten_to_date('Friday May 2, 9a...
__author__ = "Samuel Robert Mathias" __copyright__ = "Copyright (c) 2018 Sam Mathias" __license__ = "MIT" __version__ = "2.1" __maintainer__ = "Samuel Robert Mathias" __email__ = "samuel.mathias@yale.edu" __status__ = "Production"
__author__ = 'Samuel Robert Mathias' __copyright__ = 'Copyright (c) 2018 Sam Mathias' __license__ = 'MIT' __version__ = '2.1' __maintainer__ = 'Samuel Robert Mathias' __email__ = 'samuel.mathias@yale.edu' __status__ = 'Production'
class Cache: _instance = None def __init__(self): self.data = {} @classmethod def instance(cls): if cls._instance is None: cls._instance = cls() return cls._instance
class Cache: _instance = None def __init__(self): self.data = {} @classmethod def instance(cls): if cls._instance is None: cls._instance = cls() return cls._instance
def init(): global context context = {} #things that aren't mutable and so need to be wrapped in a mutable for global access global images images = {} #named images -- returns image data for blitting global blitque blitque = [] #ordered tuples (images, rects) to blit, for now just go to backgr...
def init(): global context context = {} global images images = {} global blitque blitque = [] global entities entities = []
class Grid_generator: def __init__(self): self.Init_constants() def Init_constants(self): """Set all member variables which may have changes after __init__ is called""" self.constants = op('select_output_info') self.grid_data = op('table_grid_data') self.destination_grid = op('table_points') self.c2p = ...
class Grid_Generator: def __init__(self): self.Init_constants() def init_constants(self): """Set all member variables which may have changes after __init__ is called""" self.constants = op('select_output_info') self.grid_data = op('table_grid_data') self.destination_gri...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 30 20:46:40 2020 @author: magnus """ def bacteriaGrowth(n0, alpha, K, N): tN = 0 while n0 <= N: n0 = (1+alpha*(1-(n0/K)))*n0 tN +=1 return tN
""" Created on Wed Sep 30 20:46:40 2020 @author: magnus """ def bacteria_growth(n0, alpha, K, N): t_n = 0 while n0 <= N: n0 = (1 + alpha * (1 - n0 / K)) * n0 t_n += 1 return tN
''' from lims.inventory.models import Catalog, Tag, Part, Primer, RestrictionEnzyme class Command(BaseCommand): help = 'Imports a CSV of items into a inventory' def add_arguments(self, parser): parser.add_argument('inventory_id', type=int) parser.add_argument('username') parser.add_a...
""" from lims.inventory.models import Catalog, Tag, Part, Primer, RestrictionEnzyme class Command(BaseCommand): help = 'Imports a CSV of items into a inventory' def add_arguments(self, parser): parser.add_argument('inventory_id', type=int) parser.add_argument('username') parser.add_arg...
hall_length = float(input()) hall_width = float(input()) wardrobe = float(input()) hall_area = (hall_length * 100) * (hall_width * 100) wardrobe_area = pow(wardrobe * 100, 2) bench_area = hall_area / 10 area_left = hall_area - wardrobe_area - bench_area dancer_count = area_left // 7040 print(int(dancer_count))
hall_length = float(input()) hall_width = float(input()) wardrobe = float(input()) hall_area = hall_length * 100 * (hall_width * 100) wardrobe_area = pow(wardrobe * 100, 2) bench_area = hall_area / 10 area_left = hall_area - wardrobe_area - bench_area dancer_count = area_left // 7040 print(int(dancer_count))
class MapProperty: DATA_SIZE = 33 DATA_START = 0x2d8f00 def __init__(self, rom, id): self.rom = rom self.set_id(id) self.read() def set_id(self, id): self.id = id self.data_start = self.DATA_START + self.id * self.DATA_SIZE def read(self): self.dat...
class Mapproperty: data_size = 33 data_start = 2985728 def __init__(self, rom, id): self.rom = rom self.set_id(id) self.read() def set_id(self, id): self.id = id self.data_start = self.DATA_START + self.id * self.DATA_SIZE def read(self): self.data ...
b_assnmnt = 0 b_cndtl = 0 q_assnmnt = 0 q_cndtl = 0 def bubblesort(vec): """ x is an integer array of length 0 to j. bubblesort returns an array of length j in ascending order by swapping adjacent elements if they are not in the desired order. """ global b_assnmnt global b_cndtl # Ou...
b_assnmnt = 0 b_cndtl = 0 q_assnmnt = 0 q_cndtl = 0 def bubblesort(vec): """ x is an integer array of length 0 to j. bubblesort returns an array of length j in ascending order by swapping adjacent elements if they are not in the desired order. """ global b_assnmnt global b_cndtl for j i...
class Map(object): def __init__(self, index, img): self.index = index self.img = img class normalEstate(Map): def __init__(self, index, img, price, owner, numberOfHouses, roadToll): Map.__init__(self, index, img) self.price = price self.owner = owner self.number...
class Map(object): def __init__(self, index, img): self.index = index self.img = img class Normalestate(Map): def __init__(self, index, img, price, owner, numberOfHouses, roadToll): Map.__init__(self, index, img) self.price = price self.owner = owner self.numbe...
class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: head = l1 if l1 is None: return l2 elif l2 is None: return l1 elif l1 and l2 is None: return l1 else: while head.next is not None: ...
class Solution: def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode: head = l1 if l1 is None: return l2 elif l2 is None: return l1 elif l1 and l2 is None: return l1 else: while head.next is not None: ...
bind = "0.0.0.0:8001" workers = 3 timeout = 60 pidfile = "{{ taiga_back_pidfile_path }}" accesslog = "{{ taiga_back_access_log_path }}" errorlog = "{{ taiga_back_error_log_path }}" loglevel = 'info'
bind = '0.0.0.0:8001' workers = 3 timeout = 60 pidfile = '{{ taiga_back_pidfile_path }}' accesslog = '{{ taiga_back_access_log_path }}' errorlog = '{{ taiga_back_error_log_path }}' loglevel = 'info'
m = {'0':6, '1':2, '2':5, '3':5, '4':4, '5':5, '6':6, '7':3, '8':7, '9':6} for i in range(int(input())): a,b = [int(j) for j in input().split()] c = a+b s = 0 for j in str(c): s+=m[j] print(s)
m = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6} for i in range(int(input())): (a, b) = [int(j) for j in input().split()] c = a + b s = 0 for j in str(c): s += m[j] print(s)
with open("8/input.txt", "r") as file: data = file.read().split('\n') changed = [] has_changed = False executed = [] accumulator = 0 i = 0 while i < len(data): # reset if we execute an instruction again, that means we changed the wrong jmp/nop if i in executed: has_changed = False executed...
with open('8/input.txt', 'r') as file: data = file.read().split('\n') changed = [] has_changed = False executed = [] accumulator = 0 i = 0 while i < len(data): if i in executed: has_changed = False executed = [] accumulator = 0 i = 0 parts = data[i].split(' ') instruction...
with open('input') as f: code = {i: tuple(line.split(" ")) for i, line in enumerate(f.read().strip().split("\n"))} def run(code): try: acc = 0 pc = 0 while True: op, value = code[pc] del code[pc] if op == 'acc': acc += int(value) ...
with open('input') as f: code = {i: tuple(line.split(' ')) for (i, line) in enumerate(f.read().strip().split('\n'))} def run(code): try: acc = 0 pc = 0 while True: (op, value) = code[pc] del code[pc] if op == 'acc': acc += int(value) ...