content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
''' m18 - maiores de 18 h - homens m20 - mulheres menos de 20 ''' m18 = h = m20 = 0 while True: print('-'*25) print('CADSTRE UMA PESSOA') print('-'*25) idade = int(input('Idade: ')) if idade > 18: m18 += 1 while True: sexo = str(input('Sexo: [M/F] ')).upper() if sexo in 'MF': break if sexo == 'M': h += 1 if sexo == 'F' and idade < 20: m20 += 1 while True: print('-'*25) variavel = str(input('Quer continuar [S/N]: ')).upper() if variavel in 'SN': break if variavel == 'N': break print('===== FIM DO PROGRAMA =====') print(f'Total de pessoas com mais de 18 anos: {m18}') print(f'Ao todo temos {h} homens cadastrados') print(f'E temos {m20} mulheres com menos com menos de 20 anos')
""" m18 - maiores de 18 h - homens m20 - mulheres menos de 20 """ m18 = h = m20 = 0 while True: print('-' * 25) print('CADSTRE UMA PESSOA') print('-' * 25) idade = int(input('Idade: ')) if idade > 18: m18 += 1 while True: sexo = str(input('Sexo: [M/F] ')).upper() if sexo in 'MF': break if sexo == 'M': h += 1 if sexo == 'F' and idade < 20: m20 += 1 while True: print('-' * 25) variavel = str(input('Quer continuar [S/N]: ')).upper() if variavel in 'SN': break if variavel == 'N': break print('===== FIM DO PROGRAMA =====') print(f'Total de pessoas com mais de 18 anos: {m18}') print(f'Ao todo temos {h} homens cadastrados') print(f'E temos {m20} mulheres com menos com menos de 20 anos')
bootstrap_url="http://agent-resources.cloudkick.com/" s3_bucket="s3://agent-resources.cloudkick.com" pubkey="etc/agent-linux.public.key" branding_name="cloudkick-agent"
bootstrap_url = 'http://agent-resources.cloudkick.com/' s3_bucket = 's3://agent-resources.cloudkick.com' pubkey = 'etc/agent-linux.public.key' branding_name = 'cloudkick-agent'
def binary_search(arr, num): lo, hi = 0, len(arr)-1 while lo <= hi: mid = (lo+hi)//2 if num < arr[mid]: hi = mid-1 elif num > arr[mid]: lo = mid+1 elif num == arr[mid]: print(num, 'found in array.') break if lo > hi: print(num, 'is not present in the array!') if __name__ == '__main__': arr = [2, 6, 8, 9, 10, 11, 13] binary_search(arr, 12)
def binary_search(arr, num): (lo, hi) = (0, len(arr) - 1) while lo <= hi: mid = (lo + hi) // 2 if num < arr[mid]: hi = mid - 1 elif num > arr[mid]: lo = mid + 1 elif num == arr[mid]: print(num, 'found in array.') break if lo > hi: print(num, 'is not present in the array!') if __name__ == '__main__': arr = [2, 6, 8, 9, 10, 11, 13] binary_search(arr, 12)
"""Configuration for HomeAssistant connection""" # pylint: disable=too-few-public-methods class HomeAssistantConfig: """Data structure for holding Home-Assistant server configuration.""" def __init__(self, url, token): self.url = url self.token = token
"""Configuration for HomeAssistant connection""" class Homeassistantconfig: """Data structure for holding Home-Assistant server configuration.""" def __init__(self, url, token): self.url = url self.token = token
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # TODO(borenet): This module belongs in the recipe engine. Remove it from this # repo once it has been moved. DEPS = [ 'recipe_engine/json', 'recipe_engine/path', 'recipe_engine/python', 'recipe_engine/raw_io', 'recipe_engine/step', ]
deps = ['recipe_engine/json', 'recipe_engine/path', 'recipe_engine/python', 'recipe_engine/raw_io', 'recipe_engine/step']
command = '/home/billerot/Git/alexa-flask/venv/bin/gunicorn' pythonpath = '/home/billerot/Git/alexa-flask' workers = 3 user = 'billerot' bind = '0.0.0.0:8088' logconfig = "/home/billerot/Git/alexa-flask/conf/logging.conf" capture_output = True timeout = 90
command = '/home/billerot/Git/alexa-flask/venv/bin/gunicorn' pythonpath = '/home/billerot/Git/alexa-flask' workers = 3 user = 'billerot' bind = '0.0.0.0:8088' logconfig = '/home/billerot/Git/alexa-flask/conf/logging.conf' capture_output = True timeout = 90
# def minsteps1(n): # memo = [0] * (n + 1) # def loop(n): # if n > 1: # if memo[n] != 0: # return memo[n] # else: # memo[n] = 1 + loop(n - 1) # if n % 2 == 0: # memo[n] = min(memo[n], 1 + loop(n // 2)) # if n % 3 == 0: # memo[n] = min(memo[n], 1 + loop(n // 3)) # return memo[n] # else: # return 0 # return loop(n) def minsteps(n): memo = [0] * (n + 1) for i in range(1, n+1): memo[i] = 1 + memo[i-1] if i % 2 == 0: memo[i] = min(memo[i], memo[i // 2]+1) if i % 3 == 0: memo[i] = min(memo[i], memo[i // 3]+1) return memo[n]-1 print(minsteps(10)) # 3 print(minsteps(317)) # 10 print(minsteps(514)) # 8
def minsteps(n): memo = [0] * (n + 1) for i in range(1, n + 1): memo[i] = 1 + memo[i - 1] if i % 2 == 0: memo[i] = min(memo[i], memo[i // 2] + 1) if i % 3 == 0: memo[i] = min(memo[i], memo[i // 3] + 1) return memo[n] - 1 print(minsteps(10)) print(minsteps(317)) print(minsteps(514))
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Codec: def serialize(self, root): ans = "" queue = [root] while queue: node = queue.pop(0) if node: ans += str(node.val) + "," queue.append(node.left) queue.append(node.right) else: ans += "#," return ans[:-1] def deserialize(self, data: str): if data == "#": return None data = data.split(",") if not data: return None root = TreeNode(data[0]) nodes = [root] i = 1 while i < len(data) - 1: node = nodes.pop(0) lv = data[i] rv = data[i + 1] node.left = l node.right = r i += 2 if lv != "#": l = TreeNode(lv) nodes.append(l) if rv != "#": r = TreeNode(rv) nodes.append(r) return root c1 = Codec() data = [1, 2, 3, None, None, 6, 7, None, None, 12, 13] str_data = ",".join(map(lambda x: str(x) if x is not None else "#", data)) root = c1.deserialize(str_data) print(c1.serialize(root))
class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Codec: def serialize(self, root): ans = '' queue = [root] while queue: node = queue.pop(0) if node: ans += str(node.val) + ',' queue.append(node.left) queue.append(node.right) else: ans += '#,' return ans[:-1] def deserialize(self, data: str): if data == '#': return None data = data.split(',') if not data: return None root = tree_node(data[0]) nodes = [root] i = 1 while i < len(data) - 1: node = nodes.pop(0) lv = data[i] rv = data[i + 1] node.left = l node.right = r i += 2 if lv != '#': l = tree_node(lv) nodes.append(l) if rv != '#': r = tree_node(rv) nodes.append(r) return root c1 = codec() data = [1, 2, 3, None, None, 6, 7, None, None, 12, 13] str_data = ','.join(map(lambda x: str(x) if x is not None else '#', data)) root = c1.deserialize(str_data) print(c1.serialize(root))
def f(x): return x, x + 1 for a in b, c: f(a)
def f(x): return (x, x + 1) for a in (b, c): f(a)
class Proxy: def __init__(self, obj): self._obj = obj # Delegate attribute lookup to internal obj def __getattr__(self, name): return getattr(self._obj, name) # Delegate attribute assignment def __setattr__(self, name, value): if name.startswith('_'): super().__setattr__(name, value) # Call original __setattr__ else: setattr(self._obj, name, value) if __name__ == '__main__': class A: def __init__(self, x): self.x = x def spam(self): print('A.spam') a = A(42) p = Proxy(a) print(p.x) print(p.spam()) p.x = 37 print('Should be 37:', p.x) print('Should be 37:', a.x)
class Proxy: def __init__(self, obj): self._obj = obj def __getattr__(self, name): return getattr(self._obj, name) def __setattr__(self, name, value): if name.startswith('_'): super().__setattr__(name, value) else: setattr(self._obj, name, value) if __name__ == '__main__': class A: def __init__(self, x): self.x = x def spam(self): print('A.spam') a = a(42) p = proxy(a) print(p.x) print(p.spam()) p.x = 37 print('Should be 37:', p.x) print('Should be 37:', a.x)
rolls = [6, 5, 3, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] soma = 0 # for r in rolls: # soma += r # for twice in range(0, 3): # soma +=rolls[twice] # if soma == 10: # rolls[2] *= 2 # print(rolls) # # print(twice) # print(rolls) # print(rolls[0]) # row = [i for i in rolls] # print(rolls) for iterator in range(0, len(rolls)): soma += rolls[iterator] if soma == 10: change = rolls[iterator+1]*2 rolls[iterator+1] = change print(rolls)
rolls = [6, 5, 3, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] soma = 0 for iterator in range(0, len(rolls)): soma += rolls[iterator] if soma == 10: change = rolls[iterator + 1] * 2 rolls[iterator + 1] = change print(rolls)
def dfs(node,parent): currsize=1 for child in tree[node]: if child!=parent: currsize+=dfs(child,node) subsize[node]=currsize return currsize n=int(input()) tree=[[]for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a,b=a-1,b-1 tree[a].append(b) tree[b].append(a) subsize=[0 for i in range(n)] dfs(0,-1) print(subsize)
def dfs(node, parent): currsize = 1 for child in tree[node]: if child != parent: currsize += dfs(child, node) subsize[node] = currsize return currsize n = int(input()) tree = [[] for i in range(n)] for i in range(n - 1): (a, b) = map(int, input().split()) (a, b) = (a - 1, b - 1) tree[a].append(b) tree[b].append(a) subsize = [0 for i in range(n)] dfs(0, -1) print(subsize)
''' Contains Hades gamedata ''' # Based on data in Weaponsets.lua HeroMeleeWeapons = { "SwordWeapon": "Stygian Blade", "SpearWeapon": "Eternal Spear", "ShieldWeapon": "Shield of Chaos", "BowWeapon": "Heart-Seeking Bow", "FistWeapon": "Twin Fists of Malphon", "GunWeapon": "Adamant Rail", } # Based on data from TraitData.lua AspectTraits = { "SwordCriticalParryTrait": "Nemesis", "SwordConsecrationTrait": "Arthur", "ShieldRushBonusProjectileTrait": "Chaos", "ShieldLoadAmmoTrait": "Beowulf", # "ShieldBounceEmpowerTrait": "", "ShieldTwoShieldTrait": "Zeus", "SpearSpinTravel": "Guan Yu", "GunGrenadeSelfEmpowerTrait": "Eris", "FistVacuumTrait": "Talos", "FistBaseUpgradeTrait": "Zagreus", "FistWeaveTrait": "Demeter", "FistDetonateTrait": "Gilgamesh", "SwordBaseUpgradeTrait": "Zagreus", "BowBaseUpgradeTrait": "Zagreus", "SpearBaseUpgradeTrait": "Zagreus", "ShieldBaseUpgradeTrait": "Zagreus", "GunBaseUpgradeTrait": "Zagreus", "DislodgeAmmoTrait": "Poseidon", # "SwordAmmoWaveTrait": "", "GunManualReloadTrait": "Hestia", "GunLoadedGrenadeTrait": "Lucifer", "BowMarkHomingTrait": "Chiron", "BowLoadAmmoTrait": "Hera", # "BowStoredChargeTrait": "", "BowBondTrait": "Rama", # "BowBeamTrait": "", "SpearWeaveTrait": "Hades", "SpearTeleportTrait": "Achilles", }
""" Contains Hades gamedata """ hero_melee_weapons = {'SwordWeapon': 'Stygian Blade', 'SpearWeapon': 'Eternal Spear', 'ShieldWeapon': 'Shield of Chaos', 'BowWeapon': 'Heart-Seeking Bow', 'FistWeapon': 'Twin Fists of Malphon', 'GunWeapon': 'Adamant Rail'} aspect_traits = {'SwordCriticalParryTrait': 'Nemesis', 'SwordConsecrationTrait': 'Arthur', 'ShieldRushBonusProjectileTrait': 'Chaos', 'ShieldLoadAmmoTrait': 'Beowulf', 'ShieldTwoShieldTrait': 'Zeus', 'SpearSpinTravel': 'Guan Yu', 'GunGrenadeSelfEmpowerTrait': 'Eris', 'FistVacuumTrait': 'Talos', 'FistBaseUpgradeTrait': 'Zagreus', 'FistWeaveTrait': 'Demeter', 'FistDetonateTrait': 'Gilgamesh', 'SwordBaseUpgradeTrait': 'Zagreus', 'BowBaseUpgradeTrait': 'Zagreus', 'SpearBaseUpgradeTrait': 'Zagreus', 'ShieldBaseUpgradeTrait': 'Zagreus', 'GunBaseUpgradeTrait': 'Zagreus', 'DislodgeAmmoTrait': 'Poseidon', 'GunManualReloadTrait': 'Hestia', 'GunLoadedGrenadeTrait': 'Lucifer', 'BowMarkHomingTrait': 'Chiron', 'BowLoadAmmoTrait': 'Hera', 'BowBondTrait': 'Rama', 'SpearWeaveTrait': 'Hades', 'SpearTeleportTrait': 'Achilles'}
class Property(object): def __init__(self, **kwargs): self.background = "#FFFFFF" self.candle_hl = dict() self.up_candle = dict() self.down_candle = dict() self.long_trade_line = dict() self.short_trade_line = dict() self.long_trade_tri = dict() self.short_trade_tri = dict() self.trade_close_tri = dict() self.default_colors = [ '#fa8072', '#9932cc', '#800080', '#ff4500', '#4b0082', '#483d8b', '#191970', '#a52a2a', '#dc143c', '#8b0000', '#c71585', '#ff0000', '#008b8b', '#2f4f4f', '#2e8b57', '#6b8e23', '#556b2f', '#ff8c00', '#a0522d', '#4682b4', '#696969', '#f08080', ] for key, value in kwargs.items(): setattr(self, key, value) # BigFishProperty ----------------------------------------------------- BF_LONG = "#208C13" BF_SHORT = "#D32C25" BF_CLOSE = "#F9D749" BF_KLINE = "#4DB3C7" BF_BG = "#FFFFFF" BigFishProperty = Property( background=BF_BG, candle_hl=dict( color=BF_KLINE ), up_candle=dict( fill_color=BF_BG, line_color=BF_KLINE ), down_candle = dict( fill_color=BF_KLINE, line_color=BF_KLINE ), long_trade_line=dict( color=BF_LONG ), short_trade_line=dict( color=BF_SHORT ), long_trade_tri=dict( line_color="black", fill_color=BF_LONG ), short_trade_tri=dict( line_color="black", fill_color=BF_SHORT ), trade_close_tri=dict( line_color="black", fill_color=BF_CLOSE ) ) # BigFishProperty ----------------------------------------------------- # MT4Property --------------------------------------------------------- MT4_LONG = "blue" MT4_SHORT = "red" MT4_CLOSE = "gold" MT4_KLINE = "#00FF00" MT4_BG = "#000000" MT4Property = Property( background=MT4_BG, candle_hl=dict( color=MT4_KLINE ), up_candle=dict( fill_color=MT4_BG, line_color=MT4_KLINE ), down_candle = dict( fill_color=MT4_KLINE, line_color=MT4_KLINE ), long_trade_line=dict( color=MT4_LONG ), short_trade_line=dict( color=MT4_SHORT ), long_trade_tri=dict( line_color="#FFFFFF", fill_color=MT4_LONG ), short_trade_tri=dict( line_color="#FFFFFF", fill_color=MT4_SHORT ), trade_close_tri=dict( line_color="#FFFFFF", fill_color=MT4_CLOSE ) ) # MT4Property ---------------------------------------------------------
class Property(object): def __init__(self, **kwargs): self.background = '#FFFFFF' self.candle_hl = dict() self.up_candle = dict() self.down_candle = dict() self.long_trade_line = dict() self.short_trade_line = dict() self.long_trade_tri = dict() self.short_trade_tri = dict() self.trade_close_tri = dict() self.default_colors = ['#fa8072', '#9932cc', '#800080', '#ff4500', '#4b0082', '#483d8b', '#191970', '#a52a2a', '#dc143c', '#8b0000', '#c71585', '#ff0000', '#008b8b', '#2f4f4f', '#2e8b57', '#6b8e23', '#556b2f', '#ff8c00', '#a0522d', '#4682b4', '#696969', '#f08080'] for (key, value) in kwargs.items(): setattr(self, key, value) bf_long = '#208C13' bf_short = '#D32C25' bf_close = '#F9D749' bf_kline = '#4DB3C7' bf_bg = '#FFFFFF' big_fish_property = property(background=BF_BG, candle_hl=dict(color=BF_KLINE), up_candle=dict(fill_color=BF_BG, line_color=BF_KLINE), down_candle=dict(fill_color=BF_KLINE, line_color=BF_KLINE), long_trade_line=dict(color=BF_LONG), short_trade_line=dict(color=BF_SHORT), long_trade_tri=dict(line_color='black', fill_color=BF_LONG), short_trade_tri=dict(line_color='black', fill_color=BF_SHORT), trade_close_tri=dict(line_color='black', fill_color=BF_CLOSE)) mt4_long = 'blue' mt4_short = 'red' mt4_close = 'gold' mt4_kline = '#00FF00' mt4_bg = '#000000' mt4_property = property(background=MT4_BG, candle_hl=dict(color=MT4_KLINE), up_candle=dict(fill_color=MT4_BG, line_color=MT4_KLINE), down_candle=dict(fill_color=MT4_KLINE, line_color=MT4_KLINE), long_trade_line=dict(color=MT4_LONG), short_trade_line=dict(color=MT4_SHORT), long_trade_tri=dict(line_color='#FFFFFF', fill_color=MT4_LONG), short_trade_tri=dict(line_color='#FFFFFF', fill_color=MT4_SHORT), trade_close_tri=dict(line_color='#FFFFFF', fill_color=MT4_CLOSE))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ **Project Name:** MakeHuman **Product Home Page:** http://www.makehumancommunity.org/ **Github Code Home Page:** https://github.com/makehumancommunity/ **Authors:** Thanasis Papoutsidakis **Copyright(c):** MakeHuman Team 2001-2019 **Licensing:** AGPL3 This file is part of MakeHuman Community (www.makehumancommunity.org). This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Abstract -------- Tools and interfaces for managing caches. A cache is a container associated with a method. When the method is called, the result is stored in the cache, and on subsequent calls of the method the stored result is returned, so that no recomputation is needed. The result of the method will be recalculated once the cache is explicitly invalidated (emptied) and the method gets called again. To use the caching mechanisms in your code, simply use the Cache decorator in front of the method you want to cache. Example: @Cache def method(self): ... To invalidate a cached result, you can assign Cache Empty to your method's cache: self.method.cache = Cache.Empty You can also use Cache.invalidate to inalidate caches, like so: Cache.invalidate(self, "method1", "method2") Or use Cache.invalidateAll to clear all caches of an object: Cache.invalidateAll(self) If your object happens to have a method that somehow processes all of its caches, and returns a similar object with the same methods but with all the computation done, decorate it as Cache.Compiler. When next time a method is called, the computed object's methods will be called instead of returning the method's cache, if the object is newer than the cache. """ class Cache(object): """ Method decorator class. Used on methods whose result will be cached. """ # A unique ever-increasing id for each cache update. # Can be used for comparing the age of caches. _C_CacheUID = 0 # Represents an empty cache. Empty = object() @staticmethod def getNewCacheUID(): """ Get a new unique ID for the Cache that is about to be constructed or updated. """ r = _C_CacheUID _C_CacheUID += 1 return r class Manager(object): """ Interface hidden in objects utilized by caches that enables the use of operations on all the cached objects of the parent. """ # Name of the hidden member of the managed object # that holds the Cache Manager. CMMemberName = "_CM_Cache_Manager_" @staticmethod def of(object): """ Return the Cache Manager of the object. Instantiates a new one if it doesn't have one. """ Manager(object) return getattr(object, Manager.CMMemberName) def __init__(self, parent): """ Cache Manager constructor. :param parent: The object whose caches will be managed. """ if hasattr(parent, Manager.CMMemberName) and \ isinstance(getattr(parent, Manager.CMMemberName), Manager): return setattr(parent, Manager.CMMemberName, self) self.caches = set() self.compiler = None class Compiler(Cache): """ A Cache Compiler is a special form of cache, which when invoked creates a "Compiled Cache". A Compiled Cache is a cache that is stored in the parent's Cache Manager, and essentialy replaces the parent. So, the method that will be decorated with the Compiler has to return an object with the same type as the parent, or at least one that supports the same methods of the parent that are decorated as Cache. After that, whenever a cached method is called, the result is taken from the compiled cache (except if the method's cache is newer). This is useful for objects that cache many parameters, but also have a greater method that creates a 'baked' replica of themselves. After the 'baking', the parameters can simply be taken from the cached replica. """ @staticmethod def of(object): """ Return the Cache Compiler of the object. """ return Cache.Manager.of(parent).compiler def __call__(self, parent, *args, **kwargs): Cache.Manager.of(parent).compiler = self if self.cache is Cache.Empty: self.calculate(parent, *args, **kwargs) return self.cache def __init__(self, method): """ Cache constructor. Cache is a decorator class, so the constructor is essentialy applied to a method to be cached. """ self.method = method self.cache = Cache.Empty self.cacheUID = Cache.getNewCacheUID() def __call__(self, parent, *args, **kwargs): Cache.Manager.of(parent).caches.add(self) # If a compiled cache exists and is newer, # prefer to get the value from it instead. compiler = Cache.Compiler.of(parent) if compiler and \ compiler.cacheUID > self.cacheUID and \ compiler.cache is not Cache.Empty: return getattr(compiler.cache, self.method)(parent, *args, **kwargs) if self.cache is Cache.Empty: self.calculate(parent, *args, **kwargs) return self.cache def calculate(self, *args, **kwargs): self.cache = self.method(*args, **kwargs) self.cacheUID = Cache.getNewCacheUID() @staticmethod def invalidate(object, *args): """ Invalidate the caches of the object defined in the arguments. """ for arg in args: if hasattr(object, arg) and \ isinstance(getattr(object, arg), Cache): getattr(object, arg).cache = Cache.Empty @staticmethod def invalidateAll(object): """ Invalidate all caches of the given object. """ Cache.invalidate(object, *Cache.Manager.of(object).caches)
""" **Project Name:** MakeHuman **Product Home Page:** http://www.makehumancommunity.org/ **Github Code Home Page:** https://github.com/makehumancommunity/ **Authors:** Thanasis Papoutsidakis **Copyright(c):** MakeHuman Team 2001-2019 **Licensing:** AGPL3 This file is part of MakeHuman Community (www.makehumancommunity.org). This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Abstract -------- Tools and interfaces for managing caches. A cache is a container associated with a method. When the method is called, the result is stored in the cache, and on subsequent calls of the method the stored result is returned, so that no recomputation is needed. The result of the method will be recalculated once the cache is explicitly invalidated (emptied) and the method gets called again. To use the caching mechanisms in your code, simply use the Cache decorator in front of the method you want to cache. Example: @Cache def method(self): ... To invalidate a cached result, you can assign Cache Empty to your method's cache: self.method.cache = Cache.Empty You can also use Cache.invalidate to inalidate caches, like so: Cache.invalidate(self, "method1", "method2") Or use Cache.invalidateAll to clear all caches of an object: Cache.invalidateAll(self) If your object happens to have a method that somehow processes all of its caches, and returns a similar object with the same methods but with all the computation done, decorate it as Cache.Compiler. When next time a method is called, the computed object's methods will be called instead of returning the method's cache, if the object is newer than the cache. """ class Cache(object): """ Method decorator class. Used on methods whose result will be cached. """ _c__cache_uid = 0 empty = object() @staticmethod def get_new_cache_uid(): """ Get a new unique ID for the Cache that is about to be constructed or updated. """ r = _C_CacheUID _c__cache_uid += 1 return r class Manager(object): """ Interface hidden in objects utilized by caches that enables the use of operations on all the cached objects of the parent. """ cm_member_name = '_CM_Cache_Manager_' @staticmethod def of(object): """ Return the Cache Manager of the object. Instantiates a new one if it doesn't have one. """ manager(object) return getattr(object, Manager.CMMemberName) def __init__(self, parent): """ Cache Manager constructor. :param parent: The object whose caches will be managed. """ if hasattr(parent, Manager.CMMemberName) and isinstance(getattr(parent, Manager.CMMemberName), Manager): return setattr(parent, Manager.CMMemberName, self) self.caches = set() self.compiler = None class Compiler(Cache): """ A Cache Compiler is a special form of cache, which when invoked creates a "Compiled Cache". A Compiled Cache is a cache that is stored in the parent's Cache Manager, and essentialy replaces the parent. So, the method that will be decorated with the Compiler has to return an object with the same type as the parent, or at least one that supports the same methods of the parent that are decorated as Cache. After that, whenever a cached method is called, the result is taken from the compiled cache (except if the method's cache is newer). This is useful for objects that cache many parameters, but also have a greater method that creates a 'baked' replica of themselves. After the 'baking', the parameters can simply be taken from the cached replica. """ @staticmethod def of(object): """ Return the Cache Compiler of the object. """ return Cache.Manager.of(parent).compiler def __call__(self, parent, *args, **kwargs): Cache.Manager.of(parent).compiler = self if self.cache is Cache.Empty: self.calculate(parent, *args, **kwargs) return self.cache def __init__(self, method): """ Cache constructor. Cache is a decorator class, so the constructor is essentialy applied to a method to be cached. """ self.method = method self.cache = Cache.Empty self.cacheUID = Cache.getNewCacheUID() def __call__(self, parent, *args, **kwargs): Cache.Manager.of(parent).caches.add(self) compiler = Cache.Compiler.of(parent) if compiler and compiler.cacheUID > self.cacheUID and (compiler.cache is not Cache.Empty): return getattr(compiler.cache, self.method)(parent, *args, **kwargs) if self.cache is Cache.Empty: self.calculate(parent, *args, **kwargs) return self.cache def calculate(self, *args, **kwargs): self.cache = self.method(*args, **kwargs) self.cacheUID = Cache.getNewCacheUID() @staticmethod def invalidate(object, *args): """ Invalidate the caches of the object defined in the arguments. """ for arg in args: if hasattr(object, arg) and isinstance(getattr(object, arg), Cache): getattr(object, arg).cache = Cache.Empty @staticmethod def invalidate_all(object): """ Invalidate all caches of the given object. """ Cache.invalidate(object, *Cache.Manager.of(object).caches)
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'chromium', 'isolate', 'recipe_engine/properties', ] def RunSteps(api): api.chromium.set_config('chromium') api.isolate.compare_build_artifacts('first_dir', 'second_dir') def GenTests(api): yield ( api.test('basic') + api.properties( buildername='test_buildername', buildnumber=123) ) yield ( api.test('failure') + api.properties( buildername='test_buildername', buildnumber=123) + api.step_data('compare_build_artifacts', retcode=1) )
deps = ['chromium', 'isolate', 'recipe_engine/properties'] def run_steps(api): api.chromium.set_config('chromium') api.isolate.compare_build_artifacts('first_dir', 'second_dir') def gen_tests(api): yield (api.test('basic') + api.properties(buildername='test_buildername', buildnumber=123)) yield (api.test('failure') + api.properties(buildername='test_buildername', buildnumber=123) + api.step_data('compare_build_artifacts', retcode=1))
''' # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail ''' # Write your code here def arr(): return [] def bfs(g,a,b,n): vis=[] q=[a] parent={} while(len(q)>0): t = q.pop(0) vis.append(t) n+=1 for i in g.get(t,[]): if i not in vis: parent[i]=t if i==b: return n+1,parent q.append(i) return -1,{} n,m,t,c = map(int,input().split()) g = {} for _ in range(m): a,b = map(int,input().split()) if g.get(a)==None: g[a]=[] if g.get(b)==None: g[b]=[] g[a].append(b) g[b].append(a) c,p=bfs(g,1,n,0) print(c) pp=[n] s=n while(p.get(s)!=None): pp.append(p.get(s)) s=p.get(s) pp.reverse() print(" ".join(map(str,pp)))
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ def arr(): return [] def bfs(g, a, b, n): vis = [] q = [a] parent = {} while len(q) > 0: t = q.pop(0) vis.append(t) n += 1 for i in g.get(t, []): if i not in vis: parent[i] = t if i == b: return (n + 1, parent) q.append(i) return (-1, {}) (n, m, t, c) = map(int, input().split()) g = {} for _ in range(m): (a, b) = map(int, input().split()) if g.get(a) == None: g[a] = [] if g.get(b) == None: g[b] = [] g[a].append(b) g[b].append(a) (c, p) = bfs(g, 1, n, 0) print(c) pp = [n] s = n while p.get(s) != None: pp.append(p.get(s)) s = p.get(s) pp.reverse() print(' '.join(map(str, pp)))
class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s rows = [''] * min(numRows, len(s)) cur_row = 0 goind_down = False for c in s: rows[cur_row] += c if cur_row == 0 or cur_row == numRows - 1: goind_down = not goind_down cur_row += 1 if goind_down else -1 result = '' for row in rows: result += row return result
class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s rows = [''] * min(numRows, len(s)) cur_row = 0 goind_down = False for c in s: rows[cur_row] += c if cur_row == 0 or cur_row == numRows - 1: goind_down = not goind_down cur_row += 1 if goind_down else -1 result = '' for row in rows: result += row return result
class LowPassFilter(object): def __init__(self, lpf_constants): self.tau = lpf_constants[0] self.ts = lpf_constants[1] self.a = 1. / (self.tau / self.ts + 1.) self.b = self.tau / self.ts / (self.tau / self.ts + 1.); self.last_val = 0. self.ready = False def get(self): return self.last_val def filt(self, val): if self.ready: val = self.a * val + self.b * self.last_val else: self.ready = True self.last_val = val return val
class Lowpassfilter(object): def __init__(self, lpf_constants): self.tau = lpf_constants[0] self.ts = lpf_constants[1] self.a = 1.0 / (self.tau / self.ts + 1.0) self.b = self.tau / self.ts / (self.tau / self.ts + 1.0) self.last_val = 0.0 self.ready = False def get(self): return self.last_val def filt(self, val): if self.ready: val = self.a * val + self.b * self.last_val else: self.ready = True self.last_val = val return val
''' Problem Statement : Write a function that returns the boolean True if the given number is zero, the string "positive" if the number is greater than zero or the string "negative" if it's smaller than zero. Problem Link : https://edabit.com/challenge/2TdPmSpLpa8NWh6m9 ''' def equilibrium(x): return not x or ('negative', 'positive')[x > 0]
""" Problem Statement : Write a function that returns the boolean True if the given number is zero, the string "positive" if the number is greater than zero or the string "negative" if it's smaller than zero. Problem Link : https://edabit.com/challenge/2TdPmSpLpa8NWh6m9 """ def equilibrium(x): return not x or ('negative', 'positive')[x > 0]
"""https://leetcode.com/problems/rectangle-area/ https://www.youtube.com/watch?v=zGv3hOORxh0&list=WL&index=6 You're given 2 overlapping rectangles on a plane (2 rectilinear rectangles in a 2D plane.) For each rectangle, you're given its bottom-left and top-right points How would you find the area of their overlap? (total area covered by the two rectangles.) """ class Solution: def computeArea( self, ax1: int, ay1: int, ax2: int, ay2: int, bx1: int, by1: int, bx2: int, by2: int, ) -> int: bottom_left_1 = [ax1, ay1] top_right_1 = [ax2, ay2] bottom_right_1 = [ax2, ay1] top_left_1 = [ax1, ay2] bottom_left_2 = [bx1, by1] top_right_2 = [bx2, by2] bottom_right_2 = [bx2, by1] top_left_2 = [bx1, by2] width = 0 height = 0 left_3 = max([bottom_left_1[0], bottom_left_2[0]]) right_3 = min([bottom_right_1[0], bottom_right_2[0]]) if right_3 > left_3: width = abs(right_3 - left_3) top_3 = min([top_left_1[1], top_left_2[1]]) bottom_3 = max([bottom_left_1[1], bottom_left_2[1]]) if top_3 > bottom_3: height = abs(bottom_3 - top_3) area_1 = abs(bottom_right_1[0] - bottom_left_1[0]) * abs( top_left_1[1] - bottom_left_1[1] ) area_2 = abs(bottom_right_2[0] - bottom_left_2[0]) * abs( top_left_2[1] - bottom_left_2[1] ) print(area_1, area_2, width, height) return (area_1 + area_2) - (width * height)
"""https://leetcode.com/problems/rectangle-area/ https://www.youtube.com/watch?v=zGv3hOORxh0&list=WL&index=6 You're given 2 overlapping rectangles on a plane (2 rectilinear rectangles in a 2D plane.) For each rectangle, you're given its bottom-left and top-right points How would you find the area of their overlap? (total area covered by the two rectangles.) """ class Solution: def compute_area(self, ax1: int, ay1: int, ax2: int, ay2: int, bx1: int, by1: int, bx2: int, by2: int) -> int: bottom_left_1 = [ax1, ay1] top_right_1 = [ax2, ay2] bottom_right_1 = [ax2, ay1] top_left_1 = [ax1, ay2] bottom_left_2 = [bx1, by1] top_right_2 = [bx2, by2] bottom_right_2 = [bx2, by1] top_left_2 = [bx1, by2] width = 0 height = 0 left_3 = max([bottom_left_1[0], bottom_left_2[0]]) right_3 = min([bottom_right_1[0], bottom_right_2[0]]) if right_3 > left_3: width = abs(right_3 - left_3) top_3 = min([top_left_1[1], top_left_2[1]]) bottom_3 = max([bottom_left_1[1], bottom_left_2[1]]) if top_3 > bottom_3: height = abs(bottom_3 - top_3) area_1 = abs(bottom_right_1[0] - bottom_left_1[0]) * abs(top_left_1[1] - bottom_left_1[1]) area_2 = abs(bottom_right_2[0] - bottom_left_2[0]) * abs(top_left_2[1] - bottom_left_2[1]) print(area_1, area_2, width, height) return area_1 + area_2 - width * height
""" Resource optimization functions. """ #from scipy.optimize import linprog def allocate(reservations, total=1.0): """ Allocate resources among slices with specified and unspecified reservations. Returns a new list of values with the following properties: - Every value is >= the corresponding input value. - The result sums to `total`. Examples: allocate([0.25, None, None]) -> [0.5, 0.25, 0.25] allocate([0.4, None, None]) -> [0.6, 0.2, 0.2] allocate([0.2, 0.2, 0.2]) -> [0.33, 0.33, 0.33] allocate([None, None, None]) -> [0.33, 0.33, 0.33] allocate([0.5, 0.5, 0.5]) -> ERROR """ n = len(reservations) if n <= 0: return [] remaining = total for r in reservations: if r is not None: remaining -= r result = list(reservations) # Divide the remaining resources among all slices. if remaining > 0: share = float(remaining) / n for i in range(n): if result[i] is None: result[i] = share else: result[i] += share elif remaining < 0: raise Exception("Resource allocation is infeasible (total {} > {})".format( sum(result), total)) return result # # The optimize function requires scipy. It might be useful later. # #def optimize(reservations, ub=1): # n = len(reservations) # # # In case some reservations are unspecified (None), calculate the remaining # # share and divide it evenly among the unspecified buckets. # # # # Example: # # [0.2, None, None] -> [0.2, 0.4, 0.4] # floor = allocate(reservations, ub) # print(floor) # # # Coefficients for the objective function. We want to maximize the sum, but # # linprog does minimization, hence the negative. # c = [-1] * n # # # Constraints (A_ub * x <= b_ub). # A_ub = [] # b_ub = [] # # for i in range(n): # # Competition constraint (sum of all others <= ub-reservation[i]). # # If all others (j != i) use up their allocated resource, there must # # be enough left over for reservation[i]. # row = [0] * n # for j in range(n): # # Sum of limit[j] for j != i # if j != i: # row[j] = 1 # # # ...is <= ub-reservations[i]. # A_ub.append(row) # b_ub.append(ub-floor[i]) # # # Set the upper and lower bounds: # # (reservations[i] or fair share) <= x[i] <= ub # bounds = [(floor[i], ub) for i in range(n)] # # result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=bounds) # return result
""" Resource optimization functions. """ def allocate(reservations, total=1.0): """ Allocate resources among slices with specified and unspecified reservations. Returns a new list of values with the following properties: - Every value is >= the corresponding input value. - The result sums to `total`. Examples: allocate([0.25, None, None]) -> [0.5, 0.25, 0.25] allocate([0.4, None, None]) -> [0.6, 0.2, 0.2] allocate([0.2, 0.2, 0.2]) -> [0.33, 0.33, 0.33] allocate([None, None, None]) -> [0.33, 0.33, 0.33] allocate([0.5, 0.5, 0.5]) -> ERROR """ n = len(reservations) if n <= 0: return [] remaining = total for r in reservations: if r is not None: remaining -= r result = list(reservations) if remaining > 0: share = float(remaining) / n for i in range(n): if result[i] is None: result[i] = share else: result[i] += share elif remaining < 0: raise exception('Resource allocation is infeasible (total {} > {})'.format(sum(result), total)) return result
class Solution: def findShortestSubArray(self, nums): first, count, res, degree = {}, {}, 0, 0 for i, num in enumerate(nums): first.setdefault(num, i) count[num] = count.get(num, 0) + 1 if count[num] > degree: degree = count[num] res = i - first[num] + 1 elif count[num] == degree: res = min(res, i - first[num] + 1) return res s = Solution() print(s.findShortestSubArray([])) print(s.findShortestSubArray([1])) print(s.findShortestSubArray([1, 2, 2, 3, 1])) print(s.findShortestSubArray([1, 2, 2, 3, 1, 4, 2]))
class Solution: def find_shortest_sub_array(self, nums): (first, count, res, degree) = ({}, {}, 0, 0) for (i, num) in enumerate(nums): first.setdefault(num, i) count[num] = count.get(num, 0) + 1 if count[num] > degree: degree = count[num] res = i - first[num] + 1 elif count[num] == degree: res = min(res, i - first[num] + 1) return res s = solution() print(s.findShortestSubArray([])) print(s.findShortestSubArray([1])) print(s.findShortestSubArray([1, 2, 2, 3, 1])) print(s.findShortestSubArray([1, 2, 2, 3, 1, 4, 2]))
class StitchSubclusterSelectorBase(object): """ Subclasses of this class are used to make choice which subclusters will be stitched next based on criteria. """ def __init__(self, *args, **kwargs): pass def select(self, dst, src, stitched, is_intra=False): raise NotImplementedError class MaxCommonNodeSelector(StitchSubclusterSelectorBase): """ Return subclusters that have maximum common node count. """ def __init__(self, cn_count_treshold=0): self.cn_count_treshold = cn_count_treshold def select(self, dst, src, stitched, is_intra=False): cn_count_max = 0 dstSubIndex = None srcSubIndex = None for src_index, src_sc in enumerate(src): for dst_index, dst_sc in enumerate(dst): # same subcluster if is_intra and src_index==dst_index: continue # already stitched if (dst_index, src_index) in stitched: continue # src_sc is subset of dst_sc mark src_sc stitched with dst if set(src_sc.keys())<=set(dst_sc.keys()): stitched[(dst_index, src_index)] = () continue commonNodes = [node for node in list(dst_sc.keys()) if node in list(src_sc.keys())] cn_count = len(commonNodes) if cn_count>cn_count_max and cn_count>=self.cn_count_treshold: cn_count_max = cn_count dstSubIndex = dst_index srcSubIndex = src_index # in intraStitch make sure that dstSub is larger one if is_intra and cn_count_max!=0 and \ len(src[srcSubIndex])>len(dst[dstSubIndex]): return (srcSubIndex, dstSubIndex) # swapped src and dst indexes return (dstSubIndex, srcSubIndex)
class Stitchsubclusterselectorbase(object): """ Subclasses of this class are used to make choice which subclusters will be stitched next based on criteria. """ def __init__(self, *args, **kwargs): pass def select(self, dst, src, stitched, is_intra=False): raise NotImplementedError class Maxcommonnodeselector(StitchSubclusterSelectorBase): """ Return subclusters that have maximum common node count. """ def __init__(self, cn_count_treshold=0): self.cn_count_treshold = cn_count_treshold def select(self, dst, src, stitched, is_intra=False): cn_count_max = 0 dst_sub_index = None src_sub_index = None for (src_index, src_sc) in enumerate(src): for (dst_index, dst_sc) in enumerate(dst): if is_intra and src_index == dst_index: continue if (dst_index, src_index) in stitched: continue if set(src_sc.keys()) <= set(dst_sc.keys()): stitched[dst_index, src_index] = () continue common_nodes = [node for node in list(dst_sc.keys()) if node in list(src_sc.keys())] cn_count = len(commonNodes) if cn_count > cn_count_max and cn_count >= self.cn_count_treshold: cn_count_max = cn_count dst_sub_index = dst_index src_sub_index = src_index if is_intra and cn_count_max != 0 and (len(src[srcSubIndex]) > len(dst[dstSubIndex])): return (srcSubIndex, dstSubIndex) return (dstSubIndex, srcSubIndex)
DISCORD_API_BASE_URL = "https://discord.com/api" DISCORD_AUTHORIZATION_BASE_URL = DISCORD_API_BASE_URL + "/oauth2/authorize" DISCORD_TOKEN_URL = DISCORD_API_BASE_URL + "/oauth2/token" DISCORD_OAUTH_ALL_SCOPES = [ "bot", "connections", "email", "identify", "guilds", "guilds.join", "gdm.join", "messages.read", "rpc", "rpc.api", "rpc.notifications.read", "webhook.incoming", ] DISCORD_OAUTH_DEFAULT_SCOPES = [ "identify", "email", "guilds", "guilds.join" ] DISCORD_PASSTHROUGH_SCOPES = [ "bot", "webhook.incoming", ] DISCORD_IMAGE_BASE_URL = "https://cdn.discordapp.com/" DISCORD_EMBED_BASE_BASE_URL = "https://cdn.discordapp.com/" DISCORD_IMAGE_FORMAT = "png" DISCORD_ANIMATED_IMAGE_FORMAT = "gif" DISCORD_USER_AVATAR_BASE_URL = DISCORD_IMAGE_BASE_URL + "avatars/{user_id}/{avatar_hash}.{format}" DISCORD_DEFAULT_USER_AVATAR_BASE_URL = DISCORD_EMBED_BASE_BASE_URL + "embed/avatars/{modulo5}.png" DISCORD_GUILD_ICON_BASE_URL = DISCORD_IMAGE_BASE_URL + "icons/{guild_id}/{icon_hash}.png" DISCORD_USERS_CACHE_DEFAULT_MAX_LIMIT = 100
discord_api_base_url = 'https://discord.com/api' discord_authorization_base_url = DISCORD_API_BASE_URL + '/oauth2/authorize' discord_token_url = DISCORD_API_BASE_URL + '/oauth2/token' discord_oauth_all_scopes = ['bot', 'connections', 'email', 'identify', 'guilds', 'guilds.join', 'gdm.join', 'messages.read', 'rpc', 'rpc.api', 'rpc.notifications.read', 'webhook.incoming'] discord_oauth_default_scopes = ['identify', 'email', 'guilds', 'guilds.join'] discord_passthrough_scopes = ['bot', 'webhook.incoming'] discord_image_base_url = 'https://cdn.discordapp.com/' discord_embed_base_base_url = 'https://cdn.discordapp.com/' discord_image_format = 'png' discord_animated_image_format = 'gif' discord_user_avatar_base_url = DISCORD_IMAGE_BASE_URL + 'avatars/{user_id}/{avatar_hash}.{format}' discord_default_user_avatar_base_url = DISCORD_EMBED_BASE_BASE_URL + 'embed/avatars/{modulo5}.png' discord_guild_icon_base_url = DISCORD_IMAGE_BASE_URL + 'icons/{guild_id}/{icon_hash}.png' discord_users_cache_default_max_limit = 100
CSRF_ENABLED = True SECRET_KEY = 'blabla' DOCUMENTDB_HOST = 'https://mongo-olx.documents.azure.com:443/' DOCUMENTDB_KEY = 'hJJaII1eaMs2wUHNqvjDkzRF3wOz24x8x/J7+Zfw2D91KM/LTjNXcVg8WgMV2JiaNGuTnsnInSmO8jrqDRGw/g==' DOCUMENTDB_DATABASE = 'olxDB' DOCUMENTDB_COLLECTION = 'rentals' DOCUMENTDB_DOCUMENT = 'rent-doc'
csrf_enabled = True secret_key = 'blabla' documentdb_host = 'https://mongo-olx.documents.azure.com:443/' documentdb_key = 'hJJaII1eaMs2wUHNqvjDkzRF3wOz24x8x/J7+Zfw2D91KM/LTjNXcVg8WgMV2JiaNGuTnsnInSmO8jrqDRGw/g==' documentdb_database = 'olxDB' documentdb_collection = 'rentals' documentdb_document = 'rent-doc'
class Solution: def numMovesStones(self, a: int, b: int, c: int) -> List[int]: temp = [a,b,c] temp.sort() d1, d2 = temp[1] - temp[0], temp[2] - temp[1] if d1 == 1 and d2 == 1: return [0, 0] elif d1 == 1 or d2 == 1: return [1, max(d1, d2)-1] elif d1 == 2 and d2 == 2: return [1, 2] elif d1 == 2 or d2 == 2: return [1, d1+d2-2] else: return [2, d1+d2-2]
class Solution: def num_moves_stones(self, a: int, b: int, c: int) -> List[int]: temp = [a, b, c] temp.sort() (d1, d2) = (temp[1] - temp[0], temp[2] - temp[1]) if d1 == 1 and d2 == 1: return [0, 0] elif d1 == 1 or d2 == 1: return [1, max(d1, d2) - 1] elif d1 == 2 and d2 == 2: return [1, 2] elif d1 == 2 or d2 == 2: return [1, d1 + d2 - 2] else: return [2, d1 + d2 - 2]
class EmptyLayerError(Exception): """ Represent empty layers accessing. """ def __init__(self, message="Unable to access empty layers."): super(EmptyLayerError, self).__init__(message)
class Emptylayererror(Exception): """ Represent empty layers accessing. """ def __init__(self, message='Unable to access empty layers.'): super(EmptyLayerError, self).__init__(message)
class GST_Company(): def __init__(self, gstno, rate,pos,st): self.GSTNO = gstno self.RATE = rate self.POS=pos self.ST=st self.__taxable = 0.00 self.__cgst = 0.00 self.__sgst = 0.00 self.__igst = 0.00 self.__cess = 0 self.__total = 0.00 def updata_invoice(self, taxable, cgst, sgst, igst,cess): self.__taxable += taxable self.__cgst += cgst self.__sgst += sgst self.__igst += igst self.__cess+= cess self.__total += (taxable + cgst + sgst + igst + cess) def generate_output(self): return [ self.GSTNO, self.POS,self.ST,self.__taxable, self.RATE, self.__igst, self.__cgst, self.__sgst,self.__cess, self.__total ] def test(self): return self.__taxable @classmethod def from_dict(cls,df_dict): return cls(df_dict['GSTNO'],df_dict['RATE'],df_dict['POS'],df_dict['ST'])
class Gst_Company: def __init__(self, gstno, rate, pos, st): self.GSTNO = gstno self.RATE = rate self.POS = pos self.ST = st self.__taxable = 0.0 self.__cgst = 0.0 self.__sgst = 0.0 self.__igst = 0.0 self.__cess = 0 self.__total = 0.0 def updata_invoice(self, taxable, cgst, sgst, igst, cess): self.__taxable += taxable self.__cgst += cgst self.__sgst += sgst self.__igst += igst self.__cess += cess self.__total += taxable + cgst + sgst + igst + cess def generate_output(self): return [self.GSTNO, self.POS, self.ST, self.__taxable, self.RATE, self.__igst, self.__cgst, self.__sgst, self.__cess, self.__total] def test(self): return self.__taxable @classmethod def from_dict(cls, df_dict): return cls(df_dict['GSTNO'], df_dict['RATE'], df_dict['POS'], df_dict['ST'])
"""Results gathered from tests. Copyright (c) 2019 Red Hat Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ class Results(): """Class representing results gathered from tests.""" def __init__(self): """Prepare empty result structure.""" self.tests = []
"""Results gathered from tests. Copyright (c) 2019 Red Hat Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ class Results: """Class representing results gathered from tests.""" def __init__(self): """Prepare empty result structure.""" self.tests = []
parameters = { # Add entry for each state variable to check; number is tolerance "alpha": 0.0, "b": 0.0, "d1c": 0.0, "d1t": 0.0, "d2": 0.0, "fb1": 0.0, "fb2": 0.0, "fb3": 0.0, "nstatev": 0, "phi0_12": 0.0, }
parameters = {'alpha': 0.0, 'b': 0.0, 'd1c': 0.0, 'd1t': 0.0, 'd2': 0.0, 'fb1': 0.0, 'fb2': 0.0, 'fb3': 0.0, 'nstatev': 0, 'phi0_12': 0.0}
class Stack: def __init__(self): self.queue = [] def enqueue(self, element): self.queue # [3,2,1] def dequeue(self): queue_helper = [] while len(self.queue) != 1: x = self.queue.pop() queue_helper.append(x) temp = self.queue.pop() while queue_helper: x = queue_helper.pop() self.queue.append(x) return temp stack = Stack() stack.enqueue(1) stack.enqueue(2) stack.enqueue(3) print(stack.dequeue())
class Stack: def __init__(self): self.queue = [] def enqueue(self, element): self.queue def dequeue(self): queue_helper = [] while len(self.queue) != 1: x = self.queue.pop() queue_helper.append(x) temp = self.queue.pop() while queue_helper: x = queue_helper.pop() self.queue.append(x) return temp stack = stack() stack.enqueue(1) stack.enqueue(2) stack.enqueue(3) print(stack.dequeue())
class SRTError(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg class SRTLoginError(SRTError): def __init__(self, msg="Login failed, please check ID/PW"): super().__init__(msg) class SRTResponseError(SRTError): def __init__(self, msg): super().__init__(msg) class SRTDuplicateError(SRTResponseError): def __init__(self, msg): super().__init__(msg) class SRTNotLoggedInError(SRTError): def __init__(self): super().__init__("Not logged in")
class Srterror(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg class Srtloginerror(SRTError): def __init__(self, msg='Login failed, please check ID/PW'): super().__init__(msg) class Srtresponseerror(SRTError): def __init__(self, msg): super().__init__(msg) class Srtduplicateerror(SRTResponseError): def __init__(self, msg): super().__init__(msg) class Srtnotloggedinerror(SRTError): def __init__(self): super().__init__('Not logged in')
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. # version_info = (0, 15, 0) __version__ = '%s.%s.%s' % (version_info[0], version_info[1], version_info[2]) EXTENSION_VERSION = '^0.15.0'
version_info = (0, 15, 0) __version__ = '%s.%s.%s' % (version_info[0], version_info[1], version_info[2]) extension_version = '^0.15.0'
"""File Handling.""" # my_file = open('data.txt', 'r') """ with open('data.txt', 'r') as data: print(f'File name: {data.name}') # for text_line in data.readlines(): # print(text_line, end='') for line in data: print(line, end='') """ """ lines = ["This is line 1", "This is line 2", "This is line 3", "This is line 4"] with open('data.txt', 'w') as data: for line in lines: data.write(line) data.write('\n') """ lines = ["This is line 5", "This is line 6", "This is line 3", "This is line 7"] with open('data.txt', 'r') as data: data_as_list = data.readlines() data_as_list.insert(1, "This is between line 1 and 2\n") with open('data.txt', 'w') as data: data_as_str = "".join(data_as_list) data.write(data_as_str) with open('data.txt', 'a') as data: for line in lines: data.write(line) data.write('\n') """ Text file's modes: w - Write r - Read a - Append r+ - Read Write x - Creation Mode Binary file's modes: wb - Write rb - Read ab - Append rb+ - Read Write """
"""File Handling.""" "\nwith open('data.txt', 'r') as data:\n print(f'File name: {data.name}')\n # for text_line in data.readlines():\n # print(text_line, end='')\n for line in data:\n print(line, end='')\n" '\nlines = ["This is line 1", "This is line 2", "This is line 3", "This is line 4"]\nwith open(\'data.txt\', \'w\') as data:\n for line in lines:\n data.write(line)\n data.write(\'\n\')\n' lines = ['This is line 5', 'This is line 6', 'This is line 3', 'This is line 7'] with open('data.txt', 'r') as data: data_as_list = data.readlines() data_as_list.insert(1, 'This is between line 1 and 2\n') with open('data.txt', 'w') as data: data_as_str = ''.join(data_as_list) data.write(data_as_str) with open('data.txt', 'a') as data: for line in lines: data.write(line) data.write('\n') "\nText file's modes:\nw - Write\nr - Read\na - Append\nr+ - Read Write\nx - Creation Mode\n\nBinary file's modes:\nwb - Write\nrb - Read\nab - Append\nrb+ - Read Write\n"
#!/usr/bin/env python log_dir = os.environ['LOG_DIR'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ['MANAGED_SERVER_NAME'] ###################################################################### def set_server_access_log_config(_log_dir, _server_name): cd('/Servers/' + _server_name + '/WebServer/' + _server_name + '/WebServerLog/' + _server_name) cmo.setLoggingEnabled(True) cmo.setFileName(_log_dir + '/' + _server_name + '/' + 'access.' + _server_name + '.%%yyyy%%%%MM%%%%dd%%_%%HH%%%%mm%%%%ss%%.log') # cmo.setFileName('/dev/null') cmo.setRotationType('byTime') cmo.setRotationTime('00:00') cmo.setFileTimeSpan(24) cmo.setNumberOfFilesLimited(True) cmo.setFileCount(30) cmo.setRotateLogOnStartup(False) cmo.setLogFileFormat('common') # cmo.setLogFileFormat('extended') cmo.setELFFields('date time cs-method cs-uri sc-status') cmo.setBufferSizeKB(0) cmo.setLogTimeInGMT(False) ###################################################################### admin_server_url = 't3://' + admin_server_listen_address + ':' + admin_server_listen_port connect(admin_username, admin_password, admin_server_url) edit() startEdit() domain_version = cmo.getDomainVersion() set_server_access_log_config(log_dir, managed_server_name) save() activate() exit()
log_dir = os.environ['LOG_DIR'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ['MANAGED_SERVER_NAME'] def set_server_access_log_config(_log_dir, _server_name): cd('/Servers/' + _server_name + '/WebServer/' + _server_name + '/WebServerLog/' + _server_name) cmo.setLoggingEnabled(True) cmo.setFileName(_log_dir + '/' + _server_name + '/' + 'access.' + _server_name + '.%%yyyy%%%%MM%%%%dd%%_%%HH%%%%mm%%%%ss%%.log') cmo.setRotationType('byTime') cmo.setRotationTime('00:00') cmo.setFileTimeSpan(24) cmo.setNumberOfFilesLimited(True) cmo.setFileCount(30) cmo.setRotateLogOnStartup(False) cmo.setLogFileFormat('common') cmo.setELFFields('date time cs-method cs-uri sc-status') cmo.setBufferSizeKB(0) cmo.setLogTimeInGMT(False) admin_server_url = 't3://' + admin_server_listen_address + ':' + admin_server_listen_port connect(admin_username, admin_password, admin_server_url) edit() start_edit() domain_version = cmo.getDomainVersion() set_server_access_log_config(log_dir, managed_server_name) save() activate() exit()
test = { 'name': 'scheme-def', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (def f(x y) (+ x y)) f scm> (f 2 3) 5 scm> (f 10 20) 30 """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (def factorial(x) (if (zero? x) 1 (* x (factorial (- x 1))))) factorial scm> (factorial 4) 24 """, 'hidden': False, 'locked': False } ], 'scored': True, 'setup': r""" scm> (load-all ".") """, 'teardown': '', 'type': 'scheme' } ] }
test = {'name': 'scheme-def', 'points': 1, 'suites': [{'cases': [{'code': '\n scm> (def f(x y) (+ x y))\n f\n scm> (f 2 3)\n 5\n scm> (f 10 20)\n 30\n ', 'hidden': False, 'locked': False}, {'code': '\n scm> (def factorial(x) (if (zero? x) 1 (* x (factorial (- x 1)))))\n factorial\n scm> (factorial 4)\n 24\n ', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '\n scm> (load-all ".")\n ', 'teardown': '', 'type': 'scheme'}]}
# -*- coding: utf-8 -*- def env_comment(env,comment=''): if env.get('fwuser_info') and not env['fwuser_info'].get('lock'): env['fwuser_info']['comment'] = comment env['fwuser_info']['lock'] = True
def env_comment(env, comment=''): if env.get('fwuser_info') and (not env['fwuser_info'].get('lock')): env['fwuser_info']['comment'] = comment env['fwuser_info']['lock'] = True
balance = 320000 annualInterestRate = 0.2 monthlyInterestRate = (annualInterestRate) / 12 epsilon = 0.01 lowerBound = balance / 12 upperBound = (balance * (1 + monthlyInterestRate)**12) / 12 ans = (upperBound + lowerBound)/2.0 newBalance = balance while abs(0 - newBalance) >= epsilon: newBalance = balance for i in range(0, 12): newBalance = round(((newBalance - ans) * (1 + monthlyInterestRate)), 2) if newBalance >= 0: lowerBound = ans else: upperBound = ans ans = (upperBound + lowerBound)/2.0 print("Lowest Payment: " + str(round(ans, 2)))
balance = 320000 annual_interest_rate = 0.2 monthly_interest_rate = annualInterestRate / 12 epsilon = 0.01 lower_bound = balance / 12 upper_bound = balance * (1 + monthlyInterestRate) ** 12 / 12 ans = (upperBound + lowerBound) / 2.0 new_balance = balance while abs(0 - newBalance) >= epsilon: new_balance = balance for i in range(0, 12): new_balance = round((newBalance - ans) * (1 + monthlyInterestRate), 2) if newBalance >= 0: lower_bound = ans else: upper_bound = ans ans = (upperBound + lowerBound) / 2.0 print('Lowest Payment: ' + str(round(ans, 2)))
# DO NOT LOAD THIS FILE. Targets from this file should be considered private # and not used outside of the @envoy//bazel package. load(":envoy_select.bzl", "envoy_select_google_grpc", "envoy_select_hot_restart") # Compute the final copts based on various options. def envoy_copts(repository, test = False): posix_options = [ "-Wall", "-Wextra", "-Werror", "-Wnon-virtual-dtor", "-Woverloaded-virtual", "-Wold-style-cast", "-Wvla", "-std=c++14", ] # Windows options for cleanest service compilation; # General MSVC C++ options # Streamline windows.h behavior for Win8+ API (for ntohll, see; # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx ) # Minimize Win32 API, dropping GUI-oriented features msvc_options = [ "-WX", "-Zc:__cplusplus", "-std:c++14", "-DWIN32", "-D_WIN32_WINNT=0x0602", "-DNTDDI_VERSION=0x06020000", "-DWIN32_LEAN_AND_MEAN", "-DNOUSER", "-DNOMCX", "-DNOIME", ] return select({ repository + "//bazel:windows_x86_64": msvc_options, "//conditions:default": posix_options, }) + select({ # Bazel adds an implicit -DNDEBUG for opt. repository + "//bazel:opt_build": [] if test else ["-ggdb3"], repository + "//bazel:fastbuild_build": [], repository + "//bazel:dbg_build": ["-ggdb3"], repository + "//bazel:windows_opt_build": [], repository + "//bazel:windows_fastbuild_build": [], repository + "//bazel:windows_dbg_build": [], }) + select({ repository + "//bazel:clang_build": ["-fno-limit-debug-info", "-Wgnu-conditional-omitted-operand"], repository + "//bazel:gcc_build": ["-Wno-maybe-uninitialized"], "//conditions:default": [], }) + select({ repository + "//bazel:disable_tcmalloc": ["-DABSL_MALLOC_HOOK_MMAP_DISABLE"], "//conditions:default": ["-DTCMALLOC"], }) + select({ repository + "//bazel:debug_tcmalloc": ["-DENVOY_MEMORY_DEBUG_ENABLED=1"], "//conditions:default": [], }) + select({ repository + "//bazel:disable_signal_trace": [], "//conditions:default": ["-DENVOY_HANDLE_SIGNALS"], }) + select({ repository + "//bazel:disable_object_dump_on_signal_trace": [], "//conditions:default": ["-DENVOY_OBJECT_TRACE_ON_DUMP"], }) + select({ repository + "//bazel:disable_deprecated_features": ["-DENVOY_DISABLE_DEPRECATED_FEATURES"], "//conditions:default": [], }) + select({ repository + "//bazel:enable_log_debug_assert_in_release": ["-DENVOY_LOG_DEBUG_ASSERT_IN_RELEASE"], "//conditions:default": [], }) + select({ # APPLE_USE_RFC_3542 is needed to support IPV6_PKTINFO in MAC OS. repository + "//bazel:apple": ["-D__APPLE_USE_RFC_3542"], "//conditions:default": [], }) + envoy_select_hot_restart(["-DENVOY_HOT_RESTART"], repository) + \ _envoy_select_perf_annotation(["-DENVOY_PERF_ANNOTATION"]) + \ envoy_select_google_grpc(["-DENVOY_GOOGLE_GRPC"], repository) + \ _envoy_select_path_normalization_by_default(["-DENVOY_NORMALIZE_PATH_BY_DEFAULT"], repository) # References to Envoy external dependencies should be wrapped with this function. def envoy_external_dep_path(dep): return "//external:%s" % dep def envoy_linkstatic(): return select({ "@envoy//bazel:dynamic_link_tests": 0, "//conditions:default": 1, }) def envoy_select_force_libcpp(if_libcpp, default = None): return select({ "@envoy//bazel:force_libcpp": if_libcpp, "@envoy//bazel:apple": [], "@envoy//bazel:windows_x86_64": [], "//conditions:default": default or [], }) def envoy_stdlib_deps(): return select({ "@envoy//bazel:asan_build": ["@envoy//bazel:dynamic_stdlib"], "@envoy//bazel:tsan_build": ["@envoy//bazel:dynamic_stdlib"], "//conditions:default": ["@envoy//bazel:static_stdlib"], }) # Dependencies on tcmalloc_and_profiler should be wrapped with this function. def tcmalloc_external_dep(repository): return select({ repository + "//bazel:disable_tcmalloc": None, "//conditions:default": envoy_external_dep_path("gperftools"), }) # Select the given values if default path normalization is on in the current build. def _envoy_select_path_normalization_by_default(xs, repository = ""): return select({ repository + "//bazel:enable_path_normalization_by_default": xs, "//conditions:default": [], }) def _envoy_select_perf_annotation(xs): return select({ "@envoy//bazel:enable_perf_annotation": xs, "//conditions:default": [], })
load(':envoy_select.bzl', 'envoy_select_google_grpc', 'envoy_select_hot_restart') def envoy_copts(repository, test=False): posix_options = ['-Wall', '-Wextra', '-Werror', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-Wold-style-cast', '-Wvla', '-std=c++14'] msvc_options = ['-WX', '-Zc:__cplusplus', '-std:c++14', '-DWIN32', '-D_WIN32_WINNT=0x0602', '-DNTDDI_VERSION=0x06020000', '-DWIN32_LEAN_AND_MEAN', '-DNOUSER', '-DNOMCX', '-DNOIME'] return select({repository + '//bazel:windows_x86_64': msvc_options, '//conditions:default': posix_options}) + select({repository + '//bazel:opt_build': [] if test else ['-ggdb3'], repository + '//bazel:fastbuild_build': [], repository + '//bazel:dbg_build': ['-ggdb3'], repository + '//bazel:windows_opt_build': [], repository + '//bazel:windows_fastbuild_build': [], repository + '//bazel:windows_dbg_build': []}) + select({repository + '//bazel:clang_build': ['-fno-limit-debug-info', '-Wgnu-conditional-omitted-operand'], repository + '//bazel:gcc_build': ['-Wno-maybe-uninitialized'], '//conditions:default': []}) + select({repository + '//bazel:disable_tcmalloc': ['-DABSL_MALLOC_HOOK_MMAP_DISABLE'], '//conditions:default': ['-DTCMALLOC']}) + select({repository + '//bazel:debug_tcmalloc': ['-DENVOY_MEMORY_DEBUG_ENABLED=1'], '//conditions:default': []}) + select({repository + '//bazel:disable_signal_trace': [], '//conditions:default': ['-DENVOY_HANDLE_SIGNALS']}) + select({repository + '//bazel:disable_object_dump_on_signal_trace': [], '//conditions:default': ['-DENVOY_OBJECT_TRACE_ON_DUMP']}) + select({repository + '//bazel:disable_deprecated_features': ['-DENVOY_DISABLE_DEPRECATED_FEATURES'], '//conditions:default': []}) + select({repository + '//bazel:enable_log_debug_assert_in_release': ['-DENVOY_LOG_DEBUG_ASSERT_IN_RELEASE'], '//conditions:default': []}) + select({repository + '//bazel:apple': ['-D__APPLE_USE_RFC_3542'], '//conditions:default': []}) + envoy_select_hot_restart(['-DENVOY_HOT_RESTART'], repository) + _envoy_select_perf_annotation(['-DENVOY_PERF_ANNOTATION']) + envoy_select_google_grpc(['-DENVOY_GOOGLE_GRPC'], repository) + _envoy_select_path_normalization_by_default(['-DENVOY_NORMALIZE_PATH_BY_DEFAULT'], repository) def envoy_external_dep_path(dep): return '//external:%s' % dep def envoy_linkstatic(): return select({'@envoy//bazel:dynamic_link_tests': 0, '//conditions:default': 1}) def envoy_select_force_libcpp(if_libcpp, default=None): return select({'@envoy//bazel:force_libcpp': if_libcpp, '@envoy//bazel:apple': [], '@envoy//bazel:windows_x86_64': [], '//conditions:default': default or []}) def envoy_stdlib_deps(): return select({'@envoy//bazel:asan_build': ['@envoy//bazel:dynamic_stdlib'], '@envoy//bazel:tsan_build': ['@envoy//bazel:dynamic_stdlib'], '//conditions:default': ['@envoy//bazel:static_stdlib']}) def tcmalloc_external_dep(repository): return select({repository + '//bazel:disable_tcmalloc': None, '//conditions:default': envoy_external_dep_path('gperftools')}) def _envoy_select_path_normalization_by_default(xs, repository=''): return select({repository + '//bazel:enable_path_normalization_by_default': xs, '//conditions:default': []}) def _envoy_select_perf_annotation(xs): return select({'@envoy//bazel:enable_perf_annotation': xs, '//conditions:default': []})
class lazy_property(object): """ meant to be used for lazy evaluation of an object attribute. property should represent non-mutable data, as it replaces itself. From: http://stackoverflow.com/a/6849299 """ def __init__(self, fget): self.fget = fget self.func_name = fget.__name__ def __get__(self, obj, cls): if obj is None: return None value = self.fget(obj) setattr(obj,self.func_name,value) return value
class Lazy_Property(object): """ meant to be used for lazy evaluation of an object attribute. property should represent non-mutable data, as it replaces itself. From: http://stackoverflow.com/a/6849299 """ def __init__(self, fget): self.fget = fget self.func_name = fget.__name__ def __get__(self, obj, cls): if obj is None: return None value = self.fget(obj) setattr(obj, self.func_name, value) return value
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_header(pluginname, "django")
def run(whatweb, pluginname): whatweb.recog_from_header(pluginname, 'django')
class AverageMeter: """ Class to be an average meter for any average metric like loss, accuracy, etc.. """ def __init__(self): self.value = 0 self.avg = 0 self.sum = 0 self.count = 0 self.reset() def reset(self): self.value = 0 self.avg = 0 self.sum = 0 self.count = 0 def update(self, val, n=1): self.value = val self.sum += val * n self.count += n self.avg = self.sum / self.count @property def val(self): return self.avg
class Averagemeter: """ Class to be an average meter for any average metric like loss, accuracy, etc.. """ def __init__(self): self.value = 0 self.avg = 0 self.sum = 0 self.count = 0 self.reset() def reset(self): self.value = 0 self.avg = 0 self.sum = 0 self.count = 0 def update(self, val, n=1): self.value = val self.sum += val * n self.count += n self.avg = self.sum / self.count @property def val(self): return self.avg
class Solution: def checkString(self, s: str) -> bool: a_indices = [i for i, x in enumerate(s) if x=='a'] try: if a_indices[-1] > s.index('b'): return False except: pass return True
class Solution: def check_string(self, s: str) -> bool: a_indices = [i for (i, x) in enumerate(s) if x == 'a'] try: if a_indices[-1] > s.index('b'): return False except: pass return True
""" 99 / 99 test cases passed. Runtime: 32 ms Memory Usage: 14.8 MB """ class Solution: def toGoatLatin(self, sentence: str) -> str: vowel = ['a', 'e', 'i', 'o', 'u'] ans = [] for i, word in enumerate(sentence.split()): if word[0].lower() in vowel: ans.append(word + 'ma' + 'a' * (i + 1)) else: ans.append(word[1:] + word[0] + 'ma' + 'a' * (i + 1)) return ' '.join(ans)
""" 99 / 99 test cases passed. Runtime: 32 ms Memory Usage: 14.8 MB """ class Solution: def to_goat_latin(self, sentence: str) -> str: vowel = ['a', 'e', 'i', 'o', 'u'] ans = [] for (i, word) in enumerate(sentence.split()): if word[0].lower() in vowel: ans.append(word + 'ma' + 'a' * (i + 1)) else: ans.append(word[1:] + word[0] + 'ma' + 'a' * (i + 1)) return ' '.join(ans)
# -*- coding: utf-8 -*- """ Histogram Entities. @author Hao Song (songhao@vmware.com) """
""" Histogram Entities. @author Hao Song (songhao@vmware.com) """
class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. """ # Transpose for i in range(len(matrix)): for j in range(i+1,len(matrix)): matrix[j][i],matrix[i][j] = matrix[i][j],matrix[j][i] # Flip for i in range(len(matrix)): matrix[i].reverse()
class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. """ for i in range(len(matrix)): for j in range(i + 1, len(matrix)): (matrix[j][i], matrix[i][j]) = (matrix[i][j], matrix[j][i]) for i in range(len(matrix)): matrix[i].reverse()
# [Job Adv] (Lv.30) Way of the Bandit darkMarble = 4031013 job = "Night Lord" sm.setSpeakerID(1052001) if sm.hasItem(darkMarble, 30): sm.sendNext("I am impressed, you surpassed the test. Only few are talented enough.\r\n" "You have proven yourself to be worthy, I shall mold your body into a #b"+ job +"#k.") else: sm.sendSayOkay("You have not retrieved the #t"+ darkMarble+"#s yet, I will be waiting.") sm.dispose() sm.consumeItem(darkMarble, 30) sm.completeQuestNoRewards(parentID) sm.jobAdvance(420) # Bandit sm.sendNext("You are now a #b"+ job +"#k.") sm.dispose()
dark_marble = 4031013 job = 'Night Lord' sm.setSpeakerID(1052001) if sm.hasItem(darkMarble, 30): sm.sendNext('I am impressed, you surpassed the test. Only few are talented enough.\r\nYou have proven yourself to be worthy, I shall mold your body into a #b' + job + '#k.') else: sm.sendSayOkay('You have not retrieved the #t' + darkMarble + '#s yet, I will be waiting.') sm.dispose() sm.consumeItem(darkMarble, 30) sm.completeQuestNoRewards(parentID) sm.jobAdvance(420) sm.sendNext('You are now a #b' + job + '#k.') sm.dispose()
# -*- coding: utf-8 -*- """ db_normalizer.csv_handler ----------------------------- Folder for the CSV toolbox. :authors: Bouillon Pierre, Cesari Alexandre. :licence: MIT, see LICENSE for more details. """
""" db_normalizer.csv_handler ----------------------------- Folder for the CSV toolbox. :authors: Bouillon Pierre, Cesari Alexandre. :licence: MIT, see LICENSE for more details. """
INDEX_HEADER_SIZE = 16 INDEX_RECORD_SIZE = 41 META_HEADER_SIZE = 32 kMinMetadataRead = 1024 kChunkSize = 256 * 1024 kMaxElementsSize = 64 * 1024 kAlignSize = 4096
index_header_size = 16 index_record_size = 41 meta_header_size = 32 k_min_metadata_read = 1024 k_chunk_size = 256 * 1024 k_max_elements_size = 64 * 1024 k_align_size = 4096
#!/usr/bin python dec1 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" enc1 = "EICTDGYIYZKTHNSIRFXYCPFUEOCKRNEICTDGYIYZKTHNSIRFXYCPFUEOCKRNEI" dec2 = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" enc2 = "FJDUEHZJZALUIOTJSGYZDQGVFPDLSOFJDUEHZJZALUIOTJSG" with open("krypton7", 'r') as handle: flag = handle.read() #key1 = "".join([chr(ord(dec1[i]) ^ ord(enc1[i])) for i in range(len(dec1))]) key1 = [ord(dec1[i]) - ord(enc1[i]) % 26 for i in range(len(dec1))] #decrypted = "".join([chr(ord(flag[i]) ^ ord(key[i])) for i in range(len(flag))]) decrypted = "".join([chr(((ord(flag[i]) - ord('A') + key1[i]) % 26) + ord('A')) for i in range(len(flag))]) print(decrypted)
dec1 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' enc1 = 'EICTDGYIYZKTHNSIRFXYCPFUEOCKRNEICTDGYIYZKTHNSIRFXYCPFUEOCKRNEI' dec2 = 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB' enc2 = 'FJDUEHZJZALUIOTJSGYZDQGVFPDLSOFJDUEHZJZALUIOTJSG' with open('krypton7', 'r') as handle: flag = handle.read() key1 = [ord(dec1[i]) - ord(enc1[i]) % 26 for i in range(len(dec1))] decrypted = ''.join([chr((ord(flag[i]) - ord('A') + key1[i]) % 26 + ord('A')) for i in range(len(flag))]) print(decrypted)
# -*- coding: utf-8 -*- class IRI: MAINNET_COORDINATOR = ''
class Iri: mainnet_coordinator = ''
MAX_FACTOR = 20 # avoid weirdness with python's arbitary integer precision MAX_WAIT = 60 * 60 # 1 hour class Backoff(): def __init__(self, initial=None, base=2, exp=2, max=MAX_WAIT, attempts=None): self._attempts = attempts self._initial = initial self._start = base self._max = max self._exp = exp self._counter = 0 def reset(self): self._counter = 0 def peek(self): exp = self._counter - 1 if self._counter == 1 and self._initial is not None: return self._initial elif self._initial is not None: exp -= 1 exp = min(exp, MAX_FACTOR) computed = self._start * pow(self._exp, exp) if self._max: computed = min(self._max, computed) return computed def backoff(self, error): if self._attempts and self._counter >= self._attempts: raise error self._counter += 1 return self.peek()
max_factor = 20 max_wait = 60 * 60 class Backoff: def __init__(self, initial=None, base=2, exp=2, max=MAX_WAIT, attempts=None): self._attempts = attempts self._initial = initial self._start = base self._max = max self._exp = exp self._counter = 0 def reset(self): self._counter = 0 def peek(self): exp = self._counter - 1 if self._counter == 1 and self._initial is not None: return self._initial elif self._initial is not None: exp -= 1 exp = min(exp, MAX_FACTOR) computed = self._start * pow(self._exp, exp) if self._max: computed = min(self._max, computed) return computed def backoff(self, error): if self._attempts and self._counter >= self._attempts: raise error self._counter += 1 return self.peek()
def main(): decimal = str(input()) number = float(decimal) last = int(decimal[-1]) if last == 7: number += 0.02 elif last % 2 == 1: number -= 0.09 elif last > 7: number -= 4 elif last < 4: number += 6.78 print(f"{number:.2f}") if __name__ == "__main__": main()
def main(): decimal = str(input()) number = float(decimal) last = int(decimal[-1]) if last == 7: number += 0.02 elif last % 2 == 1: number -= 0.09 elif last > 7: number -= 4 elif last < 4: number += 6.78 print(f'{number:.2f}') if __name__ == '__main__': main()
print("Hi, I'm a module!") raise Exception( "This module-level exception should also not occur during freeze" )
print("Hi, I'm a module!") raise exception('This module-level exception should also not occur during freeze')
GENCONF_DIR = 'genconf' CONFIG_PATH = GENCONF_DIR + '/config.yaml' SSH_KEY_PATH = GENCONF_DIR + '/ssh_key' IP_DETECT_PATH = GENCONF_DIR + '/ip-detect' CLUSTER_PACKAGES_PATH = GENCONF_DIR + '/cluster_packages.json' SERVE_DIR = GENCONF_DIR + '/serve' STATE_DIR = GENCONF_DIR + '/state' BOOTSTRAP_DIR = SERVE_DIR + '/bootstrap' PACKAGE_LIST_DIR = SERVE_DIR + '/package_lists' ARTIFACT_DIR = 'artifacts' CHECK_RUNNER_CMD = '/opt/mesosphere/bin/dcos-diagnostics check'
genconf_dir = 'genconf' config_path = GENCONF_DIR + '/config.yaml' ssh_key_path = GENCONF_DIR + '/ssh_key' ip_detect_path = GENCONF_DIR + '/ip-detect' cluster_packages_path = GENCONF_DIR + '/cluster_packages.json' serve_dir = GENCONF_DIR + '/serve' state_dir = GENCONF_DIR + '/state' bootstrap_dir = SERVE_DIR + '/bootstrap' package_list_dir = SERVE_DIR + '/package_lists' artifact_dir = 'artifacts' check_runner_cmd = '/opt/mesosphere/bin/dcos-diagnostics check'
class Solution: def isStrobogrammatic(self, num: str) -> bool: rotated = ['0', '1', 'x', 'x', 'x', 'x', '9', 'x', '8', '6'] l = 0 r = len(num) - 1 while l <= r: if num[l] != rotated[ord(num[r]) - ord('0')]: return False l += 1 r -= 1 return True
class Solution: def is_strobogrammatic(self, num: str) -> bool: rotated = ['0', '1', 'x', 'x', 'x', 'x', '9', 'x', '8', '6'] l = 0 r = len(num) - 1 while l <= r: if num[l] != rotated[ord(num[r]) - ord('0')]: return False l += 1 r -= 1 return True
# -*- coding: utf-8 -*- """ Created on Tue Feb 1 16:43:37 2022 @author: LENOVO """ list = [] n = 1 #valores del 1 al 100 while n <= 100: #bucle de numeros de 1 al 100 c = 1 # div x = 0 #contador div while c <= n: if n % c == 0: x = x + 1 c = c + 1 if x == 2: list.append(n) n = n + 1 # incrmeneto valor print(" los numeros primos del 1 al 100 son :",list)
""" Created on Tue Feb 1 16:43:37 2022 @author: LENOVO """ list = [] n = 1 while n <= 100: c = 1 x = 0 while c <= n: if n % c == 0: x = x + 1 c = c + 1 if x == 2: list.append(n) n = n + 1 print(' los numeros primos del 1 al 100 son :', list)
# coding: utf-8 COLORS = { 'green': '\033[22;32m', 'boldblue': '\033[01;34m', 'purple': '\033[22;35m', 'red': '\033[22;31m', 'boldred': '\033[01;31m', 'normal': '\033[0;0m' } class Logger: def __init__(self): self.verbose = False @staticmethod def _print_msg(msg: str, color: str=None): if color is None or color not in COLORS: print(msg) else: print('{colorcode}{msg}\033[0;0m'.format(colorcode=COLORS[color], msg=msg)) def debug(self, msg: str): if self.verbose: msg = '[DD] {}'.format(msg) self._print_msg(msg, 'normal') def info(self, msg: str): msg = '[II] {}'.format(msg) self._print_msg(msg, 'green') def warning(self, msg: str): msg = '[WW] {}'.format(msg) self._print_msg(msg, 'red') def error(self, msg: str, exitcode: int=255): msg = '[EE] {}'.format(msg) self._print_msg(msg, 'boldred') exit(exitcode) @staticmethod def ask(msg: str): msg = '[??] {}'.format(msg) question = '{colorcode}{msg} : \033[0;0m'.format(colorcode=COLORS['boldblue'], msg=msg) answer = input(question) return answer.strip() def ask_yesno(self, msg: str, default: str=None): valid_answers = { 'y': True, 'yes': True, 'n': False, 'no': False } if (default is None) or (default.lower() not in valid_answers): default = '' else: default = default.lower() question = '{} (y/n)'.replace(default, default.upper()).format(msg) answer = self.ask(question).lower() if answer == '': answer = default while answer not in valid_answers: answer = self.ask(question).lower() return valid_answers[answer] logger = Logger()
colors = {'green': '\x1b[22;32m', 'boldblue': '\x1b[01;34m', 'purple': '\x1b[22;35m', 'red': '\x1b[22;31m', 'boldred': '\x1b[01;31m', 'normal': '\x1b[0;0m'} class Logger: def __init__(self): self.verbose = False @staticmethod def _print_msg(msg: str, color: str=None): if color is None or color not in COLORS: print(msg) else: print('{colorcode}{msg}\x1b[0;0m'.format(colorcode=COLORS[color], msg=msg)) def debug(self, msg: str): if self.verbose: msg = '[DD] {}'.format(msg) self._print_msg(msg, 'normal') def info(self, msg: str): msg = '[II] {}'.format(msg) self._print_msg(msg, 'green') def warning(self, msg: str): msg = '[WW] {}'.format(msg) self._print_msg(msg, 'red') def error(self, msg: str, exitcode: int=255): msg = '[EE] {}'.format(msg) self._print_msg(msg, 'boldred') exit(exitcode) @staticmethod def ask(msg: str): msg = '[??] {}'.format(msg) question = '{colorcode}{msg} : \x1b[0;0m'.format(colorcode=COLORS['boldblue'], msg=msg) answer = input(question) return answer.strip() def ask_yesno(self, msg: str, default: str=None): valid_answers = {'y': True, 'yes': True, 'n': False, 'no': False} if default is None or default.lower() not in valid_answers: default = '' else: default = default.lower() question = '{} (y/n)'.replace(default, default.upper()).format(msg) answer = self.ask(question).lower() if answer == '': answer = default while answer not in valid_answers: answer = self.ask(question).lower() return valid_answers[answer] logger = logger()
# # PySNMP MIB module INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:44:05 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:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") iso, IpAddress, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, ObjectIdentity, MibIdentifier, Gauge32, Integer32, NotificationType, ModuleIdentity, enterprises, TimeTicks, Bits, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "IpAddress", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "ObjectIdentity", "MibIdentifier", "Gauge32", "Integer32", "NotificationType", "ModuleIdentity", "enterprises", "TimeTicks", "Bits", "Counter64") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") class DmiInteger(Integer32): pass class DmiDisplaystring(DisplayString): pass class DmiDateX(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(28, 28) fixedLength = 28 class DmiComponentIndex(Integer32): pass intel = MibIdentifier((1, 3, 6, 1, 4, 1, 343)) products = MibIdentifier((1, 3, 6, 1, 4, 1, 343, 2)) server_products = MibIdentifier((1, 3, 6, 1, 4, 1, 343, 2, 6)).setLabel("server-products") dmtfGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 343, 2, 6, 7)) tNameTable = MibTable((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 5), ) if mibBuilder.loadTexts: tNameTable.setStatus('mandatory') eNameTable = MibTableRow((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 5, 1), ).setIndexNames((0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "DmiComponentIndex"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a2MifId")) if mibBuilder.loadTexts: eNameTable.setStatus('mandatory') a2MifId = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 99))).clone(namedValues=NamedValues(("vUnknown", 0), ("vBaseboard", 1), ("vAdaptecScsi", 2), ("vMylexRaid", 3), ("vNic", 4), ("vUps", 5), ("vSymbiosSdms", 6), ("vAmiRaid", 7), ("vMylexGamRaid", 8), ("vAdaptecCioScsi", 9), ("vSymbiosScsi", 10), ("vIntelNic", 11), ("vTestmif", 99)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a2MifId.setStatus('mandatory') a2ComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 5, 1, 2), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2ComponentName.setStatus('mandatory') tActionsTable = MibTable((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6), ) if mibBuilder.loadTexts: tActionsTable.setStatus('mandatory') eActionsTable = MibTableRow((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1), ).setIndexNames((0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "DmiComponentIndex"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a4RelatedMif"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a4Group"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a4Instance"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a4Attribute"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a4Value"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a4Severity")) if mibBuilder.loadTexts: eActionsTable.setStatus('mandatory') a4RelatedMif = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 99))).clone(namedValues=NamedValues(("vUnknown", 0), ("vBaseboard", 1), ("vAdaptecScsi", 2), ("vMylexRaid", 3), ("vNic", 4), ("vUps", 5), ("vSymbiosSdms", 6), ("vAmiRaid", 7), ("vMylexGamRaid", 8), ("vAdaptecCioScsi", 9), ("vSymbiosScsi", 10), ("vIntelNic", 11), ("vTestmif", 99)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a4RelatedMif.setStatus('mandatory') a4Group = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 2), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4Group.setStatus('mandatory') a4Instance = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 3), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4Instance.setStatus('mandatory') a4Attribute = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 4), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4Attribute.setStatus('mandatory') a4Value = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 5), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4Value.setStatus('mandatory') a4Severity = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 6), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4Severity.setStatus('mandatory') a4BeepSpeaker = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 7), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4BeepSpeaker.setStatus('mandatory') a4DisplayAlertMessageOnConsole = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 8), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4DisplayAlertMessageOnConsole.setStatus('mandatory') a4LogToDisk = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 9), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4LogToDisk.setStatus('mandatory') a4WriteToLcd = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 10), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4WriteToLcd.setStatus('mandatory') a4ShutdownTheOs = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 11), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4ShutdownTheOs.setStatus('mandatory') a4ShutdownAndPowerOffTheSystem = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 12), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4ShutdownAndPowerOffTheSystem.setStatus('mandatory') a4ShutdownAndResetTheSystem = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 13), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4ShutdownAndResetTheSystem.setStatus('mandatory') a4ImmediatePowerOff = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 14), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4ImmediatePowerOff.setStatus('mandatory') a4ImmediateReset = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 15), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4ImmediateReset.setStatus('mandatory') a4BroadcastMessageOnNetwork = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 16), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4BroadcastMessageOnNetwork.setStatus('mandatory') a4AmsAlertName = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 17), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4AmsAlertName.setStatus('mandatory') a4Enabled = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 30), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a4Enabled.setStatus('mandatory') tActionsTableForStandardIndications = MibTable((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7), ) if mibBuilder.loadTexts: tActionsTableForStandardIndications.setStatus('mandatory') eActionsTableForStandardIndications = MibTableRow((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1), ).setIndexNames((0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "DmiComponentIndex"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a10RelatedMif"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a10EventGenerationGroup"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a10EventType"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a10Instance"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a10Reserved"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a10Severity"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a10EventSystem"), (0, "INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", "a10EventSub-system")) if mibBuilder.loadTexts: eActionsTableForStandardIndications.setStatus('mandatory') a10RelatedMif = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 99))).clone(namedValues=NamedValues(("vUnknown", 0), ("vBaseboard", 1), ("vAdaptecScsi", 2), ("vMylexRaid", 3), ("vNic", 4), ("vUps", 5), ("vSymbiosSdms", 6), ("vAmiRaid", 7), ("vMylexGamRaid", 8), ("vAdaptecCioScsi", 9), ("vSymbiosScsi", 10), ("vIntelNic", 11), ("vTestmif", 99)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a10RelatedMif.setStatus('mandatory') a10EventGenerationGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 2), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a10EventGenerationGroup.setStatus('mandatory') a10EventType = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 3), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a10EventType.setStatus('mandatory') a10Instance = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 4), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a10Instance.setStatus('mandatory') a10Reserved = MibScalar((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 5), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a10Reserved.setStatus('mandatory') a10Severity = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 6), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a10Severity.setStatus('mandatory') a10BeepSpeaker = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 7), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10BeepSpeaker.setStatus('mandatory') a10DisplayAlertMessageOnConsole = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 8), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10DisplayAlertMessageOnConsole.setStatus('mandatory') a10LogToDisk = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 9), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10LogToDisk.setStatus('mandatory') a10WriteToLcd = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 10), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10WriteToLcd.setStatus('mandatory') a10ShutdownTheOs = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 11), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10ShutdownTheOs.setStatus('mandatory') a10ShutdownAndPowerOffTheSystem = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 12), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10ShutdownAndPowerOffTheSystem.setStatus('mandatory') a10ShutdownAndResetTheSystem = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 13), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10ShutdownAndResetTheSystem.setStatus('mandatory') a10ImmediatePowerOff = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 14), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10ImmediatePowerOff.setStatus('mandatory') a10ImmediateReset = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 15), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10ImmediateReset.setStatus('mandatory') a10BroadcastMessageOnNetwork = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 16), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10BroadcastMessageOnNetwork.setStatus('mandatory') a10AmsAlertName = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 17), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a10AmsAlertName.setStatus('mandatory') a10ImmediateNmi = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 18), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10ImmediateNmi.setStatus('mandatory') a10Page = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 19), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10Page.setStatus('mandatory') a10Email = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 20), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10Email.setStatus('mandatory') a10Enabled = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 30), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a10Enabled.setStatus('mandatory') a10EventSystem = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 31), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a10EventSystem.setStatus('mandatory') a10EventSub_system = MibScalar((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 32), DmiInteger()).setLabel("a10EventSub-system").setMaxAccess("readonly") if mibBuilder.loadTexts: a10EventSub_system.setStatus('mandatory') mibBuilder.exportSymbols("INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB", products=products, a10DisplayAlertMessageOnConsole=a10DisplayAlertMessageOnConsole, a10ShutdownTheOs=a10ShutdownTheOs, DmiInteger=DmiInteger, a10BeepSpeaker=a10BeepSpeaker, eActionsTableForStandardIndications=eActionsTableForStandardIndications, tActionsTable=tActionsTable, a4Group=a4Group, intel=intel, a10ShutdownAndResetTheSystem=a10ShutdownAndResetTheSystem, dmtfGroups=dmtfGroups, DmiDisplaystring=DmiDisplaystring, server_products=server_products, tNameTable=tNameTable, a4ImmediatePowerOff=a4ImmediatePowerOff, a4BroadcastMessageOnNetwork=a4BroadcastMessageOnNetwork, a10BroadcastMessageOnNetwork=a10BroadcastMessageOnNetwork, a10WriteToLcd=a10WriteToLcd, a4ImmediateReset=a4ImmediateReset, a10AmsAlertName=a10AmsAlertName, a10Severity=a10Severity, a4Attribute=a4Attribute, a4DisplayAlertMessageOnConsole=a4DisplayAlertMessageOnConsole, a4AmsAlertName=a4AmsAlertName, a10EventGenerationGroup=a10EventGenerationGroup, a10Reserved=a10Reserved, a10ImmediateNmi=a10ImmediateNmi, a4Severity=a4Severity, a4LogToDisk=a4LogToDisk, a4Value=a4Value, a4RelatedMif=a4RelatedMif, a4ShutdownTheOs=a4ShutdownTheOs, a4ShutdownAndResetTheSystem=a4ShutdownAndResetTheSystem, a4Instance=a4Instance, a10RelatedMif=a10RelatedMif, a10Email=a10Email, tActionsTableForStandardIndications=tActionsTableForStandardIndications, a10ImmediateReset=a10ImmediateReset, DmiComponentIndex=DmiComponentIndex, a2ComponentName=a2ComponentName, a10LogToDisk=a10LogToDisk, a10Enabled=a10Enabled, a10EventType=a10EventType, a10Instance=a10Instance, a10EventSystem=a10EventSystem, a2MifId=a2MifId, eActionsTable=eActionsTable, a4WriteToLcd=a4WriteToLcd, a10EventSub_system=a10EventSub_system, a4Enabled=a4Enabled, a10ImmediatePowerOff=a10ImmediatePowerOff, a4ShutdownAndPowerOffTheSystem=a4ShutdownAndPowerOffTheSystem, eNameTable=eNameTable, a10Page=a10Page, a4BeepSpeaker=a4BeepSpeaker, DmiDateX=DmiDateX, a10ShutdownAndPowerOffTheSystem=a10ShutdownAndPowerOffTheSystem)
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_size_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (iso, ip_address, unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, counter32, object_identity, mib_identifier, gauge32, integer32, notification_type, module_identity, enterprises, time_ticks, bits, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'IpAddress', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32', 'ObjectIdentity', 'MibIdentifier', 'Gauge32', 'Integer32', 'NotificationType', 'ModuleIdentity', 'enterprises', 'TimeTicks', 'Bits', 'Counter64') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') class Dmiinteger(Integer32): pass class Dmidisplaystring(DisplayString): pass class Dmidatex(OctetString): subtype_spec = OctetString.subtypeSpec + value_size_constraint(28, 28) fixed_length = 28 class Dmicomponentindex(Integer32): pass intel = mib_identifier((1, 3, 6, 1, 4, 1, 343)) products = mib_identifier((1, 3, 6, 1, 4, 1, 343, 2)) server_products = mib_identifier((1, 3, 6, 1, 4, 1, 343, 2, 6)).setLabel('server-products') dmtf_groups = mib_identifier((1, 3, 6, 1, 4, 1, 343, 2, 6, 7)) t_name_table = mib_table((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 5)) if mibBuilder.loadTexts: tNameTable.setStatus('mandatory') e_name_table = mib_table_row((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 5, 1)).setIndexNames((0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'DmiComponentIndex'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a2MifId')) if mibBuilder.loadTexts: eNameTable.setStatus('mandatory') a2_mif_id = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 5, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 99))).clone(namedValues=named_values(('vUnknown', 0), ('vBaseboard', 1), ('vAdaptecScsi', 2), ('vMylexRaid', 3), ('vNic', 4), ('vUps', 5), ('vSymbiosSdms', 6), ('vAmiRaid', 7), ('vMylexGamRaid', 8), ('vAdaptecCioScsi', 9), ('vSymbiosScsi', 10), ('vIntelNic', 11), ('vTestmif', 99)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a2MifId.setStatus('mandatory') a2_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 5, 1, 2), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2ComponentName.setStatus('mandatory') t_actions_table = mib_table((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6)) if mibBuilder.loadTexts: tActionsTable.setStatus('mandatory') e_actions_table = mib_table_row((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1)).setIndexNames((0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'DmiComponentIndex'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a4RelatedMif'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a4Group'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a4Instance'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a4Attribute'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a4Value'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a4Severity')) if mibBuilder.loadTexts: eActionsTable.setStatus('mandatory') a4_related_mif = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 99))).clone(namedValues=named_values(('vUnknown', 0), ('vBaseboard', 1), ('vAdaptecScsi', 2), ('vMylexRaid', 3), ('vNic', 4), ('vUps', 5), ('vSymbiosSdms', 6), ('vAmiRaid', 7), ('vMylexGamRaid', 8), ('vAdaptecCioScsi', 9), ('vSymbiosScsi', 10), ('vIntelNic', 11), ('vTestmif', 99)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a4RelatedMif.setStatus('mandatory') a4_group = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 2), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4Group.setStatus('mandatory') a4_instance = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 3), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4Instance.setStatus('mandatory') a4_attribute = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 4), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4Attribute.setStatus('mandatory') a4_value = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 5), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4Value.setStatus('mandatory') a4_severity = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 6), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4Severity.setStatus('mandatory') a4_beep_speaker = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 7), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4BeepSpeaker.setStatus('mandatory') a4_display_alert_message_on_console = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 8), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4DisplayAlertMessageOnConsole.setStatus('mandatory') a4_log_to_disk = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 9), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4LogToDisk.setStatus('mandatory') a4_write_to_lcd = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 10), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4WriteToLcd.setStatus('mandatory') a4_shutdown_the_os = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 11), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4ShutdownTheOs.setStatus('mandatory') a4_shutdown_and_power_off_the_system = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 12), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4ShutdownAndPowerOffTheSystem.setStatus('mandatory') a4_shutdown_and_reset_the_system = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 13), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4ShutdownAndResetTheSystem.setStatus('mandatory') a4_immediate_power_off = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 14), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4ImmediatePowerOff.setStatus('mandatory') a4_immediate_reset = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 15), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4ImmediateReset.setStatus('mandatory') a4_broadcast_message_on_network = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 16), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4BroadcastMessageOnNetwork.setStatus('mandatory') a4_ams_alert_name = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 17), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4AmsAlertName.setStatus('mandatory') a4_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 6, 1, 30), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a4Enabled.setStatus('mandatory') t_actions_table_for_standard_indications = mib_table((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7)) if mibBuilder.loadTexts: tActionsTableForStandardIndications.setStatus('mandatory') e_actions_table_for_standard_indications = mib_table_row((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1)).setIndexNames((0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'DmiComponentIndex'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a10RelatedMif'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a10EventGenerationGroup'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a10EventType'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a10Instance'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a10Reserved'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a10Severity'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a10EventSystem'), (0, 'INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', 'a10EventSub-system')) if mibBuilder.loadTexts: eActionsTableForStandardIndications.setStatus('mandatory') a10_related_mif = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 99))).clone(namedValues=named_values(('vUnknown', 0), ('vBaseboard', 1), ('vAdaptecScsi', 2), ('vMylexRaid', 3), ('vNic', 4), ('vUps', 5), ('vSymbiosSdms', 6), ('vAmiRaid', 7), ('vMylexGamRaid', 8), ('vAdaptecCioScsi', 9), ('vSymbiosScsi', 10), ('vIntelNic', 11), ('vTestmif', 99)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a10RelatedMif.setStatus('mandatory') a10_event_generation_group = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 2), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a10EventGenerationGroup.setStatus('mandatory') a10_event_type = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 3), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a10EventType.setStatus('mandatory') a10_instance = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 4), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a10Instance.setStatus('mandatory') a10_reserved = mib_scalar((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 5), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a10Reserved.setStatus('mandatory') a10_severity = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 6), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a10Severity.setStatus('mandatory') a10_beep_speaker = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 7), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10BeepSpeaker.setStatus('mandatory') a10_display_alert_message_on_console = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 8), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10DisplayAlertMessageOnConsole.setStatus('mandatory') a10_log_to_disk = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 9), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10LogToDisk.setStatus('mandatory') a10_write_to_lcd = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 10), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10WriteToLcd.setStatus('mandatory') a10_shutdown_the_os = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 11), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10ShutdownTheOs.setStatus('mandatory') a10_shutdown_and_power_off_the_system = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 12), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10ShutdownAndPowerOffTheSystem.setStatus('mandatory') a10_shutdown_and_reset_the_system = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 13), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10ShutdownAndResetTheSystem.setStatus('mandatory') a10_immediate_power_off = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 14), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10ImmediatePowerOff.setStatus('mandatory') a10_immediate_reset = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 15), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10ImmediateReset.setStatus('mandatory') a10_broadcast_message_on_network = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 16), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10BroadcastMessageOnNetwork.setStatus('mandatory') a10_ams_alert_name = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 17), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a10AmsAlertName.setStatus('mandatory') a10_immediate_nmi = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 18), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10ImmediateNmi.setStatus('mandatory') a10_page = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 19), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10Page.setStatus('mandatory') a10_email = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 20), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10Email.setStatus('mandatory') a10_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 30), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a10Enabled.setStatus('mandatory') a10_event_system = mib_table_column((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 31), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a10EventSystem.setStatus('mandatory') a10_event_sub_system = mib_scalar((1, 3, 6, 1, 4, 1, 343, 2, 6, 7, 7, 1, 32), dmi_integer()).setLabel('a10EventSub-system').setMaxAccess('readonly') if mibBuilder.loadTexts: a10EventSub_system.setStatus('mandatory') mibBuilder.exportSymbols('INTELLANDESKSERVERMANAGER-LOCALRESPONSEAMAPPER-MIB', products=products, a10DisplayAlertMessageOnConsole=a10DisplayAlertMessageOnConsole, a10ShutdownTheOs=a10ShutdownTheOs, DmiInteger=DmiInteger, a10BeepSpeaker=a10BeepSpeaker, eActionsTableForStandardIndications=eActionsTableForStandardIndications, tActionsTable=tActionsTable, a4Group=a4Group, intel=intel, a10ShutdownAndResetTheSystem=a10ShutdownAndResetTheSystem, dmtfGroups=dmtfGroups, DmiDisplaystring=DmiDisplaystring, server_products=server_products, tNameTable=tNameTable, a4ImmediatePowerOff=a4ImmediatePowerOff, a4BroadcastMessageOnNetwork=a4BroadcastMessageOnNetwork, a10BroadcastMessageOnNetwork=a10BroadcastMessageOnNetwork, a10WriteToLcd=a10WriteToLcd, a4ImmediateReset=a4ImmediateReset, a10AmsAlertName=a10AmsAlertName, a10Severity=a10Severity, a4Attribute=a4Attribute, a4DisplayAlertMessageOnConsole=a4DisplayAlertMessageOnConsole, a4AmsAlertName=a4AmsAlertName, a10EventGenerationGroup=a10EventGenerationGroup, a10Reserved=a10Reserved, a10ImmediateNmi=a10ImmediateNmi, a4Severity=a4Severity, a4LogToDisk=a4LogToDisk, a4Value=a4Value, a4RelatedMif=a4RelatedMif, a4ShutdownTheOs=a4ShutdownTheOs, a4ShutdownAndResetTheSystem=a4ShutdownAndResetTheSystem, a4Instance=a4Instance, a10RelatedMif=a10RelatedMif, a10Email=a10Email, tActionsTableForStandardIndications=tActionsTableForStandardIndications, a10ImmediateReset=a10ImmediateReset, DmiComponentIndex=DmiComponentIndex, a2ComponentName=a2ComponentName, a10LogToDisk=a10LogToDisk, a10Enabled=a10Enabled, a10EventType=a10EventType, a10Instance=a10Instance, a10EventSystem=a10EventSystem, a2MifId=a2MifId, eActionsTable=eActionsTable, a4WriteToLcd=a4WriteToLcd, a10EventSub_system=a10EventSub_system, a4Enabled=a4Enabled, a10ImmediatePowerOff=a10ImmediatePowerOff, a4ShutdownAndPowerOffTheSystem=a4ShutdownAndPowerOffTheSystem, eNameTable=eNameTable, a10Page=a10Page, a4BeepSpeaker=a4BeepSpeaker, DmiDateX=DmiDateX, a10ShutdownAndPowerOffTheSystem=a10ShutdownAndPowerOffTheSystem)
class Solution: def repeatedNTimes(self, A: List[int]) -> int: counter = 0 N = len(A) / 2 for a in A: a_count = A.count(a) if a_count == N: return a counter += a_count if counter == N: return A[0] else: A.remove(a)
class Solution: def repeated_n_times(self, A: List[int]) -> int: counter = 0 n = len(A) / 2 for a in A: a_count = A.count(a) if a_count == N: return a counter += a_count if counter == N: return A[0] else: A.remove(a)
class BitConverter(object): """ Converts base data types to an array of bytes,and an array of bytes to base data types. """ @staticmethod def DoubleToInt64Bits(value): """ DoubleToInt64Bits(value: float) -> Int64 Converts the specified double-precision floating point number to a 64-bit signed integer. value: The number to convert. Returns: A 64-bit signed integer whose value is equivalent to value. """ pass @staticmethod def GetBytes(value): """ GetBytes(value: UInt32) -> Array[Byte] Returns the specified 32-bit unsigned integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 4. GetBytes(value: UInt16) -> Array[Byte] Returns the specified 16-bit unsigned integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 2. GetBytes(value: UInt64) -> Array[Byte] Returns the specified 64-bit unsigned integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 8. GetBytes(value: float) -> Array[Byte] Returns the specified double-precision floating point value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 8. GetBytes(value: Single) -> Array[Byte] Returns the specified single-precision floating point value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 4. GetBytes(value: Char) -> Array[Byte] Returns the specified Unicode character value as an array of bytes. value: A character to convert. Returns: An array of bytes with length 2. GetBytes(value: bool) -> Array[Byte] Returns the specified Boolean value as an array of bytes. value: A Boolean value. Returns: An array of bytes with length 1. GetBytes(value: Int16) -> Array[Byte] Returns the specified 16-bit signed integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 2. GetBytes(value: Int64) -> Array[Byte] Returns the specified 64-bit signed integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 8. GetBytes(value: int) -> Array[Byte] Returns the specified 32-bit signed integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 4. """ pass @staticmethod def Int64BitsToDouble(value): """ Int64BitsToDouble(value: Int64) -> float Converts the specified 64-bit signed integer to a double-precision floating point number. value: The number to convert. Returns: A double-precision floating point number whose value is equivalent to value. """ pass @staticmethod def ToBoolean(value, startIndex): """ ToBoolean(value: Array[Byte],startIndex: int) -> bool Returns a Boolean value converted from one byte at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: true if the byte at startIndex in value is nonzero; otherwise,false. """ pass @staticmethod def ToChar(value, startIndex): """ ToChar(value: Array[Byte],startIndex: int) -> Char Returns a Unicode character converted from two bytes at a specified position in a byte array. value: An array. startIndex: The starting position within value. Returns: A character formed by two bytes beginning at startIndex. """ pass @staticmethod def ToDouble(value, startIndex): """ ToDouble(value: Array[Byte],startIndex: int) -> float Returns a double-precision floating point number converted from eight bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A double precision floating point number formed by eight bytes beginning at startIndex. """ pass @staticmethod def ToInt16(value, startIndex): """ ToInt16(value: Array[Byte],startIndex: int) -> Int16 Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 16-bit signed integer formed by two bytes beginning at startIndex. """ pass @staticmethod def ToInt32(value, startIndex): """ ToInt32(value: Array[Byte],startIndex: int) -> int Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 32-bit signed integer formed by four bytes beginning at startIndex. """ pass @staticmethod def ToInt64(value, startIndex): """ ToInt64(value: Array[Byte],startIndex: int) -> Int64 Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 64-bit signed integer formed by eight bytes beginning at startIndex. """ pass @staticmethod def ToSingle(value, startIndex): """ ToSingle(value: Array[Byte],startIndex: int) -> Single Returns a single-precision floating point number converted from four bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A single-precision floating point number formed by four bytes beginning at startIndex. """ pass @staticmethod def ToString(value=None, startIndex=None, length=None): """ ToString(value: Array[Byte],startIndex: int) -> str Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string representation. value: An array of bytes. startIndex: The starting position within value. Returns: A string of hexadecimal pairs separated by hyphens,where each pair represents the corresponding element in a subarray of value; for example,"7F-2C-4A-00". ToString(value: Array[Byte]) -> str Converts the numeric value of each element of a specified array of bytes to its equivalent hexadecimal string representation. value: An array of bytes. Returns: A string of hexadecimal pairs separated by hyphens,where each pair represents the corresponding element in value; for example,"7F-2C-4A-00". ToString(value: Array[Byte],startIndex: int,length: int) -> str Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string representation. value: An array of bytes. startIndex: The starting position within value. length: The number of array elements in value to convert. Returns: A string of hexadecimal pairs separated by hyphens,where each pair represents the corresponding element in a subarray of value; for example,"7F-2C-4A-00". """ pass @staticmethod def ToUInt16(value, startIndex): """ ToUInt16(value: Array[Byte],startIndex: int) -> UInt16 Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array. value: The array of bytes. startIndex: The starting position within value. Returns: A 16-bit unsigned integer formed by two bytes beginning at startIndex. """ pass @staticmethod def ToUInt32(value, startIndex): """ ToUInt32(value: Array[Byte],startIndex: int) -> UInt32 Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 32-bit unsigned integer formed by four bytes beginning at startIndex. """ pass @staticmethod def ToUInt64(value, startIndex): """ ToUInt64(value: Array[Byte],startIndex: int) -> UInt64 Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 64-bit unsigned integer formed by the eight bytes beginning at startIndex. """ pass IsLittleEndian = True __all__ = [ "DoubleToInt64Bits", "GetBytes", "Int64BitsToDouble", "IsLittleEndian", "ToBoolean", "ToChar", "ToDouble", "ToInt16", "ToInt32", "ToInt64", "ToSingle", "ToString", "ToUInt16", "ToUInt32", "ToUInt64", ]
class Bitconverter(object): """ Converts base data types to an array of bytes,and an array of bytes to base data types. """ @staticmethod def double_to_int64_bits(value): """ DoubleToInt64Bits(value: float) -> Int64 Converts the specified double-precision floating point number to a 64-bit signed integer. value: The number to convert. Returns: A 64-bit signed integer whose value is equivalent to value. """ pass @staticmethod def get_bytes(value): """ GetBytes(value: UInt32) -> Array[Byte] Returns the specified 32-bit unsigned integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 4. GetBytes(value: UInt16) -> Array[Byte] Returns the specified 16-bit unsigned integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 2. GetBytes(value: UInt64) -> Array[Byte] Returns the specified 64-bit unsigned integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 8. GetBytes(value: float) -> Array[Byte] Returns the specified double-precision floating point value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 8. GetBytes(value: Single) -> Array[Byte] Returns the specified single-precision floating point value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 4. GetBytes(value: Char) -> Array[Byte] Returns the specified Unicode character value as an array of bytes. value: A character to convert. Returns: An array of bytes with length 2. GetBytes(value: bool) -> Array[Byte] Returns the specified Boolean value as an array of bytes. value: A Boolean value. Returns: An array of bytes with length 1. GetBytes(value: Int16) -> Array[Byte] Returns the specified 16-bit signed integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 2. GetBytes(value: Int64) -> Array[Byte] Returns the specified 64-bit signed integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 8. GetBytes(value: int) -> Array[Byte] Returns the specified 32-bit signed integer value as an array of bytes. value: The number to convert. Returns: An array of bytes with length 4. """ pass @staticmethod def int64_bits_to_double(value): """ Int64BitsToDouble(value: Int64) -> float Converts the specified 64-bit signed integer to a double-precision floating point number. value: The number to convert. Returns: A double-precision floating point number whose value is equivalent to value. """ pass @staticmethod def to_boolean(value, startIndex): """ ToBoolean(value: Array[Byte],startIndex: int) -> bool Returns a Boolean value converted from one byte at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: true if the byte at startIndex in value is nonzero; otherwise,false. """ pass @staticmethod def to_char(value, startIndex): """ ToChar(value: Array[Byte],startIndex: int) -> Char Returns a Unicode character converted from two bytes at a specified position in a byte array. value: An array. startIndex: The starting position within value. Returns: A character formed by two bytes beginning at startIndex. """ pass @staticmethod def to_double(value, startIndex): """ ToDouble(value: Array[Byte],startIndex: int) -> float Returns a double-precision floating point number converted from eight bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A double precision floating point number formed by eight bytes beginning at startIndex. """ pass @staticmethod def to_int16(value, startIndex): """ ToInt16(value: Array[Byte],startIndex: int) -> Int16 Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 16-bit signed integer formed by two bytes beginning at startIndex. """ pass @staticmethod def to_int32(value, startIndex): """ ToInt32(value: Array[Byte],startIndex: int) -> int Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 32-bit signed integer formed by four bytes beginning at startIndex. """ pass @staticmethod def to_int64(value, startIndex): """ ToInt64(value: Array[Byte],startIndex: int) -> Int64 Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 64-bit signed integer formed by eight bytes beginning at startIndex. """ pass @staticmethod def to_single(value, startIndex): """ ToSingle(value: Array[Byte],startIndex: int) -> Single Returns a single-precision floating point number converted from four bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A single-precision floating point number formed by four bytes beginning at startIndex. """ pass @staticmethod def to_string(value=None, startIndex=None, length=None): """ ToString(value: Array[Byte],startIndex: int) -> str Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string representation. value: An array of bytes. startIndex: The starting position within value. Returns: A string of hexadecimal pairs separated by hyphens,where each pair represents the corresponding element in a subarray of value; for example,"7F-2C-4A-00". ToString(value: Array[Byte]) -> str Converts the numeric value of each element of a specified array of bytes to its equivalent hexadecimal string representation. value: An array of bytes. Returns: A string of hexadecimal pairs separated by hyphens,where each pair represents the corresponding element in value; for example,"7F-2C-4A-00". ToString(value: Array[Byte],startIndex: int,length: int) -> str Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string representation. value: An array of bytes. startIndex: The starting position within value. length: The number of array elements in value to convert. Returns: A string of hexadecimal pairs separated by hyphens,where each pair represents the corresponding element in a subarray of value; for example,"7F-2C-4A-00". """ pass @staticmethod def to_u_int16(value, startIndex): """ ToUInt16(value: Array[Byte],startIndex: int) -> UInt16 Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array. value: The array of bytes. startIndex: The starting position within value. Returns: A 16-bit unsigned integer formed by two bytes beginning at startIndex. """ pass @staticmethod def to_u_int32(value, startIndex): """ ToUInt32(value: Array[Byte],startIndex: int) -> UInt32 Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 32-bit unsigned integer formed by four bytes beginning at startIndex. """ pass @staticmethod def to_u_int64(value, startIndex): """ ToUInt64(value: Array[Byte],startIndex: int) -> UInt64 Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array. value: An array of bytes. startIndex: The starting position within value. Returns: A 64-bit unsigned integer formed by the eight bytes beginning at startIndex. """ pass is_little_endian = True __all__ = ['DoubleToInt64Bits', 'GetBytes', 'Int64BitsToDouble', 'IsLittleEndian', 'ToBoolean', 'ToChar', 'ToDouble', 'ToInt16', 'ToInt32', 'ToInt64', 'ToSingle', 'ToString', 'ToUInt16', 'ToUInt32', 'ToUInt64']
def extraerVector(matrizPesos, i, dimVect): vectTemp = [] for j in range(dimVect - 1): vectTemp.append(matrizPesos[i][j]) return vectTemp
def extraer_vector(matrizPesos, i, dimVect): vect_temp = [] for j in range(dimVect - 1): vectTemp.append(matrizPesos[i][j]) return vectTemp
async def handler(event): # flush history data await event.kv.flush() # string: bit 0 v = await event.kv.setbit('string', 0, 1) if v != 0: return {'status': 503, 'body': 'test1 fail!'} # string: bit 1 v = await event.kv.setbit('string', 0, 1) if v != 1: return {'status': 503, 'body': 'test2 fail!'} await event.kv.setbit('string', 7, 1) await event.kv.setbit('string', 16, 1) await event.kv.setbit('string', 23, 1) # string: bit 100000010000000010000001 v = await event.kv.getbit('string', 16) if v != 1: return {'status': 503, 'body': 'test3 fail!'} # byte: [1, 1] # bit: [8, 15] v = await event.kv.bitcount('string', 1, 1) if v != 0: return {'status': 503, 'body': 'test4 fail!'} # byte: [2, 2] # bit: [16, 23] v = await event.kv.bitcount('string', 2, 2) if v != 2: return {'status': 503, 'body': 'test5 fail!'} # byte: [0, 2] # bit: [0, 23] v = await event.kv.bitcount('string', 0, 2) if v != 4: return {'status': 503, 'body': 'test6 fail!'} return {'status': 200, 'body': b'well done!'}
async def handler(event): await event.kv.flush() v = await event.kv.setbit('string', 0, 1) if v != 0: return {'status': 503, 'body': 'test1 fail!'} v = await event.kv.setbit('string', 0, 1) if v != 1: return {'status': 503, 'body': 'test2 fail!'} await event.kv.setbit('string', 7, 1) await event.kv.setbit('string', 16, 1) await event.kv.setbit('string', 23, 1) v = await event.kv.getbit('string', 16) if v != 1: return {'status': 503, 'body': 'test3 fail!'} v = await event.kv.bitcount('string', 1, 1) if v != 0: return {'status': 503, 'body': 'test4 fail!'} v = await event.kv.bitcount('string', 2, 2) if v != 2: return {'status': 503, 'body': 'test5 fail!'} v = await event.kv.bitcount('string', 0, 2) if v != 4: return {'status': 503, 'body': 'test6 fail!'} return {'status': 200, 'body': b'well done!'}
''' Copyright 2013 CyberPoint International, LLC. All rights reserved. Use and disclosure prohibited except as permitted in writing by CyberPoint. libpgm exception handler Charlie Cabot Sept 27 2013 ''' class libpgmError(Exception): pass class bntextError(libpgmError): pass
""" Copyright 2013 CyberPoint International, LLC. All rights reserved. Use and disclosure prohibited except as permitted in writing by CyberPoint. libpgm exception handler Charlie Cabot Sept 27 2013 """ class Libpgmerror(Exception): pass class Bntexterror(libpgmError): pass
# In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method # for computing the greatest common divisor (GCD) of two integers (numbers), the largest number # that divides them both without a remainder. def gcd_by_subtracting(m, n): """ Computes the greatest common divisor of two numbers by continuously subtracting the smaller number from the bigger one till they became equal. :param int m: First number. :param int n: Second number. :returns: GCD as a number. """ while m != n: if m > n: m -= n else: n -= m return m assert gcd_by_subtracting(112, 12345678) == 2 def gcd_recursive_by_divrem(m, n): """ Computes the greatest common divisor of two numbers by recursively getting remainder from division. :param int m: First number. :param int n: Second number. :returns: GCD as a number. """ if n == 0: return m return gcd_recursive_by_divrem(n, m % n) assert gcd_by_subtracting(112, 12345678) == 2 def gcd_looping_with_divrem(m, n): """ Computes the greatest common divisor of two numbers by getting remainder from division in a loop. :param int m: First number. :param int n: Second number. :returns: GCD as a number. """ while n != 0: m, n = n, m % n return m assert gcd_by_subtracting(112, 12345678) == 2
def gcd_by_subtracting(m, n): """ Computes the greatest common divisor of two numbers by continuously subtracting the smaller number from the bigger one till they became equal. :param int m: First number. :param int n: Second number. :returns: GCD as a number. """ while m != n: if m > n: m -= n else: n -= m return m assert gcd_by_subtracting(112, 12345678) == 2 def gcd_recursive_by_divrem(m, n): """ Computes the greatest common divisor of two numbers by recursively getting remainder from division. :param int m: First number. :param int n: Second number. :returns: GCD as a number. """ if n == 0: return m return gcd_recursive_by_divrem(n, m % n) assert gcd_by_subtracting(112, 12345678) == 2 def gcd_looping_with_divrem(m, n): """ Computes the greatest common divisor of two numbers by getting remainder from division in a loop. :param int m: First number. :param int n: Second number. :returns: GCD as a number. """ while n != 0: (m, n) = (n, m % n) return m assert gcd_by_subtracting(112, 12345678) == 2
class CachedLoader(object): items = {} @classmethod def load_compose_definition(cls, loader: callable): return cls.cached('compose', loader) @classmethod def cached(cls, name: str, loader: callable): if name not in cls.items: cls.items[name] = loader() return cls.items[name] @classmethod def clear(cls): cls.items = {}
class Cachedloader(object): items = {} @classmethod def load_compose_definition(cls, loader: callable): return cls.cached('compose', loader) @classmethod def cached(cls, name: str, loader: callable): if name not in cls.items: cls.items[name] = loader() return cls.items[name] @classmethod def clear(cls): cls.items = {}
print("Welcome to Byeonghoon's Age Calculator. This program provide your or someone's age at the specific date you are enquiring.") current_day = int(input("Please input the DAY you want to enquire (DD):\n")) while current_day < 1 or current_day > 31: print("!", current_day, "is not existing date. Please check your date again.") current_day = int(input("Please input again for the DAY you want to enquire:\n")) print(f"Date: {current_day}. Confirmed.") current_month = int(input("Please input the MONTH you want to enquire (MM):\n")) while current_month < 1 or current_month > 12: print("!", current_month, "is not existing month. Please check your month again.") current_month = int( input("Please input again for the MONTH you want to enquire (MM):\n") ) while ((current_day == 31) and (current_month in (2, 4, 6, 9, 11))) or ( (current_day == 30) and (current_month == 2) ): print( "! The date " f"{current_day} in the month {current_month} is not exist. Please try again." ) current_day = int(input("Please input the DAY you want to enquire (DD):\n")) while current_day < 1 or current_day > 31: print("!", current_day, "is not existing date. Please check your date again.") current_day = int( input("Please input again for the DAY you want to enquire (DD):\n") ) print(f"Date: {current_day}. Confirmed.") current_month = int(input("Please input the MONTH you want to enquire (MM):\n")) while (current_month < 1) or (current_month > 12): print( f"! {current_month} is not existing month. Please check your month again." ) current_month = int( input("Please input again for the MONTH you want to enquire (MM):\n") ) print(f"Date: {current_day}\nMonth: {current_month}. Confirmed.") current_year = int(input("Please input the YEAR you want to enquire: \n")) while current_year < 0 or current_year > 9999: print("! Please input valid year. (from 0 ~ 9999)!") current_year = int(input("Please input the YEAR you want to enquire: \n")) while ( (current_day == 29) and (current_month == 2) and ( ((current_year % 4) == (1 or 2 or 3)) or ((current_year % 4) and (current_year % 100) == 0) or (((current_year % 4) and (current_year % 100) and (current_year % 400)) > 0) ) ): print(f"! {current_year} does not have 29th day in February.") current_year = int(input("Please input the YEAR you want to enquire again: \n")) print(f"Year: {current_year}. Confirmed.") print(f"Enquiring Date is: {current_day}. {current_month}. {current_year}.") birth_day = int(input("Please input your or someone's birth DAY (DD):\n")) while birth_day < 1 or birth_day > 31: print( "!", birth_day, "is not existing date. Please check your or someone's date again.", ) birth_day = int(input("Please input your or someone's birth DAY again:\n")) print(f"Date of birth: {birth_day}. Confirmed.") birth_month = int(input("Please input your or someone's birth MONTH (MM):\n")) while birth_month < 1 or birth_month > 12: print( "!", birth_month, "is not existing month. Please check your or someone's month again.", ) birth_month = int(input("Please input your or someone's birth MONTH again (MM):\n")) while ((birth_day == 31) and (birth_month in (2, 4, 6, 9, 11))) or ( (birth_day == 30) and (birth_month == 2) ): print( "! The date " f"{birth_day} in the month {birth_month} is not exist. Please try again." ) birth_day = int(input("Please input your or someone's birth DAY (DD):\n")) while birth_day < 1 or birth_day > 31: print( "!", birth_day, "is not existing date. Please check your or someone's date again.", ) birth_day = int(input("Please input your or someone's birth DAY again (DD):\n")) print(f"Date: {birth_day}. Confirmed.") birth_month = int(input("Please input your or someone's birth MONTH (MM)\n")) while (birth_month < 1) or (birth_month > 12): print( f"! {birth_month} is not existing month. Please check your or someone's month again." ) birth_month = int( input("Please input your or someone's birth MONTH again (MM)\n") ) print(f"Date: {birth_day}\nMonth: {birth_month}. Confirmed.") birth_year = int(input("Please input your or someone's birth YEAR: \n")) while birth_year < 0 or birth_year > 9999: print("! Please input valid year. (from 0 ~ 9999") birth_year = int(input("Please input your or someone's birth YEAR agian:\n")) while ( (birth_day == 29) and (birth_month == 2) and ( ((birth_year % 4) == (1 or 2 or 3)) or ((birth_year % 4) and (birth_year % 100) == 0) or (((birth_year % 4) and (birth_year % 100) and (birth_year % 400)) > 0) ) ): print(f"! {birth_year} does not have 29th day in February.") birth_year = int(input("Please input your or someone's birth YEAR again: \n")) print(f"Year: {birth_year}. Confirmed.") print(f"Birth Date is: {birth_day}. {birth_month}. {birth_year}.") result = ( int(current_year) - int(birth_year) - 1 + int( ( current_month > birth_month or ((current_month >= birth_month) and (current_day >= birth_day)) ) and current_year >= birth_year ) ) if result < 0: print("Sorry, we can not provide the age before you or someone born") else: print("Your or someone's age at the day you enquired was:", result, "years old") if ( (birth_year == current_year) and (birth_month == current_month) and (birth_day == current_day) ): print("It is the day you or someone borned !")
print("Welcome to Byeonghoon's Age Calculator. This program provide your or someone's age at the specific date you are enquiring.") current_day = int(input('Please input the DAY you want to enquire (DD):\n')) while current_day < 1 or current_day > 31: print('!', current_day, 'is not existing date. Please check your date again.') current_day = int(input('Please input again for the DAY you want to enquire:\n')) print(f'Date: {current_day}. Confirmed.') current_month = int(input('Please input the MONTH you want to enquire (MM):\n')) while current_month < 1 or current_month > 12: print('!', current_month, 'is not existing month. Please check your month again.') current_month = int(input('Please input again for the MONTH you want to enquire (MM):\n')) while current_day == 31 and current_month in (2, 4, 6, 9, 11) or (current_day == 30 and current_month == 2): print(f'! The date {current_day} in the month {current_month} is not exist. Please try again.') current_day = int(input('Please input the DAY you want to enquire (DD):\n')) while current_day < 1 or current_day > 31: print('!', current_day, 'is not existing date. Please check your date again.') current_day = int(input('Please input again for the DAY you want to enquire (DD):\n')) print(f'Date: {current_day}. Confirmed.') current_month = int(input('Please input the MONTH you want to enquire (MM):\n')) while current_month < 1 or current_month > 12: print(f'! {current_month} is not existing month. Please check your month again.') current_month = int(input('Please input again for the MONTH you want to enquire (MM):\n')) print(f'Date: {current_day}\nMonth: {current_month}. Confirmed.') current_year = int(input('Please input the YEAR you want to enquire: \n')) while current_year < 0 or current_year > 9999: print('! Please input valid year. (from 0 ~ 9999)!') current_year = int(input('Please input the YEAR you want to enquire: \n')) while current_day == 29 and current_month == 2 and (current_year % 4 == (1 or 2 or 3) or (current_year % 4 and current_year % 100 == 0) or (current_year % 4 and current_year % 100 and current_year % 400) > 0): print(f'! {current_year} does not have 29th day in February.') current_year = int(input('Please input the YEAR you want to enquire again: \n')) print(f'Year: {current_year}. Confirmed.') print(f'Enquiring Date is: {current_day}. {current_month}. {current_year}.') birth_day = int(input("Please input your or someone's birth DAY (DD):\n")) while birth_day < 1 or birth_day > 31: print('!', birth_day, "is not existing date. Please check your or someone's date again.") birth_day = int(input("Please input your or someone's birth DAY again:\n")) print(f'Date of birth: {birth_day}. Confirmed.') birth_month = int(input("Please input your or someone's birth MONTH (MM):\n")) while birth_month < 1 or birth_month > 12: print('!', birth_month, "is not existing month. Please check your or someone's month again.") birth_month = int(input("Please input your or someone's birth MONTH again (MM):\n")) while birth_day == 31 and birth_month in (2, 4, 6, 9, 11) or (birth_day == 30 and birth_month == 2): print(f'! The date {birth_day} in the month {birth_month} is not exist. Please try again.') birth_day = int(input("Please input your or someone's birth DAY (DD):\n")) while birth_day < 1 or birth_day > 31: print('!', birth_day, "is not existing date. Please check your or someone's date again.") birth_day = int(input("Please input your or someone's birth DAY again (DD):\n")) print(f'Date: {birth_day}. Confirmed.') birth_month = int(input("Please input your or someone's birth MONTH (MM)\n")) while birth_month < 1 or birth_month > 12: print(f"! {birth_month} is not existing month. Please check your or someone's month again.") birth_month = int(input("Please input your or someone's birth MONTH again (MM)\n")) print(f'Date: {birth_day}\nMonth: {birth_month}. Confirmed.') birth_year = int(input("Please input your or someone's birth YEAR: \n")) while birth_year < 0 or birth_year > 9999: print('! Please input valid year. (from 0 ~ 9999') birth_year = int(input("Please input your or someone's birth YEAR agian:\n")) while birth_day == 29 and birth_month == 2 and (birth_year % 4 == (1 or 2 or 3) or (birth_year % 4 and birth_year % 100 == 0) or (birth_year % 4 and birth_year % 100 and birth_year % 400) > 0): print(f'! {birth_year} does not have 29th day in February.') birth_year = int(input("Please input your or someone's birth YEAR again: \n")) print(f'Year: {birth_year}. Confirmed.') print(f'Birth Date is: {birth_day}. {birth_month}. {birth_year}.') result = int(current_year) - int(birth_year) - 1 + int((current_month > birth_month or (current_month >= birth_month and current_day >= birth_day)) and current_year >= birth_year) if result < 0: print('Sorry, we can not provide the age before you or someone born') else: print("Your or someone's age at the day you enquired was:", result, 'years old') if birth_year == current_year and birth_month == current_month and (birth_day == current_day): print('It is the day you or someone borned !')
class AuthSession(object): def __init__(self, session): self._session = session def __enter__(self): return self._session def __exit__(self, *args): self._session.close()
class Authsession(object): def __init__(self, session): self._session = session def __enter__(self): return self._session def __exit__(self, *args): self._session.close()
""" Problem 7: What is the 10 001st prime number? """ def is_prime(n): for i in range(2, n // 2 + 1): if n % i == 0: return False return True class Prime: def __init__(self): self.curr = 1 def __next__(self): new_next = self.curr + 1 while not is_prime(new_next): new_next += 1 self.curr = new_next return self.curr def __iter__(self): return self pos = 0 for i in Prime(): pos += 1 if pos == 10001: print('answer:', i) break
""" Problem 7: What is the 10 001st prime number? """ def is_prime(n): for i in range(2, n // 2 + 1): if n % i == 0: return False return True class Prime: def __init__(self): self.curr = 1 def __next__(self): new_next = self.curr + 1 while not is_prime(new_next): new_next += 1 self.curr = new_next return self.curr def __iter__(self): return self pos = 0 for i in prime(): pos += 1 if pos == 10001: print('answer:', i) break
# Given the array candies and the integer extraCandies, where candies[i] represents the number of candies that the # ith kid has. # # For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the # greatest number of candies among them. Notice that multiple kids can have the greatest number of candies. # # Input: candies = [2,3,5,1,3], extraCandies = 3 # Output: [true,true,true,false,true] # # 2 <= candies.length <= 100 # 1 <= candies[i] <= 100 # 1 <= extraCandies <= 50 # # Source: https://leetcode.com/problems/kids-with-the-greatest-number-of-candies class Solution: def kidsWithCandies(self, candies, extraCandies): highest = max(candies) output_list = [] for i in candies: total = i + extraCandies if total >= highest: output_list.append(True) else: output_list.append(False) return output_list s = Solution() candies = [4, 2, 1, 1, 2] output = s.kidsWithCandies(candies, 1) print(f"{candies}\n{output}")
class Solution: def kids_with_candies(self, candies, extraCandies): highest = max(candies) output_list = [] for i in candies: total = i + extraCandies if total >= highest: output_list.append(True) else: output_list.append(False) return output_list s = solution() candies = [4, 2, 1, 1, 2] output = s.kidsWithCandies(candies, 1) print(f'{candies}\n{output}')
_base_ = './cascade_rcnn_s50_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py' model = dict( backbone=dict( stem_channels=128, depth=101, init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://resnest101')))
_base_ = './cascade_rcnn_s50_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py' model = dict(backbone=dict(stem_channels=128, depth=101, init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://resnest101')))
description = 'setup for the poller' group = 'special' sysconfig = dict(cache = 'mephisto17.office.frm2') devices = dict( Poller = device('nicos.services.poller.Poller', alwayspoll = ['tube_environ', 'pressure'], blacklist = ['tas'] ), )
description = 'setup for the poller' group = 'special' sysconfig = dict(cache='mephisto17.office.frm2') devices = dict(Poller=device('nicos.services.poller.Poller', alwayspoll=['tube_environ', 'pressure'], blacklist=['tas']))
# Asking Question print ("How old are you?"), age = input() print ("How tall are you?") height = input() print ("How much do you weigh?") weight = input() print ("So You are %r years old, %r tall and %r heavy."%(age, height , weight) )
(print('How old are you?'),) age = input() print('How tall are you?') height = input() print('How much do you weigh?') weight = input() print('So You are %r years old, %r tall and %r heavy.' % (age, height, weight))
__copyright__ = 'Copyright (C) 2019, Nokia' class TestPythonpath2(object): ROBOT_LIBRARY_SCOPE = "GLOBAL" def __init__(self): self.name = 'iina' self.age = 10 def get_name2(self): return self.name
__copyright__ = 'Copyright (C) 2019, Nokia' class Testpythonpath2(object): robot_library_scope = 'GLOBAL' def __init__(self): self.name = 'iina' self.age = 10 def get_name2(self): return self.name
# -*- coding: utf-8 -*- """ Processing a list of power plants in Germany. SPDX-FileCopyrightText: 2016-2021 Uwe Krien <krien@uni-bremen.de> SPDX-License-Identifier: MIT """ __copyright__ = "Uwe Krien <krien@uni-bremen.de>" __license__ = "MIT" # from unittest.mock import MagicMock # from nose.tools import ok_, eq_ # import os # from deflex import scenario_tools, config as cfg # # # def clean_time_series(): # sc = scenario_tools.DeflexScenario(name="test", year=2014) # csv_path = os.path.join( # os.path.dirname(__file__), "data", "deflex_2014_de21_test_csv" # ) # sc.load_csv(csv_path) # # before cleaning # ok_(("DE05", "solar") in sc.table_collection["volatile_series"]) # ok_(("DE04", "district heating") in sc.table_collection["demand_series"]) # # sc.table_collection["volatile_source"].loc["DE05", "solar"] = 0 # sc.table_collection["demand_series"]["DE04", "district heating"] = 0 # basic_scenario.clean_time_series(sc.table_collection) # # # after cleaning # ok_(("DE05", "solar") not in sc.table_collection["volatile_series"]) # ok_( # ("DE04", "district heating") # not in sc.table_collection["demand_series"] # ) # # # def scenario_creation_main(): # sc = scenario_tools.DeflexScenario(name="test", year=2014) # csv_path = os.path.join( # os.path.dirname(__file__), "data", "deflex_2014_de21_test_csv" # ) # sc.load_csv(csv_path) # basic_scenario.create_scenario = MagicMock( # return_value=sc.table_collection # ) # cfg.tmp_set( # "paths", # "scenario", # os.path.join(os.path.expanduser("~"), "deflex_tmp_test_dir"), # ) # # fn = basic_scenario.create_basic_scenario(2014, "de21", only_out="csv") # ok_(fn.xls is None) # eq_( # fn.csv[-70:], # ( # "deflex_tmp_test_dir/deflex/2014/" # "deflex_2014_de21_heat_no-reg-merit_csv" # ), # ) # # fn = basic_scenario.create_basic_scenario(2014, "de21", only_out="xls") # ok_(fn.csv is None) # eq_( # fn.xls[-70:], # ( # "deflex_tmp_test_dir/deflex/2014/" # "deflex_2014_de21_heat_no-reg-merit.xls" # ), # ) # # fn = basic_scenario.create_basic_scenario( # 2014, "de21", csv_dir="fancy_csv", xls_name="fancy.xls" # ) # eq_(fn.xls[-41:], "deflex_tmp_test_dir/deflex/2014/fancy.xls") # eq_(fn.csv[-41:], "deflex_tmp_test_dir/deflex/2014/fancy_csv")
""" Processing a list of power plants in Germany. SPDX-FileCopyrightText: 2016-2021 Uwe Krien <krien@uni-bremen.de> SPDX-License-Identifier: MIT """ __copyright__ = 'Uwe Krien <krien@uni-bremen.de>' __license__ = 'MIT'
class Solution: """ @param t: the length of the flight @param dur: the length of movies @return: output the lengths of two movies """ def aerial_Movie(self, t, dur): t -= 30 dur.sort() left = 0 right = len(dur) - 1 longest = 0 longest_pair = None while left < right: summ = dur[left] + dur[right] if summ <= t: if summ > longest: longest = summ longest_pair = [dur[left], dur[right]] left += 1 else: right -= 1 return longest_pair
class Solution: """ @param t: the length of the flight @param dur: the length of movies @return: output the lengths of two movies """ def aerial__movie(self, t, dur): t -= 30 dur.sort() left = 0 right = len(dur) - 1 longest = 0 longest_pair = None while left < right: summ = dur[left] + dur[right] if summ <= t: if summ > longest: longest = summ longest_pair = [dur[left], dur[right]] left += 1 else: right -= 1 return longest_pair
''' Source : https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/ Author : Yuan Wang Date : 2018-06-02 /********************************************************************************** * * Say you have an array for which the ith element is the price of a given stock on day i. * * If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), * design an algorithm to find the maximum profit. * *Time complexity : O(n). Only a single pass is needed. Space complexity : O(1). Only two variables are used. **********************************************************************************/ ''' def maxProfit(prices): """ :type prices: List[int] :rtype: int """ max_profit, min_price = 0, float('inf') for price in prices: min_price = min(min_price, price) profit = price - min_price max_profit = max(max_profit, profit) return max_profit def maxProfitB(prices): """ :type prices: List[int] :rtype: int """ maxCur=0 maxSoFar=0 for i in range(1,len(prices)): maxCur+=prices[i]-prices[i-1] maxCur=max(0,maxCur) maxSoFar=max(maxCur,maxSoFar) return maxSoFar print(maxProfitB([7,1,5,3,6,4]))
""" Source : https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/ Author : Yuan Wang Date : 2018-06-02 /********************************************************************************** * * Say you have an array for which the ith element is the price of a given stock on day i. * * If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), * design an algorithm to find the maximum profit. * *Time complexity : O(n). Only a single pass is needed. Space complexity : O(1). Only two variables are used. **********************************************************************************/ """ def max_profit(prices): """ :type prices: List[int] :rtype: int """ (max_profit, min_price) = (0, float('inf')) for price in prices: min_price = min(min_price, price) profit = price - min_price max_profit = max(max_profit, profit) return max_profit def max_profit_b(prices): """ :type prices: List[int] :rtype: int """ max_cur = 0 max_so_far = 0 for i in range(1, len(prices)): max_cur += prices[i] - prices[i - 1] max_cur = max(0, maxCur) max_so_far = max(maxCur, maxSoFar) return maxSoFar print(max_profit_b([7, 1, 5, 3, 6, 4]))
# 1. Escreva uma funcao que recebe como entrada as dimensoes M e N e o elemento E de preenchimento # e retorna uma lista de listas que corresponde a uma matriz MxN contendo o elemento e em todas # as posicoes. Exemplo: # >>> cria_matriz(2, 3, 0) # [[0, 0, 0], [0, 0, 0]] def f_preencheMatriz(m, n, el): matrizPreenchida = [] for lin in range(m): matrizPreenchida.append([]) for col in range(n): matrizPreenchida[lin].append(el) #fim for #fim for return matrizPreenchida #fim funcao def main(): m, n, el, matriz = 0, 0, 0, [] m = int(input("Informe a qtd de linhas da matriz: ")) n = int(input("Informe a qtd de colunas da matriz: ")) el = int(input("Informe o elemento a ser preenchido nas posicoes da matriz: ")) matriz = f_preencheMatriz(m, n, el) print(matriz) #fim main if __name__ == '__main__': main() #fim if
def f_preenche_matriz(m, n, el): matriz_preenchida = [] for lin in range(m): matrizPreenchida.append([]) for col in range(n): matrizPreenchida[lin].append(el) return matrizPreenchida def main(): (m, n, el, matriz) = (0, 0, 0, []) m = int(input('Informe a qtd de linhas da matriz: ')) n = int(input('Informe a qtd de colunas da matriz: ')) el = int(input('Informe o elemento a ser preenchido nas posicoes da matriz: ')) matriz = f_preenche_matriz(m, n, el) print(matriz) if __name__ == '__main__': main()
''' Python program to compute and print sum of two given integers (more than or equal to zero). If given integers or the sum have more than 80 digits, print "overflow". ''' print ("Input first integer:") x = int (input()) print ("Input second integer:") y = int (input()) if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= 10 ** 80: print ("Overflow!") else : print ("Sum of the two integers: ", x + y)
""" Python program to compute and print sum of two given integers (more than or equal to zero). If given integers or the sum have more than 80 digits, print "overflow". """ print('Input first integer:') x = int(input()) print('Input second integer:') y = int(input()) if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= 10 ** 80: print('Overflow!') else: print('Sum of the two integers: ', x + y)
### Caesar Cipher - Solution def caesarCipher(s, rot_count): for ch in range(len(s)): if s[ch].isalpha(): first_letter = 'A' if s[ch].isupper() else 'a' s[ch] = chr(ord(first_letter) + ((ord(s[ch]) - ord(first_letter) + rot_count) % 26)) print(*s, sep='') n = int(input()) s = list(input()[:n]) rot_count = int(input()) caesarCipher(s, rot_count)
def caesar_cipher(s, rot_count): for ch in range(len(s)): if s[ch].isalpha(): first_letter = 'A' if s[ch].isupper() else 'a' s[ch] = chr(ord(first_letter) + (ord(s[ch]) - ord(first_letter) + rot_count) % 26) print(*s, sep='') n = int(input()) s = list(input()[:n]) rot_count = int(input()) caesar_cipher(s, rot_count)
# source: https://github.com/brownie-mix/upgrades-mix/blob/main/scripts/helpful_scripts.py def encode_function_data(*args, initializer=None): """Encodes the function call so we can work with an initializer. Args: initializer ([brownie.network.contract.ContractTx], optional): The initializer function we want to call. Example: `box.store`. Defaults to None. args (Any, optional): The arguments to pass to the initializer function Returns: [bytes]: Return the encoded bytes. """ if not len(args): args = b'' if initializer: return initializer.encode_input(*args) return b''
def encode_function_data(*args, initializer=None): """Encodes the function call so we can work with an initializer. Args: initializer ([brownie.network.contract.ContractTx], optional): The initializer function we want to call. Example: `box.store`. Defaults to None. args (Any, optional): The arguments to pass to the initializer function Returns: [bytes]: Return the encoded bytes. """ if not len(args): args = b'' if initializer: return initializer.encode_input(*args) return b''
# atributos publicos, privados y protegidos class MiClase: def __init__(self): self.atributo_publico = "valor publico" self._atributo_protegido = "valor protegido" self.__atributo_privado = "valor privado" objeto1 = MiClase() # acceso a los atributos publicos print(objeto1.atributo_publico) # modificando atributos publicos objeto1.atributo_publico = "otro valor" print(objeto1.atributo_publico) # acceso a los atributos protegidos print(objeto1._atributo_protegido) # modificando atributo protegido objeto1._atributo_protegido = "otro nuevo valor" print(objeto1._atributo_protegido) # acceso a atributo privado try: print(objeto1.__atributo_privado) except AttributeError: print("No se puede acceder al atributo privado") # python convierte el atributo privado a: objeto._clase__atributo_privado print(objeto1._MiClase__atributo_privado) objeto1._MiClase__atributo_privado = "Nuevo valor privado" print(objeto1._MiClase__atributo_privado)
class Miclase: def __init__(self): self.atributo_publico = 'valor publico' self._atributo_protegido = 'valor protegido' self.__atributo_privado = 'valor privado' objeto1 = mi_clase() print(objeto1.atributo_publico) objeto1.atributo_publico = 'otro valor' print(objeto1.atributo_publico) print(objeto1._atributo_protegido) objeto1._atributo_protegido = 'otro nuevo valor' print(objeto1._atributo_protegido) try: print(objeto1.__atributo_privado) except AttributeError: print('No se puede acceder al atributo privado') print(objeto1._MiClase__atributo_privado) objeto1._MiClase__atributo_privado = 'Nuevo valor privado' print(objeto1._MiClase__atributo_privado)
class Schemas: """ Class that contains DATABASE schema names. """ chemprop_schema = "sbox_rlougee_chemprop" dsstox_schema = "ro_20191118_dsstox" qsar_schema = "sbox_mshobair_qsar_snap" invitrodb_schema = "prod_internal_invitrodb_v3_3" information_schema = "information_schema"
class Schemas: """ Class that contains DATABASE schema names. """ chemprop_schema = 'sbox_rlougee_chemprop' dsstox_schema = 'ro_20191118_dsstox' qsar_schema = 'sbox_mshobair_qsar_snap' invitrodb_schema = 'prod_internal_invitrodb_v3_3' information_schema = 'information_schema'
# inheritance - 2 - normal methods class Person(): def details(self): print("Can have information specific to the person") class Student(Person): def details(self): super().details() print("Can have information specific to the student") s = Student() s.details()
class Person: def details(self): print('Can have information specific to the person') class Student(Person): def details(self): super().details() print('Can have information specific to the student') s = student() s.details()
# 255: '11111111' # 65536: '10000000000000000' # 16777215: '111111111111111111111111' d = 0 a = 8307757 while (d != a): c = d | 0x10000 d = 14070682 while True: d = (((d + (c & 0xFF)) & 0xFFFFFF) * 65899) & 0xFFFFFF if 256 > c: break c //= 256 print("Program halts")
d = 0 a = 8307757 while d != a: c = d | 65536 d = 14070682 while True: d = (d + (c & 255) & 16777215) * 65899 & 16777215 if 256 > c: break c //= 256 print('Program halts')
""" # Definition for a Node. class Node: def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None): self.val = val self.left = left self.right = right self.next = next """ class Solution: def connect(self, root: 'Node') -> 'Node': if not root: return root prev = None q = deque([root]) while q: for _ in range(len(q)): n = q.popleft() if prev: prev.next = n prev = n if n.left: q.append(n.left) if n.right: q.append(n.right) prev = None return root
""" # Definition for a Node. class Node: def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None): self.val = val self.left = left self.right = right self.next = next """ class Solution: def connect(self, root: 'Node') -> 'Node': if not root: return root prev = None q = deque([root]) while q: for _ in range(len(q)): n = q.popleft() if prev: prev.next = n prev = n if n.left: q.append(n.left) if n.right: q.append(n.right) prev = None return root
''' You may have noticed that the medals are ordered according to a lexicographic (dictionary) ordering: Bronze < Gold < Silver. However, you would prefer an ordering consistent with the Olympic rules: Bronze < Silver < Gold. You can achieve this using Categorical types. In this final exercise, after redefining the 'Medal' column of the DataFrame medals, you will repeat the area plot from the previous exercise to see the new ordering. ''' # Redefine 'Medal' as an ordered categorical medals.Medal = pd.Categorical(values = medals.Medal, categories=['Bronze', 'Silver', 'Gold'], ordered=True) # Create the DataFrame: usa usa = medals[medals.NOC == 'USA'] # Group usa by 'Edition', 'Medal', and 'Athlete' usa_medals_by_year = usa.groupby(['Edition', 'Medal'])['Athlete'].count() # Reshape usa_medals_by_year by unstacking usa_medals_by_year = usa_medals_by_year.unstack(level='Medal') # Create an area plot of usa_medals_by_year usa_medals_by_year.plot.area() plt.show()
""" You may have noticed that the medals are ordered according to a lexicographic (dictionary) ordering: Bronze < Gold < Silver. However, you would prefer an ordering consistent with the Olympic rules: Bronze < Silver < Gold. You can achieve this using Categorical types. In this final exercise, after redefining the 'Medal' column of the DataFrame medals, you will repeat the area plot from the previous exercise to see the new ordering. """ medals.Medal = pd.Categorical(values=medals.Medal, categories=['Bronze', 'Silver', 'Gold'], ordered=True) usa = medals[medals.NOC == 'USA'] usa_medals_by_year = usa.groupby(['Edition', 'Medal'])['Athlete'].count() usa_medals_by_year = usa_medals_by_year.unstack(level='Medal') usa_medals_by_year.plot.area() plt.show()
class Node(object): def __init__(self, value): self.value = value self.next = None self.prev = None def __repr__(self): if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, self.value) class BinaryNode(): def __init__(self, key): self.key = key self.left = None self.right = None
class Node(object): def __init__(self, value): self.value = value self.next = None self.prev = None def __repr__(self): if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, self.value) class Binarynode: def __init__(self, key): self.key = key self.left = None self.right = None
def getNextPowerof2(num): power = 1 while(power < num): power *= 2 return power def buildWalshTable(wTable, length, i1,i2, j1,j2, isComplement): if length == 2: if not isComplement: wTable[i1][j1] = 1 wTable[i1][j2] = 1 wTable[i2][j1] = 1 wTable[i2][j2] = -1 else: wTable[i1][j1] = -1 wTable[i1][j2] = -1 wTable[i2][j1] = -1 wTable[i2][j2] = 1 return midi = (i1+i2)//2 midj = (j1+j2)//2 buildWalshTable(wTable, length/2, i1, midi, j1, midj, isComplement) buildWalshTable(wTable, length/2, i1, midi, midj+1, j2, isComplement) buildWalshTable(wTable, length/2, midi+1, i2, j1, midj, isComplement) buildWalshTable(wTable, length/2, midi+1, i2, midj+1, j2, not isComplement) def getWalshTable(numberOfSender:int): num = getNextPowerof2(numberOfSender) wTable = [[0 for i in range(num)] for j in range(num)] if numberOfSender == 1: wTable = [[1]] return wTable buildWalshTable(wTable, num, 0, num - 1, 0, num - 1, False) return wTable
def get_next_powerof2(num): power = 1 while power < num: power *= 2 return power def build_walsh_table(wTable, length, i1, i2, j1, j2, isComplement): if length == 2: if not isComplement: wTable[i1][j1] = 1 wTable[i1][j2] = 1 wTable[i2][j1] = 1 wTable[i2][j2] = -1 else: wTable[i1][j1] = -1 wTable[i1][j2] = -1 wTable[i2][j1] = -1 wTable[i2][j2] = 1 return midi = (i1 + i2) // 2 midj = (j1 + j2) // 2 build_walsh_table(wTable, length / 2, i1, midi, j1, midj, isComplement) build_walsh_table(wTable, length / 2, i1, midi, midj + 1, j2, isComplement) build_walsh_table(wTable, length / 2, midi + 1, i2, j1, midj, isComplement) build_walsh_table(wTable, length / 2, midi + 1, i2, midj + 1, j2, not isComplement) def get_walsh_table(numberOfSender: int): num = get_next_powerof2(numberOfSender) w_table = [[0 for i in range(num)] for j in range(num)] if numberOfSender == 1: w_table = [[1]] return wTable build_walsh_table(wTable, num, 0, num - 1, 0, num - 1, False) return wTable
""" Number to Words """ UP_TO_TWENTY = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten","Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"] TENS = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"] HUNDRED = 'Hundred' ZERO = "Zero" THOUSAND = "Thousand" MILLION = "Million" BILLION = "Billion" TRILLION = "Trillion" MINUS = "Minus" def up_to_100(n): words = [] if n >= 20: words.append(TENS[n // 10]) n = n % 10 words.append(UP_TO_TWENTY[n]) return words def up_to_1000(n, and_support=False): words = [] if n > 99: words.append(UP_TO_TWENTY[n // 100]) words.append(HUNDRED) n = n % 100 if n > 0: words += 'And' words += up_to_100(n) return words def triple_part(n, part, suffix, and_support=False): nn = (n // 10 ** part) % 1000 words = [] if nn > 0: words = up_to_1000(nn, and_support=and_support) words.append(suffix) return words def number_to_words(n, and_support=False): if n == 0: return ZERO words = [] if n < 0: words.append(MINUS) n = -n words += triple_part(n, 12, TRILLION, and_support=and_support) words += triple_part(n, 9, BILLION, and_support=and_support) words += triple_part(n, 6, MILLION, and_support=and_support) words += triple_part(n, 3, THOUSAND, and_support=and_support) words += triple_part(n, 0, "", and_support=and_support) result = ' '.join([w for w in words if w]) return result def euler_main(): total = 0 for i in range(1, 1001): s = number_to_words(i,and_support=True) total += sum(1 for ch in s if ch.isalpha()) return total def hacker_main(): t = int(input()) for _ in range(t): n = int(input()) result = number_to_words(n) print(result) print(number_to_words(101,and_support=True)) print(euler_main()) #print(number_to_words(104300513783)) # print(digits_sum(1000)) hacker_main()
""" Number to Words """ up_to_twenty = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen'] tens = ['', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'] hundred = 'Hundred' zero = 'Zero' thousand = 'Thousand' million = 'Million' billion = 'Billion' trillion = 'Trillion' minus = 'Minus' def up_to_100(n): words = [] if n >= 20: words.append(TENS[n // 10]) n = n % 10 words.append(UP_TO_TWENTY[n]) return words def up_to_1000(n, and_support=False): words = [] if n > 99: words.append(UP_TO_TWENTY[n // 100]) words.append(HUNDRED) n = n % 100 if n > 0: words += 'And' words += up_to_100(n) return words def triple_part(n, part, suffix, and_support=False): nn = n // 10 ** part % 1000 words = [] if nn > 0: words = up_to_1000(nn, and_support=and_support) words.append(suffix) return words def number_to_words(n, and_support=False): if n == 0: return ZERO words = [] if n < 0: words.append(MINUS) n = -n words += triple_part(n, 12, TRILLION, and_support=and_support) words += triple_part(n, 9, BILLION, and_support=and_support) words += triple_part(n, 6, MILLION, and_support=and_support) words += triple_part(n, 3, THOUSAND, and_support=and_support) words += triple_part(n, 0, '', and_support=and_support) result = ' '.join([w for w in words if w]) return result def euler_main(): total = 0 for i in range(1, 1001): s = number_to_words(i, and_support=True) total += sum((1 for ch in s if ch.isalpha())) return total def hacker_main(): t = int(input()) for _ in range(t): n = int(input()) result = number_to_words(n) print(result) print(number_to_words(101, and_support=True)) print(euler_main()) hacker_main()
class Credential: """ Class that generates new instances of credentials. """ credential_list = [] # Empty credential list def __init__(self, account_name, account_user_name, account_password): """ __init__ method that helps us define properties for our objects. """ self.account_name = account_name self.account_user_name = account_user_name self.account_password = account_password def save_credential(self): ''' save_credential method saves credential objects into credential_list ''' Credential.credential_list.append(self) def delete_credential(self): ''' delete_credential method deletes a saved credential from the credential_list ''' Credential.credential_list.remove(self) @classmethod def find_account_name(cls,account_name): ''' Method that takes in an account_name and returns a credential that matches that account_name. ''' for credential in cls.credential_list: if credential.account_name == account_name: return credential @classmethod def credential_exist(cls,account_name): ''' Method that checks if a credential exists from the credential list. ''' for credential in cls.credential_list: if credential.account_name == account_name: return True return False @classmethod def display_credentials(cls): ''' method that returns the credential list ''' return cls.credential_list
class Credential: """ Class that generates new instances of credentials. """ credential_list = [] def __init__(self, account_name, account_user_name, account_password): """ __init__ method that helps us define properties for our objects. """ self.account_name = account_name self.account_user_name = account_user_name self.account_password = account_password def save_credential(self): """ save_credential method saves credential objects into credential_list """ Credential.credential_list.append(self) def delete_credential(self): """ delete_credential method deletes a saved credential from the credential_list """ Credential.credential_list.remove(self) @classmethod def find_account_name(cls, account_name): """ Method that takes in an account_name and returns a credential that matches that account_name. """ for credential in cls.credential_list: if credential.account_name == account_name: return credential @classmethod def credential_exist(cls, account_name): """ Method that checks if a credential exists from the credential list. """ for credential in cls.credential_list: if credential.account_name == account_name: return True return False @classmethod def display_credentials(cls): """ method that returns the credential list """ return cls.credential_list
# # 1021. Remove Outermost Parentheses # # Q: https://leetcode.com/problems/remove-outermost-parentheses/ # A: https://leetcode.com/problems/remove-outermost-parentheses/discuss/275804/Javascript-Python3-C%2B%2B-Stack-solutions # class Solution: def removeOuterParentheses(self, parens: str) -> str: s, x = [], [] for c in parens: if c == ')': s.pop() if len(s): x.append(c) if c == '(': s.append(c) return ''.join(x)
class Solution: def remove_outer_parentheses(self, parens: str) -> str: (s, x) = ([], []) for c in parens: if c == ')': s.pop() if len(s): x.append(c) if c == '(': s.append(c) return ''.join(x)
""" [2014-12-3] Challenge #191 [Intermediate] Space Probe. Alright Alright Alright. https://www.reddit.com/r/dailyprogrammer/comments/2o5tb7/2014123_challenge_191_intermediate_space_probe/ #Description: NASA has contracted you to program the AI of a new probe. This new probe must navigate space from a starting location to an end location. The probe will have to deal with Asteroids and Gravity Wells. Hopefully it can find the shortest path. #Map and Path: This challenge requires you to establish a random map for the challenge. Then you must navigate a probe from a starting location to an end location. #Map: You are given N -- you generate a NxN 2-D map (yes space is 3-D but for this challenge we are working in 2-D space) * 30% of the spots are "A" asteroids * 10% of the spots are "G" gravity wells (explained below) * 60% of the spots are "." empty space. When you generate the map you must figure out how many of each spaces is needed to fill the map. The map must then be randomly populated to hold the amount of Gravity Wells and Asteroids based on N and the above percentages. ## N and Obstacles As n changes so does the design of your random space map. Truncate the amount of obstacles and its always a min size of 1. (So say N is 11 so 121 spaces. At 10% for wells you need 12.1 or just 12 spots) N can be between 2 and 1000. To keep it simple you will assume every space is empty then populate the random Asteroids and Gravity wells (no need to compute the number of empty spaces - they will just be the ones not holding a gravity well or asteroid) ## Asteroids Probes cannot enter the space of an Asteroid. It will just be destroyed. ## Empty Spaces Probes can safely cross space by the empty spaces of space. Beware of gravity wells as described below. ## Gravity Wells Gravity wells are interesting. The Space itself is so dense it cannot be travelled in. The adjacent spaces of a Gravity well are too strong and cannot be travelled in. Therefore you might see this. . = empty space, G = gravity well ..... ..... ..G.. ..... ..... But due to the gravity you cannot pass (X = unsafe) ..... .XXX. .XGX. .XXX. ..... You might get Gravity wells next to each other. They do not effect each other but keep in mind the area around them will not be safe to travel in. ...... .XXXX. .XGGX. .XXXX. ...... #Probe Movement: Probes can move 8 directions. Up, down, left, right or any of the 4 adjacent corners. However there is no map wrapping. Say you are at the top of the map you cannot move up to appear on the bottom of the map. Probes cannot fold space. And for whatever reason we are contained to only the spots on the map even thou space is infinite in any direction. #Output: Must show the final Map and shortest safe route on the map. * . = empty space * S = start location * E = end location * G = gravity well * A = Asteroid * O = Path. If you fail to get to the end because of no valid path you must travel as far as you can and show the path. Note that the probe path was terminated early due to "No Complete Path" error. #Challenge Input: using (row, col) for coordinates in space. Find solutions for: * N = 10, start = (0,0) end = (9,9) * N = 10, start = (9, 0) end = (0, 9) * N= 50, start = (0,0) end = (49, 49) #Map Obstacle % I generated a bunch of maps and due to randomness you will get easy ones or hard ones. I suggest running your solutions many times to see your outcomes. If you find the solution is always very straight then I would increase your asteroid and gravity well percentages. Or if you never get a good route then decrease the obstacle percentages. #Challenge Theme Music: If you need inspiration for working on this solution listen to this in the background to help you. https://www.youtube.com/watch?v=4PL4kzsrVX8 Or https://www.youtube.com/watch?v=It4WxQ6dnn0 """ def main(): pass if __name__ == "__main__": main()
""" [2014-12-3] Challenge #191 [Intermediate] Space Probe. Alright Alright Alright. https://www.reddit.com/r/dailyprogrammer/comments/2o5tb7/2014123_challenge_191_intermediate_space_probe/ #Description: NASA has contracted you to program the AI of a new probe. This new probe must navigate space from a starting location to an end location. The probe will have to deal with Asteroids and Gravity Wells. Hopefully it can find the shortest path. #Map and Path: This challenge requires you to establish a random map for the challenge. Then you must navigate a probe from a starting location to an end location. #Map: You are given N -- you generate a NxN 2-D map (yes space is 3-D but for this challenge we are working in 2-D space) * 30% of the spots are "A" asteroids * 10% of the spots are "G" gravity wells (explained below) * 60% of the spots are "." empty space. When you generate the map you must figure out how many of each spaces is needed to fill the map. The map must then be randomly populated to hold the amount of Gravity Wells and Asteroids based on N and the above percentages. ## N and Obstacles As n changes so does the design of your random space map. Truncate the amount of obstacles and its always a min size of 1. (So say N is 11 so 121 spaces. At 10% for wells you need 12.1 or just 12 spots) N can be between 2 and 1000. To keep it simple you will assume every space is empty then populate the random Asteroids and Gravity wells (no need to compute the number of empty spaces - they will just be the ones not holding a gravity well or asteroid) ## Asteroids Probes cannot enter the space of an Asteroid. It will just be destroyed. ## Empty Spaces Probes can safely cross space by the empty spaces of space. Beware of gravity wells as described below. ## Gravity Wells Gravity wells are interesting. The Space itself is so dense it cannot be travelled in. The adjacent spaces of a Gravity well are too strong and cannot be travelled in. Therefore you might see this. . = empty space, G = gravity well ..... ..... ..G.. ..... ..... But due to the gravity you cannot pass (X = unsafe) ..... .XXX. .XGX. .XXX. ..... You might get Gravity wells next to each other. They do not effect each other but keep in mind the area around them will not be safe to travel in. ...... .XXXX. .XGGX. .XXXX. ...... #Probe Movement: Probes can move 8 directions. Up, down, left, right or any of the 4 adjacent corners. However there is no map wrapping. Say you are at the top of the map you cannot move up to appear on the bottom of the map. Probes cannot fold space. And for whatever reason we are contained to only the spots on the map even thou space is infinite in any direction. #Output: Must show the final Map and shortest safe route on the map. * . = empty space * S = start location * E = end location * G = gravity well * A = Asteroid * O = Path. If you fail to get to the end because of no valid path you must travel as far as you can and show the path. Note that the probe path was terminated early due to "No Complete Path" error. #Challenge Input: using (row, col) for coordinates in space. Find solutions for: * N = 10, start = (0,0) end = (9,9) * N = 10, start = (9, 0) end = (0, 9) * N= 50, start = (0,0) end = (49, 49) #Map Obstacle % I generated a bunch of maps and due to randomness you will get easy ones or hard ones. I suggest running your solutions many times to see your outcomes. If you find the solution is always very straight then I would increase your asteroid and gravity well percentages. Or if you never get a good route then decrease the obstacle percentages. #Challenge Theme Music: If you need inspiration for working on this solution listen to this in the background to help you. https://www.youtube.com/watch?v=4PL4kzsrVX8 Or https://www.youtube.com/watch?v=It4WxQ6dnn0 """ def main(): pass if __name__ == '__main__': main()
# QUESTION """ Given an array A[] of size n. The task is to find the largest element in it. Example 1: Input: n = 5 A[] = {1, 8, 7, 56, 90} Output: 90 Explanation: The largest element of given array is 90. Example 2: Input: n = 7 A[] = {1, 2, 0, 3, 2, 4, 5} Output: 5 Explanation: The largest element of given array is 5. Your Task: You don't need to read input or print anything. Your task is to complete the function largest() which takes the array A[] and its size n as inputs and returns the maximum element in the array. Expected Time Complexity: O(N) Expected Auxiliary Space: O(1) """ #SOLUTION #User function Template for python3 def largest( arr, n): max=arr[0] for i in range(n): if max>arr[i]: continue else: max=arr[i] return max #{ # Driver Code Starts #Initial Template for Python 3 def main(): T = int(input()) while(T > 0): n = int(input()) a = [int(x) for x in input().strip().split()] print(largest(a, n)) T -= 1 if __name__ == "__main__": main() # } Driver Code Ends
""" Given an array A[] of size n. The task is to find the largest element in it. Example 1: Input: n = 5 A[] = {1, 8, 7, 56, 90} Output: 90 Explanation: The largest element of given array is 90. Example 2: Input: n = 7 A[] = {1, 2, 0, 3, 2, 4, 5} Output: 5 Explanation: The largest element of given array is 5. Your Task: You don't need to read input or print anything. Your task is to complete the function largest() which takes the array A[] and its size n as inputs and returns the maximum element in the array. Expected Time Complexity: O(N) Expected Auxiliary Space: O(1) """ def largest(arr, n): max = arr[0] for i in range(n): if max > arr[i]: continue else: max = arr[i] return max def main(): t = int(input()) while T > 0: n = int(input()) a = [int(x) for x in input().strip().split()] print(largest(a, n)) t -= 1 if __name__ == '__main__': main()
{'983ab651-eb86-4471-8361-c97a5015637e': ('eb86', 'gcpuujtn5ydu', 'SW3', 'Chelsea', ['Chelsea'], (51.491239, -0.16875000000000001)), '83f496df-fcc8-4dcf-8161-a60a75364cf2': ('fcc8', 'gcpuwf1xsv7d', 'SE26', 'Sydenham', ['Sydenham'], (51.428317999999997, -0.052663000000000001)), '31f90575-7945-4999-b3a7-5045bb860302': ('7945', 'gcpuwqsv468q', 'SE22', 'EastDulwich', ['East Dulwich'], (51.452593999999998, -0.070283999999999999)), 'bfbf3ae9-2de6-4121-ad2d-f0af56aead36': ('2de6', 'gcpuuxpu34wm', 'SW1', 'StJamess', ["St James's"], (51.499156999999997, -0.14311399999999999)), '84ef8a77-21b6-4ee7-aa1e-b6c3f46ec594': ('21b6', 'gcpv5skk61e3', 'W9', 'MaidaVale', ['Maida Vale'], (51.527990000000003, -0.191827)), '5e835e97-dc8c-4dd6-bccd-a10fd9a32cdf': ('dc8c', 'gcpucby83fj5', 'SW14', 'Mortlake', ['Mortlake'], (51.464134999999999, -0.26565)), 'ecba74ab-9924-4a75-9d35-3425360b24d3': ('9924', 'gcpvpyrfxbn9', 'E15', 'Stratford', ['Stratford'], (51.538668000000001, -1.9999999999999999e-06)), '2463521e-627b-4c8a-86a1-103dad37603c': ('627b', 'gcpuf7h3m8bj', 'SW13', 'Castelnau', ['Castelnau'], (51.476660000000003, -0.246613)), 'f4bb9dff-1053-417a-a2b5-e1e74f1dca87': ('1053', 'gcpvpkx3jc6n', 'E3', 'OldFord', ['Old Ford'], (51.528804999999998, -0.022752999999999999)), '51983070-a4a1-4d31-97cd-62ce2a116df1': ('a4a1', 'gcpuub2qphrv', 'SW4', 'ClaphamPark', ['Clapham Park'], (51.462387999999997, -0.14216799999999999)), 'e43e519e-a914-4d5a-80fc-5d12deef77d2': ('a914', 'u10hb99hf4mm', 'SE3', 'Kidbrooke', ['Kidbrooke'], (51.469028999999999, 0.023439000000000002)), '55425e98-f4ca-44e5-be77-fbda71da5f55': ('f4ca', 'gcputq019puc', 'SW2', 'StreathamHill', ['Streatham Hill'], (51.449274000000003, -0.1208)), 'd96fe7f2-efdb-4b54-9fb8-0820543c92f9': ('efdb', 'gcpvqf9kqcng', 'E5', 'LowerClapton', ['Lower Clapton'], (51.56232, -0.052915999999999998)), '60416efe-ad71-48de-8fcd-fb9d3b4b2836': ('ad71', 'gcpvmq7qde7j', 'N8', 'Hornsey', ['Hornsey'], (51.583317999999998, -0.116275)), 'd4783dc6-f280-4e70-8e0d-a67608cc5bda': ('f280', 'gcpvxzewnu5j', 'E4', 'SouthChingford', ['South Chingford'], (51.634048, -0.0058859999999999997)), '94fee5ec-dbd5-464c-9033-2e83c120e29f': ('dbd5', 'gcpuz4fnu72k', 'SE14', 'NewCrossGate', ['New Cross Gate'], (51.476244000000001, -0.041015999999999997)), 'ff3571f8-890c-44c7-9cea-a6060fb290de': ('890c', 'u10h9m8d8xf3', 'SE9', 'NewEltham', ['New Eltham'], (51.446699000000002, 0.055642999999999998)), '04df0845-7c22-4d09-93d5-5989d26a54fd': ('7c22', 'gcpvm30np125', 'N7', 'LowerHolloway', ['Lower Holloway'], (51.554381999999997, -0.120549)), '525a86a4-991f-47ed-b021-641420d4c0b3': ('991f', 'u10hceucd7v2', 'SE18', 'ShootersHill', ["Shooter's Hill"], (51.480837999999999, 0.072544999999999998)), '40cfb279-cb70-4c66-9e50-c9533b22ff1a': ('cb70', 'u10hbu3sg932', 'SE7', 'NewCharlton', ['New Charlton'], (51.484129000000003, 0.035171000000000001)), '6243716d-0acd-4367-8d44-ccf16a0380e8': ('0acd', 'u10hbh808hv5', 'SE10', 'Greenwich', ['Greenwich'], (51.484791999999999, 6.9999999999999999e-06)), '171c72b8-2ddf-411d-869a-614aff049e75': ('2ddf', 'gcpvj5wjvs5n', 'WC1', 'StPancras', ['St Pancras'], (51.524141999999998, -0.12335599999999999)), '34f8fa53-5797-457d-9683-82873b564bb9': ('5797', 'u10hftqqzu2f', 'SE2', 'AbbeyWood', ['Abbey Wood'], (51.489981999999998, 0.11878)), '0b1d9677-0d94-43d7-bf35-81fdbaaeb39b': ('0d94', 'gcpuy9ch3swp', 'SE15', 'Peckham', ['Peckham'], (51.470329, -0.064472000000000002)), '800a7f3a-5277-4aac-9890-6189235ebfbd': ('5277', 'gcpv1cqz2wb5', 'W3', 'SouthActon', ['South Acton'], (51.512053999999999, -0.26536700000000002)), '450d69a1-7298-45e4-9278-fb0b87ecb396': ('7298', 'gcpvh9fbt2jv', 'W1', 'Soho', ['Soho'], (51.513606000000003, -0.14979899999999999)), '72d89cc1-4467-4790-96f2-f1f2b99d99b5': ('4467', 'gcpuug5d4wcn', 'SW9', 'Stockwell', ['Stockwell'], (51.476821000000001, -0.137907)), '88f209f1-a4d5-4d7c-b444-0c521e89d420': ('a4d5', 'u10j2kh63fey', 'E11', 'Leytonstone', ['Leytonstone'], (51.570225000000001, 0.016903000000000001)), 'd0dd9e9e-5c2b-48c4-9621-03cbe5620a81': ('5c2b', 'gcpuw0246ymx', 'SE19', 'NorwoodNewTown', ['Norwood New Town'], (51.417810000000003, -0.087764999999999996)), '9c0eb702-fa19-48fe-a122-54c729bdf8ef': ('fa19', 'gcpuugpfm07m', 'SW8', 'SouthLambeth', ['South Lambeth'], (51.476829000000002, -0.13195999999999999)), 'f2aa6787-5a3c-4b00-9973-1339eb3e02bf': ('5a3c', 'gcpvtsuvsst1', 'N13', 'PalmersGreen', ['Palmers Green'], (51.618858000000003, -0.10314)), 'ba2f866f-d4ec-4f8e-a146-c24c51d48601': ('d4ec', 'gcpuz0j754c3', 'SE4', 'HonorOakPark', ['Honor Oak Park'], (51.460490999999998, -0.036604999999999999)), '730a4947-903f-4f87-95a6-3f43972cc52b': ('903f', 'gcpvjdrgghcv', 'EC4', 'StPauls', ["St Paul's"], (51.516936000000001, -0.099088999999999997)), '202ec7c8-ff91-49eb-b1b7-ec6f6960e4a6': ('ff91', 'gcpug6fvvvdp', 'SW6', 'SandsEnd', ['Sands End'], (51.476084999999998, -0.20471400000000001)), '21f228c9-53ae-4456-98c6-5d7f61b8a756': ('53ae', 'gcpv7t2z70tq', 'NW11', 'HampsteadGardenSuburb', ['Hampstead Garden Suburb'], (51.577939000000001, -0.19658800000000001)), 'fa6c4eaa-965b-400f-b69c-75461c88e37f': ('965b', 'gcpuwv5g2y8k', 'SE23', 'ForestHill', ['Forest Hill'], (51.444074999999998, -0.049749000000000002)), '0b5189f3-2a7d-4b18-85c3-6afb539817cd': ('2a7d', 'u10j884sxfer', 'E18', 'SouthWoodford', ['South Woodford'], (51.592584000000002, 0.025742999999999999)), '212e503d-ee81-4294-b88e-c80330c34a4f': ('ee81', 'gcpugu4kmehu', 'SW10', 'Chelsea', ['Chelsea'], (51.482680000000002, -0.18343499999999999)), '0814e592-837f-430c-ae1d-1f03ace83565': ('837f', 'gcpv11sqy0gp', 'W5', 'LittleEaling', ['Little Ealing'], (51.513309999999997, -0.30151899999999998)), 'd2f8c6d7-f6e8-4d48-a6c2-b6ddff4e0e99': ('f6e8', 'gcpuz7d45bzg', 'SE8', 'StJohns', ["St John's"], (51.479534999999998, -0.030041000000000002)), '83b92fd8-8943-42e8-a630-18a5d10750f3': ('8943', 'gcpve9e3w57f', 'N3', 'Finchley', ['Finchley'], (51.600312000000002, -0.19302800000000001)), 'fc6db129-b514-4019-ad15-8acdcc91d72b': ('b514', 'gcpvqnjp4k68', 'N15', 'SouthTottenham', ['South Tottenham'], (51.582034999999998, -0.080923999999999996)), 'c86f4d27-97f3-4d00-87f7-505c9514bdb0': ('97f3', 'gcpvq9xjqmtj', 'N6', 'Highgate', ['Highgate'], (51.557023000000001, -0.056030000000000003)), '128346f0-cc6d-49da-af42-41eb2f9aeb57': ('cc6d', 'gcpv48vch87m', 'W12', 'ShepherdsBush', ["Shepherd's Bush"], (51.508200000000002, -0.23360500000000001)), 'c1b0c4a2-e463-47c7-a87e-fd2f80f053b5': ('e463', 'gcpugx6z7e0j', 'W8', 'Kensington', ['Kensington'], (51.501047999999997, -0.193827)), '517df5a0-4beb-4960-b605-4924420852b8': ('4beb', 'gcpvpp61444j', 'E9', 'SouthHackney', ['South Hackney'], (51.543914999999998, -0.041110000000000001)), '6ac3107a-92b7-45b3-b928-0e8d585fb37f': ('92b7', 'gcpuqxhuk2ft', 'SE20', 'Penge', ['Penge'], (51.411256999999999, -0.059208999999999998)), '19c47730-6dee-43ea-af7d-adcbdd02eec9': ('6dee', 'gcpue38x3ktv', 'SW19', 'Southfields', ['Southfields'], (51.425525, -0.20799200000000001)), '4b9d261a-de5f-4ca7-8ed2-965490308a35': ('de5f', 'gcpv539sjgzc', 'W11', 'NottingHill', ['Notting Hill'], (51.512853, -0.206423)), '1ce75af5-caef-4cd2-83f0-536882c92706': ('caef', 'gcpuewe8s2jv', 'SW18', 'Earlsfield', ['Earlsfield'], (51.451808, -0.19275700000000001)), '9be7b8b6-30f8-4e04-abc1-e71af5566be2': ('30f8', 'u10j01qmsbp8', 'E16', 'Silvertown', ['Silvertown'], (51.511716999999997, 0.0087969999999999993)), '6c608fad-09ab-4ca1-ac71-c503796df5a8': ('09ab', 'gcpufvcjm9yk', 'W6', 'Hammersmith', ['Hammersmith'], (51.492457999999999, -0.22909499999999999)), '8afcb180-b06f-4d91-a053-0235286fa1e5': ('b06f', 'gcpvegyn7rnz', 'N12', 'NorthFinchley', ['North Finchley'], (51.613508000000003, -0.17837900000000001)), '1d3b7666-ee1d-4e40-b666-ef3bda16f8b6': ('ee1d', 'gcpuvmpr79rm', 'SE11', 'Lambeth', ['Lambeth'], (51.488678999999998, -0.110733)), 'f4875ab4-d771-46c1-ac49-69166cbdcfba': ('d771', 'gcpvhtqek3v4', 'NW1', 'SomersTown', ['Somers Town'], (51.533313, -0.14469299999999999)), '50c8042b-fec6-4b22-80eb-4e09cb00f185': ('fec6', 'gcpvk10mxy5j', 'NW3', 'SwissCottage', ['Swiss Cottage'], (51.554321999999999, -0.17510100000000001)), 'ead567a9-0edc-4cac-bdf4-c1917e7620bd': ('0edc', 'gcpvwjrtn3rv', 'N9', 'LowerEdmonton', ['Lower Edmonton'], (51.621502, -0.077312000000000006)), 'cd1a60cf-b122-4011-9496-bf2e0de91847': ('b122', 'gcpvjg9vyzt4', 'EC1', 'StLukes', ['St Lukes'], (51.524160000000002, -0.096176999999999999)), 'b79116a7-4a7f-4095-acbb-5599ce4cba67': ('4a7f', 'gcpuvvh5w2xu', 'SE17', 'Kennington', ['Kennington'], (51.488030999999999, -0.093104999999999993)), '5225659f-84df-4bb1-9fe5-df245e76df1f': ('84df', 'u10j0s4tw9bg', 'E13', 'Plaistow', ['Plaistow'], (51.526833000000003, 0.025686)), '5bd781bc-be2e-4f83-99f3-63ba3bd5ec6a': ('be2e', 'gcpvkpk9j61e', 'N2', 'HampsteadGardenSuburb', ['Hampstead Garden Suburb'], (51.587859999999999, -0.169374)), '186c888a-53e1-41aa-878e-94d3ab60625f': ('53e1', 'gcpvjfm0n5j0', 'EC3', 'Monument', ['Monument'], (51.516281999999997, -0.091745999999999994)), 'cfd7c10a-2aaa-4a53-ab76-fdef599a7568': ('2aaa', 'u10h8sugc59d', 'SE12', 'Lee', ['Lee'], (51.442771, 0.028541)), '1c58f914-c1f8-4439-8c39-cf11edc45c04': ('c1f8', 'gcpvmsj40epd', 'N4', 'StroudGreen', ['Stroud Green'], (51.570183999999998, -0.102965)), 'd014fffa-23d3-40ee-baef-b9ef5ef86f19': ('23d3', 'gcpudwnb9j9y', 'SW15', 'Roehampton', ['Roehampton'], (51.449091000000003, -0.23238400000000001)), '99d2e512-1679-4ed9-87ba-90bfb303adec': ('1679', 'u10j17ctvf9v', 'E6', 'EastHam', ['East Ham'], (51.525506999999998, 0.057241)), 'f064057e-56f1-4f30-bda0-ca35fd1b0275': ('56f1', 'gcpv035z084j', 'W7', 'Hanwell', ['Hanwell'], (51.510601999999999, -0.33540199999999998)), '57d92dfa-5afc-4b66-a69b-375048374bbc': ('5afc', 'gcpvre3p0my3', 'E10', 'Leyton', ['Leyton'], (51.566937000000003, -0.020580000000000001)), '8264e8b8-2888-40a3-9a4c-010cf12fbeb6': ('2888', 'gcpuywxvqy5n', 'SE16', 'SurreyQuays', ['Surrey Quays'], (51.496600999999998, -0.054981000000000002)), '428c88ee-09a3-457f-be28-1aa3093b1f72': ('09a3', 'gcpuvfk5wemz', 'SE5', 'Camberwell', ['Camberwell'], (51.472940000000001, -0.093096999999999999)), '67d104ca-2f95-4a8d-b3ce-1c42613e591f': ('2f95', 'gcpuvye9s9wv', 'SE1', 'Southwark', ['Southwark'], (51.495933000000001, -0.093867999999999993)), 'd39d0988-cefc-4d8f-8b72-64ed3881d4c2': ('cefc', 'gcpvrwfw78yu', 'E17', 'HighamHill', ['Higham Hill'], (51.586008, -0.018380000000000001)), 'd09d5605-f644-4155-ae45-5cf4a3303e74': ('f644', 'gcpvq68k4xkv', 'N16', 'StokeNewington', ['Stoke Newington'], (51.562311000000001, -0.076447000000000001)), '597632a0-8635-4c58-bded-10ab82f3d96f': ('8635', 'gcpvsu2fr2xx', 'N11', 'NewSouthgate', ['New Southgate'], (51.615532999999999, -0.14147100000000001)), '2bf2ef47-d531-4762-a6c1-582dd87b67dc': ('d531', 'gcpvjfgp1e36', 'EC2', 'Shoreditch', ['Shoreditch'], (51.520232, -0.094690999999999997)), '91e5f13b-d90e-4aa1-8050-4749ca54ec3d': ('d90e', 'gcpvmc0f6dqm', 'N5', 'Highbury', ['Highbury'], (51.553744000000002, -0.097730999999999998)), '5859f04d-a8a8-45ec-a368-bea08222c0d0': ('a8a8', 'gcput0fc803g', 'SW16', 'StreathamVale', ['Streatham Vale'], (51.420394999999999, -0.128057)), '0bc702d1-efc8-42bd-95d9-efd42fa7804a': ('efc8', 'gcpvdshzhj7k', 'NW7', 'MillHill', ['Mill Hill'], (51.615000000000002, -0.23499999999999999)), '4b5c4caa-33ea-4952-b972-7b7a8fb53660': ('33ea', 'gcpv5qz2vh66', 'NW6', 'SouthHampstead', ['South Hampstead'], (51.541136999999999, -0.19856599999999999)), '9aece44b-d117-492f-b33b-6208214eab2b': ('d117', 'gcpus4sq65c6', 'SW17', 'Summerstown', ['Summerstown'], (51.430841999999998, -0.16985700000000001)), '6f1f25f4-9c2d-4ea4-aedd-09e5b8e295ea': ('9c2d', 'gcpvvb3hsqec', 'N14', 'Southgate', ['Southgate'], (51.637923000000001, -0.097316)), '50e43d8d-96c1-476e-b218-54c85fab68db': ('96c1', 'gcpvj6cqvmuv', 'N1', 'Shoreditch', ['Shoreditch'], (51.520203000000002, -0.11890100000000001)), '799851e1-1570-4c9b-80d6-c9a451fa4ed7': ('1570', 'gcpv6zsbj7fe', 'NW4', 'Hendon', ['Hendon'], (51.589070999999997, -0.22396099999999999)), '4dd3a18e-8787-4723-be8b-4c4b4c0a8fd1': ('8787', 'gcpvhj0e7wbk', 'NW8', 'StJohnsWood', ["St John's Wood"], (51.531967000000002, -0.17494399999999999)), 'aa7bcc09-a080-4581-a1d0-5cf0aecae0f7': ('a080', 'gcpvndj2852y', 'E1', 'Stepney', ['Stepney'], (51.514997000000001, -0.058707000000000002)), '36ec9cff-ee6b-40e9-ae13-a69774c8d8ea': ('ee6b', 'gcpuqk88jj63', 'SE25', 'SouthNorwood', ['South Norwood'], (51.396818000000003, -0.075999999999999998)), 'be88118b-1e83-4961-b8c4-dc1f8649e932': ('1e83', 'gcpvs8tg6j2f', 'N10', 'MuswellHill', ['Muswell Hill'], (51.595129999999997, -0.14582500000000001)), 'a747f0a7-bba6-4eae-a659-8985281c5d6c': ('bba6', 'gcpvj1xc18kj', 'WC2', 'Strand', ['Strand'], (51.512320000000003, -0.12112299999999999)), '8166dc3b-15ac-4b59-a720-aaa7225a1ff0': ('15ac', 'gcpvje5vyfkq', 'W10', 'NorthKensington', ['North Kensington'], (51.521386, -0.104418)), '61645feb-3027-4428-b0c9-c42fee257c8c': ('3027', 'gcpvnrrch0g7', 'E8', 'Hackney', ['Hackney'], (51.543908000000002, -0.066085000000000005)), 'ec003925-2a7f-4351-917f-597d010d4528': ('2a7f', 'u10j30uqsn1g', 'E12', 'ManorPark', ['Manor Park'], (51.55312, 0.049956)), '55ff69b9-6d76-4ff6-9006-e0198d420bf3': ('6d76', 'gcpustk68s07', 'SW12', 'Balham', ['Balham'], (51.445306000000002, -0.14795)), '26161918-e6d0-4225-9f5c-0ee6579ebd17': ('e6d0', 'gcputwrmr4bq', 'SE24', 'HerneHill', ['Herne Hill'], (51.451264999999999, -0.099606)), '5afdd212-5851-4fc7-9b36-237c4cb94bb1': ('5851', 'gcpuwh8s43e6', 'SE21', 'Dulwich', ['Dulwich'], (51.441429999999997, -0.087103)), '4fc9354c-16d7-49e4-bf23-6ee8b6faa710': ('16d7', 'gcpuxz85b4np', 'SE13', 'Lewisham', ['Lewisham'], (51.45787, -0.010978)), 'a57f18e2-65e7-4472-aa70-cdc6ffb083e9': ('65e7', 'gcpu6y8eff8j', 'SW20', 'SouthWimbledon', ['South Wimbledon'], (51.408434, -0.229908)), '1ad1b8f1-c615-424a-90f7-4f92e885102b': ('c615', 'gcpuzxepvydq', 'E14', 'Poplar', ['Poplar'], (51.502526000000003, -0.017603000000000001)), '225dec1e-4b47-4f4b-8d3c-1b34e8cd355f': ('4b47', 'u10j0xuk6051', 'E7', 'ForestGate', ['Forest Gate'], (51.547207999999998, 0.027899)), 'f7a54813-2396-403d-b1e3-437937f094aa': ('2396', 'gcpv5cuzym7p', 'W2', 'Paddington', ['Paddington'], (51.514879000000001, -0.17997199999999999)), 'd8b3bf21-a2aa-4de2-92ba-542b1827882e': ('a2aa', 'gcpugtkw2hwj', 'SW5', 'EarlsCourt', ["Earl's Court"], (51.489897999999997, -0.19156599999999999)), 'b03a5366-3c31-4ec5-8c51-64195bf64f24': ('3c31', 'gcpv4pnxt9ch', 'NW10', 'Stonebridge', ['Stonebridge'], (51.543655999999999, -0.25450800000000001)), '5ae64e5d-fddb-4eb1-8025-ed1eb9b91be9': ('fddb', 'gcpvwknwtxb8', 'N18', 'Edmonton', ['Edmonton'], (51.614927000000002, -0.067740999999999996)), '0397f4fd-bfb5-4d8a-bd2e-0fbbb92e7c63': ('bfb5', 'gcpuu0ym1p5p', 'SW11', 'ClaphamJunction', ['Clapham Junction'], (51.464978000000002, -0.16715099999999999)), 'b60b7507-6cf3-4543-a38a-1ab5d5eadb68': ('6cf3', 'gcpvt3ucuyvd', 'N22', 'NoelPark', ['Noel Park'], (51.601747000000003, -0.11411499999999999)), 'f771fc64-ebc5-4c65-9982-d1bf0bf96daa': ('ebc5', 'gcpuxetvshmd', 'SE6', 'HitherGreen', ['Hither Green'], (51.436208999999998, -0.013897)), '5d1d956f-1209-4f4c-9bdc-335453e2a5cf': ('1209', 'gcpuun82bjd1', 'SW7', 'SouthKensington', ['South Kensington'], (51.495825000000004, -0.17543500000000001)), 'e2c32ded-1b66-4a40-97ae-2c6da262d753': ('1b66', 'gcpvnsshv31u', 'E2', 'Shoreditch', ['Shoreditch'], (51.529446999999998, -0.060197000000000001)), 'b94cb0a1-6dc6-4707-b57d-e36cbf912898': ('6dc6', 'gcpv6nfh9ne3', 'NW9', 'Kingsbury', ['Kingsbury'], (51.585737999999999, -0.260878)), 'ad2b3b27-53ff-4cc2-99b6-d5051d9f1d8f': ('53ff', 'gcpvk9pjf7mu', 'NW5', 'KentishTown', ['Kentish Town'], (51.554349999999999, -0.144091)), '418c1037-5ef2-42f2-9de3-8e02202b0859': ('5ef2', 'gcpvkfzee7gc', 'N19', 'DartmouthPark', ['Dartmouth Park'], (51.563578999999997, -0.132378)), '2260e8b8-7b09-4b58-a103-8f5d5bf5e924': ('7b09', 'gcpv6fj5cg01', 'NW2', 'Neasden', ['Neasden'], (51.559497999999998, -0.223771)), '55e97cec-6288-4bfb-86b0-1c942acbfd53': ('6288', 'gcpucvpmyk8q', 'W4', 'Chiswick', ['Chiswick'], (51.488439, -0.26443299999999997))}
{'983ab651-eb86-4471-8361-c97a5015637e': ('eb86', 'gcpuujtn5ydu', 'SW3', 'Chelsea', ['Chelsea'], (51.491239, -0.16875)), '83f496df-fcc8-4dcf-8161-a60a75364cf2': ('fcc8', 'gcpuwf1xsv7d', 'SE26', 'Sydenham', ['Sydenham'], (51.428318, -0.052663)), '31f90575-7945-4999-b3a7-5045bb860302': ('7945', 'gcpuwqsv468q', 'SE22', 'EastDulwich', ['East Dulwich'], (51.452594, -0.070284)), 'bfbf3ae9-2de6-4121-ad2d-f0af56aead36': ('2de6', 'gcpuuxpu34wm', 'SW1', 'StJamess', ["St James's"], (51.499157, -0.143114)), '84ef8a77-21b6-4ee7-aa1e-b6c3f46ec594': ('21b6', 'gcpv5skk61e3', 'W9', 'MaidaVale', ['Maida Vale'], (51.52799, -0.191827)), '5e835e97-dc8c-4dd6-bccd-a10fd9a32cdf': ('dc8c', 'gcpucby83fj5', 'SW14', 'Mortlake', ['Mortlake'], (51.464135, -0.26565)), 'ecba74ab-9924-4a75-9d35-3425360b24d3': ('9924', 'gcpvpyrfxbn9', 'E15', 'Stratford', ['Stratford'], (51.538668, -2e-06)), '2463521e-627b-4c8a-86a1-103dad37603c': ('627b', 'gcpuf7h3m8bj', 'SW13', 'Castelnau', ['Castelnau'], (51.47666, -0.246613)), 'f4bb9dff-1053-417a-a2b5-e1e74f1dca87': ('1053', 'gcpvpkx3jc6n', 'E3', 'OldFord', ['Old Ford'], (51.528805, -0.022753)), '51983070-a4a1-4d31-97cd-62ce2a116df1': ('a4a1', 'gcpuub2qphrv', 'SW4', 'ClaphamPark', ['Clapham Park'], (51.462388, -0.142168)), 'e43e519e-a914-4d5a-80fc-5d12deef77d2': ('a914', 'u10hb99hf4mm', 'SE3', 'Kidbrooke', ['Kidbrooke'], (51.469029, 0.023439)), '55425e98-f4ca-44e5-be77-fbda71da5f55': ('f4ca', 'gcputq019puc', 'SW2', 'StreathamHill', ['Streatham Hill'], (51.449274, -0.1208)), 'd96fe7f2-efdb-4b54-9fb8-0820543c92f9': ('efdb', 'gcpvqf9kqcng', 'E5', 'LowerClapton', ['Lower Clapton'], (51.56232, -0.052916)), '60416efe-ad71-48de-8fcd-fb9d3b4b2836': ('ad71', 'gcpvmq7qde7j', 'N8', 'Hornsey', ['Hornsey'], (51.583318, -0.116275)), 'd4783dc6-f280-4e70-8e0d-a67608cc5bda': ('f280', 'gcpvxzewnu5j', 'E4', 'SouthChingford', ['South Chingford'], (51.634048, -0.005886)), '94fee5ec-dbd5-464c-9033-2e83c120e29f': ('dbd5', 'gcpuz4fnu72k', 'SE14', 'NewCrossGate', ['New Cross Gate'], (51.476244, -0.041016)), 'ff3571f8-890c-44c7-9cea-a6060fb290de': ('890c', 'u10h9m8d8xf3', 'SE9', 'NewEltham', ['New Eltham'], (51.446699, 0.055643)), '04df0845-7c22-4d09-93d5-5989d26a54fd': ('7c22', 'gcpvm30np125', 'N7', 'LowerHolloway', ['Lower Holloway'], (51.554382, -0.120549)), '525a86a4-991f-47ed-b021-641420d4c0b3': ('991f', 'u10hceucd7v2', 'SE18', 'ShootersHill', ["Shooter's Hill"], (51.480838, 0.072545)), '40cfb279-cb70-4c66-9e50-c9533b22ff1a': ('cb70', 'u10hbu3sg932', 'SE7', 'NewCharlton', ['New Charlton'], (51.484129, 0.035171)), '6243716d-0acd-4367-8d44-ccf16a0380e8': ('0acd', 'u10hbh808hv5', 'SE10', 'Greenwich', ['Greenwich'], (51.484792, 7e-06)), '171c72b8-2ddf-411d-869a-614aff049e75': ('2ddf', 'gcpvj5wjvs5n', 'WC1', 'StPancras', ['St Pancras'], (51.524142, -0.123356)), '34f8fa53-5797-457d-9683-82873b564bb9': ('5797', 'u10hftqqzu2f', 'SE2', 'AbbeyWood', ['Abbey Wood'], (51.489982, 0.11878)), '0b1d9677-0d94-43d7-bf35-81fdbaaeb39b': ('0d94', 'gcpuy9ch3swp', 'SE15', 'Peckham', ['Peckham'], (51.470329, -0.064472)), '800a7f3a-5277-4aac-9890-6189235ebfbd': ('5277', 'gcpv1cqz2wb5', 'W3', 'SouthActon', ['South Acton'], (51.512054, -0.265367)), '450d69a1-7298-45e4-9278-fb0b87ecb396': ('7298', 'gcpvh9fbt2jv', 'W1', 'Soho', ['Soho'], (51.513606, -0.149799)), '72d89cc1-4467-4790-96f2-f1f2b99d99b5': ('4467', 'gcpuug5d4wcn', 'SW9', 'Stockwell', ['Stockwell'], (51.476821, -0.137907)), '88f209f1-a4d5-4d7c-b444-0c521e89d420': ('a4d5', 'u10j2kh63fey', 'E11', 'Leytonstone', ['Leytonstone'], (51.570225, 0.016903)), 'd0dd9e9e-5c2b-48c4-9621-03cbe5620a81': ('5c2b', 'gcpuw0246ymx', 'SE19', 'NorwoodNewTown', ['Norwood New Town'], (51.41781, -0.087765)), '9c0eb702-fa19-48fe-a122-54c729bdf8ef': ('fa19', 'gcpuugpfm07m', 'SW8', 'SouthLambeth', ['South Lambeth'], (51.476829, -0.13196)), 'f2aa6787-5a3c-4b00-9973-1339eb3e02bf': ('5a3c', 'gcpvtsuvsst1', 'N13', 'PalmersGreen', ['Palmers Green'], (51.618858, -0.10314)), 'ba2f866f-d4ec-4f8e-a146-c24c51d48601': ('d4ec', 'gcpuz0j754c3', 'SE4', 'HonorOakPark', ['Honor Oak Park'], (51.460491, -0.036605)), '730a4947-903f-4f87-95a6-3f43972cc52b': ('903f', 'gcpvjdrgghcv', 'EC4', 'StPauls', ["St Paul's"], (51.516936, -0.099089)), '202ec7c8-ff91-49eb-b1b7-ec6f6960e4a6': ('ff91', 'gcpug6fvvvdp', 'SW6', 'SandsEnd', ['Sands End'], (51.476085, -0.204714)), '21f228c9-53ae-4456-98c6-5d7f61b8a756': ('53ae', 'gcpv7t2z70tq', 'NW11', 'HampsteadGardenSuburb', ['Hampstead Garden Suburb'], (51.577939, -0.196588)), 'fa6c4eaa-965b-400f-b69c-75461c88e37f': ('965b', 'gcpuwv5g2y8k', 'SE23', 'ForestHill', ['Forest Hill'], (51.444075, -0.049749)), '0b5189f3-2a7d-4b18-85c3-6afb539817cd': ('2a7d', 'u10j884sxfer', 'E18', 'SouthWoodford', ['South Woodford'], (51.592584, 0.025743)), '212e503d-ee81-4294-b88e-c80330c34a4f': ('ee81', 'gcpugu4kmehu', 'SW10', 'Chelsea', ['Chelsea'], (51.48268, -0.183435)), '0814e592-837f-430c-ae1d-1f03ace83565': ('837f', 'gcpv11sqy0gp', 'W5', 'LittleEaling', ['Little Ealing'], (51.51331, -0.301519)), 'd2f8c6d7-f6e8-4d48-a6c2-b6ddff4e0e99': ('f6e8', 'gcpuz7d45bzg', 'SE8', 'StJohns', ["St John's"], (51.479535, -0.030041)), '83b92fd8-8943-42e8-a630-18a5d10750f3': ('8943', 'gcpve9e3w57f', 'N3', 'Finchley', ['Finchley'], (51.600312, -0.193028)), 'fc6db129-b514-4019-ad15-8acdcc91d72b': ('b514', 'gcpvqnjp4k68', 'N15', 'SouthTottenham', ['South Tottenham'], (51.582035, -0.080924)), 'c86f4d27-97f3-4d00-87f7-505c9514bdb0': ('97f3', 'gcpvq9xjqmtj', 'N6', 'Highgate', ['Highgate'], (51.557023, -0.05603)), '128346f0-cc6d-49da-af42-41eb2f9aeb57': ('cc6d', 'gcpv48vch87m', 'W12', 'ShepherdsBush', ["Shepherd's Bush"], (51.5082, -0.233605)), 'c1b0c4a2-e463-47c7-a87e-fd2f80f053b5': ('e463', 'gcpugx6z7e0j', 'W8', 'Kensington', ['Kensington'], (51.501048, -0.193827)), '517df5a0-4beb-4960-b605-4924420852b8': ('4beb', 'gcpvpp61444j', 'E9', 'SouthHackney', ['South Hackney'], (51.543915, -0.04111)), '6ac3107a-92b7-45b3-b928-0e8d585fb37f': ('92b7', 'gcpuqxhuk2ft', 'SE20', 'Penge', ['Penge'], (51.411257, -0.059209)), '19c47730-6dee-43ea-af7d-adcbdd02eec9': ('6dee', 'gcpue38x3ktv', 'SW19', 'Southfields', ['Southfields'], (51.425525, -0.207992)), '4b9d261a-de5f-4ca7-8ed2-965490308a35': ('de5f', 'gcpv539sjgzc', 'W11', 'NottingHill', ['Notting Hill'], (51.512853, -0.206423)), '1ce75af5-caef-4cd2-83f0-536882c92706': ('caef', 'gcpuewe8s2jv', 'SW18', 'Earlsfield', ['Earlsfield'], (51.451808, -0.192757)), '9be7b8b6-30f8-4e04-abc1-e71af5566be2': ('30f8', 'u10j01qmsbp8', 'E16', 'Silvertown', ['Silvertown'], (51.511717, 0.008797)), '6c608fad-09ab-4ca1-ac71-c503796df5a8': ('09ab', 'gcpufvcjm9yk', 'W6', 'Hammersmith', ['Hammersmith'], (51.492458, -0.229095)), '8afcb180-b06f-4d91-a053-0235286fa1e5': ('b06f', 'gcpvegyn7rnz', 'N12', 'NorthFinchley', ['North Finchley'], (51.613508, -0.178379)), '1d3b7666-ee1d-4e40-b666-ef3bda16f8b6': ('ee1d', 'gcpuvmpr79rm', 'SE11', 'Lambeth', ['Lambeth'], (51.488679, -0.110733)), 'f4875ab4-d771-46c1-ac49-69166cbdcfba': ('d771', 'gcpvhtqek3v4', 'NW1', 'SomersTown', ['Somers Town'], (51.533313, -0.144693)), '50c8042b-fec6-4b22-80eb-4e09cb00f185': ('fec6', 'gcpvk10mxy5j', 'NW3', 'SwissCottage', ['Swiss Cottage'], (51.554322, -0.175101)), 'ead567a9-0edc-4cac-bdf4-c1917e7620bd': ('0edc', 'gcpvwjrtn3rv', 'N9', 'LowerEdmonton', ['Lower Edmonton'], (51.621502, -0.077312)), 'cd1a60cf-b122-4011-9496-bf2e0de91847': ('b122', 'gcpvjg9vyzt4', 'EC1', 'StLukes', ['St Lukes'], (51.52416, -0.096177)), 'b79116a7-4a7f-4095-acbb-5599ce4cba67': ('4a7f', 'gcpuvvh5w2xu', 'SE17', 'Kennington', ['Kennington'], (51.488031, -0.093105)), '5225659f-84df-4bb1-9fe5-df245e76df1f': ('84df', 'u10j0s4tw9bg', 'E13', 'Plaistow', ['Plaistow'], (51.526833, 0.025686)), '5bd781bc-be2e-4f83-99f3-63ba3bd5ec6a': ('be2e', 'gcpvkpk9j61e', 'N2', 'HampsteadGardenSuburb', ['Hampstead Garden Suburb'], (51.58786, -0.169374)), '186c888a-53e1-41aa-878e-94d3ab60625f': ('53e1', 'gcpvjfm0n5j0', 'EC3', 'Monument', ['Monument'], (51.516282, -0.091746)), 'cfd7c10a-2aaa-4a53-ab76-fdef599a7568': ('2aaa', 'u10h8sugc59d', 'SE12', 'Lee', ['Lee'], (51.442771, 0.028541)), '1c58f914-c1f8-4439-8c39-cf11edc45c04': ('c1f8', 'gcpvmsj40epd', 'N4', 'StroudGreen', ['Stroud Green'], (51.570184, -0.102965)), 'd014fffa-23d3-40ee-baef-b9ef5ef86f19': ('23d3', 'gcpudwnb9j9y', 'SW15', 'Roehampton', ['Roehampton'], (51.449091, -0.232384)), '99d2e512-1679-4ed9-87ba-90bfb303adec': ('1679', 'u10j17ctvf9v', 'E6', 'EastHam', ['East Ham'], (51.525507, 0.057241)), 'f064057e-56f1-4f30-bda0-ca35fd1b0275': ('56f1', 'gcpv035z084j', 'W7', 'Hanwell', ['Hanwell'], (51.510602, -0.335402)), '57d92dfa-5afc-4b66-a69b-375048374bbc': ('5afc', 'gcpvre3p0my3', 'E10', 'Leyton', ['Leyton'], (51.566937, -0.02058)), '8264e8b8-2888-40a3-9a4c-010cf12fbeb6': ('2888', 'gcpuywxvqy5n', 'SE16', 'SurreyQuays', ['Surrey Quays'], (51.496601, -0.054981)), '428c88ee-09a3-457f-be28-1aa3093b1f72': ('09a3', 'gcpuvfk5wemz', 'SE5', 'Camberwell', ['Camberwell'], (51.47294, -0.093097)), '67d104ca-2f95-4a8d-b3ce-1c42613e591f': ('2f95', 'gcpuvye9s9wv', 'SE1', 'Southwark', ['Southwark'], (51.495933, -0.093868)), 'd39d0988-cefc-4d8f-8b72-64ed3881d4c2': ('cefc', 'gcpvrwfw78yu', 'E17', 'HighamHill', ['Higham Hill'], (51.586008, -0.01838)), 'd09d5605-f644-4155-ae45-5cf4a3303e74': ('f644', 'gcpvq68k4xkv', 'N16', 'StokeNewington', ['Stoke Newington'], (51.562311, -0.076447)), '597632a0-8635-4c58-bded-10ab82f3d96f': ('8635', 'gcpvsu2fr2xx', 'N11', 'NewSouthgate', ['New Southgate'], (51.615533, -0.141471)), '2bf2ef47-d531-4762-a6c1-582dd87b67dc': ('d531', 'gcpvjfgp1e36', 'EC2', 'Shoreditch', ['Shoreditch'], (51.520232, -0.094691)), '91e5f13b-d90e-4aa1-8050-4749ca54ec3d': ('d90e', 'gcpvmc0f6dqm', 'N5', 'Highbury', ['Highbury'], (51.553744, -0.097731)), '5859f04d-a8a8-45ec-a368-bea08222c0d0': ('a8a8', 'gcput0fc803g', 'SW16', 'StreathamVale', ['Streatham Vale'], (51.420395, -0.128057)), '0bc702d1-efc8-42bd-95d9-efd42fa7804a': ('efc8', 'gcpvdshzhj7k', 'NW7', 'MillHill', ['Mill Hill'], (51.615, -0.235)), '4b5c4caa-33ea-4952-b972-7b7a8fb53660': ('33ea', 'gcpv5qz2vh66', 'NW6', 'SouthHampstead', ['South Hampstead'], (51.541137, -0.198566)), '9aece44b-d117-492f-b33b-6208214eab2b': ('d117', 'gcpus4sq65c6', 'SW17', 'Summerstown', ['Summerstown'], (51.430842, -0.169857)), '6f1f25f4-9c2d-4ea4-aedd-09e5b8e295ea': ('9c2d', 'gcpvvb3hsqec', 'N14', 'Southgate', ['Southgate'], (51.637923, -0.097316)), '50e43d8d-96c1-476e-b218-54c85fab68db': ('96c1', 'gcpvj6cqvmuv', 'N1', 'Shoreditch', ['Shoreditch'], (51.520203, -0.118901)), '799851e1-1570-4c9b-80d6-c9a451fa4ed7': ('1570', 'gcpv6zsbj7fe', 'NW4', 'Hendon', ['Hendon'], (51.589071, -0.223961)), '4dd3a18e-8787-4723-be8b-4c4b4c0a8fd1': ('8787', 'gcpvhj0e7wbk', 'NW8', 'StJohnsWood', ["St John's Wood"], (51.531967, -0.174944)), 'aa7bcc09-a080-4581-a1d0-5cf0aecae0f7': ('a080', 'gcpvndj2852y', 'E1', 'Stepney', ['Stepney'], (51.514997, -0.058707)), '36ec9cff-ee6b-40e9-ae13-a69774c8d8ea': ('ee6b', 'gcpuqk88jj63', 'SE25', 'SouthNorwood', ['South Norwood'], (51.396818, -0.076)), 'be88118b-1e83-4961-b8c4-dc1f8649e932': ('1e83', 'gcpvs8tg6j2f', 'N10', 'MuswellHill', ['Muswell Hill'], (51.59513, -0.145825)), 'a747f0a7-bba6-4eae-a659-8985281c5d6c': ('bba6', 'gcpvj1xc18kj', 'WC2', 'Strand', ['Strand'], (51.51232, -0.121123)), '8166dc3b-15ac-4b59-a720-aaa7225a1ff0': ('15ac', 'gcpvje5vyfkq', 'W10', 'NorthKensington', ['North Kensington'], (51.521386, -0.104418)), '61645feb-3027-4428-b0c9-c42fee257c8c': ('3027', 'gcpvnrrch0g7', 'E8', 'Hackney', ['Hackney'], (51.543908, -0.066085)), 'ec003925-2a7f-4351-917f-597d010d4528': ('2a7f', 'u10j30uqsn1g', 'E12', 'ManorPark', ['Manor Park'], (51.55312, 0.049956)), '55ff69b9-6d76-4ff6-9006-e0198d420bf3': ('6d76', 'gcpustk68s07', 'SW12', 'Balham', ['Balham'], (51.445306, -0.14795)), '26161918-e6d0-4225-9f5c-0ee6579ebd17': ('e6d0', 'gcputwrmr4bq', 'SE24', 'HerneHill', ['Herne Hill'], (51.451265, -0.099606)), '5afdd212-5851-4fc7-9b36-237c4cb94bb1': ('5851', 'gcpuwh8s43e6', 'SE21', 'Dulwich', ['Dulwich'], (51.44143, -0.087103)), '4fc9354c-16d7-49e4-bf23-6ee8b6faa710': ('16d7', 'gcpuxz85b4np', 'SE13', 'Lewisham', ['Lewisham'], (51.45787, -0.010978)), 'a57f18e2-65e7-4472-aa70-cdc6ffb083e9': ('65e7', 'gcpu6y8eff8j', 'SW20', 'SouthWimbledon', ['South Wimbledon'], (51.408434, -0.229908)), '1ad1b8f1-c615-424a-90f7-4f92e885102b': ('c615', 'gcpuzxepvydq', 'E14', 'Poplar', ['Poplar'], (51.502526, -0.017603)), '225dec1e-4b47-4f4b-8d3c-1b34e8cd355f': ('4b47', 'u10j0xuk6051', 'E7', 'ForestGate', ['Forest Gate'], (51.547208, 0.027899)), 'f7a54813-2396-403d-b1e3-437937f094aa': ('2396', 'gcpv5cuzym7p', 'W2', 'Paddington', ['Paddington'], (51.514879, -0.179972)), 'd8b3bf21-a2aa-4de2-92ba-542b1827882e': ('a2aa', 'gcpugtkw2hwj', 'SW5', 'EarlsCourt', ["Earl's Court"], (51.489898, -0.191566)), 'b03a5366-3c31-4ec5-8c51-64195bf64f24': ('3c31', 'gcpv4pnxt9ch', 'NW10', 'Stonebridge', ['Stonebridge'], (51.543656, -0.254508)), '5ae64e5d-fddb-4eb1-8025-ed1eb9b91be9': ('fddb', 'gcpvwknwtxb8', 'N18', 'Edmonton', ['Edmonton'], (51.614927, -0.067741)), '0397f4fd-bfb5-4d8a-bd2e-0fbbb92e7c63': ('bfb5', 'gcpuu0ym1p5p', 'SW11', 'ClaphamJunction', ['Clapham Junction'], (51.464978, -0.167151)), 'b60b7507-6cf3-4543-a38a-1ab5d5eadb68': ('6cf3', 'gcpvt3ucuyvd', 'N22', 'NoelPark', ['Noel Park'], (51.601747, -0.114115)), 'f771fc64-ebc5-4c65-9982-d1bf0bf96daa': ('ebc5', 'gcpuxetvshmd', 'SE6', 'HitherGreen', ['Hither Green'], (51.436209, -0.013897)), '5d1d956f-1209-4f4c-9bdc-335453e2a5cf': ('1209', 'gcpuun82bjd1', 'SW7', 'SouthKensington', ['South Kensington'], (51.495825, -0.175435)), 'e2c32ded-1b66-4a40-97ae-2c6da262d753': ('1b66', 'gcpvnsshv31u', 'E2', 'Shoreditch', ['Shoreditch'], (51.529447, -0.060197)), 'b94cb0a1-6dc6-4707-b57d-e36cbf912898': ('6dc6', 'gcpv6nfh9ne3', 'NW9', 'Kingsbury', ['Kingsbury'], (51.585738, -0.260878)), 'ad2b3b27-53ff-4cc2-99b6-d5051d9f1d8f': ('53ff', 'gcpvk9pjf7mu', 'NW5', 'KentishTown', ['Kentish Town'], (51.55435, -0.144091)), '418c1037-5ef2-42f2-9de3-8e02202b0859': ('5ef2', 'gcpvkfzee7gc', 'N19', 'DartmouthPark', ['Dartmouth Park'], (51.563579, -0.132378)), '2260e8b8-7b09-4b58-a103-8f5d5bf5e924': ('7b09', 'gcpv6fj5cg01', 'NW2', 'Neasden', ['Neasden'], (51.559498, -0.223771)), '55e97cec-6288-4bfb-86b0-1c942acbfd53': ('6288', 'gcpucvpmyk8q', 'W4', 'Chiswick', ['Chiswick'], (51.488439, -0.264433))}
"""Hackerrank Problems""" def staircase(n): """Print right justified staircase usings spaces and hashes""" for row in range(n): n_hashes = row + 1 n_spaces = n - n_hashes print(" " * n_spaces, end="") print("#" * n_hashes)
"""Hackerrank Problems""" def staircase(n): """Print right justified staircase usings spaces and hashes""" for row in range(n): n_hashes = row + 1 n_spaces = n - n_hashes print(' ' * n_spaces, end='') print('#' * n_hashes)
"""Specialized mobject base classes. Modules ======= .. autosummary:: :toctree: ../reference ~image_mobject ~point_cloud_mobject ~vectorized_mobject """
"""Specialized mobject base classes. Modules ======= .. autosummary:: :toctree: ../reference ~image_mobject ~point_cloud_mobject ~vectorized_mobject """
def mayor(a,b): if(a>b): print("a es mayor que b") mayor(4,3) mayor(0,-1) mayor(9,9)
def mayor(a, b): if a > b: print('a es mayor que b') mayor(4, 3) mayor(0, -1) mayor(9, 9)
class TextureType: PLAYER = 0 HOUSE_INTERIOR = 1 GROCERY_STORE_INTERIOR = 2 VEHICLE = 3 SINK = 4 SHOPPING_CART = 5 DOG = 6 FOOD = 7 SOAP = 8 HAND_SANITIZER = 9 TOILET_PAPER = 10 MASK = 11 PET_SUPPLIES = 12 AISLE = 13 DOOR = 14 HOUSE_EXTERIOR = 15 STORE_EXTERIOR = 16 SELF_CHECKOUT = 17 CLOSET = 18 CIVILIAN = 19 FUEL_DISPENSER = 20 ROAD = 21 SIDEWALK = 22 DRIVEWAY = 23 PARKING_LOT = 24 KITCHEN = 25 COUNTER = 26 BED = 27 DESK = 28 COMPUTER = 29 STOCKER = 30 GAS_STATION_INTERIOR = 31 GAS_STATION_EXTERIOR = 32 GROCERY_STORE_EXTERIOR = 33 SPLASH_SCREEN = 34 HOUSE_EXTERIOR_REAR = 35 GRASS = 36 MINI_MAP = 37 MAIN_MENU = 38 LOSE_SCREEN = 39 class LocationType: HOUSE = 0 GROCERY_STORE = 1 GAS_STATION = 2 HOUSE_REAR = 3 class ItemType: VEHICLE = 0 SINK = 1 SHOPPING_CART = 2 SUPPLY = 3 DOOR = 4 SELF_CHECKOUT = 5 CLOSET = 6 FUEL_DISPENSER = 7 KITCHEN = 8 BED = 9 COMPUTER = 10 class SupplyType: FOOD = 0 SOAP = 1 HAND_SANITIZER = 2 TOILET_PAPER = 3 PET_SUPPLIES = 4 MASK = 5 supply_strs = [ "food", "soap", "hand sanitizer", "toilet paper", "mask", "pet supplies" ] class CharacterType: PET = 0 SHOPPER = 1 STOCKER = 2 class PetType: DOG = 0 CAT = 1 class AisleType: GROCERIES = 0 TOILETRIES = 1 PET_SUPPLIES = 2 class InventoryType: BACKPACK = 0 SHOPPING_CART = 1 CLOSET = 2 class MapElementType: AISLE = 0 ROAD = 1 SIDEWALK = 2 DRIVEWAY = 3 PARKING_LOT = 4 COUNTER = 5 DESK = 6 class RoadType: SMALL = 0 MEDIUM = 1 LARGE = 2
class Texturetype: player = 0 house_interior = 1 grocery_store_interior = 2 vehicle = 3 sink = 4 shopping_cart = 5 dog = 6 food = 7 soap = 8 hand_sanitizer = 9 toilet_paper = 10 mask = 11 pet_supplies = 12 aisle = 13 door = 14 house_exterior = 15 store_exterior = 16 self_checkout = 17 closet = 18 civilian = 19 fuel_dispenser = 20 road = 21 sidewalk = 22 driveway = 23 parking_lot = 24 kitchen = 25 counter = 26 bed = 27 desk = 28 computer = 29 stocker = 30 gas_station_interior = 31 gas_station_exterior = 32 grocery_store_exterior = 33 splash_screen = 34 house_exterior_rear = 35 grass = 36 mini_map = 37 main_menu = 38 lose_screen = 39 class Locationtype: house = 0 grocery_store = 1 gas_station = 2 house_rear = 3 class Itemtype: vehicle = 0 sink = 1 shopping_cart = 2 supply = 3 door = 4 self_checkout = 5 closet = 6 fuel_dispenser = 7 kitchen = 8 bed = 9 computer = 10 class Supplytype: food = 0 soap = 1 hand_sanitizer = 2 toilet_paper = 3 pet_supplies = 4 mask = 5 supply_strs = ['food', 'soap', 'hand sanitizer', 'toilet paper', 'mask', 'pet supplies'] class Charactertype: pet = 0 shopper = 1 stocker = 2 class Pettype: dog = 0 cat = 1 class Aisletype: groceries = 0 toiletries = 1 pet_supplies = 2 class Inventorytype: backpack = 0 shopping_cart = 1 closet = 2 class Mapelementtype: aisle = 0 road = 1 sidewalk = 2 driveway = 3 parking_lot = 4 counter = 5 desk = 6 class Roadtype: small = 0 medium = 1 large = 2