content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- """ Created on Tue May 25 11:16:49 2021 @author: SST-Lab """ class XBank: loggedinCounter = 0 def _init_(self, atmpin, theaccountbalance, thename): self.atmpin = theatmpin self.accountbalance = theaccountbalance self.name = thename XBank.loggedinCounter ...
""" Created on Tue May 25 11:16:49 2021 @author: SST-Lab """ class Xbank: loggedin_counter = 0 def _init_(self, atmpin, theaccountbalance, thename): self.atmpin = theatmpin self.accountbalance = theaccountbalance self.name = thename XBank.loggedinCounter = XBank.loggedinCounte...
def linear_search(list, target): """ Returns the index position of the target if found, else returns None """ for i in range(0, len(list)): if list[i] == target: return i return None def verify(index): if index is not None: print("Target is found at index: ", index...
def linear_search(list, target): """ Returns the index position of the target if found, else returns None """ for i in range(0, len(list)): if list[i] == target: return i return None def verify(index): if index is not None: print('Target is found at index: ', index) ...
DEBIAN = 'debian' CENTOS = 'centos' OPENSUSE = 'opensuse' UBUNTU = 'ubuntu'
debian = 'debian' centos = 'centos' opensuse = 'opensuse' ubuntu = 'ubuntu'
#MenuTitle: Make bottom left node first # -*- coding: utf-8 -*- __doc__=""" Makes the bottom left node in each path the first node in all masters """ def left(x): return x.position.x def bottom(x): return x.position.y layers = Glyphs.font.selectedLayers for aLayer in layers: for idx, thisLayer in enumerate(a...
__doc__ = '\nMakes the bottom left node in each path the first node in all masters\n' def left(x): return x.position.x def bottom(x): return x.position.y layers = Glyphs.font.selectedLayers for a_layer in layers: for (idx, this_layer) in enumerate(aLayer.parent.layers): for p in thisLayer.paths: ...
class Solution(object): def nextPermutation(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ # find the longest non-decreasing suffix in nums right = len(nums) - 1 while right >= 1 and nums[right] <=...
class Solution(object): def next_permutation(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ right = len(nums) - 1 while right >= 1 and nums[right] <= nums[right - 1]: right -= 1 if rig...
cand1 = 0 cand2 = 0 cand3 = 0 eleitores = int(input('Digite a quantidade de eleitores: ')) print('Para votar no Candidato 1 digite [1]\nPara votar no Candidato 2 digite [2]\nPara votar no Candidato 3 digite [3]') for cont in range(0, eleitores): voto = str(input('Digite seu voto: ')) if voto == '1': can...
cand1 = 0 cand2 = 0 cand3 = 0 eleitores = int(input('Digite a quantidade de eleitores: ')) print('Para votar no Candidato 1 digite [1]\nPara votar no Candidato 2 digite [2]\nPara votar no Candidato 3 digite [3]') for cont in range(0, eleitores): voto = str(input('Digite seu voto: ')) if voto == '1': can...
# ---------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. # All rights reserved. # ---------------------------------------------------------------------- # TODO: Consider just inheriting from Python's set type -MPL class SymbolSet: def __init__(self): ...
class Symbolset: def __init__(self): self._symbol_set_collection = set() @property def size(self): return len(self._symbol_set_collection) def add(self, new_symbol): self._symbol_set_collection.add(new_symbol) def merge(self, sym_set): if sym_set is not None: ...
fix = {'5':'S', '0':'O', '1':'I'} def correct(s): return "".join(fix.get(c, c) for c in s)
fix = {'5': 'S', '0': 'O', '1': 'I'} def correct(s): return ''.join((fix.get(c, c) for c in s))
def config_step_task(name, task_name, task_params=[], on_failure='TERMINATE_CLUSTER'): """ Returns a Python dict representing the step. :param name: semantic name of the task :param task_name: task name, identifies executable :param task_params: task parameters :param on_failure: either "CONTI...
def config_step_task(name, task_name, task_params=[], on_failure='TERMINATE_CLUSTER'): """ Returns a Python dict representing the step. :param name: semantic name of the task :param task_name: task name, identifies executable :param task_params: task parameters :param on_failure: either "CONTI...
#!/usr/bin/python3 def test_erc165_support(nft): erc165_interface_id = "0x01ffc9a7" assert nft.supportsInterface(erc165_interface_id) is True def test_erc721_support(nft): erc721_interface_id = "0x80ac58cd" assert nft.supportsInterface(erc721_interface_id) is True
def test_erc165_support(nft): erc165_interface_id = '0x01ffc9a7' assert nft.supportsInterface(erc165_interface_id) is True def test_erc721_support(nft): erc721_interface_id = '0x80ac58cd' assert nft.supportsInterface(erc721_interface_id) is True
def fatorial(_numero = 1, show = False): resultado = 1 for item in range(1, _numero + 1): resultado *= item if show: texto = '' for item in reversed(range(1, _numero + 1)): texto += '{} '.format(item) if item == 1: texto += '= {}'.format(resul...
def fatorial(_numero=1, show=False): resultado = 1 for item in range(1, _numero + 1): resultado *= item if show: texto = '' for item in reversed(range(1, _numero + 1)): texto += '{} '.format(item) if item == 1: texto += '= {}'.format(resultado)...
""" Management of OpenStack Keystone Roles ====================================== .. versionadded:: 2018.3.0 :depends: shade :configuration: see :py:mod:`salt.modules.keystoneng` for setup instructions Example States .. code-block:: yaml create role: keystone_role.present: - name: role1 dele...
""" Management of OpenStack Keystone Roles ====================================== .. versionadded:: 2018.3.0 :depends: shade :configuration: see :py:mod:`salt.modules.keystoneng` for setup instructions Example States .. code-block:: yaml create role: keystone_role.present: - name: role1 dele...
BLACK = '\x1b[0;30m' RED = '\x1b[0;31m' GREEN = '\x1b[0;32m' BROWN = '\x1b[0;33m' BLUE = '\x1b[0;34m' PURPLE = '\x1b[0;35m' CYAN = '\x1b[0;36m' LIGHT_GRAY = '\x1b[0;37m' DARK_GRAY = '\x1b[1;30m' LIGHT_RED = '\x1b[1;31m' LIGHT_GREEN = '\x1b[1;32m' YELLOW = '\x1b[1;33m' LIGHT_BLUE = '\x1b[1;34m' LIGHT_PURPLE = '\x1b[1;3...
black = '\x1b[0;30m' red = '\x1b[0;31m' green = '\x1b[0;32m' brown = '\x1b[0;33m' blue = '\x1b[0;34m' purple = '\x1b[0;35m' cyan = '\x1b[0;36m' light_gray = '\x1b[0;37m' dark_gray = '\x1b[1;30m' light_red = '\x1b[1;31m' light_green = '\x1b[1;32m' yellow = '\x1b[1;33m' light_blue = '\x1b[1;34m' light_purple = '\x1b[1;35...
""" Assignment 8 1. Write a function that will return True if the passed-in number is even, and False if it is odd. 2. Write a second function that will call the first with values 0-6 and print each result on a new line. 3. Invoke the second function. The signature of the first function should be: `is_even(num: int) ...
""" Assignment 8 1. Write a function that will return True if the passed-in number is even, and False if it is odd. 2. Write a second function that will call the first with values 0-6 and print each result on a new line. 3. Invoke the second function. The signature of the first function should be: `is_even(num: int) ...
authentication = { "type": "object", "properties": { "access": { "type": "object", "properties": { "token": { "type": "object", "properties": { "id": { "type": "string" ...
authentication = {'type': 'object', 'properties': {'access': {'type': 'object', 'properties': {'token': {'type': 'object', 'properties': {'id': {'type': 'string'}}, 'required': ['id']}, 'serviceCatalog': {'type': 'array'}}, 'required': ['token', 'serviceCatalog']}}, 'required': ['access']}
class Node: def __init__(self, value): self.value = value self.next = None class Queue: def __init__(self): self.front = None self.rear = None def enqueue(self, data): node = Node(data) if self.rear: self.rear.next = node self.rear...
class Node: def __init__(self, value): self.value = value self.next = None class Queue: def __init__(self): self.front = None self.rear = None def enqueue(self, data): node = node(data) if self.rear: self.rear.next = node self.rear ...
class Customer: def __init__(self, name, age, phone_no, address): self.name = name self.age = age self.phone_no = phone_no self.address = address def view_details(self): print(self.name, self.age, self.phone_no) print(self.address.get_door_no(), sel...
class Customer: def __init__(self, name, age, phone_no, address): self.name = name self.age = age self.phone_no = phone_no self.address = address def view_details(self): print(self.name, self.age, self.phone_no) print(self.address.get_door_no(), self.address.get...
#!/usr/bin/env python3 # https://abc054.contest.atcoder.jp/tasks/abc054_a a, b = map(int, input().split()) if a == b: print('Draw') elif a == 1: print('Alice') elif b == 1: print('Bob') elif a > b: print('Alice') else: print('Bob')
(a, b) = map(int, input().split()) if a == b: print('Draw') elif a == 1: print('Alice') elif b == 1: print('Bob') elif a > b: print('Alice') else: print('Bob')
class NoQueueError(Exception): pass class JobError(RuntimeError): pass class TimeoutError(JobError): pass class CrashError(JobError): pass
class Noqueueerror(Exception): pass class Joberror(RuntimeError): pass class Timeouterror(JobError): pass class Crasherror(JobError): pass
# ------------------------------ # 33. Search in Rotated Sorted Array # # Description: # Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. # # (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). # You are given a target value to search. If found in the array return its index...
class Solution(object): def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if not nums: return -1 if target not in nums: return -1 left = 0 right = len(nums) - 1 while le...
# Encoding and Decoding in Python 3.x a = 'Harshit' # initialize byte object. c = b'Harshit' # using encode() to encode string d = a.encode('ASCII') if (d == c): print("Encoding successful.") else: print("Encoding unsuccessful. :( ") # Similarly, decode() is the inverse process. # decode() will convert byte...
a = 'Harshit' c = b'Harshit' d = a.encode('ASCII') if d == c: print('Encoding successful.') else: print('Encoding unsuccessful. :( ')
#! /usr/bin/env python3 """ --- besspin-ci.py is the CI entry to the BESSPIN program. --- This file provide the combinations of CI files generated. --- Every combination is represented as a set of tuples. Each tuple represents one setting and its possible values. Each "values" should be a tuple. Please note t...
""" --- besspin-ci.py is the CI entry to the BESSPIN program. --- This file provide the combinations of CI files generated. --- Every combination is represented as a set of tuples. Each tuple represents one setting and its possible values. Each "values" should be a tuple. Please note that a 1-element tuple sh...
''' Verify correct field and URL verification behavior for not and nocase modifiers. ''' # @file # # Copyright 2021, Verizon Media # SPDX-License-Identifier: Apache-2.0 # Test.Summary = ''' Verify correct field and URL verification behavior for equals, absent, present, contains, prefix, and suffix with not, nocase, a...
""" Verify correct field and URL verification behavior for not and nocase modifiers. """ Test.Summary = '\nVerify correct field and URL verification behavior for\nequals, absent, present, contains, prefix, and suffix\nwith not, nocase, and both not and nocase modifiers\n' r = Test.AddTestRun("Verify 'not' and 'nocase' ...
#!/usr/bin/python3 """ Class Square creation module A Blueprint for squares """ class Square: """Set the class square""" def __init__(self, size=0): """Iniatiate Attributes for Square class. Args: size: integer with size of the square. """ self.__size = size ...
""" Class Square creation module A Blueprint for squares """ class Square: """Set the class square""" def __init__(self, size=0): """Iniatiate Attributes for Square class. Args: size: integer with size of the square. """ self.__size = size @property def s...
# Python API for using CAPI 3 core files from VUnit # Authors: # Unai Martinez-Corral # # Copyright 2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus> # # 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...
def add_core_filesets(vunitHandle, core, filesets): """ Add the sources of some filesets from a CAPI 3 compliant core, into a VUnit handle through VUnit's API (``add_library`` and ``add_source_files``). :param vunitHandle: handle to the VUnit object instance. :param core: CAPI 3 compliant object (c...
"""Welcome to FIRESONG, the FIRst Extragalactic Simulation Of Neutrinos and Gamma-rays""" __author__ = 'C.F. Tung, T. Glauch, M. Larson, A. Pizzuto, R. Reimann, I. Taboada' __email__ = '' __version__ = '1.8' __all__ = ['Firesong', 'Evolution', 'distance', 'FluxPDF', 'input_out', 'Luminosity', 'sampling', '...
"""Welcome to FIRESONG, the FIRst Extragalactic Simulation Of Neutrinos and Gamma-rays""" __author__ = 'C.F. Tung, T. Glauch, M. Larson, A. Pizzuto, R. Reimann, I. Taboada' __email__ = '' __version__ = '1.8' __all__ = ['Firesong', 'Evolution', 'distance', 'FluxPDF', 'input_out', 'Luminosity', 'sampling', 'Legend']
# ------------------------------ # 1027. Longest Arithmetic Sequence # # Description: # Given an array A of integers, return the length of the longest arithmetic subsequence in A. # Recall that a subsequence of A is a list A[i_1], A[i_2], ..., A[i_k] with 0 <= i_1 < i_2 < # ... < i_k <= A.length - 1, and that a sequ...
class Solution: def longest_arith_seq_length(self, A: List[int]) -> int: dp = {} for i in range(len(A)): for j in range(i + 1, len(A)): dp[j, A[j] - A[i]] = dp.get((i, A[j] - A[i]), 1) + 1 return max(dp.values()) if __name__ == '__main__': test = solution()
products = {} command = input() while command != "statistics": command = input() while command != "statistics": tokens = command.split(": ") product = tokens[0] quantity = int(tokens[1]) if product not in products: products[product] = 0 products[product] += quantity print("Products in s...
products = {} command = input() while command != 'statistics': command = input() while command != 'statistics': tokens = command.split(': ') product = tokens[0] quantity = int(tokens[1]) if product not in products: products[product] = 0 products[product] += quantity print('Products in st...
DEBUG = False ALLOWED_HOSTS = ['*'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'db1', 'USER': 'alex', 'PASSWORD': 'asdewqr1', 'HOST': 'localhost', # Set to empty string for localhost. 'PORT': '', # Set to empty string for default. } ...
debug = False allowed_hosts = ['*'] databases = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'db1', 'USER': 'alex', 'PASSWORD': 'asdewqr1', 'HOST': 'localhost', 'PORT': ''}}
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright (c) 2002-2020 "Neo4j," # Neo4j Sweden AB [http://neo4j.com] # # This file is part of Neo4j. # # 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 L...
""" This module contains the core driver exceptions. """ class Protocolerror(Exception): """ Raised when an unexpected or unsupported protocol event occurs. """ class Serviceunavailable(Exception): """ Raised when no database service is available. """ class Incompletecommiterror(Exception): """ R...
class Dummy: def __str__(self) -> str: return "dummy" d1 = Dummy() print(d1)
class Dummy: def __str__(self) -> str: return 'dummy' d1 = dummy() print(d1)
""" Problem 1 - https://adventofcode.com/2020/day/2 Part 1 - Given a list of password and conditions the passwords have to fulfill, return the number of passwords that fulfill the conditions Part 2 - Same as part 1 with different conditions """ # Set up the input with open('input-02122020.txt', 'r') as file...
""" Problem 1 - https://adventofcode.com/2020/day/2 Part 1 - Given a list of password and conditions the passwords have to fulfill, return the number of passwords that fulfill the conditions Part 2 - Same as part 1 with different conditions """ with open('input-02122020.txt', 'r') as file: s = file.readl...
""" Last one was a bit easy. Let's ramp it up a tad :) This challenge is close to the real deal. Some of you may get it here. Solve the equation for X. Example For string = "99X=1(mod 8)", the output should be breakDown3(string) = 3. "99X=1(mod 8)". To solve this equation, first you must reduce the left side. Make i...
""" Last one was a bit easy. Let's ramp it up a tad :) This challenge is close to the real deal. Some of you may get it here. Solve the equation for X. Example For string = "99X=1(mod 8)", the output should be breakDown3(string) = 3. "99X=1(mod 8)". To solve this equation, first you must reduce the left side. Make i...
_use_time = True try: _start_time = datetime.utcnow().timestamp() except Exception: _use_time = False
_use_time = True try: _start_time = datetime.utcnow().timestamp() except Exception: _use_time = False
# -*- coding: utf-8 -*- """ sphinxcontrib.websupport.version ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2007-2018 by the Sphinx team, see README. :license: BSD, see LICENSE for details. """ __version__ = '1.1.0' __version_info__ = tuple(map(int, __version__.split('.')))
""" sphinxcontrib.websupport.version ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2007-2018 by the Sphinx team, see README. :license: BSD, see LICENSE for details. """ __version__ = '1.1.0' __version_info__ = tuple(map(int, __version__.split('.')))
# -*- coding: utf-8 -*- extensions = ['sphinx.ext.viewcode'] master_doc = 'index' exclude_patterns = ['_build'] viewcode_follow_imported_members = False
extensions = ['sphinx.ext.viewcode'] master_doc = 'index' exclude_patterns = ['_build'] viewcode_follow_imported_members = False
#!/usr/bin/env python # encoding: utf-8 __all__ = ['gcd'] def gcd(a, b): """Compute gcd(a,b) :param a: first number :param b: second number :returns: the gcd """ pos_a, _a = (a >= 0), abs(a) pos_b, _b = (b >= 0), abs(b) gcd_sgn = (-1 + 2*(pos_a or po...
__all__ = ['gcd'] def gcd(a, b): """Compute gcd(a,b) :param a: first number :param b: second number :returns: the gcd """ (pos_a, _a) = (a >= 0, abs(a)) (pos_b, _b) = (b >= 0, abs(b)) gcd_sgn = -1 + 2 * (pos_a or pos_b) if _a > _b: c = _a % _b else: ...
''' Anti-palindrome strings You are given a string containing only lowercase alphabets. You can swap two adjacent characters any number of times (including 0). A string is called anti-palindrome if it is not a palindrome. If it is possible to make a string anti-palindrome, then find the lexicographically smallest an...
""" Anti-palindrome strings You are given a string containing only lowercase alphabets. You can swap two adjacent characters any number of times (including 0). A string is called anti-palindrome if it is not a palindrome. If it is possible to make a string anti-palindrome, then find the lexicographically smallest an...
""" all opcodes Python3.6.0 """ # general NOP = 9 POP_TOP = 1 ROT_TWO = 2 ROT_THREE = 3 DUP_TOP = 4 DUP_TOP_TWO = 5 # one operand UNARY_POSITIVE = 10 UNARY_NEGATIVE = 11 UNARY_NOT = 12 UNARY_INVERT = 15 GET_ITER = 68 GET_YIELD_FROM_ITER = 69 # two operand BINARY_POWER = 19 BINARY_MULTIPLY = 20 BINARY_MATRIX_MULTIPLY...
""" all opcodes Python3.6.0 """ nop = 9 pop_top = 1 rot_two = 2 rot_three = 3 dup_top = 4 dup_top_two = 5 unary_positive = 10 unary_negative = 11 unary_not = 12 unary_invert = 15 get_iter = 68 get_yield_from_iter = 69 binary_power = 19 binary_multiply = 20 binary_matrix_multiply = 16 binary_floor_divide = 26 binary_tru...
def bom_populate(bom): bom.components.new( name="s1", description="HPE ML30 INTEL, 4U Tower, 8 HD's fit inside, 1 gbit dual", cost=378, rackspace_u=0, cru=0, sru=0, hru=0, mru=0, su_perc=50, cu_perc=50, power=150, ) ...
def bom_populate(bom): bom.components.new(name='s1', description="HPE ML30 INTEL, 4U Tower, 8 HD's fit inside, 1 gbit dual", cost=378, rackspace_u=0, cru=0, sru=0, hru=0, mru=0, su_perc=50, cu_perc=50, power=150) bom.components.new(name='s2', description="HPE ML110 INTEL, 4U Tower, 8 HD's fit inside, 1 gbit dua...
class Model: def to_dict(self): return NotImplementedError class User(Model): def to_dict(self): return {} class UserID(Model): def to_dict(self): return {} class UserAuth(Model): def to_dict(self): return {}
class Model: def to_dict(self): return NotImplementedError class User(Model): def to_dict(self): return {} class Userid(Model): def to_dict(self): return {} class Userauth(Model): def to_dict(self): return {}
# @file dsc_processor_plugin # Plugin for for parsing DSCs ## # Copyright (c) Microsoft Corporation # # SPDX-License-Identifier: BSD-2-Clause-Patent ## class IDscProcessorPlugin(object): ## # does the transform on the DSC # # @param dsc - the in-memory model of the DSC # @param thebuilder - UefiB...
class Idscprocessorplugin(object): def do_transform(self, dsc, thebuilder): return 0 def get_level(self, thebuilder): return 0
def q2(stop_value): first, second = 0, 1 i = 0 while first < stop_value: print(f"{i}th term is: {first}") first, second = first + second, first i += 1 if __name__ == "__main__": n = 20 q2(n)
def q2(stop_value): (first, second) = (0, 1) i = 0 while first < stop_value: print(f'{i}th term is: {first}') (first, second) = (first + second, first) i += 1 if __name__ == '__main__': n = 20 q2(n)
def titulo(): print('~' * 80) print('{:^80}'.format('Sistema Interativo PyHelp')) print('~' * 80) def leia_comando(): comando = str(input( '> Insira o comando que deseja obter ajuda: ("fim" para encerrar) ')).lower().strip() return comando def imprimir_manual(_comando): try: ...
def titulo(): print('~' * 80) print('{:^80}'.format('Sistema Interativo PyHelp')) print('~' * 80) def leia_comando(): comando = str(input('> Insira o comando que deseja obter ajuda: ("fim" para encerrar) ')).lower().strip() return comando def imprimir_manual(_comando): try: print() ...
class Status: """ If you create a custom Status symbol, please keep in mind that all statuses are registered globally and that can cause name collisions. However, it's an intended use case for your checks to be able to yield custom statuses. Interpreters of the check protocol will have to skip stat...
class Status: """ If you create a custom Status symbol, please keep in mind that all statuses are registered globally and that can cause name collisions. However, it's an intended use case for your checks to be able to yield custom statuses. Interpreters of the check protocol will have to skip stat...
"""Detects and configures the local Python. Add the following to your WORKSPACE FILE: ```python python_configure(name = "cpython37", interpreter = "python3.7") ``` Args: name: A unique name for this workspace rule. interpreter: interpreter used to config this workspace """ def _tpl(repository_ctx, tpl, substitu...
"""Detects and configures the local Python. Add the following to your WORKSPACE FILE: ```python python_configure(name = "cpython37", interpreter = "python3.7") ``` Args: name: A unique name for this workspace rule. interpreter: interpreter used to config this workspace """ def _tpl(repository_ctx, tpl, substitu...
# Mu Lung Dojo Bulletin Board (2091006) | Mu Lung Temple (250000100) dojo = 925020000 response = sm.sendAskYesNo("Would you like to go to Mu Lung Dojo?") if response: sm.setReturnField() sm.setReturnPortal(0) sm.warp(dojo)
dojo = 925020000 response = sm.sendAskYesNo('Would you like to go to Mu Lung Dojo?') if response: sm.setReturnField() sm.setReturnPortal(0) sm.warp(dojo)
# -------------- # Code starts here 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_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, 'English...
""" Spark mllib Algorithms -> Classification regression clustering topic modelling. etc. workflows -> feature transformations pipelines evaluations hyperparameter tuning utilities -> Distributed math libraries statistics functions """ # Normalize -> maps data from original range to range of 0 to 1 # Advantage of ...
""" Spark mllib Algorithms -> Classification regression clustering topic modelling. etc. workflows -> feature transformations pipelines evaluations hyperparameter tuning utilities -> Distributed math libraries statistics functions """
badge_icon = 'app.icns' icon_locations = { 'LBRY.app': (115, 164), 'Applications': (387, 164) } background='dmg_background.png' default_view='icon-view' symlinks = { 'Applications': '/Applications' } window_rect=((200, 200), (500, 320)) files = [ 'LBRY.app' ] icon_size=128
badge_icon = 'app.icns' icon_locations = {'LBRY.app': (115, 164), 'Applications': (387, 164)} background = 'dmg_background.png' default_view = 'icon-view' symlinks = {'Applications': '/Applications'} window_rect = ((200, 200), (500, 320)) files = ['LBRY.app'] icon_size = 128
# -*- coding: utf-8 -*- """ Created on Mon Jun 11 01:37:09 2018 @author: sushy """ secretWord = 'apple' lettersGuessed = ['e', 'i', 'k', 'p', 'r', 's'] def getGuessedWord(sW, lG): ''' sW: string, the word the user is guessing lG: list, what letters have been guessed so far returns: string, comprised ...
""" Created on Mon Jun 11 01:37:09 2018 @author: sushy """ secret_word = 'apple' letters_guessed = ['e', 'i', 'k', 'p', 'r', 's'] def get_guessed_word(sW, lG): """ sW: string, the word the user is guessing lG: list, what letters have been guessed so far returns: string, comprised of letters and unders...
# # PySNMP MIB module TPT-TPA-HARDWARE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-TPA-HARDWARE-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:26:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ...
class Solution: def criticalConnections(self, n: int, connections: List[List[int]]) -> List[List[int]]: INF = 1000000 lows = [INF] * n ranks = [INF] * n graph = collections.defaultdict(list) for u, v in connections: graph[u].append(v) graph[v].append(u...
class Solution: def critical_connections(self, n: int, connections: List[List[int]]) -> List[List[int]]: inf = 1000000 lows = [INF] * n ranks = [INF] * n graph = collections.defaultdict(list) for (u, v) in connections: graph[u].append(v) graph[v].appe...
# mode: run # ticket: 593 # tag: property, decorator my_property = property class Prop(object): """ >>> p = Prop() >>> p.prop GETTING 'None' >>> p.prop = 1 SETTING '1' (previously: 'None') >>> p.prop GETTING '1' 1 >>> p.prop = 2 SETTING '2' (previously: '1') >>> p.prop ...
my_property = property class Prop(object): """ >>> p = Prop() >>> p.prop GETTING 'None' >>> p.prop = 1 SETTING '1' (previously: 'None') >>> p.prop GETTING '1' 1 >>> p.prop = 2 SETTING '2' (previously: '1') >>> p.prop GETTING '2' 2 >>> del p.prop DELETING ...
l = [83, 85, 78, 123, 77, 52, 57, 53, 45, 102, 52, 110, 33, 125] flag = "" for c in l: flag += chr(c) print(flag)
l = [83, 85, 78, 123, 77, 52, 57, 53, 45, 102, 52, 110, 33, 125] flag = '' for c in l: flag += chr(c) print(flag)
class ServerObj: """Server class""" def __init__(self): self._name = '' self._totalPhysicalMemory = 0 self._freePhysicalMemory = 0 self._disks = [] @property def name(self): return self._name @name.setter def name(self...
class Serverobj: """Server class""" def __init__(self): self._name = '' self._totalPhysicalMemory = 0 self._freePhysicalMemory = 0 self._disks = [] @property def name(self): return self._name @name.setter def name(self, n): self._name = n @...
l,S1,final=[],[],[] S=input('Enter the numbers: ') S1=S.split() for i in S1: l.append(int(i)) final=str("['"+str(l)+"']") print(final)
(l, s1, final) = ([], [], []) s = input('Enter the numbers: ') s1 = S.split() for i in S1: l.append(int(i)) final = str("['" + str(l) + "']") print(final)
# Permutation def permutation_rec(a): if len(a) == 0: return [] if len(a) == 1: return [a] l = [] for i in range(len(a)): x = a[:i] + a[i+1:] for j in permutation_rec(x): str2 = a[i] + j l.append(str2) return l count = 0 for r in permutati...
def permutation_rec(a): if len(a) == 0: return [] if len(a) == 1: return [a] l = [] for i in range(len(a)): x = a[:i] + a[i + 1:] for j in permutation_rec(x): str2 = a[i] + j l.append(str2) return l count = 0 for r in permutation_rec('chip'): ...
# almostIncreasingSequence or "too big or too small" # is there one exception to the list being sorted? (with no repeats) # including being already sorted # (User's) Problem # We Have: # list of int # We Need: # Is there one exception to the list being sorted? yes/no # We Must: # return boolean: true false...
def almost_increasing_sequence(input_list): if input_list == sorted(list(set(input_list))): return True for i in range(len(input_list) - 1): if input_list[i] >= input_list[i + 1]: if i == 0: input_list.pop(i) elif i == len(input_list) - 1: ...
# Header used at the top of log files and such # usage: header = "(>'')><('')><(''<)" header = r""" _____ .__ ____ ____ _____/ ____\_____ | | ___.__. _/ ___\/ _ \ / \ __\\____ \| |< | | \ \__( <_> ) | \ | | |_> > |_\___ | \___ >____/|___| /__| | __/|____/ ____|...
header = '\n _____ .__\n ____ ____ _____/ ____\\_____ | | ___.__.\n_/ ___\\/ _ \\ / \\ __\\\\____ \\| |< | |\n\\ \\__( <_> ) | \\ | | |_> > |_\\___ |\n \\___ >____/|___| /__| | __/|____/ ____|\n \\/ \\/ |__| \\/\n' __override_dict = {'con...
# # PySNMP MIB module XEDIA-DHCP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XEDIA-DHCP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:36:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ...
class CustomError(Exception): def __init__(self, *args): if args: self.topic = args[0] else: self.topic = None def __str__(self): if self.topic: return 'Custom Error:, {0}'.format(self.topic) class MessageHandler(object): def __init__(self, event...
class Customerror(Exception): def __init__(self, *args): if args: self.topic = args[0] else: self.topic = None def __str__(self): if self.topic: return 'Custom Error:, {0}'.format(self.topic) class Messagehandler(object): def __init__(self, eve...
class Solution: # @return a string def longestCommonPrefix(self, strs): n = len(strs) if n == 0: return '' if n == 1: return strs[0] prefix = '' m = min([len(s) for s in strs]) for i in range(m): first = strs[0] com...
class Solution: def longest_common_prefix(self, strs): n = len(strs) if n == 0: return '' if n == 1: return strs[0] prefix = '' m = min([len(s) for s in strs]) for i in range(m): first = strs[0] common = True ...
"""Shared constants.""" # Wiktionary dump URL # {0}: current locale # {1}: dump date BASE_URL = "https://dumps.wikimedia.org/{0}wiktionary" DUMP_URL = f"{BASE_URL}/{{1}}/{{0}}wiktionary-{{1}}-pages-meta-current.xml.bz2" # GitHub stuff # {0}: current locale REPOS = "BoboTiG/ebook-reader-dict" GH_REPOS = f"https://gith...
"""Shared constants.""" base_url = 'https://dumps.wikimedia.org/{0}wiktionary' dump_url = f'{BASE_URL}/{{1}}/{{0}}wiktionary-{{1}}-pages-meta-current.xml.bz2' repos = 'BoboTiG/ebook-reader-dict' gh_repos = f'https://github.com/{REPOS}' release_url = f'https://api.github.com/repos/{REPOS}/releases/tags/{{0}}' download_u...
def parseSolutions(solutions, orderList): parsedSolutions = [] for solution in solutions: solutionItems = solution.items() schedule = [] finishTimes = [] for item in solutionItems: if "enter" in item[0]: parsedItem = item[0].split("-") order = orderList.orderFromID(int(parsedItem[0])) schedule....
def parse_solutions(solutions, orderList): parsed_solutions = [] for solution in solutions: solution_items = solution.items() schedule = [] finish_times = [] for item in solutionItems: if 'enter' in item[0]: parsed_item = item[0].split('-') ...
# Copyright 2014-2019 Ivan Yelizariev <https://it-projects.info/team/yelizariev> # Copyright 2015 Bassirou Ndaw <https://github.com/bassn> # Copyright 2015 Alexis de Lattre <https://github.com/alexis-via> # Copyright 2016-2017 Stanislav Krotov <https://it-projects.info/team/ufaks> # Copyright 2017 Ilmir Karamov <https:...
{'name': 'POS: Prepaid credits', 'summary': 'Comfortable sales for your regular customers. Debt payment method for POS', 'category': 'Point Of Sale', 'images': ['images/debt_notebook.png'], 'version': '12.0.5.3.2', 'author': 'IT-Projects LLC, Ivan Yelizariev', 'support': 'apps@itpp.dev', 'website': 'https://apps.odoo.c...
""" Implement shared pieces of Erlang node negotiation and distribution protocol """ DIST_VSN = 5 DIST_VSN_PAIR = (DIST_VSN, DIST_VSN) " Supported distribution protocol version (MAX,MIN). " def dist_version_check(max_min: tuple) -> bool: """ Check pair of versions against version which is supported by us ...
""" Implement shared pieces of Erlang node negotiation and distribution protocol """ dist_vsn = 5 dist_vsn_pair = (DIST_VSN, DIST_VSN) ' Supported distribution protocol version (MAX,MIN). ' def dist_version_check(max_min: tuple) -> bool: """ Check pair of versions against version which is supported by us ...
description = 'BOA Translations stages' pvprefix = 'SQ:BOA:mcu2:' devices = dict( translation_300mm_a = device('nicos_ess.devices.epics.motor.EpicsMotor', description = 'Translation 1', motorpv = pvprefix + 'TVA', errormsgpv = pvprefix + 'TVA-MsgTxt', ), translation_300mm_b = devic...
description = 'BOA Translations stages' pvprefix = 'SQ:BOA:mcu2:' devices = dict(translation_300mm_a=device('nicos_ess.devices.epics.motor.EpicsMotor', description='Translation 1', motorpv=pvprefix + 'TVA', errormsgpv=pvprefix + 'TVA-MsgTxt'), translation_300mm_b=device('nicos_ess.devices.epics.motor.EpicsMotor', descr...
query = """ select * from languages; """ query = """ select * from games where test=0 """ def get_query(): query = f"SELEct max(weight) from world where ocean='Atlantic'" return query def get_query(): limit = 6 query = f"SELEct speed from world where animal='dolphin' limit {limit}" ...
query = '\n select * from languages;\n' query = '\n select *\n from games\n where test=0\n' def get_query(): query = f"SELEct max(weight) from world where ocean='Atlantic'" return query def get_query(): limit = 6 query = f"SELEct speed from world where animal='dolphin' limit {limit}" r...
def frac(num1,num2): if num1 == 0 or num2 ==0: return 0 else: sum1 = num1 / num2 sum1 = str(sum1) sum1 = sum1.split(".") final = "0."+ sum1[1][0] final = float(final) return final print(frac(4,1))
def frac(num1, num2): if num1 == 0 or num2 == 0: return 0 else: sum1 = num1 / num2 sum1 = str(sum1) sum1 = sum1.split('.') final = '0.' + sum1[1][0] final = float(final) return final print(frac(4, 1))
my_dict = {} my_dict[(1,2,4)] = 8 my_dict[(4,2,1)] = 10 my_dict[(1,2)] = 12 sum = 0 for k in my_dict: sum += my_dict[k] print (sum) print(my_dict)
my_dict = {} my_dict[1, 2, 4] = 8 my_dict[4, 2, 1] = 10 my_dict[1, 2] = 12 sum = 0 for k in my_dict: sum += my_dict[k] print(sum) print(my_dict)
def increase(colour, increments): """Take a colour and increase each channel by the increments given in the list""" colour_values = [int(colour[1:3], 16), int(colour[3:5], 16), int(colour[5:], 16)] output = [min(255, colour_values[0] + increments[0]), min(255, colour_values[1] + increments[1]), min(255, col...
def increase(colour, increments): """Take a colour and increase each channel by the increments given in the list""" colour_values = [int(colour[1:3], 16), int(colour[3:5], 16), int(colour[5:], 16)] output = [min(255, colour_values[0] + increments[0]), min(255, colour_values[1] + increments[1]), min(255, col...
user = input("Say something! ") print(user.upper()) print(user.lower()) print(user.swapcase())
user = input('Say something! ') print(user.upper()) print(user.lower()) print(user.swapcase())
# 1. The code below prints the numbers from 1 to 50. Rewrite the code using a while loop to # accomplish the same thing. # for i in range(1,51): # print(i) i = 1 while i <= 50: print(i) i += 1
i = 1 while i <= 50: print(i) i += 1
#!/usr/bin/env python def vowel_percent(in_str): vowels = 'aeiou' consonants = 'bcdfghjklmnpqrstvwxyz' vowel_count = 0 consonant_count = 0 total = 0 for a_char in in_str: if a_char in vowels or a_char in consonants: total += 1 # only increment total for letters, not space/pu...
def vowel_percent(in_str): vowels = 'aeiou' consonants = 'bcdfghjklmnpqrstvwxyz' vowel_count = 0 consonant_count = 0 total = 0 for a_char in in_str: if a_char in vowels or a_char in consonants: total += 1 if a_char in vowels: vowel_count += 1 ...
#Code written by Ryan Helgoth class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: sol = [] for i in range(len(nums)): currentNum = nums[i] if currentNum <= target: amountLeft = target - currentNum try: ...
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: sol = [] for i in range(len(nums)): current_num = nums[i] if currentNum <= target: amount_left = target - currentNum try: index1 = i ...
# -*- coding: utf-8 -*- """ Created on Sat Dec 14 09:13:30 2019 @author: NOTEBOOK """ def main(): g = 'green' o = 'orange' p = 'purple' print('') print('Welcome to your Color mixing application '+ 'Please be aware that you can only input '+ 'primary colours(red,blue,yellow)') ...
""" Created on Sat Dec 14 09:13:30 2019 @author: NOTEBOOK """ def main(): g = 'green' o = 'orange' p = 'purple' print('') print('Welcome to your Color mixing application ' + 'Please be aware that you can only input ' + 'primary colours(red,blue,yellow)') slot_1 = input('Enter color 1: ') s...
class UsersPage: TITLE = "All users" INVITE_BUTTON = "Invite a new user" MANAGE_ROLES_BUTTON = "Manage roles" INVITE_SUCCESSFUL_BANNER = "User has been invited successfully" class Table: NAME = "Name" EMAIL = "Email" TEAM = "Team" ROLE = "Role" STATUS = "Stat...
class Userspage: title = 'All users' invite_button = 'Invite a new user' manage_roles_button = 'Manage roles' invite_successful_banner = 'User has been invited successfully' class Table: name = 'Name' email = 'Email' team = 'Team' role = 'Role' status = 'Stat...
SETTINGS = { "FPS": 60, "WIDTH": 1280, "HEIGHT": 720, "SOUNDS_VOLUME": 1.0, "MUSICS_VOLUME": 0.1 }
settings = {'FPS': 60, 'WIDTH': 1280, 'HEIGHT': 720, 'SOUNDS_VOLUME': 1.0, 'MUSICS_VOLUME': 0.1}
""" Custom error classes """ class GenerationError(Exception): pass class TooManyInvalidError(RuntimeError): pass
""" Custom error classes """ class Generationerror(Exception): pass class Toomanyinvaliderror(RuntimeError): pass
# # PySNMP MIB module BAS-SONET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAS-SONET-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:17:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(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) ...
class Question: def __init__(self, prompt, answer): self.prompt = prompt self.answer = answer question_prompt = ["what is my name? \n" , "When was I born? \n", "Name my by color \n"] questions = [Question(question_prompt[0], "Michael"), Question(question_prompt[1], 2002), ...
class Question: def __init__(self, prompt, answer): self.prompt = prompt self.answer = answer question_prompt = ['what is my name? \n', 'When was I born? \n', 'Name my by color \n'] questions = [question(question_prompt[0], 'Michael'), question(question_prompt[1], 2002), question(question_prompt[2]...
""" Recursivly compute the Fibonacci sequence """ def rec_fib(n): if n == 1: return 1 elif n == 0: return 0 else: return rec_fib(n-1)+rec_fib(n-2) def main(): n : int = int(input("n := ")) for i in range(0, n): print(rec_fib(i)) if __name__ == "__main__": m...
""" Recursivly compute the Fibonacci sequence """ def rec_fib(n): if n == 1: return 1 elif n == 0: return 0 else: return rec_fib(n - 1) + rec_fib(n - 2) def main(): n: int = int(input('n := ')) for i in range(0, n): print(rec_fib(i)) if __name__ == '__main__': ...
Scale.default = Scale.egyptian Root.default = 0 Clock.bpm = 120 print(SynthDefs) print(BufferManager()) print(Player.get_attributes()) p1 >> play( P["@+ET"], ).every(3, "stutter", dur=1/2) p1 >> play( P["V+EA"], ).every(3, "stutter", dur=1/2) p2 >> play( P["<X >< n >"],#.layer("mirror"), sample = ...
Scale.default = Scale.egyptian Root.default = 0 Clock.bpm = 120 print(SynthDefs) print(buffer_manager()) print(Player.get_attributes()) p1 >> play(P['@+ET']).every(3, 'stutter', dur=1 / 2) p1 >> play(P['V+EA']).every(3, 'stutter', dur=1 / 2) p2 >> play(P['<X >< n >'], sample=2) p2.stop() p3.stop() p4.stop() p5 >> pla...
# coding: utf-8 def check(a,b,s,ans): for j in range(b): if [s[k] for k in range(12) if k%b==j].count('X')==a: ans.append('%dx%d'%(a,b)) return ans return ans t = int(input()) for i in range(t): ans = [] s = input() ans = check(1,12,s,ans) ans = check(2,6,s,ans) ...
def check(a, b, s, ans): for j in range(b): if [s[k] for k in range(12) if k % b == j].count('X') == a: ans.append('%dx%d' % (a, b)) return ans return ans t = int(input()) for i in range(t): ans = [] s = input() ans = check(1, 12, s, ans) ans = check(2, 6, s, ans)...
# !/usr/bin/env python3 # -*- coding: utf-8 -*- """ Name this module. This is blank """
""" Name this module. This is blank """
## @ StitchIfwi.py # This is an IFWI stitch config script for Slim Bootloader # # Copyright (c) 2020, Intel Corporation. All rights reserved. <BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## extra_usage_txt = \ """This is an IFWI stitch config script for Slim Bootloader For the FIT tool and stitchin...
extra_usage_txt = 'This is an IFWI stitch config script for Slim Bootloader For the FIT tool and\nstitching ingredients listed in step 2 below, please contact your Intel representative.\n\n 1. Create a stitching workspace directory. The paths mentioned below are all\n relative to it.\n\n 2. Extract required tools...
####################################SLICING###################################### # x[start:stop:step] # result starts at <start> including it # result ends at <stop> excluding it # optional third argument determines which arguments are carved out (default is 1) # slice assgnments -> ###############################...
letters_amazon = '\nWe spent several years building our own database engine,\nAmazon Aurora, a fully-managed MySQL and PostgreSQL-compatible\nservice with the same or better durability and availability as\nthe commercial engines, but at one-tenth of the cost. We were\nnot surprised when this worked.\n' find = lambda x,...
# Python program to find largest # number in a list # list of numbers list1 = [10, 20, 4, 45, 99] # printing the maximum element print("Largest element is:", max(list1))
list1 = [10, 20, 4, 45, 99] print('Largest element is:', max(list1))
""" Colours used in Capel & Mortlock (2019). """ darkblue = '#114A56' midblue = '#1A7282' lightblue = '#6DA5AF' lightpurple = '#875F74' purple = '#592441' grey = '#BEC1C2' lightgrey = '#F9F9F9' darkgrey= '#464747' white = '#FFFFFF'
""" Colours used in Capel & Mortlock (2019). """ darkblue = '#114A56' midblue = '#1A7282' lightblue = '#6DA5AF' lightpurple = '#875F74' purple = '#592441' grey = '#BEC1C2' lightgrey = '#F9F9F9' darkgrey = '#464747' white = '#FFFFFF'
t = int(input()) visit = None sequence = None def dfs(x, y, r, c, dist): global visit, sequence visit[x][y] = True # print(x, y, dist) # print(visit) sequence[x][y] = dist if dist == r * c - 1: return True for nx in range(r): for ny in range(c): if visit[nx][ny...
t = int(input()) visit = None sequence = None def dfs(x, y, r, c, dist): global visit, sequence visit[x][y] = True sequence[x][y] = dist if dist == r * c - 1: return True for nx in range(r): for ny in range(c): if visit[nx][ny] or nx == x or ny == y or (nx - ny == x - y)...
class Event: def __init__(self, event_name, sender, params=None): """ Defines an event. name: event name sender: who has sent the event params: dictionary of event parameters """ self.event_name = event_name self.sender = sender self.params =...
class Event: def __init__(self, event_name, sender, params=None): """ Defines an event. name: event name sender: who has sent the event params: dictionary of event parameters """ self.event_name = event_name self.sender = sender self.params =...
#!/usr/bin/env python3 # -*- coding utf-8 -*- __Author__ ='eamon' 'Object Oriented Programming' std1={'name':'Eamon','Score':99} std2={'name':'chen','Score':100} def print_score(std): print('%s: %s' % (std['name'], std['Score'])) print_score(std1) print_score(std2) class Student(object): def __init__(se...
___author__ = 'eamon' 'Object Oriented Programming' std1 = {'name': 'Eamon', 'Score': 99} std2 = {'name': 'chen', 'Score': 100} def print_score(std): print('%s: %s' % (std['name'], std['Score'])) print_score(std1) print_score(std2) class Student(object): def __init__(self, name, score): self.__name =...
class HostManagerBase(object): def get_sni_host(self, ip): return "", ""
class Hostmanagerbase(object): def get_sni_host(self, ip): return ('', '')
n = int(input("Enter the month number:")) a = [1,3,5,7,8,10,12] b = [4,6,9,11] c = 2 if n in a: print("The total number of days in month",n,"is 31") elif n in b: print("The total number of days in month",n,"is 30") elif n == c: print("This month may have 28 or 29 days based on leap year") else: ...
n = int(input('Enter the month number:')) a = [1, 3, 5, 7, 8, 10, 12] b = [4, 6, 9, 11] c = 2 if n in a: print('The total number of days in month', n, 'is 31') elif n in b: print('The total number of days in month', n, 'is 30') elif n == c: print('This month may have 28 or 29 days based on leap year') else:...
# Hyperparameters BUFFER_SIZE = int(1e6) BATCH_SIZE = 64 GAMMA = 0.99 TAU = 0.01 LRA = 1e-4 LRC = 1e-3 HIDDEN_1 = 400 HIDDEN_2 = 300 MAX_EPISODES = 50000 MAX_STEPS = 200 GLOBAL_LINEAR_EPS_DECAY = 1e-5 # Decay over 100 thousand transitions OPTION_LINEAR_EPS_DECAY = 2e-5 # Decay over 50 thousand transitions PRINT_EVE...
buffer_size = int(1000000.0) batch_size = 64 gamma = 0.99 tau = 0.01 lra = 0.0001 lrc = 0.001 hidden_1 = 400 hidden_2 = 300 max_episodes = 50000 max_steps = 200 global_linear_eps_decay = 1e-05 option_linear_eps_decay = 2e-05 print_every = 10
class Rqst: """ Request object helper """ @classmethod def get_post_get_param(cls, request, name, default_value): """ Retrieve either POST or GET variable from the request object :param request: the request object :param name: the name :param default_value...
class Rqst: """ Request object helper """ @classmethod def get_post_get_param(cls, request, name, default_value): """ Retrieve either POST or GET variable from the request object :param request: the request object :param name: the name :param default_value: ...
# opyright 2010 OpenStack Foundation # 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 # # Unl...
"""Possible task states for instances. extended for vcloud driver Compute instance task states represent what is happening to the instance at the current moment. """ downloading = 'downloading' converting = 'converting' packing = 'packing' network_creating = 'network_creating' importing = 'importing' vm_creating = 'v...
"""To be deleted once https://github.com/ansible/ansible/pull/15062 has been merged""" def issubset(a, b): return set(a) <= set(b) def issuperset(a, b): return set(a) >= set(b) class FilterModule(object): def filters(self): return { 'issubset': issubset, 'issuperset': is...
"""To be deleted once https://github.com/ansible/ansible/pull/15062 has been merged""" def issubset(a, b): return set(a) <= set(b) def issuperset(a, b): return set(a) >= set(b) class Filtermodule(object): def filters(self): return {'issubset': issubset, 'issuperset': issuperset}
# @author: cchen # pretty long and should be simplified later class Solution: # @param {string} s # @return {string} def longestPalindrome(self, s): size = len(s) ls = [] ll = 0 rr = 0 l = 0 r = 0 maxlen = r - l + 1 for i in range(1, size): ...
class Solution: def longest_palindrome(self, s): size = len(s) ls = [] ll = 0 rr = 0 l = 0 r = 0 maxlen = r - l + 1 for i in range(1, size): if s[i - 1] == s[i]: r = i else: if r - l + 1 > maxlen...