content
stringlengths
7
1.05M
ies = [] ies.append({ "ie_type" : "Node ID", "ie_value" : "Node ID", "presence" : "M", "instance" : "0", "comment" : "This IE shall contain the unique identifier of the sending Node."}) ies.append({ "ie_type" : "Cause", "ie_value" : "Cause", "presence" : "M", "instance" : "0", "comment" : "This IE shall indicate the ac...
''' This is a sample input, you can change it of course but you have to follow rules of the questions ''' compressed_string = "2[1[b]10[c]]a" def decompress(str=compressed_string): string = "" number_stack = [] replace_index_stack = [] bracket_index_stack = [] i = 0 while i < len(str): ...
# Problem 6 MIT Midterm # # The function isMyNumber is used to hide a secret number (integer). # It takes an integer guess as a parameter and compares it to the secret number. # It returns: # -1 if the parameter x is less than the secret number # 0 if the parameter x is correct # 1 if the parameter x is greater than th...
def add(a,b): return a+b def sub(a,b): return a-b def multiply(a,b): return a*b def div(a,b): return a/b
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def add(self, data): if self.head is None: self.head = Node(data) else: temp = self.head self.head = N...
#!/usr/bin/python x = int(raw_input("Ingrese el input1: ")) print(not x)
''' Visit the link : https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json ''' def turn_right(): turn_left() turn_left() turn_left() def complete(): move() turn_left() move() turn_right() ...
# Reads two grades and prints average grade1 = float(input('Digite a primeira nota: ')) grade2 = float(input('Digite a segunda nota: ')) grade_average = (grade1 + grade2) / 2 print('Tirando {:.1f} e {:.1f}, a média é {:.1f}'.format(grade1, grade2, grade_average)) if grade_average < 5: print('O aluno(a) está REPROV...
#!/usr/bin/env python # -*- coding:utf-8 -*- # http://www.accesstoinsight.org/tipitaka/index.html PaliTextTitle = { 'Tipiṭaka (Mūla)': 'Pāḷi Canon', 'Vinayapiṭaka': 'The Basket of the Discipline', 'Suttapiṭaka': 'The Basket of Discourses', 'Dīghanikāya': 'Long Discourses', 'Dīgha nikāya': 'Long Discourses', 'S...
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'bisect_tester_staging', 'chromium', 'chromium_tests', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/step...
""" Problem Statement: Print Indentation Correctly Given a string "(hello word (bye bye))" Need to print: ( hello word ( bye bye ) ) Language: Python Written by: Mostofa Adib Shakib References: => https://leetcode.com/discuss/interview-question/409902/Snap-or-phone-or-print-indentation-correctly...
# Taum and B'day # Calculate the minimum cost required to buy some amounts of two types of gifts when costs of each type and the rate of conversion from one form to another is provided. # # https://www.hackerrank.com/challenges/taum-and-bday/problem # def taumBday(b, w, x, y, z): # Complete this function # x...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) # $builtin-init-module$ # These values are injected by our boot process. flake8 has no knowledge about # their definitions and will complain without these circular assignments. _Unbound = _Unbound # noqa: F821 def _...
def longestCommonSubsequence(str1, str2): if not str1 or not str2: return [] dp = [[0 for _ in range(len(str2))] for __ in range(len(str1))] commons = [] inc = 0 for i in range(len(str1)): if str1[i] == str2[0]: inc = 1 dp[i][0] = inc inc = 0 for j in ra...
# -*- coding: utf-8 -*- class Node: def __init__(self, node_type): self.type = node_type self.node_problems = [] @property def name(self): return "" @property def problems(self): return self.node_problems class ValueNode(Node): def __init__(self, node_type, va...
''' https://leetcode.com/problems/maximum-subarray/ ''' class Solution(object): def maxSubArray(self, nums): if len(nums) == 1: return nums[0] m = nums[0] h = {0:nums[0]} for i in range(1, len(nums)): # we loop through the array and store the longest suba...
input = open('input.txt', 'r').read().split("\n") # Part 1 x = 0 depth = 0 for line in input: line_elements = line.split(' ') cmd = line_elements[0] distance = int(line_elements[1]) if cmd == 'forward': x += distance elif cmd == 'down': depth += distance else: depth += -distance print('X: ' + str(x)) p...
_base_ = [ '../../_base_/models/swav/r50.py', '../../_base_/datasets/imagenet/swav_mcrop-2-6_sz224_96_bs32.py', '../../_base_/default_runtime.py', ] # model settings model = dict( type='SwAV', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3,), #...
# File: vmray_consts.py # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) VMRAY_JSON_SERVER = "vmray_server" VMRAY_JSON_API_KEY = "vmray_api_key" VMRAY_JSON_DISABLE_CERT = "disable_cert_verification" VMRAY_ERR_SERVER_CONNECTION = "Could not connect to server. {}" VMRAY_ERR_CONNECTIVITY_TES...
IDENTIFIER = 'everything' NEWSPAPER_DIR = 'newspapers_everything' RESULTS_DIR = 'results_everything' MIN_FREQUENCY = 50 EPOCHS = 40 MODEL_OPTIONS = { 'vector_size': 100, 'alpha': 0.1, 'window': 8, 'sample': 0.00001, 'workers': 8 } VOCABULARY = f'{IDENTIFIER}.dict'
a, b, c = map(int, input().split()) x = max(a, b, c) total = a + b + c if x % 2 != total % 2: x += 1 print((3 * x - total) // 2)
class BentPlateTestingTool(object): """ BentPlateTestingTool() """ def CreateByFaces(self, part1, face1, part2, face2): """ CreateByFaces(self: BentPlateTestingTool,part1: Part,face1: IList[Point],part2: Part,face2: IList[Point]) -> BentPlate """ pass
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def __init__(self): self.rst = list() def inorderTraversal(self, root): """ :type root: TreeNode :rt...
count = 0 sum = 0 while True: X = float(input('')) if X >= 0 and X <= 10: count += 1 sum += X if count == 2: average = sum / count print('media = %0.2f' %average) break else: print('nota invalida')
commands = [] while True: try: line = input() except: break if not line: break commands.append(line.split()) for starting_a in range(155, 160): d = {'a': starting_a, 'b': 0, 'c': 0, 'd': 0} i = 0 out = [] while len(out) < 100: if commands[i][0] == 'inc' and commands[i+1][0] == ...
tiles = [ (17, 20946, 50678), # https://www.openstreetmap.org/way/215472849 (17, 20959, 50673), # https://www.openstreetmap.org/node/1713279804 (17, 20961, 50675), # https://www.openstreetmap.org/node/3188857553 (17, 20969, 50656), # https://www.openstreetmap.org/node/3396659022 (17, 21013, 50637), ...
def method1(n: int) -> int: c = 0 while n: c += n & 1 n >>= 1 return c def method2(n: int) -> int: if n == 0: return 0 else: return (n & 1) + method2(n >> 1) if __name__ == "__main__": """ from timeit import timeit print(timeit(lambda: method1(9), numb...
"""These stopwords are taken from - people.stanford.edu/widner/content/text-mining-middle-ages (slide 13) - textifier.com/resources/common-english-words.txt - en.wikipedia.org/wiki/Middle_English - en.wiktionary.org/wiki/Category:Middle_English_prepositions - en.wiktionary.org/wiki/Category:MIddle_English_determiners ...
''' Given two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays. Input: nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7] Output: 3 Explanation: The repeated subarray with maximum length is [3,2,1]. Input: num1 = [3], nums2 = [3] Output: 1 Input: [1,2], [4,6] Output: 0 Input...
def data_generator_enabled(request): return {'DATA_GENERATOR_ENABLED': True}
class Encoders: def __init__(self, aStar): self.aStar = aStar self.countLeft = 0 self.countRight = 0 self.lastCountLeft = 0 self.lastCountRight = 0 self.countSignLeft = 1 self.countSignRight = -1 self.aStar.reset_encoders() def readCounts(self): ...
def DectoHex(n): if isinstance(n,int) == True: hexnum = hex(n)[2:] return hexnum.upper() else: intnum = int(n) hexnum = hex(intnum)[2:] return hexnum.upper()
params = [ { 'dronename': 'drone', 'stateofhealth': 100.0, 'startstateofcharge': 100.0, 'altitude': 100.0, 'temperaturesealevel': 15.0, 'rain': False, 'dropsize': 0.0, 'liquidwatercontent': 1.0, 'temperature': 15.0, 'wind': False, 'windspeed': 0.0, 'winddirection': 0.0, 'relativehumidity': 85.0, 'icing': False, 'timest...
## Python INTRO for TD Users ## Kike Ramírez ## May, 2018 ## Understanding python strings. string1 = "I Love Python!" ## Print first character print ("string1[0]:",string1[0]) ## Print characters from 3 to 5! print ("string1[2:5]:",string1[2:5]) ## Print last character only print ("string1[-1]:",string1[-1]) ## ...
__ = "-=> FILL ME IN! <=-" def assert_equal(expected, actual): assert expected == actual, '%r == %r' % (expected, actual) # double quoted strings are strings string = "Hello, world." assert_equal(__, isinstance(string, str)) # single quoted strings are also strings string = 'Goodbye, world.' assert_equal(__, i...
""" >>> nCr(4, 2) 6 """ def nCr(n, k): # C = [[0] * (k+1) for i in range(n+1)] # for i in range(n+1): # C[i][0] = 1 # for i in range(1, k+1): # C[0][i] = 0 # for i in range(1, n+1): # for j in range(1, k+1): # C[i][j] = C[i-1][j-1] + C[i-1][j] # return C C =...
skip_files = ["Fleece+CoreFoundation.h"] excluded = ["FLStr","operatorslice","operatorFLSlice","FLMutableArray_Retain","FLMutableArray_Release","FLMutableDict_Retain","FLMutableDict_Release","FLEncoder_NewWritingToFile","FLSliceResult_Free"] default_param_name = {"FLValue":"value","FLSliceResult":"slice","FLSlice":"sli...
''' Напишите программу, которая объявляет переменную "s" и присваивает ей значение "Мы изучаем язык программирования Python". После инициализации переменной программа должна напечатать значение этой переменной. Sample Input: Sample Output: Мы изучаем язык программирования Python ''' s = 'Мы изучаем язык программировани...
"""This application overrides to django-machina's forum_conversation app.""" # pylint: disable=invalid-name default_app_config = ( "ashley.machina_extensions.forum_conversation.apps.ForumConversationAppConfig" )
# [351] Android Unlock Patterns # Description # Given an Android 3x3 key lock screen and two integers m and n, where 1 <= m <= n <= 9, # count the total number of unlock patterns of the Android lock screen, which consist # of minimum of m keys and maximum n keys. # Rules for a valid pattern: # 1) Each pattern must ...
#!/usr/bin/env python # encoding: utf-8 # author: pyclearl # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None # leetcode这里要注释掉才能AC class Solution(object): def __init__(self): self.carry = 0 def addTwoNumbers(self, l1, l2): """ :t...
# SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenColorIO Project. class GroupTransform: """ GroupTransform """ def __init__(self): pass def getTransform(self, index): pass def getNumTransforms(self): pass def appendTransform(self, transform...
# Python - 3.4.3 def calculator(x, y, op): # 使用根據運算子建立對應的計算值並回傳 return { '+': x + y, '-': x - y, '*': x * y, '/': x / y }.get(op, 'unknown value')
#somando dois numeros n1 = int(input('Digite o primeiro numero: ')) n2 = int(input('Digite o segundo numero: ')) s = n1 + n2 print('{} mais {} é igual a {}'.format(n1, n2, s)) # int 7, -4, 0 9875 # float 4.5 0.076 -15.223 3.1415333 7.0 # bool True False # str alfanumerico ' '
''' Created on 27 Aug 2010 @author: dev solr configurations ''' solr_base_url = "http://solr:8983/solr/" solr_urls = { 'all' : solr_base_url + 'all', 'locations' : solr_base_url + 'locations', 'comments' : solr_base_url + 'comments', 'images' : solr_base_url + 'images', 'works' : solr_base_url +...
'''Faça um programa que leia um número digitado pelo usuário. Depois, informe todos os números primos gerados até o número digitado pelo usuário.''' n = int(input("Verificar números primos até:")) cont=0 nPrimos = [] for i in range(2,n): if (n % i == 0): cont += 1 if(cont==0): nPrimos.append(n) prin...
def clean_version( version: str, *, build: bool = False, patch: bool = False, commit: bool = False, drop_v: bool = False, flat: bool = False, ): "Clean up and transform the many flavours of versions" # 'v1.13.0-103-gb137d064e' --> 'v1.13-103' if version in ["", "-"]: re...
print("Insert an in integer") n = input() nn = n + n nnn = nn + n result = int(n) + int(nn) + int(nnn) print(result)
""" Metaclass of Response and Request """ class ResponseMeta(type): """ Meta class of Response """ response_class_by_response_type = {} @classmethod def register(mcs, clazz, typez): """ register son class to response_class_by_response_type :param clazz: son class ...
# ______________________________________________________________________________ # The Wumpus World class Gold(Thing): def __eq__(self, rhs): '''All Gold are equal''' return rhs.__class__ == Gold pass class Bump(Thing): pass class Glitter(Thing): pass class Pit(Thing): pass cl...
print('\033[1m>>> SOMA E MÉDIA <<<\033[m') soma = 0 c = 0 for c in range(5): c += 1 num = int(input(f'- {c}º VALOR: ')) soma += num media = soma/c print(f'A SOMA DOS VALORES É: {soma}') print(f'A MÉDIA DOS VALORES É: {media:.2f}')
""" ########################B6-Dictionary(字典)######################### """ """ 字典(dictionary)是Python中另一个非常有用的内置数据类型。 列表是有序的对象集合,字典是无序的对象集合。两者之间的区别在于:字典当中的元素是通过键来存取的,而不是通过偏移存取。 字典是一种映射类型,字典用"{ }"标识,它是一个无序的键(key) : 值(value)对集合。 键(key)必须使用不可变类型。在同一个字典中,键(key)必须是唯一的。 """ dict = {} dict['one'] = "one的value" dict[2] = "two" ...
"""2019 Advent of Code, Day 1""" with open("input", "r+") as file: puzzle_input = file.readlines() def mass(item): """Calculate the fuel required for an item, and the fuel required for that fuel, and so on""" fuel = item // 3 - 2 if fuel < 0: return 0 return fuel + mass(fuel) SUM = 0 SUM...
class Command(object): """ By using the NAMES command, a user can list all nicknames that are visible to him. For more details on what is visible and what is not, see "Internet Relay Chat: Channel Management" [IRC-CHAN]. The <channel> parameter specifies which channel(s) to return information ...
print(divmod(100, 7)) print(7 > 2 and 1 > 6) print(7 > 2 or 1 > 6) number_list = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] print(number_list[2:8]) print(number_list[0:9:3]) print(number_list[0:10:3])
# https://docs.python.org/3/library/functions.html#built-in-functions my_results = [True, True, 2*2==4, True] print(all(my_results)) # all statements in the sequence should be truthy to get True else we get False my_results.append(False) print(my_results) print(all(my_results)) #In logic this is called universal quanto...
#!/usr/bin/env pyrate build_output = ['makefile'] ex_d = executable('exampleM2_debug.bin', 'test.cpp foo.cpp', compiler_opts = '-O0') ex_r = executable('exampleM2_release.bin', 'test.cpp foo.cpp', compiler_opts = '-O3') default_targets = ex_r
class DescriptionError(Exception): pass class ParseError(DescriptionError): pass class GettingError(DescriptionError): pass
MyAttr = 'eval:1' My_Attr = 'eval:foo=1;bar=2;foo+bar' attr_1 = 'tango:a/b/c/d' attr_2 = 'a/b/c/d' attr1 = 'eval:"Hello_World!!"' foo = 'eval:/@Foo/True' # 1foo = 'eval:2' Foo = 'eval:False' res_attr = 'res:attr1' dev1 = 'tango:a/b/c' # invalid for attribute dev2 = 'eval:@foo' # invalid for attribute
# Problem 1 # 1'den 1000'e kadar olan sayılardan mükemmel sayı olanları ekrana yazdırın. # Bunun için bir sayının mükemmel olup olmadığını dönen bir tane fonksiyon # yazın. # Bir sayının bölenlerinin toplamı kendine eşitse bu sayı mükemmel bir # sayıdır. Örnek olarak 6 mükemmel bir sayıdır (1 + 2 + 3 = 6). def perfNum...
# Program to input a number and find it's sum of digits n = int(input("Enter the number: ")) tot = 0 while(n>0): d = n%10 tot = tot+d n=n//10 print("Sum of Digits is:",tot)
def func(): print("func() in one.py") print("TOP LEVEL ONE.PY") if __name__ == "__main__": print("one.py is being run directly") else: print("one.py has been imported")
class NessusObject(object): def __init__(self, server): self._id = None self._server = server def save(self): if self._id is None: return getattr(self._server, "create_%s" % self.__class__.__name__.lower())(self) else: return getattr(self._server, "updat...
#Find structs by field type. #@author Rena #@category Struct #@keybinding #@menupath #@toolbar StringColumnDisplay = ghidra.app.tablechooser.StringColumnDisplay AddressableRowObject = ghidra.app.tablechooser.AddressableRowObject TableChooserExecutor = ghidra.app.tablechooser.TableChooserExecutor DTM = state.tool.getS...
expected_output = { "interface": { "GigabitEthernet1/0/1": { "out": { "mcast_pkts": 188396, "bcast_pkts": 0, "ucast_pkts": 124435064, "name": "GigabitEthernet1/0/1", "octets": 24884341205, }, ...
# %% [1071. Greatest Common Divisor of Strings](https://leetcode.com/problems/greatest-common-divisor-of-strings/) # 問題:str1とstr2を分割する文字列を返せ(存在しないときは空文字列)。s = t * nのときtはsを分割する # 解法:math.gcdを用いる class Solution: def gcdOfStrings(self, str1: str, str2: str) -> str: n = math.gcd(n1 := len(str1), n2 := len(str2)...
def doador(): nome = str(input('Qual o seu nome senhor(a)?')) print('Meu nome é {}'.format(nome)) idade = int(input('Qual a sua idade?')) print('Minha idade é {}'.format(idade)) peso = float(input('Digite o seu peso')) print('Meu peso é {}'.format(peso)) if idade >= 18 and peso >= 50: ...
DOMAIN = "echonet_lite" MANUFACTURER = { 0x0B: "Panasonic", 0x69: "Toshiba", 0x2f: "AIPHONE", } CONF_STATE_CLASS = "state_class"
""" Container for Configuration related errors. """ class ConfigError(Exception): """ Generic exception raised by configuration errors. """ def __init__(self, expr, msg): self.expression = expr self.message = msg def __str__(self): return self.message
files = ['avalon_mm_bfm_pkg.vhd', 'avalon_st_bfm_pkg.vhd', 'axilite_bfm_pkg.vhd', 'axistream_bfm_pkg.vhd', 'gmii_bfm_pkg.vhd', 'gpio_bfm_pkg.vhd', 'i2c_bfm_pkg.vhd', 'rgmii_bfm_pkg.vhd', 'sbi_bfm_pkg.vhd', 'spi_bfm_pkg.vhd', 'uart...
#pragma repy restrictions.loose # create a junk.py file myfo = open("junk.py","w") print >> myfo, "print 'Hello world'" myfo.close() removefile("junk.py") # should be removed...
""" How to find GCD (Greater Common Divisor) of two numbers using recursion? Based on Euclidean Algorithm """ def GCD(n1, n2): assert n1 != 0 and n2 != 0 and int(n1) == n1 and int(n2) == n2, "error" if n1 < 0: n1 *= -1 if n2 < 0: n2 *= -1 if n1 % n2 == 0: return n2 return G...
a = ['a','b','c'] b = ['1','2','3','4','5','6'] c = list(zip(*b)) print(a) print(c) for d,e in zip(c,a): print(d) print(e)
#!/usr/bin/env python # coding: utf-8 # # Mendel's First Law # ## Problem # # Probability is the mathematical study of randomly occurring phenomena. We will model such a phenomenon with a random variable, which is simply a variable that can take a number of different distinct outcomes depending on the result of an un...
# examples on set and dict comprehensions # EXAMPLES OF SET COMPREHENSION # making a set comprehension is actually really easy # instead of a list, we'll just use a set notation as follows: my_list = [char for char in 'hello'] my_set = {char for char in 'hello'} print(my_list) print(my_set) my_list1 = [num for num i...
class binding_(object): """Register key bindings with the object binding.""" def __init__(self): self.bindings = {} def __call__(self, key): def register(func): def decorator(model, nav, io, *args, **kwargs): res = func(model, nav, io, *args, **kwargs) ...
class HtmlReportException(Exception): pass class HtmlReport: def __init__(self): self.path = None self.file = None self.header = None self.start_time = None self.is_initialized = False def __del__(self): if self.is_initialized and self.file: sel...
SIZE = 9 INPUT_LEVEL_DIR = "File.txt" INPUT_CONSTRAINTS_DIR = "Constraints.txt" OUTPUT_SOLUTION_DIR = "Solution.txt" ASSIGNED_VALUE_NUM = 0
class Mother: @staticmethod def take_screenshot(): print('I can make a screenshot') @staticmethod def receive_email(): print('I can receive email') class Father: @staticmethod def drive_car(): print('I can drive a car ') @staticmethod def play_music(): ...
def get_tokens(): return _tokens def get_inverse_tokens(): flipped = dict() for key in _tokens: flipped[_tokens[key]] = key return flipped _tokens = dict([ (b'\x01', '>DMS'), (b'\x02', '>Dec'), (b'\x03', '>Frac'), (b'\x04', '→'), (b'\x05', 'BoxPlot'), (b'\x06', '['), ...
class NewsModule: def __init__(self): pass def update(self): pass
# AUTOGENERATED! DO NOT EDIT! File to edit: 01_Virtual_data_setup.ipynb (unless otherwise specified). __all__ = ['Get_sub_watersheds'] # Cell def Get_sub_watersheds(watershed, order_max, order_min = 4): '''Obtains the sub-watersheds a different orders starting from the order_max and ending on the order_min, t...
class Slot: def __init__(self, name="", description = ""): self.type = type # categorical, verbatim self.name = name self.description = description self.values = ["not-present"] self.values_descriptions = ["Ignore me, I'm used for programming."] def len (self): ...
# Check if removing an edge of a binary tree can divide # the tree in two equal halves # Count the number of nodes, say n. Then traverse the tree # in bottom up manner and check if n - s = s class Node: def __init__(self, val): self.val = val self.left = None self.right = None def coun...
""" Задача: Дано три отсортированных массива чисел. Они могут быть как одинаковой, так и разной длинны. Во всех массивах есть минимум одно общее число. Найти: Любое общее число которое есть во всех трех массивах Пример: на вход: [1, 2, 3, 4, 5, 100], [6, 7, 8, 9, 100], [10, 20, 21, 22, 23, 24, 100], на вы...
class Cipher: def __init__(self, codestring): # Hints: # Does the capitalization of the words or letter matter here? # Is hello the same as Hello or even hElLo in terms of definition? Yes # Maybe we should convert everything to uppercase # Add your code here self.a...
# coding: utf-8 ######################################################################### # 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> # # author yeeku.H.lee kongyeeku@163.com # # # # version...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2006 Zuza Software Foundation # # This file is part of translate. # # translate 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 2 of t...
description = 'FRM II FAK40 information (cooling water system)' group = 'lowlevel' tango_base = 'tango://ictrlfs.ictrl.frm2:10000/frm2/' devices = dict( FAK40_Cap = device('nicos.devices.entangle.AnalogInput', tangodevice = tango_base +'fak40/CF001', description = 'The capacity of the cooling wat...
# Ejercicio 6 # Al realizar una consulta en un registro hemos obtenido una cadena de texto corrupta al revés. # Al parecer contiene el nombre de un alumno y la nota de un exámen. # ¿Cómo podríamos formatear la cadena y conseguir una estructura como la siguiente? # Nombre Apellido ha sacado un Nota de nota. cadena = "ze...
# # PySNMP MIB module DHCP-SERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///home/tin/Dev/mibs.snmplabs.com/asn1/DHCP-SERVER-MIB # Produced by pysmi-0.3.4 at Fri Jan 31 21:33:35 2020 # On host bier platform Linux version 5.4.0-3-amd64 by user tin # Using Python version 3.7.6 (default, Jan 19 2020, 22:34:52)...
# Text for update_startup_screen() startup_screen_1 = "Bienvenue au" startup_screen_2 = "LightningATM" startup_screen_3 = "- veuillez insérer des pièces -" # Text for error_screen() error_screen_1 = "Une erreur s'est produite:" # Text for update_qr_request() qr_request_1 = "Veuillez scanner" qr_request_2 = "votre fac...
def residual(s:dict, y, x): """ Return residuals :param s: state - supply empty dict on first call :param y: incoming observation :param x: term structure of predictions out k steps ahead, made after y received :returns k-vector of residuals """ k = len(x) if not s: ...
html_head = r"""<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" ...
"""Dot notation for dictionary.""" class Map(dict): """dot.notation access to dictionary attributes. Args: dict (dict): dictionary to map. """ __getattr__ = dict.get __setattr__ = dict.__setitem__ __delattr__ = dict.__delitem__
# 并查集模板 class UnionFind: ''' 适用范围:连通性检测 ''' def __init__(self, n: int): self.parent = list(range(n)) self.size = [1] * n self.n = n # 当前连通分量数目 self.setCount = n def findset(self, x: int) -> int: if self.parent[x] == x: return x ...
#!/usr/bin/python3 # https://practice.geeksforgeeks.org/problems/max-level-sum-in-binary-tree/1 def maxLevelSum(root): # Code here h = {} level = 0 getLevelSum(root, level, h) return max(h.values()) def getLevelSum(root, level, h): if root == None: return if level not in h...
''' Семипроцентный барьер ''' parties = [] votes = [] sum_votes = 0 with open('input.txt', 'r', encoding='utf8') as file: flag = False for line in file: line_el = line.split() line = line.replace('\n', '') if (line_el[0][1:] == 'PARTIES:'): continue elif (line_el[0] =...
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. class BigQueryObject(object): """A BigQueryObject holds data that will be read from/written to BigQuery.""" def __eq__(self, other): return self.__...
A = [10,13,7] B = [1,2,3,4,5,6] def sum_all(A, B): ASum = sum(A) #print(ASum) BSum = sum(B) #print(BSum) TSum = ASum+BSum #print(TSum) return ASum, BSum, TSum ASum, BSum, TSum = sum_all(A,B) print('The sum of list 1 is '+str(ASum)) print('The sum of list 2 is '+str(BSum)) print('The sum of both lists is '+str...