content
stringlengths
7
1.05M
""" Exception classes - Subclassing to check for specific errors """ class AlpineException(Exception): """ General Alpine Exception """ def __init__(self, reason, *args): super(AlpineException, self).__init__(reason, *args) self.reason = reason def __repr__(self): return '...
def up(config, conn, semester, course): with conn.cursor() as cursor: cursor.execute("""CREATE TABLE IF NOT EXISTS notification_settings ( user_id character varying NOT NULL, merge_threads BOOLEAN DEFAULT FALSE NOT NULL, all_new_threads BOOLEAN DEFAULT FALSE NOT NULL, all_new_pos...
# 80文字以上になる場合は改行するのがルール s = 'aaaaaaaaa' \ + 'bbbbbbbb' print(s) x = 1 + 1 + 1 + 1 + 1 + 1 + 1 \ + 1 + 1 + 1 + 1 + 1 + 1 + 1 print(x) x = (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1) print(x)
""" File: phillips_hue.py George Farris <farrisg@gmsys.com> Copyright (c), 2015 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 ver...
# V0 # V1 # https://blog.csdn.net/fuxuemingzhu/article/details/81079015 class Solution(object): def asteroidCollision(self, asteroids): """ :type asteroids: List[int] :rtype: List[int] """ stack = [] for ast in asteroids: while stack and ast < 0 and sta...
class Solution: def maximumProduct(self, nums: List[int]) -> int: min1 = min2 = inf max1 = max2 = max3 = -inf for n in nums: if n < min1: min2, min1 = min1, n elif n < min2: min2 = n if n > max1: max3, max2...
class ListNode(object): def __init__(self, x): self.val = x self.next = None def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode 在每次生成一个节点后再多生成一个节点,用来判断最后一位还有没有 """ n = l1.val + l2.val l3 = L...
OUTCOMES = [ [None, "Buzz"], ["Fizz", "FizzBuzz"], ] def fizzbuzz(number: int) -> str: mod3 = number % 3 == 0 mod5 = number % 5 == 0 outcome = OUTCOMES[mod3][mod5] return outcome or str(number) def main(): for i in range(101): fbi = fizzbuzz(i) print(fbi) if __name__ ...
total = mais1000 = maisbarato = cont = 0 nomebarato = '' while True: produto = str(input('Nome do produto: ')).strip().title() preço = float(input('Preço: R$')) cont += 1 total += preço if preço > 1000: mais1000 += 1 if cont == 1: maisbarato = preço nomebarato = produto ...
_.targets # unused attribute (packages/cli/odahuflow/cli/parsers/local/packaging.py:118) build_client # unused function (packages/sdk/odahuflow/sdk/clients/api_aggregated.py:88) ConfigurationClient # unused class (packages/sdk/odahuflow/sdk/clients/configuration.py:28) AsyncConfigurationClient # unused class (packa...
class Schema(object): def __init__(self, name, tag_name, tag_case_sensitive, model, validators, attributes, children, content): self.name = name self.tag_name = tag_name self.tag_case_sensitive = tag_case_sensitive self.model = model self.validators = validators sel...
""" Problem Statement Given a target amount n and a list (array) of distinct coin values, what's the fewest coins needed to make the change amount. For example: If n = 10 and coins = [1,5,10]. Then there are 4 possible ways to make change: 1+1+1+1+1+1+1+1+1+1 5 + 1+1+1+1+1 5+5 10 With 1 coin being the minimum amoun...
{ 'variables': { 'linear_sample_parent_path': '/', }, 'targets': [ { 'target_name': 'tcp_client_sample', 'type': 'executable', 'sources': [ 'tcp_client_sample.cpp', ], }, { 'target_name': 'tcp_server_sample', 'type': 'executable', 'sources': [ ...
def rna_to_protein(rna): ''' Takes a string and returns a protein sequence WIHOUT using biopython Input params: rna = rna string Output params: protein = protein sequence ''' codon = [] protein = [] while rna: codon.append(rna[:3]) rna = rna[3:] f...
PROG_NAME = "MTSv" VERSION = "2.0.0" DEFAULT_CFG_FNAME = "mtsv.cfg" DEFAULT_LOG_FNAME = "mtsv_{COMMAND}_{TIMESTAMP}.log" CONFIG_STRING = """ # NOTE: Changes to the config file in the middle of the pipeline # may force previous steps to be rerun. # # =============================================================== # ...
# # @lc app=leetcode id=998 lang=python3 # # [998] Maximum Binary Tree II # # https://leetcode.com/problems/maximum-binary-tree-ii/description/ # # algorithms # Medium (63.74%) # Likes: 246 # Dislikes: 495 # Total Accepted: 20.7K # Total Submissions: 32.3K # Testcase Example: '[4,1,3,null,null,2]\n5' # # We are ...
# 异位词:1.字母次数一样;2.次序不同 # 我的思路:hash 先判断1.字母次数是否一样:不一样false; # 一样进入2.基本情况1)s="",t="";2)s="a",t="a";3)一般情况比如:s="ab",t="ba" # 我自己辣鸡代码: class Solution: def isAnagram(self,s,t): # 空字符情况 if len(s) == 0: return True # 判断字母次数一样 num_s = {} fo...
class Solution: def isTransformable(self, s: str, t: str) -> bool: positions = defaultdict(list) for i in reversed(range(len(s))): positions[int(s[i])].append(i) for char in t: num = int(char) if not positions[num]: return False ...
class Solution: def solve(self, intervals, types): sorted_endpoints = sorted(list({end for interval in intervals for end in interval})) counts = defaultdict(int) for start, end in intervals: counts[start] += 1 counts[end] -= 1 counts = dict(zip(sorted_endpoi...
def add_data_opts(parser): data_opts = parser.add_argument_group("General Data Options") data_opts.add_argument('--manifest-dir', default='./', type=str, help='Output directory for manifests') data_opts.add_argument('--min-duration', default=1, type=int, ...
class object_ustr(object): def __unicode__(self): '''This should really be overriden in subclasses''' class_name = self.__class__.__name__ attr_pairs = ('%s=%s' % (key, val) for key, val in self.__dict__.items()) return u'<%s %s>' % (class_name, ' '.join(attr_pairs)) def __str__...
# The gameboy color has no cpu opcodes for multiplication. I could write some # complicated algorithm to do this stuff on the gameboy's cpu, but I'm going to # cheat and just use canned data. If you feed the assembly code for a color # palette into this script, it will output a canned fade animation, 32 steps in # size...
""" Video encoding names """ class EncodingNames: """Simple class to hold encoding names""" ORIGINAL = "original" HLS = "HLS" SMALL = "small" BASIC = "basic" MEDIUM = "medium" LARGE = "large" HD = "HD" MP4 = [HD, LARGE, MEDIUM, BASIC, SMALL]
# # PySNMP MIB module IEEE8021-CFM-V2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IEEE8021-CFM-V2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:40:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
SPEC = \ { "input": [ { "name": "first number", "type": "int" }, { "name": "second number", "type": "int" } ], "output": [ { "name": "number sum", "type": "int" } ], "package": { "author": "Stefan Maetschke", "author_email": "stefan.maetsch...
class Solution: # my solution def removeDuplicates(self, nums: List[int]) -> int: i = 1 # while i < len(nums): for j in range(len(nums)-1): if nums[j] != nums[j+1]: nums[i] = nums[j+1] i += 1 return i
load("@io_bazel_rules_docker//container:providers.bzl", "PushInfo") def _run_deployment_impl(ctx): registry = ctx.attr.image_push[PushInfo].registry repository = ctx.attr.image_push[PushInfo].repository image = "%s/%s" % (registry, repository) deploy_deps_string = "\n".join([ label[DefaultInfo...
""" SPIFlash.py Contains code needed to emulate SPI flash memory. Copyright (c) 2018, wchill All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above c...
class Solution: def trap(self, height: List[int]) -> int: if not height: return 0 s = [] result = 0 for i in range(len(height)): while s and height[i] > height[s[-1]]: top = s.pop() if not s: break distance = i - s[-1] - ...
""" Search in a rotated sorted array - Distinct There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1]...
def test_i8(): i: i8 i = 5 print(i) def test_i16(): i: i16 i = 4 print(i) def test_i32(): i: i32 i = 3 print(i) def test_i64(): i: i64 i = 2 print(i)
s1 = float(input('Primeiro segmento: ')) s2 = float(input('Segundo segmento: ')) s3 = float(input('Terceiro segmento: ')) if s1 < s2 + s3 and s2 < s1 + s3 and s3 < s1 + s2: print('Os valores informados PODEM FORMAR um triângulo', end=' ') if s1 == s2 == s3: print('EQUILÁTERO.') elif s1 != s2 != s3 !...
class MyQueue: def __init__(self): self.queue = [] self.behind = -1 self.front = -1 def push(self, x: int) -> None: self.queue.append(x) self.behind = self.behind + 1 def pop(self) -> int: popResult = self.queue.pop(0) self.front = self.front + 1 ...
def age_assignment(*args, **kwargs): result = {} for n in args: result[n] = kwargs[n[0]] return result
hrs = input("Enter Hours:") h = float(hrs) rate = input("Enter rate: ") r = float(rate) if h <= 40: pay = h * r else: pay = r * 40 + (r * 1.5) * (h - 40) print(pay)
f = open("/home/gangserver/dev/data/new.txt", 'r') while True: line = f.readline() if not line: break print(line) f.close() print("*" * 30) f = open("/home/gangserver/dev/data/new.txt", 'r') lines = f.readlines() for line in lines: print(line) f.close() print("*" * 30) f = open("/home/gangserver/dev...
# codeforces round 608 div 2 - A # solved in time # https://codeforces.com/contest/1271/problem/A?locale=en # a - галстуки a = int(input()) # b - шарфы b = int(input()) # c - жилетки c = int(input()) # d - пиджаки d = int(input()) # e - стоимость a + d e = int(input()) # f - стоимость b + c + d f = int(input()) if e ...
s = input() answer = [] for e in s: if not e in ["a", "i", "u", "e", "o"]: answer.append(e) print("".join(answer))
#inheritance class Employee: def __init__(self): self.__id=10 self._name="ABC" self.salary=100 class Student(Employee): def Display(self): #print(self.__id) unavailable to object print(self._name) print(self.salary) ob=Student() ob.Display() print(ob...
""" Date: 06/06/2021 Name: Rio Weil Title: errors.py Description: Custom errors for project. """ """ Base class for other exceptions """ class Error(Exception): pass """ Error raised when initializing board with zero space or bombs """ class ZeroException(Error): pass """ Error raised when more bombs than po...
#Slicing Strings """ b = "hello, word!" print(b[2:5]) """ """ b = "hello, word!" print(b[2:5]) """ """ b = "hello, word!" print(b[2:]) """ b = "hello, word!" print(b[-5:-2])
""" A function which formats a duration, given as a number of seconds, in a human-friendly way. """ # Created by Egor Kostan. # GitHub: https://github.com/ikostan # LinkedIn: https://www.linkedin.com/in/egor-kostan/ def format_duration(seconds: int) -> str: """ A function which formats a duration, given a...
def normalize(state): temp_state = [] temp_state.append(0.001*state[0]) temp_state.append((state[1]-2478330.0752)/188151.0787) temp_state.append((state[2]-9696.347622)/14234.47008) temp_state.append((state[3]-2515.821571)/2615.29795) temp_state.append(0.01*state[4]) temp_state.append(0.01*st...
#!/usr/bin/env python3 inp = "(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()(((...
# -*- coding: utf-8 -*- """ exceptions in xalpha packages """ class XalphaException(Exception): pass class FundTypeError(XalphaException): """ The code mismatches the fund type obj, fundinfo/mfundinfo """ pass class FundNotExistError(XalphaException): """ There is no fund with given c...
INPUT_DIR = "/mnt/input" OUTPUT_DIR = "/mnt/output" CONFIG_FILE_NAME = 'config.yml' CONFIG_SECTION = 'fc_survival_svm'
if __name__ == '__main__': for _ in range(int(input())): a = int(input()) A = set(map(int,input().split())) b = int(input()) B = set(map(int,input().split())) # if len(A-B) == 0: # print(True) # else: # print(False) # print(not bool(A.difference(B))) # print( A.intersection(B) == A) pr...
class Node: def __init__(self, val): self.val = val self.next = None class SinglyLinkedList: def __init__(self): self.head = None def add(self, val): curNode = self.head while(curNode.next != None): curNode = curNode.next curNode.next = Node(val)...
"""Rules for StringTemplate 4.""" def _impl(ctx): if not ctx.attr.controller and not ctx.attr.data and not ctx.attr.json: fail("Missing template data. Provide at least one of \"controller\", \"data\" or \"json\" attributes.") output = ctx.actions.declare_file(ctx.attr.out) deps = depset(transitive...
# Reversing linked list. class Node: def __init__(self, cargo=None, next=None): self.cargo = cargo self.next = next def __str__(self): return str(self.cargo) class SimpleLinkedList: def __init__(self, init_values=[]): self.length = 0 self.head = None if ...
''' Facebook error classes also see http://fbdevwiki.com/wiki/Error_codes#User_Permission_Errors ''' class OpenFacebookException(Exception): ''' BaseClass for all open facebook errors ''' @classmethod def codes_list(cls): ''' Returns the codes as a list of instructions ''...
# -*- coding: utf-8 -*- ''' Para resolver o problema é necessário considerar todas as posições da matriz primeiro. Para isso são usadas duas funções de tranformação de matrizes, a função de rotação e uma de espelhamento. O programa compara cada elemento em cada matriz com a função "comp_mat" que retorna a precisão. ...
def add_native_methods(clazz): def SCardEstablishContext__int__(a0): raise NotImplementedError() def SCardListReaders__long__(a0): raise NotImplementedError() def SCardConnect__long__java_lang_String__int__int__(a0, a1, a2, a3): raise NotImplementedError() def SCardTransmit__l...
def check_ticket(char, string, integer): if integer == 20: print(f'ticket "{string}" - {integer/2:.0f}{char} Jackpot!') return True left_part = string[:10] right_part = string[10:] is_found = False left_counter = 0 right_counter = 0 for el in left_part: # 2 "for" ...
""" We need to divide our data set Get a pivot point recursively sort each half of the array """ def particion(arr, low, high): i = (low-1) pivot = arr[high] for j in range(low, high): if arr[j]<= pivot: i = i+1 arr[i], arr[j] = arr[j], arr[i] arr[i+1], arr[high] = arr[high], arr...
# Time: O(nlogn) # Space: O(1) # 1231 biweekly contest 11 10/19/2019 # You have one chocolate bar that consists of some chunks. Each chunk has its own sweetness given by the array sweetness. # # You want to share the chocolate with your K friends so you start cutting the chocolate bar into K+1 pieces using # K cuts, ...
class BaseModelConfig(object): scheduler: dict concurrency_limiter: dict early_stopping: dict score_function: dict reporter: dict tune_best_trial: dict stopper: dict tune_run: dict optuna_search: dict = {} # used for creating groups during train/val split in hp optimizat...
""" Generated Loss CLI parsers """ def binary_crossentropyConfig(argument_parser): """ Set CLI arguments :param argument_parser: argument parser :type argument_parser: ```ArgumentParser``` :returns: argument_parser :rtype: ```ArgumentParser``` """ argument_parser.description = """Com...
name = input() def foo(name): print("Hello, world! Hello, "+name) foo(name)
""" Problem 3: What is the largest prime factor of the number 600851475143 ? """ def is_prime(n): for i in range(2, n // 2 + 1): if n % 2 == 0: return False return True class Prime: def __init__(self): self.curr = 1 def __next__(self): new_next = self.cur...
n = int(input()) flag = True if n == 1 or n == 2: flag = True if n % 2 == 0: flag = False else: i = 3 while i*i <= n: if n % i == 0: flag = False break i += 2 if flag == True: print("N") else: print("S")
def greet(val): return 'Hello, ' + val + '!' print(greet('pah'))
# import libraries here ... model = """ data { int<lower=0> K; // Number of cluster int<lower=0> N; // Number of observations real y[N]; // observations real<lower=0> alpha_shape; real<lower=0> alpha_rate; real<lower=0> sigma_shape; real<lower=0> sigma_rate; } parameters { real mu[K]; // cluster me...
class MyCircularQueue: def __init__(self, k): """ Initialize your data structure here. Set the size of the queue to be k. """ self.q = [None] * (k+1) self.front, self.rear = -1, -1 def enQueue(self, value): """ Insert an element into the circular queue. ...
class Events: ALWAYS = "ALWAYS" ON_LOGIN = "ON_LOGIN" ON_ITEM_DONE = "ON_ITEM_DONE"
# # PySNMP MIB module HM2-DNS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-DNS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:18:37 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, 0...
"""Exceptions when there is a problem with a call to the LBRY daemons.""" def print_request(request): """Print a prepared request to give the user info as to what they're sending. :param request.PreparedRequest request: PreparedRequest object to be printed :return: Nothing """ start = "----------...
class Node: def __init__(self,key): self.key = key self.parent = None self.right = None self.left = None class Tree: def __init__(self): self.root = None self.node = Node(self.root) self.find_node = None def add(self,key): if (self.root ==...
if __name__ == '__main__': with open('train.csv', 'w') as f: for i in range(1, 451): f.write(f'/workspace/data/VCTK-Corpus/wav48/p239/p239_{i:03d}.wav,/workspace/data/VCTK-Corpus/txt/p239/p239_{i:03d}.txt\n') with open('val.csv', 'w') as f: for i in range(451, 476): f.write(f'/workspace/data/VCTK-Corpus/w...
number = int(input()) for a in range(1, 9 + 1): for b in range(1, 9 + 1): for c in range(1, 9 + 1): for d in range(1, 9 + 1): if a + b == c + d and number % (a +b) == 0: print('{0}{1}{2}{3}'.format(a, b, c, d), end=" ")
class DataProcessor(object): def get_train_examples(self, data_dir): raise NotImplementedError() def get_dev_examples(self, data_dir): raise NotImplementedError() def get_test_examples(self, data_dir, data_file_name): raise NotImplementedError() def get_labels(self): ...
"""Same name 2.0 This program has only one variable. Attributes: eggs (str): String denoting global variable. """ eggs = 'global' def spam() -> None: """Spam Reassigns global variable called eggs. Returns: None. """ global eggs eggs = 'spam' #: Reassign global variable. de...
def a(): raise "a" # 文字列を例外として投げる事はできません # ------ def b(): raise Exception("b")
""" coding: utf-8 Created on 11/11/2020 @author: github.com/edrmonteiro From: Hackerrank challenges Language: Python Title: Minimum Swaps 2 You are given an unordered array consisting of consecutive integers [1, 2, 3, ..., n] without any duplicates. You are allowed to swap any two elements. You need to find the mini...
def my_func(name): print(f"this function is {name}") return "ha ha ha" my_func("Carlos's") the_input = int(input("Tell me something: ")) print(the_input + 2)
def get_item_by_name(self, item_name): for item in self.items: if item.item_name == item_name: return item return None def get_item_list_by_name(self, item_name): for item_list in self.item_lists: if item_list.item_name == item_name: return item_list return None...
# -*- coding: utf-8 -*- """ Config parser of the shunt connector. Copyright 2021 Christian Doppler Laboratory for Embedded Machine Learning 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 ...
while True: n = int(input('Quer ver a tabuada de qual valor? (número negativo finaliza programa): ')) print(70 * '_') if n < 0: break for p in range(0, 11): print(f'{p:2} x {n} = {p * n}') print(70 * '_') print('PROGRAMA TABUADA ENCERRADO. Volte sempre!')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 22 18:10:02 2022 @author: victor """ fav_numbers = {'eric': 17, 'ever': 4} for name, number in fav_numbers.items(): print(name + ' loves ' + str(number))
EXAMPLES = { "pyxel": [], "pygame": [], "cli": [], "matplotlib": [], "pyglet": [], "streamlit": [], "kivy": [], } class TestExamples: def test_all_examples_were_registered(self): ... class BaseRunner: def run(self, file): """ Run file """ class T...
#characterization of a linguistic value #it has a belonging function and possibly its inverse function class fuzzy_linguistic_value: #builder (belonging function and its inverse) def __init__(self, function, inverse_function = None): self.function = function self.inverse_function = inverse_func...
s = input() ans = 0 for i in range(len(s) // 2): if s[i] != s[len(s) - 1 - i]: ans += 1 print(ans)
# -*- coding: utf-8 -*-# ''' @Project : ClassicAlgorighthms @File : RadixSort.py @USER : ZZZZZ @TIME : 2021/4/25 14:03 ''' class RadixSort(): ''' 基数排序的方式可以采用LSD(Least significant digital)或MSD(Most significant digital LSD的排序方式由键值的最右边开始,而MSD则相反,由键值的最左边开始。 ''' def __init__...
# test basic await expression # adapted from PEP0492 async def abinary(n): print(n) if n <= 0: return 1 l = await abinary(n - 1) r = await abinary(n - 1) return l + 1 + r o = abinary(4) try: while True: o.send(None) except StopIteration: print('finished')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- print('[+] First Read') with open('file.txt', 'r') as file: print(file.read()) print('\n[+] Second Read') with open('file.txt', 'r') as file: while True: line = file.readline() print(line, end='') if not line: break print('\n...
rows =13 mid=int(rows/2) for row in range(rows): if row <=mid: for blank in range(mid-row): print(" ",end="") for star in range(2*row+1): print("*",end="") else: for blank in range(row-mid): print(" ",end="") for star in range(rows-2*(row-mid)...
#!/usr/bin/env python # # Cloudlet Infrastructure for Mobile Computing # # Author: Kiryong Ha <krha@cmu.edu> # Zhuo Chen <zhuoc@cs.cmu.edu> # # Copyright (C) 2011-2013 Carnegie Mellon University # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in com...
# -*- coding: utf-8 -*- z = 'watevah' def blah(a,k='b'): def blorp(b): print(b) #3 print(a) #4 print(z) #5 print(__name__) #6 l = lambda x: x #def l(x): return x print(l("zoom!")) #1 print(a,k) #2 blorp("boom") blah("floom")
class Solution: """ @param numbers: Give an array numbers of n integer @param target: An integer @return: return the sum of the three integers, the sum closest target. """ def threeSumClosest(self, numbers, target): if len(numbers) < 3: return 0 numbers.sort() ...
#max(x,y) = (x+y+|x-y|)/2 #max(x,y,z) = max(x,max(y,z)) def AlgebraicallyFindMaxTwo(x,y): return(x+y+abs(x-y))/2 AlgebraicallyFindMaxTwo(3,4) def AlgebraicallyFindMaxThree(x,y,z): print (AlgebraicallyFindMaxTwo(AlgebraicallyFindMaxTwo(x,y), z)) AlgebraicallyFindMaxThree(3,4,5)
# common values for app boards MESSAGE_FIELD_SIZE = 8000 BOARD_NAME_SIZE = 30 DESCRIPTION_SIZE = 100 TOPIC_SUBJECT_SIZE = 255 POSTS_PER_PAGE = 2 TOPICS_PER_PAGE = 10 HAS_MANY_PAGES_LIMIT = 3 POST_SUBJECT_SIZE = 255 EXCLUDE_USERS = ['default_user', 'moderator'] MAX_SYMBOLS_ALLOWED = 20 # common values for app newsfeed ...
# # PySNMP MIB module ADTRAN-AOS-MEDIAGATEWAY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-AOS-MEDIAGATEWAY-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:14:04 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
# -*- coding: utf-8 -*- def find_floor(string: str) -> int: floor = 0 for direction in string: if direction == '(': floor += 1 else: floor -= 1 return floor def find_position(string: str) -> int: floor = 0 for i, s in enumerate(string): floor = flo...
def get_input(): with open("input.txt") as f: lines = f.read().splitlines() food_list = [] for line in lines: split = line.split("(") ingredients = set(split[0].split()) allergens = set(split[1][9:-1].split(", ")) food_list.append((ingredients,...
a = int(input()) b = 1 for i in range(1, a + 1): b *= i print(b)
# wczytanie slow with open('../dane/dane.txt') as f: data = [] for line in f.readlines(): data.append(line[:-1]) # licznik liczb parzystych even = 0 for word in data: # zamieniam na male litery, potem na system dziesietny # i wtedy sprawdzam czy jest podzielne przez 2 if int(word.lower(), ...
"""Version file.""" VERSION_INFO = (0, 1, 0, "dev0") __version__ = ".".join((str(version) for version in VERSION_INFO))
#coding: utf-8 #--------------------------------------------------------------------- # Um programa que contém uma função que recebe vários parâmetros com # valores inteiros analizando os valores e retornando o maior deles. #--------------------------------------------------------------------- # Função que descobre...
range_start = 367479 range_stop = 893698 def isvalid(n): ns = str(n) if not len(ns) == 6: return False has_same = False for pos in range(len(ns) - 1): if ns[pos] > ns[pos + 1]: return False if ns[pos] == ns[pos + 1]: has_same = True return has_same ...
def recommend_dictionary(): return {} def coerce_dictionary(): return { "另一種": 20, }