content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
inputFile = "day13/day13_1_input.txt" # https://adventofcode.com/2021/day/13 def deleteAndAddKeys(paperDict, keysToPop, keysToAdd): for key in keysToPop: del paperDict[key] for key in keysToAdd: if key not in paperDict: paperDict[key] = True def foldYUp(paperDict, y): keysT...
input_file = 'day13/day13_1_input.txt' def delete_and_add_keys(paperDict, keysToPop, keysToAdd): for key in keysToPop: del paperDict[key] for key in keysToAdd: if key not in paperDict: paperDict[key] = True def fold_y_up(paperDict, y): keys_to_pop = [] keys_to_add = [] ...
SPECIMEN_MAPPING = { "output_name": "specimen", "select": [ "specimen_id", "external_sample_id", "colony_id", "strain_accession_id", "genetic_background", "strain_name", "zygosity", "production_center", "phenotyping_center", "projec...
specimen_mapping = {'output_name': 'specimen', 'select': ['specimen_id', 'external_sample_id', 'colony_id', 'strain_accession_id', 'genetic_background', 'strain_name', 'zygosity', 'production_center', 'phenotyping_center', 'project', 'litter_id', 'biological_sample_group', 'sex', 'pipeline_stable_id', 'developmental_st...
class Node: def __init__(self, data=None): self.__data = data self.__next = None @property def data(self): return self.__data @data.setter def data(self, data): self.__data = data @property def next(self): return self.__next @next.setter de...
class Node: def __init__(self, data=None): self.__data = data self.__next = None @property def data(self): return self.__data @data.setter def data(self, data): self.__data = data @property def next(self): return self.__next @next.setter d...
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
class Communicationmetadata(object): command = 'command' task_name = 'task_name' fl_ctx = 'fl_ctx' event_type = 'event_type' handle_conn = 'handle_conn' exe_conn = 'exe_conn' components = 'MPExecutor_components' handlers = 'MPExecutor_handlers' local_executor = 'local_executor' r...
def Part1(): File = open("Input.txt").read().split("\n") Order = [3,1] CurrentLocation = [0,0] Trees = 0 while (CurrentLocation[1] < len(File)-1): CurrentLocation[1] += Order[1] CurrentLocation[0] += Order[0] if File[CurrentLocation[1]][CurrentLocation[0] % 31] == "#": ...
def part1(): file = open('Input.txt').read().split('\n') order = [3, 1] current_location = [0, 0] trees = 0 while CurrentLocation[1] < len(File) - 1: CurrentLocation[1] += Order[1] CurrentLocation[0] += Order[0] if File[CurrentLocation[1]][CurrentLocation[0] % 31] == '#': ...
lista=[[],[]] for i in range(0,7): numero=int(input('Digite um valor: ')) if numero%2==0: lista[0].append(numero) else: lista[1].append(numero) lista[0].sort() lista[1].sort() print(f'Os valores pares foram {lista[0]} e os impares foram {lista[1]}')
lista = [[], []] for i in range(0, 7): numero = int(input('Digite um valor: ')) if numero % 2 == 0: lista[0].append(numero) else: lista[1].append(numero) lista[0].sort() lista[1].sort() print(f'Os valores pares foram {lista[0]} e os impares foram {lista[1]}')
class Build: def __init__(self, **CONFIG): self.CONFIG = CONFIG try: self.builtup = CONFIG['STRING'] except KeyError: raise KeyError('Could not find configuration "STRING"') def __call__(self): return self.builtup def reset(self): self.builtup = self.CONFIG['STRING'...
class Build: def __init__(self, **CONFIG): self.CONFIG = CONFIG try: self.builtup = CONFIG['STRING'] except KeyError: raise key_error('Could not find configuration "STRING"') def __call__(self): return self.builtup def reset(self): self.buil...
class Check(object): '''Base class for defining linting checks.''' ID = None def run(self, name, meta, source): return True
class Check(object): """Base class for defining linting checks.""" id = None def run(self, name, meta, source): return True
# pylint: skip-file # flake8: noqa # noqa: E302,E301 # pylint: disable=too-many-instance-attributes class RouteConfig(object): ''' Handle route options ''' # pylint: disable=too-many-arguments def __init__(self, sname, namespace, kubeconfig, ...
class Routeconfig(object): """ Handle route options """ def __init__(self, sname, namespace, kubeconfig, destcacert=None, cacert=None, cert=None, key=None, host=None, tls_termination=None, service_name=None, wildcard_policy=None, weight=None): """ constructor for handling route options """ self...
class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: # Solution 1: # Time Complexity: O(n) # Space Complexity: O(n) # nums_sorted = sorted(nums) # res = [] # for num in nums: # res.append(nums_sorted.index(num)) # retu...
class Solution: def smaller_numbers_than_current(self, nums: List[int]) -> List[int]: res = [] for i in nums: summ = 0 for j in nums: if i > j: summ += 1 res.append(summ) return res
# jupyter_notebook_config.py in $JUPYTER_CONFIG_DIR c = get_config() # c.NotebookApp.allow_root = True c.NotebookApp.ip = '*' c.NotebookApp.port = 8888 # NOTE don't forget to open c.NotebookApp.open_browser = False c.NotebookApp.allow_remote_access = True c.NotebookApp.password_required = False c.NotebookApp.password...
c = get_config() c.NotebookApp.ip = '*' c.NotebookApp.port = 8888 c.NotebookApp.open_browser = False c.NotebookApp.allow_remote_access = True c.NotebookApp.password_required = False c.NotebookApp.password = '' c.NotebookApp.token = ''
def to_separate_args(content: str, sep='|'): return list(map(lambda s: s.strip(), content.split(sep))) def prepare_bot_module(name: str): if not name.startswith('cogs.'): name = 'cogs.' + name return name
def to_separate_args(content: str, sep='|'): return list(map(lambda s: s.strip(), content.split(sep))) def prepare_bot_module(name: str): if not name.startswith('cogs.'): name = 'cogs.' + name return name
# Copyright (c) 2020 safexl # A config file to capture Excel constants for later use # these are also available from `win32com.client.constants` # though not in a format that plays nicely with autocomplete in IDEs # Can be accessed like - `safexl.xl_constants.xlToLeft` # Constants xlAll = -4104 xlAutomatic =...
xl_all = -4104 xl_automatic = -4105 xl_both = 1 xl_center = -4108 xl_checker = 9 xl_circle = 8 xl_corner = 2 xl_criss_cross = 16 xl_cross = 4 xl_diamond = 2 xl_distributed = -4117 xl_double_accounting = 5 xl_fixed_value = 1 xl_formats = -4122 xl_gray16 = 17 xl_gray8 = 18 xl_grid = 15 xl_high = -4127 xl_inside = 2 xl_ju...
''' Your function should take in a signle parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' def count_th(word): print(word) if len(word) < 2: re...
""" Your function should take in a signle parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. """ def count_th(word): print(word) if len(word) < 2: retu...
def triangle(rows): spaces = rows for i in range(0, rows*2, 2): for j in range(0, spaces): print(end = " ") spaces -= 1 for j in range(0, i + 1): print("$", end = "") print() triangle(5)
def triangle(rows): spaces = rows for i in range(0, rows * 2, 2): for j in range(0, spaces): print(end=' ') spaces -= 1 for j in range(0, i + 1): print('$', end='') print() triangle(5)
# list examples a=['spam','eggs',100,1234] print(a[:2]+['bacon',2*2]) print(3*a[:3]+['Boo!']) print(a[:]) a[2]=a[2]+23 print(a) a[0:2]=[1,12] print(a) a[0:2]=[] print(a) a[1:1]=['bletch','xyzzy'] print(a) a[:0]=a print(a) a[:]=[] print(a) a.extend('ab') print(a) a.extend([1,2,33]) print(a)
a = ['spam', 'eggs', 100, 1234] print(a[:2] + ['bacon', 2 * 2]) print(3 * a[:3] + ['Boo!']) print(a[:]) a[2] = a[2] + 23 print(a) a[0:2] = [1, 12] print(a) a[0:2] = [] print(a) a[1:1] = ['bletch', 'xyzzy'] print(a) a[:0] = a print(a) a[:] = [] print(a) a.extend('ab') print(a) a.extend([1, 2, 33]) print(a)
class Message_Template: def __init__( self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None, parse_mode=None, disable_notification=None, timeout=None ): self.chat_id = chat_id self.text = text self.disable_web_page_preview = disable_web_page_pre...
class Message_Template: def __init__(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None, parse_mode=None, disable_notification=None, timeout=None): self.chat_id = chat_id self.text = text self.disable_web_page_preview = disable_web_page_preview ...
''' Design Amazon / Flipkart (an online shopping platform) Beyond the basic functionality (signup, login etc.), interviewers will be looking for the following: Discoverability: How will the buyer discover a product? How will the search surface results? Cart & Checkout: Users expect the cart and checkou...
""" Design Amazon / Flipkart (an online shopping platform) Beyond the basic functionality (signup, login etc.), interviewers will be looking for the following: Discoverability: How will the buyer discover a product? How will the search surface results? Cart & Checkout: Users expect the cart and checkou...
def list_open_ports(): pass
def list_open_ports(): pass
def swap_case(s): str1 = "" for i in range(len(s)): if s[i].isupper(): str1 = str1+s[i].lower() elif s[i].islower(): str1 = str1+s[i].upper() else: str1 = str1+s[i] return str1 if __name__ == '__main__': s = input() result = ...
def swap_case(s): str1 = '' for i in range(len(s)): if s[i].isupper(): str1 = str1 + s[i].lower() elif s[i].islower(): str1 = str1 + s[i].upper() else: str1 = str1 + s[i] return str1 if __name__ == '__main__': s = input() result = swap_case...
# SPDX-FileCopyrightText: 2020 2019-2020 SAP SE # # SPDX-License-Identifier: Apache-2.0 API_FIELD_CLIENT_ID = 'clientId' API_FIELD_CLIENT_LIMIT = 'limit' API_FIELD_CLIENT_NAME = 'clientName' API_FIELD_DOCUMENT_TYPE = 'documentType' API_FIELD_ENRICHMENT = 'enrichment' API_FIELD_EXTRACTED_HEADER_FIELDS = 'headerFields' ...
api_field_client_id = 'clientId' api_field_client_limit = 'limit' api_field_client_name = 'clientName' api_field_document_type = 'documentType' api_field_enrichment = 'enrichment' api_field_extracted_header_fields = 'headerFields' api_field_extracted_line_item_fields = 'lineItemFields' api_field_extracted_values = 'ext...
def selection_sort(arr): comparisons = 1 for i in range(len(arr)): comparisons += 1 min_idx = i comparisons += 1 for j in range(i + 1, len(arr)): comparisons += 2 if arr[min_idx] > arr[j]: min_idx = j arr[i], arr[min_idx] = arr[min_...
def selection_sort(arr): comparisons = 1 for i in range(len(arr)): comparisons += 1 min_idx = i comparisons += 1 for j in range(i + 1, len(arr)): comparisons += 2 if arr[min_idx] > arr[j]: min_idx = j (arr[i], arr[min_idx]) = (arr[m...
# fail-if: '-x' not in EXTRA_JIT_ARGS def dec(f): return f @dec def f(): pass
def dec(f): return f @dec def f(): pass
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Andre Augusto Giannotti Scota (https://sites.google.com/view/a2gs/) def my_decorator(func): def wrapper(): print("Something is happening before the function is called.") func() print("Something is happening after the function is called.") return wrapper @my_de...
def my_decorator(func): def wrapper(): print('Something is happening before the function is called.') func() print('Something is happening after the function is called.') return wrapper @my_decorator def say_whee(): print('Whee!') say_whee()
def register_init(func): pass def register_config(func): pass def register_read(func): pass def register_write(func): pass def info(msg): print(msg)
def register_init(func): pass def register_config(func): pass def register_read(func): pass def register_write(func): pass def info(msg): print(msg)
class Solution: def solve(self, words): minimum = sorted(words, key = len)[0] LCP = '' for i in range(len(minimum)): matches = True curChar = minimum[i] for j in range(len(words)): if words[j][i] != curChar: matches ...
class Solution: def solve(self, words): minimum = sorted(words, key=len)[0] lcp = '' for i in range(len(minimum)): matches = True cur_char = minimum[i] for j in range(len(words)): if words[j][i] != curChar: matches = Fa...
# -*- coding: utf-8 -*- operation = input() total = 0 for i in range(144): N = float(input()) line = (i // 12) + 1 if (i < (line * 12 - line)): total += N answer = total if (operation == 'S') else (total / 66) print("%.1f" % answer)
operation = input() total = 0 for i in range(144): n = float(input()) line = i // 12 + 1 if i < line * 12 - line: total += N answer = total if operation == 'S' else total / 66 print('%.1f' % answer)
# -*- coding: utf-8 -*- ''' File name: code\onechild_numbers\sol_413.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #413 :: One-child Numbers # # For more information see: # https://projecteuler.net/problem=413 # Problem Statement ''' ...
""" File name: code\\onechild_numbers\\sol_413.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nWe say that a d-digit positive number (no leading zeros) is a one-child number if exactly one of its sub-strings is divisible by d.\n\nFor example, 5671 is a 4-digit one-child num...
# A DP program to solve edit distance problem def editDistDP(x, y): m = len(x); n = len(y); # Create an e-table to store results of subproblems e = [[0 for j in range(n + 1)] for i in range(m + 1)] # Fill in e[][] in bottom up manner for i in range(m + 1): for j in range(n + 1)...
def edit_dist_dp(x, y): m = len(x) n = len(y) e = [[0 for j in range(n + 1)] for i in range(m + 1)] for i in range(m + 1): for j in range(n + 1): if i == 0: e[i][j] = j elif j == 0: e[i][j] = i elif x[i - 1] == y[j - 1]: ...
def sum(matriz): sumValue = 0; if len(matriz) > 0 and matriz[-1] <= 1000: for item in matriz: sumValue += item return sumValue print(sum([1, 2, 3]));
def sum(matriz): sum_value = 0 if len(matriz) > 0 and matriz[-1] <= 1000: for item in matriz: sum_value += item return sumValue print(sum([1, 2, 3]))
# https://www.acmicpc.net/problem/11091 input = __import__('sys').stdin.readline N = int(input()) for _ in range(N): chars = [0 for _ in range(26)] line = input().rstrip() for char in line: if 97 <= ord(char) < 123: chars[ord(char) - 97] += 1 elif 65 <= ord(char) < 91: ...
input = __import__('sys').stdin.readline n = int(input()) for _ in range(N): chars = [0 for _ in range(26)] line = input().rstrip() for char in line: if 97 <= ord(char) < 123: chars[ord(char) - 97] += 1 elif 65 <= ord(char) < 91: chars[ord(char) - 65] += 1 missing...
attendees = ["Ken", "Alena", "Treasure"] attendees.append("Ashley") attendees.extend(["James", "Guil"]) optional_attendees = ["Ben J.", "Dave"] potential_attendees = attendees + optional_attendees print("There are", len(potential_attendees), "attendees currently")
attendees = ['Ken', 'Alena', 'Treasure'] attendees.append('Ashley') attendees.extend(['James', 'Guil']) optional_attendees = ['Ben J.', 'Dave'] potential_attendees = attendees + optional_attendees print('There are', len(potential_attendees), 'attendees currently')
## https://leetcode.com/problems/dota2-senate/ ## go through the rounds of voting, where a vote is to ban another ## senator or, if all senators of the other party are banned, delcare ## victory. ## the optimal play for each senator is to ban the first member of ## the opposition party after them. fastest way to ha...
class Solution: def predict_party_victory(self, senate: str) -> str: bans_to_proc = 0 values = {'D': 1, 'R': -1} while len(set(senate)) > 1: next_senate = '' for (ii, char) in enumerate(senate): if bans_to_proc == 0: next_senate +=...
# init exercise 2 solution # Using an approach similar to what was used in the Iris example # we can identify appropriate boundaries for our meshgrid by # referencing the actual wine data x_1_wine = X_wine_train[predictors[0]] x_2_wine = X_wine_train[predictors[1]] x_1_min_wine, x_1_max_wine = x_1_wine.min() - 0.2, ...
x_1_wine = X_wine_train[predictors[0]] x_2_wine = X_wine_train[predictors[1]] (x_1_min_wine, x_1_max_wine) = (x_1_wine.min() - 0.2, x_1_wine.max() + 0.2) (x_2_min_wine, x_2_max_wine) = (x_2_wine.min() - 0.2, x_2_wine.max() + 0.2) (xx_1_wine, xx_2_wine) = np.meshgrid(np.arange(x_1_min_wine, x_1_max_wine, 0.003), np.aran...
# addinterest1.py def addInterest(balance, rate): newBalance = balance * (1+rate) balance = newBalance def test(): amount = 1000 rate = 0.05 addInterest(amount, rate) print(amount) test()
def add_interest(balance, rate): new_balance = balance * (1 + rate) balance = newBalance def test(): amount = 1000 rate = 0.05 add_interest(amount, rate) print(amount) test()
print ("How many students' test scores do you want to arrange?") a = input() if a == "2": print ("Enter first student's name") name1 = input() print ("Enter his/her score") score1 = input() print ("Enter second student's name") name2 = input() print ("Enter his/her score") scor...
print("How many students' test scores do you want to arrange?") a = input() if a == '2': print("Enter first student's name") name1 = input() print('Enter his/her score') score1 = input() print("Enter second student's name") name2 = input() print('Enter his/her score') score2 = input() ...
# .-. . .-. .-. . . .-. .-. # `-. | | | | | | `-. | # `-' `--`-' `-' `-' `-' ' __title__ = 'slocust' __version__ = '0.18.5.17.1' __description__ = 'Generate serveral Locust nodes on single server.' __license__ = 'MIT' __url__ = 'http://ityoung.gitee.io' __author__ = 'Shin Yeung' __author_email__ = 'ityoung@foxma...
__title__ = 'slocust' __version__ = '0.18.5.17.1' __description__ = 'Generate serveral Locust nodes on single server.' __license__ = 'MIT' __url__ = 'http://ityoung.gitee.io' __author__ = 'Shin Yeung' __author_email__ = 'ityoung@foxmail.com' __copyright__ = 'Copyright 2018 Shin Yeung'
def add(x, y): return x+y def product(z, y): return z*y
def add(x, y): return x + y def product(z, y): return z * y
# Project Euler Problem 21 # Created on: 2012-06-18 # Created by: William McDonald # Returns a list of all primes under n using a sieve technique def primes(n): # 0 prime, 1 not. primeSieve = ['0'] * (n / 2 - 1) primeList = [2] for i in range(3, n, 2): if primeSieve[(i - 3) / 2] == '0...
def primes(n): prime_sieve = ['0'] * (n / 2 - 1) prime_list = [2] for i in range(3, n, 2): if primeSieve[(i - 3) / 2] == '0': primeList.append(i) for j in range((i - 3) / 2 + i, len(primeSieve), i): primeSieve[j] = '1' return primeList def prime_d(n): ...
# # PySNMP MIB module ALTEON-TRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTEON-TRAP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:21:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(ip_cur_cfg_gw_index, altswitch_traps, slb_cur_cfg_virt_service_real_port, flt_cur_cfg_port_indx, slb_cur_cfg_real_server_ip_addr, slb_cur_cfg_real_server_index, flt_cur_cfg_indx, ip_cur_cfg_gw_addr, slb_cur_cfg_real_server_name) = mibBuilder.importSymbols('ALTEON-PRIVATE-MIBS', 'ipCurCfgGwIndex', 'altswitchTraps', 'sl...
class Solution: def pyramidTransition(self, bottom: str, allowed: List[str]) -> bool: d = defaultdict(set) for a in allowed: d[a[:2]].add(a[2]) return self._dfs(bottom, d, 0, "") def _dfs(self, bottom, d, p, nxt): if len(bottom) == 1: return True ...
class Solution: def pyramid_transition(self, bottom: str, allowed: List[str]) -> bool: d = defaultdict(set) for a in allowed: d[a[:2]].add(a[2]) return self._dfs(bottom, d, 0, '') def _dfs(self, bottom, d, p, nxt): if len(bottom) == 1: return True ...
for i in range(10): print(i) print("YY")
for i in range(10): print(i) print('YY')
# # PySNMP MIB module UX25-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UX25-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:30:16 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ...
if __name__ == '__main__': # with open("input/12.test") as f: with open("input/12.txt") as f: lines = f.read().split("\n") pots = lines[0].split(":")[1].strip() rules = dict() for line in lines[2:]: [k, v] = line.split("=>") k = k.strip() v = v.strip() rule...
if __name__ == '__main__': with open('input/12.txt') as f: lines = f.read().split('\n') pots = lines[0].split(':')[1].strip() rules = dict() for line in lines[2:]: [k, v] = line.split('=>') k = k.strip() v = v.strip() rules[k] = v print(rules) ngen = 20 ...
expected_output = { "ACL_TEST": { "aces": { "80": { "actions": {"forwarding": "deny", "logging": "log-none"}, "matches": { "l3": { "ipv4": { "source_network": { ...
expected_output = {'ACL_TEST': {'aces': {'80': {'actions': {'forwarding': 'deny', 'logging': 'log-none'}, 'matches': {'l3': {'ipv4': {'source_network': {'10.4.7.0 0.0.0.255': {'source_network': '10.4.7.0 0.0.0.255'}}, 'protocol': 'tcp', 'destination_network': {'host 192.168.16.1': {'destination_network': 'host 192.168....
# %% ####################################### def dict_creation_demo(): print( "We can convert a list of tuples into Dictionary Items: dict( [('key1','val1'), ('key2', 'val2')] " ) was_tuple = dict([("key1", "val1"), ("key2", "val2")]) print(f"This was a list of Tuples: {was_tuple}\n") print(...
def dict_creation_demo(): print("We can convert a list of tuples into Dictionary Items: dict( [('key1','val1'), ('key2', 'val2')] ") was_tuple = dict([('key1', 'val1'), ('key2', 'val2')]) print(f'This was a list of Tuples: {was_tuple}\n') print("We can convert a list of lists into Dictionary Items: dict...
def gcd(a,b): assert a>= a and b >= 0 and a + b > 0 while a > 0 and b > 0: if a >= b: a = a % b else: b = b % a return max(a,b) def egcd(a, b): x,y, u,v = 0,1, 1,0 while a != 0: q, r = b//a, b%a m, n = x-u*q, y-v*q b,a, x,y, u,v ...
def gcd(a, b): assert a >= a and b >= 0 and (a + b > 0) while a > 0 and b > 0: if a >= b: a = a % b else: b = b % a return max(a, b) def egcd(a, b): (x, y, u, v) = (0, 1, 1, 0) while a != 0: (q, r) = (b // a, b % a) (m, n) = (x - u * q, y - v ...
asSignedInt = lambda s: -int(0x7fffffff&int(s)) if bool(0x80000000&int(s)) else int(0x7fffffff&int(s)) # TODO: swig'ged HIPS I/O unsigned int -> PyInt_AsLong vice PyLong_AsInt; OverflowError: long int too large to convert to int ZERO_STATUS = 0x00000000 def SeparatePathFromPVDL(pathToPVDL,normalizeStrs=False): # n...
as_signed_int = lambda s: -int(2147483647 & int(s)) if bool(2147483648 & int(s)) else int(2147483647 & int(s)) zero_status = 0 def separate_path_from_pvdl(pathToPVDL, normalizeStrs=False): if pathToPVDL.find('\\') != -1: dsep = '\\' path_to_pvdl = pathToPVDL.replace('\\', '/') else: dse...
df12.interaction(['A','B'], pairwise=False, max_factors=3, min_occurrence=1) # A_B # ------- # foo_one # bar_one # foo_two # other # foo_two # other # foo_one # other # # [8 rows x 1 column]
df12.interaction(['A', 'B'], pairwise=False, max_factors=3, min_occurrence=1)
def read(text_path): texts = [] with open(text_path) as f: for line in f.readlines(): texts.append(line.strip()) return texts def corpus_perplexity(corpus_path, model): texts = read(corpus_path) N = sum(len(x.split()) for x in texts) corpus_perp = 1 for text in texts: ...
def read(text_path): texts = [] with open(text_path) as f: for line in f.readlines(): texts.append(line.strip()) return texts def corpus_perplexity(corpus_path, model): texts = read(corpus_path) n = sum((len(x.split()) for x in texts)) corpus_perp = 1 for text in texts: ...
################################################ # result postprocessing utils def divide_list_chunks(list, size_list): assert(sum(size_list) >= len(list)) if sum(size_list) < len(list): size_list.append(len(list) - sum(size_list)) for j in range(len(size_list)): cur_id = sum(size_list[0:j...
def divide_list_chunks(list, size_list): assert sum(size_list) >= len(list) if sum(size_list) < len(list): size_list.append(len(list) - sum(size_list)) for j in range(len(size_list)): cur_id = sum(size_list[0:j]) yield list[cur_id:cur_id + size_list[j]] def divide_nested_list_chunks...
class Hash: def __init__(self): self.m = 5 # cantidad de posiciones iniciales self.min = 20 # porcentaje minimo a ocupar self.max = 80 # porcentaje maximo a ocupar self.n = 0 self.h = [] self.init() def division(self, k): return int(k % ...
class Hash: def __init__(self): self.m = 5 self.min = 20 self.max = 80 self.n = 0 self.h = [] self.init() def division(self, k): return int(k % self.m) def linear(self, k): return (k + 1) % self.m def init(self): self.n = 0 ...
with open("English dictionary.txt", "r") as input_file, open("English dictionary.out", "w") as output_file: row_id = 2 for line in input_file: line = line.strip() output_file.write("%d,%s\n" % (row_id, line.split(",")[1])) row_id += 1
with open('English dictionary.txt', 'r') as input_file, open('English dictionary.out', 'w') as output_file: row_id = 2 for line in input_file: line = line.strip() output_file.write('%d,%s\n' % (row_id, line.split(',')[1])) row_id += 1
def test_cat1(): assert True def test_cat2(): assert True def test_cat3(): assert True def test_cat4(): assert True def test_cat5(): assert True def test_cat6(): assert True def test_cat7(): assert True def test_cat8(): assert True
def test_cat1(): assert True def test_cat2(): assert True def test_cat3(): assert True def test_cat4(): assert True def test_cat5(): assert True def test_cat6(): assert True def test_cat7(): assert True def test_cat8(): assert True
# print("Hello") # print("Hello") # print("Hello") # i = 1 # so caller iterator, or index if you will # while i < 5: # while loops are for indeterminate time # print("Hello No.", i) # print(f"Hello Number {i}") # i += 1 # i = i + 1 # we will have a infinite loop without i += 1, there is no i++ # # print...
i = 5 while i < 10: print(i) i += 1 if i % 2 == 0: print('Even number', i) else: print('Doing something with odd number', i) print('We do something here')
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/xtark/ros_ws/devel/include;/home/xtark/ros_ws/src/third_packages/ar_track_alvar/ar_track_alvar/include".split(';') if "/home/xtark/ros_ws/devel/include;/home/xtark/ros_ws/src/third_packages/ar_tr...
catkin_package_prefix = '' project_pkg_config_include_dirs = '/home/xtark/ros_ws/devel/include;/home/xtark/ros_ws/src/third_packages/ar_track_alvar/ar_track_alvar/include'.split(';') if '/home/xtark/ros_ws/devel/include;/home/xtark/ros_ws/src/third_packages/ar_track_alvar/ar_track_alvar/include' != '' else [] project_c...
def maxfun(l, *arr): maxn = 0 maxsum = 0 for k, i in enumerate(arr): s = 0 for t in l: s += i(t) if s >= maxsum: maxn = k maxsum = s return arr[maxn]
def maxfun(l, *arr): maxn = 0 maxsum = 0 for (k, i) in enumerate(arr): s = 0 for t in l: s += i(t) if s >= maxsum: maxn = k maxsum = s return arr[maxn]
class EngineParams(object): def __init__(self, **kwargs): # Iterates over provided arguments and sets the provided arguments as class properties for key, value in kwargs.items(): setattr(self, key, value)
class Engineparams(object): def __init__(self, **kwargs): for (key, value) in kwargs.items(): setattr(self, key, value)
colours = {} # Regular colours["Black"]="\033[0;30m" colours["Red"]="\033[0;31m" colours["Green"]="\033[0;32m" colours["Yellow"]="\033[0;33m" colours["Blue"]="\033[0;34m" colours["Purple"]="\033[0;35m" colours["Cyan"]="\033[0;36m" colours["White"]="\033[0;37m" #Bold colours["BBlack"]="\033[1;30m" colours["BRed"]="\033[...
colours = {} colours['Black'] = '\x1b[0;30m' colours['Red'] = '\x1b[0;31m' colours['Green'] = '\x1b[0;32m' colours['Yellow'] = '\x1b[0;33m' colours['Blue'] = '\x1b[0;34m' colours['Purple'] = '\x1b[0;35m' colours['Cyan'] = '\x1b[0;36m' colours['White'] = '\x1b[0;37m' colours['BBlack'] = '\x1b[1;30m' colours['BRed'] = '\...
class A(object): x:int = 1 def foo(): print(1) print(A) print(foo()) #ok print(foo) #error
class A(object): x: int = 1 def foo(): print(1) print(A) print(foo()) print(foo)
# The path to the Webdriver (for Chrome/Chromium) CHROMEDRIVER_PATH = 'C:\\WebDriver\\bin\\chromedriver.exe' # Tell the browser to ignore invalid/insecure https connections BROWSER_INSECURE_CERTS = True # The URL pointing to the Franka Control Webinterface (Desk) DESK_URL = 'robot.franka.de' # Expect a login page wh...
chromedriver_path = 'C:\\WebDriver\\bin\\chromedriver.exe' browser_insecure_certs = True desk_url = 'robot.franka.de' desk_login_required = True plc_id = '127.0.0.1.1.1' plc_start_flag = 'GVL.bStartBlockly' plc_error_flag = 'GVL.bBlockleniumError' plc_error_msg = 'GVL.sBlockleniumErrorMsg' plc_desk_user = 'GVL.sDeskUse...
def print_division(a,b): try: result = a / b print(f"result: {result}") except: # It catches ALL errors print("error occurred") print_division(10,5) print_division(10,0) print_division(10,2) str_line = input("please enter two numbers to divide:") a = int(str_line.split(" ")[0]) b = int(str_line.split(" "...
def print_division(a, b): try: result = a / b print(f'result: {result}') except: print('error occurred') print_division(10, 5) print_division(10, 0) print_division(10, 2) str_line = input('please enter two numbers to divide:') a = int(str_line.split(' ')[0]) b = int(str_line.split(' ')[1...
t = int(input()) while t: arr = [] S = input().split() if(len(S)==1): print(S[0].capitalize()) else: for i in range(len(S)): arr.append(S[i].capitalize()) for i in range(len(S)-1): print(arr[i][0]+'.',end=' ') print(S[len(S)-1].capitalize()) ...
t = int(input()) while t: arr = [] s = input().split() if len(S) == 1: print(S[0].capitalize()) else: for i in range(len(S)): arr.append(S[i].capitalize()) for i in range(len(S) - 1): print(arr[i][0] + '.', end=' ') print(S[len(S) - 1].capitalize()...
class Image_SVG(): def Stmp(self): return
class Image_Svg: def stmp(self): return
def crack(value,g,mod): for i in range(mod): if ((g**i) % mod == value): return i # print("X = ", crack(57, 13, 59)) # print("Y = ", crack(44,13,59)) # print("Alice computes", (44**20)%59) # print("Bob computes", (57**47)%59) def find_num(target): for i in range(target): for j in range(target): ...
def crack(value, g, mod): for i in range(mod): if g ** i % mod == value: return i def find_num(target): for i in range(target): for j in range(target): if i * j == target: print(i, j) find_num(5561) def lcm(x, y): orig_x = x orig_y = y while ...
__version__ = '1.0.3.5' if __name__ == '__main__': print(__version__) # ****************************************************************************** # MIT License # # Copyright (c) 2020 Jianlin Shi # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated ...
__version__ = '1.0.3.5' if __name__ == '__main__': print(__version__)
#tests if passed-in number is a prime number def is_prime(num): if num < 2: return False for i in range(2, num): if num % i == 0: return False return True #takes in a number and returns a list of prime numbers for zero to the number def generate_prime_numbers(number): primes = [] try: isinstance(number,...
def is_prime(num): if num < 2: return False for i in range(2, num): if num % i == 0: return False return True def generate_prime_numbers(number): primes = [] try: isinstance(number, int) if number > 0: for num in range(2, number + 1): ...
# time O(nlogn) # space O(1) def minimumWaitingTime(queries): queries.sort() total = 0 prev_sum = 0 for i in queries[:-1]: prev_sum += i total += prev_sum return total # time O(nlogn) # space O(1) def minimumWaitingTime(queries): queries.sort() total = 0 f...
def minimum_waiting_time(queries): queries.sort() total = 0 prev_sum = 0 for i in queries[:-1]: prev_sum += i total += prev_sum return total def minimum_waiting_time(queries): queries.sort() total = 0 for (idx, wait_time) in enumerate(queries, start=1): queries_l...
for _ in range(int(input())): n, m, k = map(int, input().split()) req = 0 req = 1*(m-1) + m*(n-1) if req == k: print("YES") else: print("NO")
for _ in range(int(input())): (n, m, k) = map(int, input().split()) req = 0 req = 1 * (m - 1) + m * (n - 1) if req == k: print('YES') else: print('NO')
#/*********************************************************\ # * File: 44ScriptOOP.py * # * # * Copyright (C) 2002-2013 The PixelLight Team (http://www.pixellight.org/) # * # * This file is part of PixelLight. # * # * Permission is hereby granted, free of charge, to any person obtain...
class Myscriptclass(object): """My script class""" def __del__(this): PL['System']['Console']['Print']('MyScriptClass::~MyScriptClass() - a=' + str(this.a) + '\n') def __init__(this, a): this.a = a PL['System']['Console']['Print']('MyScriptClass::MyScriptClass(a) - a=' + str(this.a...
orig = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" num = int(input()) for i in range(num): alpha = list(orig) key = input() cipher = input() tl = list(key) letters = [] newAlpha = [] for l in tl: if l not in letters: letters.append(l) alpha.remove(l) length = len(letters...
orig = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' num = int(input()) for i in range(num): alpha = list(orig) key = input() cipher = input() tl = list(key) letters = [] new_alpha = [] for l in tl: if l not in letters: letters.append(l) alpha.remove(l) length = len(letter...
def get_inplane(inplanes, idx): if isinstance(inplanes, list): return inplanes[idx] else: return inplanes
def get_inplane(inplanes, idx): if isinstance(inplanes, list): return inplanes[idx] else: return inplanes
def linearsearch(_list, _v): if len(_list) == 0: return False for i, item in enumerate(_list): if item == _v: return i return False
def linearsearch(_list, _v): if len(_list) == 0: return False for (i, item) in enumerate(_list): if item == _v: return i return False
images = [ "https://demo.com/imgs/1.jpg", "https://demo.com/imgs/2.jpg", "https://demo.com/imgs/3.jpg", ]
images = ['https://demo.com/imgs/1.jpg', 'https://demo.com/imgs/2.jpg', 'https://demo.com/imgs/3.jpg']
INITIAL_CAROUSEL_DATA = [ { "title": "New Feature", "description": "Explore", "graphic": "/images/homepage/map-explorer.png", "url": "/explore" }, { "title": "Data Visualization", "description": "Yemen - WFP mVAM, Food Security Monitoring", "graphic": ...
initial_carousel_data = [{'title': 'New Feature', 'description': 'Explore', 'graphic': '/images/homepage/map-explorer.png', 'url': '/explore'}, {'title': 'Data Visualization', 'description': 'Yemen - WFP mVAM, Food Security Monitoring', 'graphic': '/images/homepage/mVAM.png', 'url': '//data.humdata.org/visualization/wf...
"optimize with in-place list operations" class error(Exception): pass # when imported: local exception class Stack: def __init__(self, start=[]): # self is the instance object self.stack = [] # start is any sequence: stack... for x in start: s...
"""optimize with in-place list operations""" class Error(Exception): pass class Stack: def __init__(self, start=[]): self.stack = [] for x in start: self.push(x) def push(self, obj): self.stack.append(obj) def pop(self): if not self.stack: rai...
''' A Simple nested if ''' # Can you eat chicken? a = input("Are you veg or non veg?\n") day = input("Which day is today?\n") if(a == "nonveg"): if(day == "sunday"): print("You can eat chicken") else: print("It is not sunday! You cannot eat chicken..") else: print("you are vegitarian! you cannot eat ch...
""" A Simple nested if """ a = input('Are you veg or non veg?\n') day = input('Which day is today?\n') if a == 'nonveg': if day == 'sunday': print('You can eat chicken') else: print('It is not sunday! You cannot eat chicken..') else: print('you are vegitarian! you cannot eat chicken!')
languages = {} banned = [] results = {} data = input().split("-") while "exam finished" not in data: if "banned" in data: banned.append(data[0]) data = input().split("-") continue name = data[0] language = data[1] points = int(data[2]) current_points = 0 if language i...
languages = {} banned = [] results = {} data = input().split('-') while 'exam finished' not in data: if 'banned' in data: banned.append(data[0]) data = input().split('-') continue name = data[0] language = data[1] points = int(data[2]) current_points = 0 if language in la...
''' Generic functions for files ''' class FileOps: def open(self, name): ''' Open the file and return a string ''' with open(name, 'rb') as f: return f.read()
""" Generic functions for files """ class Fileops: def open(self, name): """ Open the file and return a string """ with open(name, 'rb') as f: return f.read()
''' Caesar Cypher, by Jackson Urquhart - 19 February 2022 @ 22:47 ''' in_str = str(input("\nEnter phrase: \n")) # Gets in_string from user key = int(input("\nEnter key: \n")) # Gets key from user keep_upper = str(input("\nMaintain case? y/n\n")) # Determines whether user wants to maintiain case values def encrypt(in_...
""" Caesar Cypher, by Jackson Urquhart - 19 February 2022 @ 22:47 """ in_str = str(input('\nEnter phrase: \n')) key = int(input('\nEnter key: \n')) keep_upper = str(input('\nMaintain case? y/n\n')) def encrypt(in_str, key): out_str = '' for letter in in_str: if 96 < ord(letter.lower()) < 123: ...
# # PySNMP MIB module ETHER-WIS (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ETHER-WIS # Produced by pysmi-0.3.4 at Wed May 1 13:06:45 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...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_intersection, constraints_union, value_size_constraint) ...
print("hello world") #prin("how are you") def fa(): return fb() def fb(): return fc() def fc(): return 1 def suma(a, b): return a + b
print('hello world') def fa(): return fb() def fb(): return fc() def fc(): return 1 def suma(a, b): return a + b
# # PySNMP MIB module Nortel-Magellan-Passport-BaseRoutingMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-BaseRoutingMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:16:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwan...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) ...
def denumerate(enum_list): try: nums = dict(enum_list) maximum = max(nums) + 1 result = ''.join(nums[a] for a in xrange(maximum)) if result.isalnum() and len(result) == maximum: return result except (KeyError, TypeError, ValueError): pass return False
def denumerate(enum_list): try: nums = dict(enum_list) maximum = max(nums) + 1 result = ''.join((nums[a] for a in xrange(maximum))) if result.isalnum() and len(result) == maximum: return result except (KeyError, TypeError, ValueError): pass return False
lines = open('input.txt', 'r').readlines() timestamp = int(lines[0].strip()) buses = lines[1].strip().split(',') m, x = [], [] for i, bus in enumerate(buses): if bus == 'x': continue bus = int(bus) m.append(bus) x.append((bus - i) % bus) def extended_euclidean(a, b): if a == 0: return b, 0, 1 else: g, y,...
lines = open('input.txt', 'r').readlines() timestamp = int(lines[0].strip()) buses = lines[1].strip().split(',') (m, x) = ([], []) for (i, bus) in enumerate(buses): if bus == 'x': continue bus = int(bus) m.append(bus) x.append((bus - i) % bus) def extended_euclidean(a, b): if a == 0: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # def is_whitespaces_str(s): return True if len(s.strip(" \t\n\r\f\v")) == 0 else False
def is_whitespaces_str(s): return True if len(s.strip(' \t\n\r\x0c\x0b')) == 0 else False
command = '/usr/bin/gunicorn' pythonpath = '/usr/share/webapps/netbox' bind = '127.0.0.1:8001' workers = 3 user = 'netbox'
command = '/usr/bin/gunicorn' pythonpath = '/usr/share/webapps/netbox' bind = '127.0.0.1:8001' workers = 3 user = 'netbox'
# This one's a bit different, representing an unusual (and honestly, # not recommended) strategy for tracking users that sign up for a service. class User: # An (intentionally shared) collection storing users who sign up for some hypothetical service. # There's only one set of members, so it lives at the class...
class User: members = {} names = set() def __init__(self, name): if not self.names: self.names.add(name) else: self.names = set(name) if self.members == {}: self.members = set() def sign_up(self): self.members.add(self.name) sarah = u...
def is_knight_removed(matrix: list, row: int, col: int): if row not in range(rows) or col not in range(rows): return False return matrix[row][col] == "K" def affected_knights(matrix: list, row: int, col: int): result = 0 if is_knight_removed(matrix, row - 2, col + 1): result += 1 i...
def is_knight_removed(matrix: list, row: int, col: int): if row not in range(rows) or col not in range(rows): return False return matrix[row][col] == 'K' def affected_knights(matrix: list, row: int, col: int): result = 0 if is_knight_removed(matrix, row - 2, col + 1): result += 1 if...
def dight(n): sum=0 while n>0: sum=sum+n%10 n=n//10 return sum k=0 l=[] for i in range(2,100): for j in range(2,100): t=i**j d=dight(t) if d==i: k+=1 l.append(t) l=sorted(l) print(l[29])
def dight(n): sum = 0 while n > 0: sum = sum + n % 10 n = n // 10 return sum k = 0 l = [] for i in range(2, 100): for j in range(2, 100): t = i ** j d = dight(t) if d == i: k += 1 l.append(t) l = sorted(l) print(l[29])
load("//cuda:providers.bzl", "CudaInfo") def is_dynamic_input(src): return src.extension in ["so", "dll", "dylib"] def is_object_file(src): return src.extension in ["obj", "o"] def is_static_input(src): return src.extension in ["a", "lib", "lo"] def is_source_file(src): return src.extens...
load('//cuda:providers.bzl', 'CudaInfo') def is_dynamic_input(src): return src.extension in ['so', 'dll', 'dylib'] def is_object_file(src): return src.extension in ['obj', 'o'] def is_static_input(src): return src.extension in ['a', 'lib', 'lo'] def is_source_file(src): return src.extension in ['c',...
def custMin(paramList): n = len(paramList)-1 for pos in range(n): if paramList[pos] < paramList[pos+1]: paramList[pos], paramList[pos+1] = paramList[pos+1], paramList[pos] return paramList[n] print(custMin([5, 2, 9, 10, -2, 90]))
def cust_min(paramList): n = len(paramList) - 1 for pos in range(n): if paramList[pos] < paramList[pos + 1]: (paramList[pos], paramList[pos + 1]) = (paramList[pos + 1], paramList[pos]) return paramList[n] print(cust_min([5, 2, 9, 10, -2, 90]))
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
integrator = 'bin/integrator' analytics = 'wso2/analytics/wso2/worker/bin/carbon' broker = 'wso2/broker/bin/wso2server' bp = 'wso2/business-process/bin/wso2server' micro_intg = 'wso2/micro-integrator/bin/wso2server' datasource_paths = {'product-apim': {}, 'product-is': {}, 'product-ei': {'CORE': ['conf/datasources/mast...
def get_digit(num): root = num ** 0.5 if root % 1 == 0: return counting = [] b = (root // 1) c = 1 while True: d = (c / (root - b)) // 1 e = num - b ** 2 if e % c == 0: c = e / c else: c = e b = (c * d - b) ...
def get_digit(num): root = num ** 0.5 if root % 1 == 0: return counting = [] b = root // 1 c = 1 while True: d = c / (root - b) // 1 e = num - b ** 2 if e % c == 0: c = e / c else: c = e b = c * d - b if [b, c] in co...
# https://youtu.be/wNVCJj642n4?list=PLAB1DA9F452D9466C def binary_search(items, target): low = 0 high = len(items) while (high - low) > 1: middle = (low + high) // 2 if target < items[middle]: high = middle if target >= items[middle]: low = mi...
def binary_search(items, target): low = 0 high = len(items) while high - low > 1: middle = (low + high) // 2 if target < items[middle]: high = middle if target >= items[middle]: low = middle if items[low] == target: return low raise value_error...
# https://www.hackerrank.com/challenges/count-luck/problem def findMove(matrix,now,gone): x,y = now moves = list() moves.append((x+1,y)) if(x!=len(matrix)-1 and matrix[x+1][y]!='X' ) else None moves.append((x,y+1)) if(y!=len(matrix[0])-1 and matrix[x][y+1]!='X') else None moves.append((x-1,y)) if(x...
def find_move(matrix, now, gone): (x, y) = now moves = list() moves.append((x + 1, y)) if x != len(matrix) - 1 and matrix[x + 1][y] != 'X' else None moves.append((x, y + 1)) if y != len(matrix[0]) - 1 and matrix[x][y + 1] != 'X' else None moves.append((x - 1, y)) if x != 0 and matrix[x - 1][y] != 'X...
# # PySNMP MIB module CISCO-LWAPP-DOT11-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-DOT11-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:47:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
#!/usr/bin/env python3 __version__ = (0, 5, 2) __version_info__ = ".".join(map(str, __version__)) APP_NAME = 'pseudo-interpreter' APP_AUTHOR = 'bell345' APP_VERSION = __version_info__
__version__ = (0, 5, 2) __version_info__ = '.'.join(map(str, __version__)) app_name = 'pseudo-interpreter' app_author = 'bell345' app_version = __version_info__
class DiagonalDisproportion: def getDisproportion(self, matrix): r = 0 for i, s in enumerate(matrix): r += int(s[i]) - int(s[-i-1]) return r
class Diagonaldisproportion: def get_disproportion(self, matrix): r = 0 for (i, s) in enumerate(matrix): r += int(s[i]) - int(s[-i - 1]) return r
for num in range(101): div = 0 for x in range(1, num+1): resto = num % x if resto == 0: div += 1 if div == 2: print(num)
for num in range(101): div = 0 for x in range(1, num + 1): resto = num % x if resto == 0: div += 1 if div == 2: print(num)