content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class SmokeTestFail(Exception): pass class SmokeTestRegistry(object): def __init__(self): self.tests = {} def register(self, sequence, name): def decorator(fn): self.tests[name] = { 'sequence': sequence, 'test': fn } ret...
class Smoketestfail(Exception): pass class Smoketestregistry(object): def __init__(self): self.tests = {} def register(self, sequence, name): def decorator(fn): self.tests[name] = {'sequence': sequence, 'test': fn} return fn return decorator def __ite...
# Stores JSON schema version, incrementing major/minor number = incompatible CDOT_JSON_VERSION_KEY = "cdot_version" # Keys used in dictionary (serialized to JSON) CONTIG = "contig" CHROM = "chrom" START = "start" END = "stop" STRAND = "strand" BEST_REGION_TYPE_ORDER = ["coding", "5PUTR", "3PUTR", "non coding", "intr...
cdot_json_version_key = 'cdot_version' contig = 'contig' chrom = 'chrom' start = 'start' end = 'stop' strand = 'strand' best_region_type_order = ['coding', '5PUTR', '3PUTR', 'non coding', 'intron']
def int_from_rgb(r, g, b): return (r << 16) + (g << 8) + b def rgb_from_int(color): return ((color >> 16) & 255), ((color >> 8) & 255), (color & 255)
def int_from_rgb(r, g, b): return (r << 16) + (g << 8) + b def rgb_from_int(color): return (color >> 16 & 255, color >> 8 & 255, color & 255)
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Misc.py: Just a sample file with a function. This material is part of this post: http://raccoon.ninja/pt/dev-pt/python-importando-todos-os-arquivos-de-um-diretorio/ """ def hey_ho(): return "Let's go!"
""" Misc.py: Just a sample file with a function. This material is part of this post: http://raccoon.ninja/pt/dev-pt/python-importando-todos-os-arquivos-de-um-diretorio/ """ def hey_ho(): return "Let's go!"
# Runtime: 68 ms, faster than 87.39% of Python3 online submissions for Design Circular Queue. # Memory Usage: 14.5 MB, less than 5.26% of Python3 online submissions for Design Circular Queue. class MyCircularQueue: class Node: def __init__(self, val, prev=None, next=None): self.val = val ...
class Mycircularqueue: class Node: def __init__(self, val, prev=None, next=None): self.val = val self.prev = prev self.next = next def __init__(self, k: int): """ Initialize your data structure here. Set the size of the queue to be k. """ ...
questions = ['''A 2m long stick, when it is at rest, moves past an observer on the ground with a speed of 0.5c. (a) What is the length measured by the observer ? (b) If the same stick moves with the velocity of 0.05c what would be its length measured by the observer ''',''' A small lantern of mass 100 gm is hanged fro...
questions = ['A 2m long stick, when it is at rest, moves past an observer on the ground with a speed of 0.5c.\n(a) What is the length measured by the observer ?\n(b) If the same stick moves with the velocity of 0.05c what would be its length measured by the observer ', ' A small lantern of mass 100 gm is hanged from t...
# Copyright 2014-2017 Insight Software Consortium. # Copyright 2004-2009 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. # See http://www.boost.org/LICENSE_1_0.txt class byte_info(object): """ This class stores information about the byte size and byte align values from a dec...
class Byte_Info(object): """ This class stores information about the byte size and byte align values from a declaration/type. """ def __init__(self): self._byte_size = 0 self._byte_align = 0 @property def byte_size(self): """ Size of this declaration/type i...
pkg_dnf = {} actions = { 'dnf_makecache': { 'command': 'dnf makecache', 'triggered': True, }, } files = { '/etc/dnf/dnf.conf': { 'source': 'dnf.conf', 'mode': '0644', }, } if node.metadata.get('dnf', {}).get('auto_downloads', False): pkg_dnf['yum-cron'] = {} s...
pkg_dnf = {} actions = {'dnf_makecache': {'command': 'dnf makecache', 'triggered': True}} files = {'/etc/dnf/dnf.conf': {'source': 'dnf.conf', 'mode': '0644'}} if node.metadata.get('dnf', {}).get('auto_downloads', False): pkg_dnf['yum-cron'] = {} svc_systemd = {'yum-cron': {'needs': ['pkg_dnf:yum-cron']}} f...
#https://stackabuse.com/parallel-processing-in-python/ def load_deck(deck_loc): deck_list = open('vintage_cube.txt', 'r') deck = Queue() for card in deck_list: deck.put(card) deck_list.close() return deck
def load_deck(deck_loc): deck_list = open('vintage_cube.txt', 'r') deck = queue() for card in deck_list: deck.put(card) deck_list.close() return deck
n=[int(x) for x in input("Enter the numbers with space: ").split()] x=[ ] s=0 for i in range(len(n)): for j in range(i+1,len(n)): x.append((n[i],n[j])) for i in range(int(len(x))): a = min(x[i])+min(x[len(x)-i-1]) if(a>s): s=a print("OUTPUT: ",s)
n = [int(x) for x in input('Enter the numbers with space: ').split()] x = [] s = 0 for i in range(len(n)): for j in range(i + 1, len(n)): x.append((n[i], n[j])) for i in range(int(len(x))): a = min(x[i]) + min(x[len(x) - i - 1]) if a > s: s = a print('OUTPUT: ', s)
class Params (): def __init__(self): print('HotpotQA') self.name = "HotpotQA" ################################ # dataset ################################ data_path = '' DATA_TRAIN = 'train.pkl' DATA_DEV = 'dev.pkl' DATA_TEST = 'dev.pkl' ...
class Params: def __init__(self): print('HotpotQA') self.name = 'HotpotQA' data_path = '' data_train = 'train.pkl' data_dev = 'dev.pkl' data_test = 'dev.pkl' data_debug = 'debug.pkl' dic = 'vocab-elmo.txt' elmo_token = 'ELMO_token_embeddings.hdf5' elmo_options = 'ELM...
""" Call ECMWF eccodes tools for manipulate grib files. https://software.ecmwf.int/wiki/display/ECC/GRIB+tools """ __author__ = "The R & D Center for Weather Forecasting Technology in NMC, CMA" __version__ = '0.1.0'
""" Call ECMWF eccodes tools for manipulate grib files. https://software.ecmwf.int/wiki/display/ECC/GRIB+tools """ __author__ = 'The R & D Center for Weather Forecasting Technology in NMC, CMA' __version__ = '0.1.0'
METHOD = "twoSum" TESTCASES = [ ([2,7,11,15],9), ([-1,-2,-3,-4,-5],-8) ] class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ mem = {} for i in range(len(nums)): x = nums[i] ...
method = 'twoSum' testcases = [([2, 7, 11, 15], 9), ([-1, -2, -3, -4, -5], -8)] class Solution: def two_sum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ mem = {} for i in range(len(nums)): x = nums[i] ...
pkgname = "duktape" pkgver = "2.7.0" pkgrel = 0 build_style = "makefile" make_cmd = "gmake" make_build_args = ["-f", "Makefile.sharedlibrary"] make_install_args = ["-f", "Makefile.sharedlibrary", "INSTALL_PREFIX=/usr"] hostmakedepends = ["gmake", "pkgconf"] pkgdesc = "Embeddeable JavaScript engine" maintainer = "q66 <q...
pkgname = 'duktape' pkgver = '2.7.0' pkgrel = 0 build_style = 'makefile' make_cmd = 'gmake' make_build_args = ['-f', 'Makefile.sharedlibrary'] make_install_args = ['-f', 'Makefile.sharedlibrary', 'INSTALL_PREFIX=/usr'] hostmakedepends = ['gmake', 'pkgconf'] pkgdesc = 'Embeddeable JavaScript engine' maintainer = 'q66 <q...
class Solution: def titleToNumber(self, s): """ :type s: str :rtype: int """ n = len(s) power = n-1 result = 0 for i in range(n): value = ord(s[i])-64 result = result + (value * pow(26, power)) power = power - 1 ...
class Solution: def title_to_number(self, s): """ :type s: str :rtype: int """ n = len(s) power = n - 1 result = 0 for i in range(n): value = ord(s[i]) - 64 result = result + value * pow(26, power) power = power - 1...
config = { 'row_data_path': './data/rel_data.txt', 'triplet_data_path': './data/triplet_data.txt', 'kg_data_path': './output/kg_data.json', 'template_path': './output/template.xlsx', 'url': "http://localhost:7474", 'user': "neo4j", 'password': "123456" }
config = {'row_data_path': './data/rel_data.txt', 'triplet_data_path': './data/triplet_data.txt', 'kg_data_path': './output/kg_data.json', 'template_path': './output/template.xlsx', 'url': 'http://localhost:7474', 'user': 'neo4j', 'password': '123456'}
class Villager: def __init__(self, number, books): self.number = number self.books = books self.goodTrades = [] def getNumber(self): return self.number def getBooks(self): return self.books def addGoodTrade(self, book): self.goodTrades.append(bo...
class Villager: def __init__(self, number, books): self.number = number self.books = books self.goodTrades = [] def get_number(self): return self.number def get_books(self): return self.books def add_good_trade(self, book): self.goodTrades.append(book)...
class Solution: def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ if not digits: return [] result = [] self.backtrack(result, '', digits) return result def backtrack(self, result, combination, d...
class Solution: def letter_combinations(self, digits): """ :type digits: str :rtype: List[str] """ if not digits: return [] result = [] self.backtrack(result, '', digits) return result def backtrack(self, result, combination, digits):...
#!/usr/bin/env python3 def lookandsay(n): acc = [(1,n[0])] for c in n[1:]: count, num = acc[-1] if num == c: acc[-1] = (count+1, num) else: acc += [(1, c)] return "".join(["".join((str(x),y)) for (x,y) in acc]) seed = "3113322113" for i in range(50): see...
def lookandsay(n): acc = [(1, n[0])] for c in n[1:]: (count, num) = acc[-1] if num == c: acc[-1] = (count + 1, num) else: acc += [(1, c)] return ''.join([''.join((str(x), y)) for (x, y) in acc]) seed = '3113322113' for i in range(50): seed = lookandsay(see...
class ControllerToWorkerMessage(object): """ Class defines the message sent from the controller to the workers. It takes a task as defined by the user and then sends it. This class assumes that the generated tasks are PICKLEABLE although it does not explicitly check. """ TASK_KEY = "task" ...
class Controllertoworkermessage(object): """ Class defines the message sent from the controller to the workers. It takes a task as defined by the user and then sends it. This class assumes that the generated tasks are PICKLEABLE although it does not explicitly check. """ task_key = 'task' ...
# encoding: utf-8 """ Package with various simple non-GUI utilities. The modules and objects defined in this package have no dependencies on other parts of madgui and are neither subscribers nor submitters of any events. They should also have little to no dependencies on non-standard 3rd party modules. """
""" Package with various simple non-GUI utilities. The modules and objects defined in this package have no dependencies on other parts of madgui and are neither subscribers nor submitters of any events. They should also have little to no dependencies on non-standard 3rd party modules. """
class RBI: def __init__(self, fmeca): self.fmeca = fmeca self._generate_rbi() def _generate_rbi(self): # TODO: Add rbi logic (from risk_calculator but modified to take a # fmeca argument and loop through each inspection type) if self._total_risk is None: ...
class Rbi: def __init__(self, fmeca): self.fmeca = fmeca self._generate_rbi() def _generate_rbi(self): if self._total_risk is None: print('Calculating total component risk.') self._total_risk = 0 for subcomponent in self.subcomponents: ...
def parse(it): result = [] while True: try: tk = next(it) except StopIteration: break if tk == '}': break val = next(it) if val == '{': result.append((tk,parse(it))) else: result.append((tk, val)) r...
def parse(it): result = [] while True: try: tk = next(it) except StopIteration: break if tk == '}': break val = next(it) if val == '{': result.append((tk, parse(it))) else: result.append((tk, val)) re...
kminicial = float(input('Insira a km inicial: ')) kmatual = float(input('insira a km atual: ')) dias = int(input('Quantos dias ficou alugado? ')) kmpercorrido = kmatual - kminicial rkm = kmpercorrido * 0.15 rdias = dias * 60 total = rkm+rdias print ('O total de km percorrido foi: {}. A quantidade de dias utilizado foi...
kminicial = float(input('Insira a km inicial: ')) kmatual = float(input('insira a km atual: ')) dias = int(input('Quantos dias ficou alugado? ')) kmpercorrido = kmatual - kminicial rkm = kmpercorrido * 0.15 rdias = dias * 60 total = rkm + rdias print('O total de km percorrido foi: {}. A quantidade de dias utilizado foi...
attribute_filter_parameter_schema = [ { 'name': 'search', 'in': 'query', 'required': False, 'description': 'Lucene query syntax string for use with Elasticsearch. ' 'See <a href=https://www.elastic.co/guide/en/elasticsearch/' 'reference/7...
attribute_filter_parameter_schema = [{'name': 'search', 'in': 'query', 'required': False, 'description': 'Lucene query syntax string for use with Elasticsearch. See <a href=https://www.elastic.co/guide/en/elasticsearch/reference/7.10/query-dsl-query-string-query.html#query-string-syntax>reference</a>. This search strin...
def get_max_profit(prices, fee, reserve=0, buyable=True): if not prices: return reserve price_offset = -prices[0] - fee if buyable else prices[0] return max( get_max_profit(prices[1:], fee, reserve, buyable), get_max_profit(prices[1:], fee, reserve + price_offset, not buyable) )...
def get_max_profit(prices, fee, reserve=0, buyable=True): if not prices: return reserve price_offset = -prices[0] - fee if buyable else prices[0] return max(get_max_profit(prices[1:], fee, reserve, buyable), get_max_profit(prices[1:], fee, reserve + price_offset, not buyable)) assert get_max_profit(...
# ============================================================================= # Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/ # FileName: 11056.py # Description: UVa Online Judge - 11056 # ============================================================================= while True: ...
while True: try: n = int(input()) except EOFError: break a = [] for i in range(N): line = input() (name, time_str) = line.split(' : ') time_token = time_str.split() time = 60 * 1000 * int(time_token[0]) + 1000 * int(time_token[2]) + int(time_token[4]) ...
""" Ex 48 - Create a multiplication table """ # Enter the number t = int(input('Enter the number to be calculated on the multiplication table: ')) print('-=' * 8) # Loop and Calculation for c in range(1, 11): print(f'||{c} x {t:2} =\t{t * c}||') print('-=' * 8) input('Enter to exit')
""" Ex 48 - Create a multiplication table """ t = int(input('Enter the number to be calculated on the multiplication table: ')) print('-=' * 8) for c in range(1, 11): print(f'||{c} x {t:2} =\t{t * c}||') print('-=' * 8) input('Enter to exit')
class ModbusException(Exception): @staticmethod def fromExceptionCode(exception_code: int): if exception_code == 1: return IllegalFunctionError elif exception_code == 2: return IllegalDataAddressError elif exception_code == 3: return IllegalDataValueError elif exception_code == 4: ...
class Modbusexception(Exception): @staticmethod def from_exception_code(exception_code: int): if exception_code == 1: return IllegalFunctionError elif exception_code == 2: return IllegalDataAddressError elif exception_code == 3: return IllegalDataValu...
"""Contants for Hitachi Smart App integration""" DOMAIN = "Hitachi_smart_app" #PLATFORMS = ["humidifier", "sensor", "number", "climate","fan"] PLATFORMS = ["humidifier","sensor","number","fan","climate","switch"] MANUFACTURER = "Hitachi" DEFAULT_NAME = "Hitachi Smart Application" DEVICE_TYPE_AC = 0x01 DEVICE_TYPE_DEH...
"""Contants for Hitachi Smart App integration""" domain = 'Hitachi_smart_app' platforms = ['humidifier', 'sensor', 'number', 'fan', 'climate', 'switch'] manufacturer = 'Hitachi' default_name = 'Hitachi Smart Application' device_type_ac = 1 device_type_dehumidifier = 4 data_client = 'client' data_coordinator = 'coordina...
# aoc 2020 day 9 def two_sum(val, lst): for x in lst: for y in lst: if x + y == val: return True return False prelude_len = 25 with open("aoc_2020_9.in") as f: data = f.readlines() data = list(map(int, data)) part_one_answer = 0 for idx in range(prelude_len, len(dat...
def two_sum(val, lst): for x in lst: for y in lst: if x + y == val: return True return False prelude_len = 25 with open('aoc_2020_9.in') as f: data = f.readlines() data = list(map(int, data)) part_one_answer = 0 for idx in range(prelude_len, len(data)): preceding = da...
# # PySNMP MIB module A3COM-SWITCHING-SYSTEMS-FDDI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-SWITCHING-SYSTEMS-FDDI-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:08:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pyt...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) ...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def __init__(self): self.result = [] def rightSideView(self, root): """ :type root: TreeNode...
class Solution(object): def __init__(self): self.result = [] def right_side_view(self, root): """ :type root: TreeNode :rtype: List[int] """ self.travel(root, 1) return self.result def travel(self, tree_node, depth): if tree_node is None: ...
N = int(input()) with open('applicant_list.txt', 'r') as f: data = f.readlines() data = [d.split() for d in data] for d in data: for i in range(2, 7): d[i] = float(d[i]) def sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam): """ exam = 2 --> phy --> phy + math exam = ...
n = int(input()) with open('applicant_list.txt', 'r') as f: data = f.readlines() data = [d.split() for d in data] for d in data: for i in range(2, 7): d[i] = float(d[i]) def sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam): """ exam = 2 --> phy --> phy + math exam = 3 ...
# Huu Hung Nguyen # 12/07/2021 # Nguyen_HuuHung_freq_distribution.py # The program takes a numbers list and creates a frequency distribution table. # It then display the frequency distribution table. def get_max(data_list): ''' Take a data list and return its maximum data. ''' # Determine the num...
def get_max(data_list): """ Take a data list and return its maximum data. """ n = len(data_list) if n == 0: max_data = 0 else: max_data = data_list[0] for data in data_list[1:]: if data > max_data: max_data = data return max_data def get_min(data_...
n = int(input()) data = list(map(int,input().split())) one , two , three = [] , [] , [] for i in range(len(data)): if data[i] == 1: one.append(i+1) elif data[i] == 2: two.append(i+1) else: three.append(i+1) teams = min(len(one),len(two),len(three)) print(teams) for i in range(teams):...
n = int(input()) data = list(map(int, input().split())) (one, two, three) = ([], [], []) for i in range(len(data)): if data[i] == 1: one.append(i + 1) elif data[i] == 2: two.append(i + 1) else: three.append(i + 1) teams = min(len(one), len(two), len(three)) print(teams) for i in rang...
one_char = ["!", "#", "%", "&", "\\", "'", "(", ")", "*", "+", "-", ".", "/", ":", ";", "<", "=", ">", "?", "[", "]", "^", "{", "|", "}", "~", ","] # they must be ordered by length decreasing multi_char = ["...", "::", ">>=", "<<=", ">>>", "<<<", "===", "!=", "==", "===", "<=", ">=", "*=", "&&", "-=", "+=",...
one_char = ['!', '#', '%', '&', '\\', "'", '(', ')', '*', '+', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '^', '{', '|', '}', '~', ','] multi_char = ['...', '::', '>>=', '<<=', '>>>', '<<<', '===', '!=', '==', '===', '<=', '>=', '*=', '&&', '-=', '+=', '||', '--', '++', '|=', '&=', '%=', '/=', '^=', '::'] ...
class MachopCommand(object): def shutdown(self): pass def cleanup(self): pass
class Machopcommand(object): def shutdown(self): pass def cleanup(self): pass
INPUT_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Deriva Demo Input", "description": ("Input schema for the demo DERIVA ingest Action Provider. This Action " "Provider can restore a DERIVA backup to a new or existing catalog, " "or creat...
input_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'Deriva Demo Input', 'description': 'Input schema for the demo DERIVA ingest Action Provider. This Action Provider can restore a DERIVA backup to a new or existing catalog, or create a new DERIVA catalog from a BDBag containing TableSchema.'...
class TestClassConverter: @classmethod def setup_class(cls): print("\nsetup_class: setup any state specific to the execution of the given class\n") @classmethod def teardown_class(cls): print("\nteardown_class: teardown any state that was previously setup with a call to setup_class....
class Testclassconverter: @classmethod def setup_class(cls): print('\nsetup_class: setup any state specific to the execution of the given class\n') @classmethod def teardown_class(cls): print('\nteardown_class: teardown any state that was previously setup with a call to setup_class.\n'...
# model settings norm_cfg = dict(type='GN', num_groups=32, requires_grad=True) model = dict( type='TDN', pretrained='modelzoo://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'), ne...
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True) model = dict(type='TDN', pretrained='modelzoo://resnet50', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'), neck=dict(type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=...
# convert a decimal number to bukiyip. def decimal_to_bukiyip(a): bukiyip = '' quotient = 2000000 while quotient > 0: quotient = a // 3 remainder = a % 3 bukiyip += str(remainder) a = quotient return bukiyip[::-1] # convert a bukiyip number to decimal def bukiyip_to_d...
def decimal_to_bukiyip(a): bukiyip = '' quotient = 2000000 while quotient > 0: quotient = a // 3 remainder = a % 3 bukiyip += str(remainder) a = quotient return bukiyip[::-1] def bukiyip_to_decimal(a): decimal = 0 string_a = str(a) power = 0 for i in stri...
# -*- coding: utf-8 -*- # Authors: Y. Jia <ytjia.zju@gmail.com> """ Sort a linked list in O(n log n) time using constant space complexity. https://leetcode.com/problems/sort-list/description/ """ # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x s...
""" Sort a linked list in O(n log n) time using constant space complexity. https://leetcode.com/problems/sort-list/description/ """ class Listnode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def sort_list(self, head): """ :type head:...
expected_output = { 'type': { 'IP route': { 'address': '10.21.12.0', 'mask': '255.255.255.0', 'state': 'Down', 'state_description': 'no ip route', 'delayed': { 'delayed_state': 'Up', 'secs_remaining': 1.0, ...
expected_output = {'type': {'IP route': {'address': '10.21.12.0', 'mask': '255.255.255.0', 'state': 'Down', 'state_description': 'no ip route', 'delayed': {'delayed_state': 'Up', 'secs_remaining': 1.0, 'connection_state': 'connected'}, 'change_count': 1, 'last_change': '00:00:24'}}, 'delay_up_secs': 20.0, 'delay_down_s...
# Open terminal > python3 condition.py # Start typing below commands and see the output x = int(input('Please enter an integer: ')) if x < 0: print(str(x) + ' is a negative number') elif x == 0: print(str(x) + ' is zero') else: print(str(x) + ' is a positive number')
x = int(input('Please enter an integer: ')) if x < 0: print(str(x) + ' is a negative number') elif x == 0: print(str(x) + ' is zero') else: print(str(x) + ' is a positive number')
""" Calculator library containing basic math operations. """ class Calculator: def add(self, first_term, second_term): return first_term + second_term def subtract(self, first_term, second_term): return first_term - second_term def divide(self, first_term, second_term): return fi...
""" Calculator library containing basic math operations. """ class Calculator: def add(self, first_term, second_term): return first_term + second_term def subtract(self, first_term, second_term): return first_term - second_term def divide(self, first_term, second_term): return fi...
class Stopwatch(object): """ Provides a set of methods and properties that you can use to accurately measure elapsed time. Stopwatch() """ @staticmethod def GetTimestamp(): """ GetTimestamp() -> Int64 Gets the current number of ticks in the timer mechanism. Re...
class Stopwatch(object): """ Provides a set of methods and properties that you can use to accurately measure elapsed time. Stopwatch() """ @staticmethod def get_timestamp(): """ GetTimestamp() -> Int64 Gets the current number of ticks in the timer mechanism. Returns: A long int...
name0_0_1_1_0_0_0 = None name0_0_1_1_0_0_1 = None name0_0_1_1_0_0_2 = None name0_0_1_1_0_0_3 = None name0_0_1_1_0_0_4 = None
name0_0_1_1_0_0_0 = None name0_0_1_1_0_0_1 = None name0_0_1_1_0_0_2 = None name0_0_1_1_0_0_3 = None name0_0_1_1_0_0_4 = None
""" <<>> __enter__() <<>> -> Called on a context manager just before entering the with-block -> The return value is bound the as-variable. -> May return any value it wants, including None. -> Commonly returns the context manager itself. <<>> __exit__() <<>> -> Executed after the with-block terminates -> Handles except...
""" <<>> __enter__() <<>> -> Called on a context manager just before entering the with-block -> The return value is bound the as-variable. -> May return any value it wants, including None. -> Commonly returns the context manager itself. <<>> __exit__() <<>> -> Executed after the with-block terminates -> Handles except...
if float(input()) < 16 : print('Master' if input() == 'm' else 'Miss') else: print('Mr.' if input() == 'm' else 'Ms.')
if float(input()) < 16: print('Master' if input() == 'm' else 'Miss') else: print('Mr.' if input() == 'm' else 'Ms.')
""" Module to demonstrate how to modify a list in a for-loop. This function does not use the accumulator pattern, because we are not trying to make a new list. Instead, we wish to modify the original list. Note that you should never modify the list you are looping over (this is bad practice). So we loop over the ran...
""" Module to demonstrate how to modify a list in a for-loop. This function does not use the accumulator pattern, because we are not trying to make a new list. Instead, we wish to modify the original list. Note that you should never modify the list you are looping over (this is bad practice). So we loop over the ran...
fruit = {"orange":"a sweet, orange, citrus fruit", "apple": " good for making cider", "lemon":"a sour, yellow citrus fruit", "grape":"a small, sweet fruit growing in bunches", "lime": "a sour, green citrus fruit", "lime":"its yellow"} print(fruit) # .items will pr...
fruit = {'orange': 'a sweet, orange, citrus fruit', 'apple': ' good for making cider', 'lemon': 'a sour, yellow citrus fruit', 'grape': 'a small, sweet fruit growing in bunches', 'lime': 'a sour, green citrus fruit', 'lime': 'its yellow'} print(fruit) print(fruit.items()) f_tuple = tuple(fruit.items()) print(f_tuple) f...
def isPalindrome(s): s = s.lower() holdit = "" for charac in s: if charac.isalpha(): holdit+=charac i=0 j=len(holdit)-1 while i<=j: if holdit[i]!=holdit[j]: return False i+=1 j-=1 return True s = "0P" print(isPalindrome(s))
def is_palindrome(s): s = s.lower() holdit = '' for charac in s: if charac.isalpha(): holdit += charac i = 0 j = len(holdit) - 1 while i <= j: if holdit[i] != holdit[j]: return False i += 1 j -= 1 return True s = '0P' print(is_palindrom...
############################################################################## # # Copyright (c) 2003-2020 by The University of Queensland # http://www.uq.edu.au # # Primary Business: Queensland, Australia # Licensed under the Apache License, version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # # Development unt...
escript_opts_version = 203 openmp = True umfpack = True umfpack_prefix = ['/usr/include/suitesparse', '/usr/lib'] umfpack_libs = ['umfpack', 'blas', 'amd'] pythoncmd = '/usr/bin/python3' pythonlibname = 'python3.8' pythonlibpath = '/usr/lib/x86_64-linux-gnu/' pythonincpath = '/usr/include/python3.8' boost_python = 'boo...
def trace_get_attributes(cls: type): class Wrapper: def __init__(self, *args, **kwargs): self.wrapped = cls(*args, **kwargs) def __getattr__(self, item): result = getattr(self.wrapped, item) print(f"-- getting attribute '{item}' = {result}") return res...
def trace_get_attributes(cls: type): class Wrapper: def __init__(self, *args, **kwargs): self.wrapped = cls(*args, **kwargs) def __getattr__(self, item): result = getattr(self.wrapped, item) print(f"-- getting attribute '{item}' = {result}") return ...
class Controller: def __init__(self, cfg): self.internal = 0 # self.update_period = cfg.policy.params.period self.last_action = None def reset(self): raise NotImplementedError("Subclass must implement this function") def get_action(self, state): raise NotImplement...
class Controller: def __init__(self, cfg): self.internal = 0 self.last_action = None def reset(self): raise not_implemented_error('Subclass must implement this function') def get_action(self, state): raise not_implemented_error('Subclass must implement this function')
""" Exception classes for subway. """ # TODO: more organized and hierachical exceptions. class SubwayException(Exception): def __init__(self, message, code=10): """ :param message: str. :param code: int. 10 general, 11 jobid unmatch, 12 only valid for general without id 13 no ...
""" Exception classes for subway. """ class Subwayexception(Exception): def __init__(self, message, code=10): """ :param message: str. :param code: int. 10 general, 11 jobid unmatch, 12 only valid for general without id 13 no such atrribute in history of conf """ ...
#!usr/bin/python # -*- coding:utf8 -*- class Cat(object): def say(self): print("I am a cat") class Dog(object): def say(self): print("I am a dog") def __getitem__(self, item): return "bobby" class Duck(object): def say(self): print("I am a duck") # animal = Cat # ani...
class Cat(object): def say(self): print('I am a cat') class Dog(object): def say(self): print('I am a dog') def __getitem__(self, item): return 'bobby' class Duck(object): def say(self): print('I am a duck') animal_list = [Cat, Dog, Duck] for animal in animal_list: ...
# coding=utf-8 # /usr/bin/env python ''' Author: wenqiangw Email: wenqiangw@opera.com Date: 2020-07-30 11:05 Desc: '''
""" Author: wenqiangw Email: wenqiangw@opera.com Date: 2020-07-30 11:05 Desc: """
name = 'tinymce4' authors = 'Joost Cassee, Aljosa Mohorovic' version = '3.0.2' release = version
name = 'tinymce4' authors = 'Joost Cassee, Aljosa Mohorovic' version = '3.0.2' release = version
#!/usr/bin/python3 def solution(A): if not A: return 0 max_profit = 0 min_value = A[0] for a in A: max_profit = max(max_profit, a - min_value) min_value = min(min_value, a) return max_profit
def solution(A): if not A: return 0 max_profit = 0 min_value = A[0] for a in A: max_profit = max(max_profit, a - min_value) min_value = min(min_value, a) return max_profit
#-*- coding : utf-8 -*- class Distribute(object): def __init__(self): self.__layout = 0 self.__funcs = {list:self._list, dict:self._dict} @property def funcs(self): return self.__funcs def _drowTab( self, tab, add=' |' ): add = add * tab return " {add}".format(**locals()) def _dict( self, data, tab ):...
class Distribute(object): def __init__(self): self.__layout = 0 self.__funcs = {list: self._list, dict: self._dict} @property def funcs(self): return self.__funcs def _drow_tab(self, tab, add=' |'): add = add * tab return ' {add}'.format(**locals()) def _d...
"""TensorFlow project.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def deps(prefix = ""): http_archive( name = "com_google_farmhash", build_file = prefix + "//third_party/farmhash:farmhash.BUILD", strip_prefix = "farmhash-master", # Does not have any rel...
"""TensorFlow project.""" load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def deps(prefix=''): http_archive(name='com_google_farmhash', build_file=prefix + '//third_party/farmhash:farmhash.BUILD', strip_prefix='farmhash-master', urls=['https://github.com/google/farmhash/archive/master.zip'], s...
s = input().lower() search = input().lower().strip() str_list = [] # Tokenize token = "" for c in s: if c not in [' ','\'','"','.',',']: token += c else: if len(token) > 0: str_list.append(token) token = "" if len(token) > 0: str_list.append(token) # Search print('Fou...
s = input().lower() search = input().lower().strip() str_list = [] token = '' for c in s: if c not in [' ', "'", '"', '.', ',']: token += c elif len(token) > 0: str_list.append(token) token = '' if len(token) > 0: str_list.append(token) print('Found' if search in str_list else 'Not F...
def multiply(a, b): return a * b result = multiply(2,3) print(result)
def multiply(a, b): return a * b result = multiply(2, 3) print(result)
'''https://leetcode.com/problems/decode-string/''' class Solution: def decodeString(self, s: str) -> str: stack = [] curNum = 0 curStr = '' for i in s: if i=='[': stack.append(curStr) stack.append(curNum) curNum = 0 ...
"""https://leetcode.com/problems/decode-string/""" class Solution: def decode_string(self, s: str) -> str: stack = [] cur_num = 0 cur_str = '' for i in s: if i == '[': stack.append(curStr) stack.append(curNum) cur_num = 0 ...
''' Backward method to solve 1D reaction-diffusion equation: u_t = k * u_xx with Neumann boundary conditions at x=0: u_x(0,t) = 0 = sin(2*np.pi) at x=L: u_x(L,t) = 0 = sin(2*np.pi) with L = 1 and initial conditions: u(x,0) = (1.0/2.0)+ np.cos(2.0*np.pi*x) - (1.0/2.0)*np.cos(3*np.pi*x) u_x(x,t) = (-4.0*(...
""" Backward method to solve 1D reaction-diffusion equation: u_t = k * u_xx with Neumann boundary conditions at x=0: u_x(0,t) = 0 = sin(2*np.pi) at x=L: u_x(L,t) = 0 = sin(2*np.pi) with L = 1 and initial conditions: u(x,0) = (1.0/2.0)+ np.cos(2.0*np.pi*x) - (1.0/2.0)*np.cos(3*np.pi*x) u_x(x,t) = (-4.0*(...
test_input = """7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 22 13 17 11 0 8 2 23 4 24 21 9 14 16 7 6 10 3 18 5 1 12 20 15 19 3 15 0 2 22 9 18 13 17 5 19 8 7 25 23 20 11 10 24 4 14 21 16 12 6 14 21 17 24 4 10 16 15 9 19 18 8 23 26 20 22 11 13 6 5 2 0 12 3 7 """ ...
test_input = '7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1\n\n22 13 17 11 0\n 8 2 23 4 24\n21 9 14 16 7\n 6 10 3 18 5\n 1 12 20 15 19\n\n 3 15 0 2 22\n 9 18 13 17 5\n19 8 7 25 23\n20 11 10 24 4\n14 21 16 12 6\n\n14 21 17 24 4\n10 16 15 9 19\n18 8 23 26 20\n22 11 13 6 5\n 2 ...
#!/usr/bin/python3 ''' Program: This is a table of environment variable of deep learning python. Usage: import DL_conf.py // in your deep learning python program editor Jacob975 20180123 ################################# update log 20180123 version alpha 1: Hello!, just a test ''' # Comment of what ki...
""" Program: This is a table of environment variable of deep learning python. Usage: import DL_conf.py // in your deep learning python program editor Jacob975 20180123 ################################# update log 20180123 version alpha 1: Hello!, just a test """ path_of_python = '/usr/bin/python3' path...
n = int(input()) i = 2 while n != 1: if n%i == 0: n//=i;print(i) else: i+=1
n = int(input()) i = 2 while n != 1: if n % i == 0: n //= i print(i) else: i += 1
def extractAdamantineDragonintheCrystalWorld(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Crystal World' in item['tags']: return buildReleaseMessageWithType(item, 'Adamantine Dragon i...
def extract_adamantine_dragoninthe_crystal_world(item): """ """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Crystal World' in item['tags']: return build_release_messag...
class ManipulationDelta(object): """ Contains transformation data that is accumulated when manipulation events occur. ManipulationDelta(translation: Vector,rotation: float,scale: Vector,expansion: Vector) """ @staticmethod def __new__(self,translation,rotation,scale,expansion): """ __new__(cls: type...
class Manipulationdelta(object): """ Contains transformation data that is accumulated when manipulation events occur. ManipulationDelta(translation: Vector,rotation: float,scale: Vector,expansion: Vector) """ @staticmethod def __new__(self, translation, rotation, scale, expansion): """ __new...
""" Meta information for this project """ __project__ = 'Croesus' __version__ = '0.1.1' __author__ = 'Brian Lusina' __email__ = 'lusinabrian@gmail.com' __url__ = 'http://croesus.com' __copyright__ = 'Brian Lusina'
""" Meta information for this project """ __project__ = 'Croesus' __version__ = '0.1.1' __author__ = 'Brian Lusina' __email__ = 'lusinabrian@gmail.com' __url__ = 'http://croesus.com' __copyright__ = 'Brian Lusina'
def best_par_in_df(search_df): ''' This function takes as input a pandas dataframe containing the inference results (saved in a file having 'search_history.csv' ending) and returns the highest-likelihood parameters set that was found during the search. Args: - search_df (pandas DataFrame object...
def best_par_in_df(search_df): """ This function takes as input a pandas dataframe containing the inference results (saved in a file having 'search_history.csv' ending) and returns the highest-likelihood parameters set that was found during the search. Args: - search_df (pandas DataFrame object...
class Solution: def numFriendRequests(self, ages: List[int]) -> int: """Hash table. """ c = collections.Counter(ages) res = 0 for ka, va in c.items(): for kb, vb in c.items(): if kb > 0.5 * ka + 7 and kb <= ka: if ka == kb: ...
class Solution: def num_friend_requests(self, ages: List[int]) -> int: """Hash table. """ c = collections.Counter(ages) res = 0 for (ka, va) in c.items(): for (kb, vb) in c.items(): if kb > 0.5 * ka + 7 and kb <= ka: if ka == k...
class Config(object): DEBUG = False TESTING = False SQLALCHEMY_TRACK_MODIFICATIONS = False class Production(Config): SQLALCHEMY_DATABASE_URI = '<Production DB URL>' class Development(Config): # psql postgresql://Nghi:nghi1996@localhost/postgres DEBUG = True SQLALCHEMY_DATABASE_URI = 'pos...
class Config(object): debug = False testing = False sqlalchemy_track_modifications = False class Production(Config): sqlalchemy_database_uri = '<Production DB URL>' class Development(Config): debug = True sqlalchemy_database_uri = 'postgresql://Nghi:nghi1996@localhost/postgres' sqlalchemy_...
def rotateImage(a): size = len(a) b = [] for col in range(size): temp = [] for row in reversed(range(size)): temp.append(a[row][col]) b.append(temp) return b if __name__ == '__main__': a = [ [1,2,3], [4,5,6], [7,8,9], ] print(rota...
def rotate_image(a): size = len(a) b = [] for col in range(size): temp = [] for row in reversed(range(size)): temp.append(a[row][col]) b.append(temp) return b if __name__ == '__main__': a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print(rotate_image(a))
class Context: def time(self): raise NotImplemented def user(self): raise NotImplemented class DefaultContext(Context): def __init__(self, current_time, current_user_id): super(DefaultContext, self).__init__() self.current_time = current_time self.current_user_id...
class Context: def time(self): raise NotImplemented def user(self): raise NotImplemented class Defaultcontext(Context): def __init__(self, current_time, current_user_id): super(DefaultContext, self).__init__() self.current_time = current_time self.current_user_id ...
# This program knows about the schedule for a conference that runs over the # course of a day, with sessions in different tracks in different rooms. Given # a room and a time, it can tell you which session starts at that time. # # Usage: # # $ python conference_schedule.py [room] [time] # # For instance: # # $ python ...
schedule = {'Main Hall': {'10:00': 'Django REST framework', '11:00': 'Lessons learned from PHP', '12:00': "Tech interviews that don't suck", '14:00': 'Taking control of your Bluetooth devices', '15:00': "Fast Python? Don't Bother!", '16:00': 'Test-Driven Data Analysis'}, 'Seminar Room': {'10:00': 'Python in my Science ...
"grpc_py_library.bzl provides a py_library for grpc files." load("@rules_python//python:defs.bzl", "py_library") def grpc_py_library(**kwargs): py_library(**kwargs)
"""grpc_py_library.bzl provides a py_library for grpc files.""" load('@rules_python//python:defs.bzl', 'py_library') def grpc_py_library(**kwargs): py_library(**kwargs)
#Conceito Mec l=int(input()) p=int(input()) r= p / l if r <= 8: print("A") elif 9 <= r <= 12: print("B") elif 13 <= r <= 18: print("C") elif r > 18: print("D")
l = int(input()) p = int(input()) r = p / l if r <= 8: print('A') elif 9 <= r <= 12: print('B') elif 13 <= r <= 18: print('C') elif r > 18: print('D')
""" Metainf block field registrations. The META_FIELDS dictionary registers allowable fields in the markdown metainf block as well as the type and default value. The dictionary structure is defined as ``` META_FIELDS = { 'camel_cased_field_name': ('python_type', default_value) } ``` """ META_FIELDS = { 'titl...
""" Metainf block field registrations. The META_FIELDS dictionary registers allowable fields in the markdown metainf block as well as the type and default value. The dictionary structure is defined as ``` META_FIELDS = { 'camel_cased_field_name': ('python_type', default_value) } ``` """ meta_fields = {'title': (...
## inotify_init1 flags. IN_CLOEXEC = 0o2000000 IN_NONBLOCK = 0o0004000 ## Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. IN_ACCESS = 0x00000001 IN_MODIFY = 0x00000002 IN_ATTRIB = 0x00000004 IN_CLOSE_WRITE = 0x00000008 IN_CLOSE_NOWRITE = 0x00000010 IN_OPEN = 0x0000...
in_cloexec = 524288 in_nonblock = 2048 in_access = 1 in_modify = 2 in_attrib = 4 in_close_write = 8 in_close_nowrite = 16 in_open = 32 in_moved_from = 64 in_moved_to = 128 in_create = 256 in_delete = 512 in_delete_self = 1024 in_move_self = 2048 in_close = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE in_move = IN_MOVED_FROM | IN_...
def costodepasajes(): #definir variables y otros montoP=0 #datos de entrada cantidadX=int(input("ingrese la cantidad de estudiantes:")) #proceso if cantidadX>=100: montoP=cantidadX*20 elif cantidadX<100 and cantidadX>49: montoP=cantidadX*35 elif cantidadX<50 and cantidadX>19: montoP=cantidad...
def costodepasajes(): monto_p = 0 cantidad_x = int(input('ingrese la cantidad de estudiantes:')) if cantidadX >= 100: monto_p = cantidadX * 20 elif cantidadX < 100 and cantidadX > 49: monto_p = cantidadX * 35 elif cantidadX < 50 and cantidadX > 19: monto_p = cantidadX * 40 ...
mylist=[] #python now knows it is a 1D list mylist.append(5) #append is to add a thing to the end print(mylist) #will print only 5 mylist.append(6) print(mylist) #will print 5 AND 6 mylist[1]=7 #value 7 will overwrite the value in position 1 of mylist (which is 6) num=int(input("Enter number to append to the list")) ...
mylist = [] mylist.append(5) print(mylist) mylist.append(6) print(mylist) mylist[1] = 7 num = int(input('Enter number to append to the list')) mylist.append(num) print('Unsorted List is ', mylist) print(mylist[2]) mylist.sort() print('Sorted list is ', mylist) looplist = [] for i in range(10): looplist.append(int(i...
# HEAD # Classes - Polymorphism # DESCRIPTION # Describes how to create polymorphism using classes # RESOURCES # # Creating Parent class class Parent(): par_cent = "parent" def p_method(self): print("Parent Method invoked with par_cent", self.par_cent) return self.par_cent # Inheriting...
class Parent: par_cent = 'parent' def p_method(self): print('Parent Method invoked with par_cent', self.par_cent) return self.par_cent class Childone(Parent): chi_one_cent = 'childtwo' def c_one_method(self): print('Child Method invoked with chi_one_cent', self.chi_one_cent) ...
# Information connected to the email account email = "email@website.com" password = "password" server = "server.website.com" port = 25 # The folder with settings (rss-links.txt and time.txt) folder = "path to folder"
email = 'email@website.com' password = 'password' server = 'server.website.com' port = 25 folder = 'path to folder'
## Copyright 2021 InferStat Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
""" Directory for example scripts showing usages of InferTrade. """
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'and closedBra closedParen coma comment div do doubleColon doubleEquals elif else end endline equals exit id if int integer less lessEquals minus more moreEquals mul not...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'and closedBra closedParen coma comment div do doubleColon doubleEquals elif else end endline equals exit id if int integer less lessEquals minus more moreEquals mul not notEquals openBra openParen or parens plus print program rea read real string subroutine swap...
__author__ = 'cosmin' class Validator: def __init__(self): pass
__author__ = 'cosmin' class Validator: def __init__(self): pass
catalogue = { 'iphone': { 'X': 800, 'XR': 900, '11': 1000, '12': 1200, }, 'ipad': { 'mini': 400, 'air': 500, 'pro': 800, }, 'mac': { 'macbook air': 999, 'macbook': 1299, ...
catalogue = {'iphone': {'X': 800, 'XR': 900, '11': 1000, '12': 1200}, 'ipad': {'mini': 400, 'air': 500, 'pro': 800}, 'mac': {'macbook air': 999, 'macbook': 1299, 'macbook pro': 1799}} for (key, value) in catalogue.items(): print('-' * 10) print(key) for (k, v) in value.items(): print(k, '', v) print...
def recurse(n, s): """ Calculates n factorial recursively """ if n == 0: print(s) else: recurse(n-1, n+s) recurse(3, 0)
def recurse(n, s): """ Calculates n factorial recursively """ if n == 0: print(s) else: recurse(n - 1, n + s) recurse(3, 0)
# # PySNMP MIB module LBHUB-BRIDGE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LBHUB-BRIDGE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:05:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ...
a = int(input()) if(a>1000000): print(0) else: c = int(input()) if(c==a): print(0) else: ver = [] var = [] for i in range(a): b = float(input()) var.append(b) j=0 sumout = [] for element in var: k=j ...
a = int(input()) if a > 1000000: print(0) else: c = int(input()) if c == a: print(0) else: ver = [] var = [] for i in range(a): b = float(input()) var.append(b) j = 0 sumout = [] for element in var: k = j ...
# python3 # coding=<UTF-8> class EmptyPageException(Exception): """Raised when empty page encountered"""
class Emptypageexception(Exception): """Raised when empty page encountered"""
def main(): total = float print("**********Think in te last five game that you buy**********") game1 = input("What's the game?: ") time1 = float(input(f"How many hours did you play {game1}?: ")) price1 = float(input(f"How many dollars did you spend in the {game1}?: ")) print("--------------...
def main(): total = float print('**********Think in te last five game that you buy**********') game1 = input("What's the game?: ") time1 = float(input(f'How many hours did you play {game1}?: ')) price1 = float(input(f'How many dollars did you spend in the {game1}?: ')) print('-------------------...
class Solution: def minCostToMoveChips(self, position: List[int]) -> int: even_cnt = 0 odd_cnt = 0 for i in position: if i % 2 == 0: even_cnt += 1 else: odd_cnt += 1 return min(even_cnt, odd_cnt)
class Solution: def min_cost_to_move_chips(self, position: List[int]) -> int: even_cnt = 0 odd_cnt = 0 for i in position: if i % 2 == 0: even_cnt += 1 else: odd_cnt += 1 return min(even_cnt, odd_cnt)
class Configuration(object): """ Base configuration, regardless of the environment. """ SECRET_KEY='\x96\x0f\\\x8b\x9f=t\x07(pE\xfdku\xee\t' class DevelopmentConfig(Configuration): """ Configuration for development environment only """ SQLALCHEMY_DATABASE_URI = 'sqlite:///database.db'
class Configuration(object): """ Base configuration, regardless of the environment. """ secret_key = '\x96\x0f\\\x8b\x9f=t\x07(pEýkuî\t' class Developmentconfig(Configuration): """ Configuration for development environment only """ sqlalchemy_database_uri = 'sqlite:///database.db'
n = int(input()) positives = [] negatives = [] for i in range(n): current_number = int(input()) if current_number >= 0: positives.append(current_number) else: negatives.append(current_number) #============ Comprehension =============== #numbers = [int(input()) for _ in range(n)] #positive...
n = int(input()) positives = [] negatives = [] for i in range(n): current_number = int(input()) if current_number >= 0: positives.append(current_number) else: negatives.append(current_number) print(positives) print(negatives) print(f'Count of positives: {len(positives)}. Sum of negatives: {s...
# # PySNMP MIB module JUNIPER-LSYSSP-NATSRCPOOL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-LSYSSP-NATSRCPOOL-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:00:04 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) ...