content
stringlengths
7
1.05M
n = float(input()) whole = int(n) fractional = int(round((n % 1), 2) * 100) print(whole, fractional)
frase = str(input('Digite uma palavra para saber, se ela é um políndromo: ')).strip().upper() palavras = frase.split() junto = ''.join(palavras) inverso = '' for letra in range(len(junto)-1,-1,-1): inverso += junto[letra] if junto == inverso: print('A palavra {} é um políndromo '.format(frase)) print(invers...
class Spam(object): def __init__(self, key, value): self.list_ = [value] self.dict_ = {key : value} self.list_.append(value) self.dict_[key] = value print(f'List: {self.list_}') print(f'Dict: {self.dict_}') Spam('Key 1', 'Value 1') Spam('Key 2', 'Value 2')
lista = [5,7,9,2,4,3,1,6,8] comparaciones = 0 for i in range(len(lista) -1): #recorre la lista for j in range(len(lista)-1): #sirve para comparar los elementos de la lista #print('Comparando: ' , lista[j], "con ", lista[j+1]) if(lista[j] > lista[j+1]): #lista[j], lista[j+1] = lista[j+1] ...
#Programa que pergunte a distancia de uma viagem, e cobre 0.50 cents por km até 200km e .45 para viagens mais longas distancia = int(input('Digite a distancia em km da sua viagem: ')) if distancia > 200: valor = (distancia * 0.45) else: valor = (distancia * 0.50) print(f'O valor cobrado pela sua viagem de {d...
# # PySNMP MIB module SW-TRUNK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SW-TRUNK-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:05:02 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,...
class Twitter(): Consumer_Key = '' Consumer_Secret = '' Access_Token = '' Access_Token_Secret = '' CONNECTION_STRING = "sqlite:///Twitter.db" LANG = ["en"]
feature_types = { # features with continuous numeric values "continuous": [ "number_diagnoses", "time_in_hospital", "number_inpatient", "number_emergency", "num_procedures", "num_medications", "num_lab_procedures"], # features which describe buckets o...
def main() : #Create a set lstOrganizations = {"sharjeelswork", "Fiserv", "R Systems"} print(lstOrganizations) # Sets are unordered, so the items will appear in a random order. """Access Items You cannot access items in a set by referring to an index, since sets are unordered the items has no index. But you ca...
arr = [1, 2, 3, 6, 9, 5, 7] # 创建数组 n = len(arr) # 获取数组的长度 for i in range(n): # 进行循环迭代 for j in range(0, n - i - 1): # 循环迭代 if arr[j] > arr[j + 1]: arr[j] = arr[j + 1] arr[j + 1] = arr[j] # 进行交换元素 print(arr)
while True: try: input() alice = set(input().split()) beatriz = set(input().split()) repeticoes = [1 for carta in alice if carta in beatriz] print(min([len(alice), len(beatriz)]) - len(repeticoes)) except EOFError: break
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # Meta-info Author: Nelson Brochado Created: 09/10/2017 Updated: 02/04/2018 # Description Given a set P = {(x₁, y₁), ..., (xᵢ, yᵢ)} of 2-dimensional points, then the so-called problem of "polynomial interpolation" consists in finding the polynomial of smallest d...
# Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. # According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more...
def square(a): return(a*a) # a=int(input("enter the number")) # square(a) s=[2,3,4,5,6,7,8,9,10] print(list(map(square,s)))
""" @file @brief Exception for Mokadi. """ class MokadiException(Exception): """ Mokadi exception. """ pass # pylint: disable=W0107 class CognitiveException(Exception): """ Failure when calling the API. """ pass # pylint: disable=W0107 class WikipediaException(Exception): """...
features = [ "mtarg1", "mtarg2", "mtarg3", "roll", "pitch", "LACCX", "LACCY", "LACCZ", "GYROX", "GYROY", "SC1I", "SC2I", "SC3I", "BT1I", "BT2I", "vout", "iout", "cpuUsage", ] fault_features = ["fault", "fault_type", "fault_value", "fault_duration"...
READ_ME =""" INDEXICAL is designed to assist in the creation of book indexes. It offers the following functionality: (1) Analyze a readable PDF, extracting capitalized phrases, italicized phrases, phrases in double quotation marks, and phrases surrounding by parentheses. (2) Filter through the results of (1)...
"""Implements a class for Latin Square puzzles. A Latin Square is a square grid of numbers from 1..N, where a number may not be repeated in the same row or column. Such squares form the basis of puzzles like Sudoku, Kenken(tm), and their variants. Classes: LatinSquare: Implements a square puzzle constrained by no...
n1 = cont = soma = 0 n1 = int(input('Digite um número [999 para parar]: ')) while n1 != 999: cont += 1 soma += n1 n1 = int(input('Digite um número [999 para parar]: ')) print('Foram digitados {} números e a soma entre eles é {}'.format(cont, soma))
maxsimal = 0 while True: a = int(input("Masukan bilangan = ")) if maxsimal < a: maxsimal = a if a == 0: break print("Bilangan Terbesarnya Adalah = ", maxsimal)
class Holding(object): def __init__(self, name, symbol, sector, market_val_percent, market_value, number_of_shares): self.name = name self.symbol = symbol self.sector = sector self.market_val_percent = market_val_percent self.market_value = market_value self.number_...
# rps data for the rock-paper-scissors portion of the red-green game # to be imported by rg.cgi # this file represents the "host throw" for each numbered round rps_data = { 0: "rock", 1: "rock", 2: "scissors", 3: "paper", 4: "paper", 5: "scissors", 6: "rock", 7: "scissors", 8: "pape...
user_info = {} while True: print("\n\t\t\tUnits:metric") name = str(input("Enter your name: ")) height = float(input("Input your height in meters(For instance:1.89): ")) weight = float(input("Input your weight in kilogram(For instance:69): ")) age = int(input("Input your age: ")) sex = str(input...
#!/usr/bin/env python #-*- coding: utf-8 -*- def getHeaders(fileName): headers = [] headerList = ['User-Agent','Cookie'] with open(fileName, 'r') as fp: for line in fp.readlines(): name, value = line.split(':', 1) if name in headerList: headers.append((name.st...
class ComponentsAssembly: def __init__(self, broker, strategy, datafeed, sizer, metrics_collection, *args): self._components = [broker, strategy, datafeed, sizer, metrics_collection, *args] def __iter__(self): self.index = 0 return self def __next__(self): if self.index ...
''' 单例模式 ''' class Singleton(object): def __new__(cls): print(dir(cls)) if not hasattr(cls, 'instance'): # 判断有没有 instance 属性 cls.instance = super(Singleton, cls).__new__(cls) return cls.instance if __name__ == "__main__": s1 = Singleton() print("Object created", s1) ...
# Lecture 3.6, slide 2 # Defines the value to take the square root of, epsilon, and the number of guesses. x = 9 epsilon = 0.01 numGuesses = 0 # Here, 0 < x < 1, then the low is x and the high is 1 - the sqrt(x) > x if 0 < x < 1. # If x > 1, then the low is 0 and the high is x - the sqrt(x) < x if x > 1. if (x >= 0 a...
# 创建用户名列表 current_users = ['Admin','yang yahu','gao xiangzhou','eric','yang yuhang'] # 创建另一个用户名列表 new_users = ['admin','Yang yahu','li jianfeng','yuan lishan','wang hao'] # 遍历列表 for new_user in new_users: if new_user.lower() and new_user.upper() and new_user.title() in [current_user.lower() and curren...
# ctx.addClock("csi_rx_i.dphy_clk", 96) # ctx.addClock("video_clk", 24) # ctx.addClock("uart_i.sys_clk_i", 12) ctx.addClock("EXTERNAL_CLK", 12) # ctx.addClock("clk", 25)
class Solution: def soupServings(self, N: int) -> float: def dfs(a: int, b: int) -> float: if a <= 0 and b <= 0: return 0.5 if a <= 0: return 1.0 if b <= 0: return 0.0 if memo[a][b] > 0: return memo[a][b] memo[a][b] = 0.25 * (dfs(a - 4, b) + ...
# First we define a variable "to_find" which contains the alphabet to be checked for in the file # fo is the file which is to be read. to_find="e" fo = open('E:/file1.txt' ,'r+') count=0 for line in fo: for word in line.split(): if word.find(to_find)!=-1: count=count+1 print(...
DELIVERY_TYPES = ( (1, "Vaginal Birth"), # Execise care when changing... (2, "Caesarian") )
class Solution: def makeGood(self, s: str) -> str: i = 0 string = list(s) while i < len(string) - 1: a = string[i] b = string[i + 1] if a.lower() == b.lower() and a != b: string.pop(i) string.pop(i) i = 0 ...
l,j,k=[list(input()) for i in range(3)] l.extend(j) for i in l: if i not in k : k.append(i) break k.remove(i) print('YES' if k==[] else 'NO')
# # PySNMP MIB module CXQLLC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXQLLC-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:33:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
class Solution: """ https://leetcode.com/problems/move-zeroes/ Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3...
RGB2HEX = 1 RGB2HSV = 2 RGB2HSL = 3 HEX2RGB = 4 HSV2RGB = 5 OPCV_RGB2HSV = 100 OPCV_HSV2RGB = 101
class ImageGroupsComponent: def __init__(self, key=None, imageGroup=None): self.key = 'imagegroups' self.current = None self.animationList = {} self.alpha = 255 self.hue = None self.playing = True if key is not None and imageGroup is not None: sel...
class Tag(object): def __init__(self, tag_name : str, type_ = None): self.__tag_name = tag_name self.__type : str = type_ if type_ is not None else "" @property def type(self) -> str: return self.__type @property def name(self) -> str: return self.__tag_name...
# super(): COME DELEGARE ALLA CLASSE BASE # Perchè viene utilizzato il metodo super()? # prendiamo l'esempio che segue: class Animale(): def __init__(self,specie): self.specie = specie def razza(self): return f"Io sono della specie {self.specie}" class Cane(Animale): def __init__(self, ...
''' - DESAFIO 007 - Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média. ''' n1 = float(input('Informe a primeira nota: ')) n2 = float(input('Informe a segunda nota: ')) media = (n1 + n2)/2 print('A média é igual a {}'.format(media))
#First go print("Hello, World!") message = "Hello, World!" print(message) #-------> print "Hello World!" is Python 2 syntax, use print("Hello World!") for Python 3
def register(username, password, check_password): if password == check_password: if 8 < len(username) < 40 and 8 < len(password) < 16: print("Успешно") with open("database.txt", "w") as db1: db1.write(username + '\n' + password) code = 1234 ...
# coding=utf-8 class Folding(object): NO = 0 DEVICE = 1 SUBSYSTEM = 2 SERVER = 3 def __init__(self, args): self.args = args def fold(self, data, level): """ Схлапывает значения в дикте до среднего арифметического """ if not data: return 1 if self.a...
""" This is a module defined in sub-package It defines following importable objects - two module top level functions - one class """ def top_level_function1() -> None: """ This is first top level function """ def top_level_function2() -> None: """ This is second top level function """ class Clas...
# https://leetcode.com/problems/minimum-depth-of-binary-tree # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def minDepth(self, root): if not root: return 0 ...
EXCHANGE_CFFEX = 0 EXCHANGE_SHFE = 1 EXCHANGE_DCE = 2 EXCHANGE_SSEOPT = 3 EXCHANGE_CZCE = 4 EXCHANGE_SZSE = 5 EXCHANGE_SSE = 6 EXCHANGE_UNKNOWN = 7
numerator = int(input("Enter a numerator: ")) denominator = int(input("Enter denominator: ")) while denominator == 0: print("Denominator cannot be 0") denominator = int(input("Enter denominator: ")) if int(numerator / denominator) * denominator == numerator: print("Divides evenly!") else: ...
class Solution: #Function to find sum of weights of edges of the Minimum Spanning Tree. def spanningTree(self, V, adj): #code here ##findpar with rank compression def findpar(x): if parent[x]==x: return x else: parent[x]=findpa...
class Pegawai: def __init__(self, nama, email, gaji): self.__namaPegawai = nama self.__emailPegawai = email self.__gajiPegawai = gaji # decoration ini digunakan untuk mengakses property # nama pegawai agar dapat diakses tanpa menggunakan # intance.namaPegawai() melainkan instan...
snippet_normalize (cr, width, height) cr.set_line_width (0.12) cr.set_line_cap (cairo.LINE_CAP_BUTT) #/* default */ cr.move_to (0.25, 0.2); cr.line_to (0.25, 0.8) cr.stroke () cr.set_line_cap (cairo.LINE_CAP_ROUND) cr.move_to (0.5, 0.2); cr.line_to (0.5, 0.8) cr.stroke () cr.set_line_cap (cairo.LINE_CAP_SQUARE) cr.m...
class DiscreteEnvWrapper: def __init__(self, env): self.__env = env def reset(self): return self.__env.reset() def step(self, action): next_state, reward, done, info = self.__env.step(action) return next_state, reward, done, info def render(self): self.__env.re...
def mse(x, target): n = max(x.numel(), target.numel()) return (x - target).pow(2).sum() / n def snr(x, target): noise = (x - target).pow(2).sum() signal = target.pow(2).sum() SNR = 10 * (signal / noise).log10_() return SNR
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def bstFromPreorder(self, preorder: List[int]) -> TreeNode: size = len(preorder) root = TreeNode(preorder[0]) s = ...
def get_account(account_id: int): return { 'account_id': 1, 'email': 'noreply@gerenciagram.com', 'first_name': 'Gerenciagram' }
__author__ = 'Michael Andrew michael@hazardmedia.co.nz' class SoundModel(object): sound = None path = "" delay = 0 delay_min = 0 delay_max = 0 def __init__(self, sound, path, delay=0, delay_min=0, delay_max=0): self.sound = sound self.path = path self.delay = delay ...
max_strlen=[] max_strindex=[] for i in range(1,11): file_name="sample."+str(i) with open(file_name,"rb") as f: offsets=[] len_of_file=[] for strand in f.readlines(): offsets.append(sum(len_of_file)) len_of_file.append(len(strand)) max_strlen.appe...
tokens = ('IMPLY', 'LPAREN', 'RPAREN', 'PREDICATENAME', 'PREDICATEVAR') precedence = ( ('left', 'IMPLY'), ('left', '|', '&'), ('right', '~'), ) t_ignore = ' \t' t_IMPLY = r'=>' t_RPAREN = r'\)' t_LPAREN = r'\(' literals = ['|', ',', '&', '~'] def t_PREDICATENAME(t): r'[A-Z][a-zA-Z0-9_]*'...
#Faça um programa que seja capaz de receber do usario a DISTANCIA de uma viagem #e o TEMPO em que essa viagem aconteceu. O programa deve exibir, no final, a velocidade média # print("VELO IDEAL PARA SUA TRIP") distanc = float(input('Digite a distância')) time = float(input('Digite o tempo da viagem')) veloci_media =...
for i in range(int(input())): n = int(input()) a = [0 for j in range(32)] for j in range(n): s = input() p = 0 if('a' in s): p|=1 if('e' in s): p|=2 if('i' in s): p|=4 if('o' in s): p|=8 if('u' in s): ...
begin_unit comment|'# Copyright 2013 OpenStack Foundation' nl|'\n' comment|'#' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at' ...
## https://blog.ionelmc.ro/2015/02/09/understanding-python-metaclasses/ ## Restrictions with multiple metaclasses # class Meta1(type): # pass # class Meta2(type): # pass # class Base1(metaclass=Meta1): # pass # class Base2(metaclass=Meta2): # pass # class Foobar(Base1, Base2): # pass # class Meta(type)...
# Copyright © 2020 by Spectrico # Licensed under the MIT License model_file = "model-weights-spectrico-car-colors-recognition-mobilenet_v3-224x224-180420.pb" # path to the car color classifier label_file = "labels.txt" # path to the text file, containing list with the supported makes and models input_layer = "...
# 14. Longest Common Prefix # Write a function to find the longest common prefix string amongst an array of strings. # If there is no common prefix, return an empty string "". class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ ...
STRING_FILTER = 'string' CHOICE_FILTER = 'choice' BOOLEAN_FILTER = 'boolean' RADIO_FILTER = 'radio' HALF_WIDTH_FILTER = 'half_width' FULL_WIDTH_FILTER = 'full_width' VALID_FILTERS = ( STRING_FILTER, CHOICE_FILTER, BOOLEAN_FILTER, RADIO_FILTER, ) VALID_FILTER_WIDTHS = ( HALF_WIDTH_FILTER, FULL...
class Passenger(): def __init__(self, weight, floor, destination, time): self.weight = weight self.floor = floor self.destination = destination self.elevator = None self.created_at = time def enter(self, elevator): ''' Input: the elevator that the passen...
# ============================================================ # Title: Keep Talking and Nobody Explodes Solver: Who's on First? # Author: Ryan J. Slater # Date: 4/4/2019 # ============================================================ def solveSimonSays(textList, # List of strings [displayText, topLeft, topRight, m...
#coding:utf-8 #pulic BASE_DIR = "/home/dengerqiang/Documents/WORK/" VQA_BASE = BASE_DIR + 'VQA/' DATA10 = VQA_BASE + "data1.0/" DATA20 = VQA_BASE + "data2.0/" IMAGE_DIR = VQA_BASE + "images/" GLOVE_DIR = BASE_DIR + 'glove/' NLTK_DIR = BASE_DIR + "nltk_data" #private WORK_DIR = BASE_DIR+ "VQA/DenseCoAttention/" GLOVE_...
#!/usr/bin/python class RedditUser: def __init__( self, name: str, can_submit_guess: bool = True, is_potential_winner: bool = False, num_guesses: int = 0, ): """ Parametrized constructor """ self.name = name self.can_submit_guess =...
def toMinutesArray(times: str): res = [0, 0] startEnd = times.split() hourMin = startEnd[0].split(':') res[0] = int(hourMin[0]) * 60 + int(hourMin[1]) hourMin = startEnd[1].split(':') res[1] = int(hourMin[0]) * 60 + int(hourMin[1]) return res MAX_MINS = 1500 N = int(input()) table = [0] *...
# For the central discovery server LOG_FILE = 'discovered.pkl' DISCOVERY_PORT = 4444 MESSAGING_PORT = 8192 PROMPT_FILE = 'prompt' SHARED_FOLDER = 'shared' DOWNLOAD_FOLDER = 'download' CHUNK_SIZE = 1000000
class FindImage: def __init__(self, image_repo): self.image_repo = image_repo def by_ayah_id(self, ayah_id): return self.image_repo.find_by_ayah_id(ayah_id)
# Copyright 2020 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# -*- coding: utf-8 -*- """ > 005 @ Jane Street ~~~~~~~~~~~~~~~~~~~ ```cons(a, b)``` constructs a pair, and ```car(pair)``` and ```cdr(pair)``` returns the first and last element of that pair. For example, ```car(cons(3, 4))``` returns ```3```, and ```cdr(cons(3, 4))``` returns ```4```. Given ...
# To review... adding up the lengths of strings in a list # e.g. totalLength(["UCSB","Apple","Pie"]) should be: 12 # because len("UCSB")=4, len("Apple")=5, and len("Pie")=3, and 4+5+3 = 12 def totalLength(listOfStrings): " add up length of all the strings " # for now, ignore errors.. assume they are all of ...
T = int(input('')) X = 0 Y = 0 for i in range(T): B = int(input('')) A1, D1, L1 = map(int, input().split()) A2, D2, L2 = map(int, input().split()) X = (A1 + D1) / 2 if L1 % 2 == 0: X = X + L1 Y = (A2 + D2) / 2 if L2 % 2 == 0: Y = Y + L1 if X == Y: print('Empate') ...
class Solution: def XXX(self, n: int) -> str: ans = '1#' for i in range(1, n): t, cnt = '', 1 for j in range(1, len(ans)): if ans[j] == ans[j - 1]: cnt += 1 else: t += (str(cnt) + ans[j - 1]) ...
# This kata was seen in programming competitions with a wide range of variations. A strict bouncy array of numbers, of # length three or longer, is an array that each term (neither the first nor the last element) is strictly higher or lower # than its neighbours. # For example, the array: # arr = [7,9,6,10,5,11,10,12,...
DEFAULTS = { 'label': "{win[title]}", 'label_alt': "[class_name='{win[class_name]}' exe='{win[process][name]}' hwnd={win[hwnd]}]", 'label_no_window': None, 'max_length': None, 'max_length_ellipsis': '...', 'monitor_exclusive': True, 'ignore_windows': { 'classes': [], 'process...
""" /* * * Crypto.BI Toolbox * https://Crypto.BI/ * * Author: José Fonseca (https://zefonseca.com/) * * Distributed under the MIT software license, see the accompanying * file COPYING or http://www.opensource.org/licenses/mit-license.php. * */ """ class CBAddress: """ Address related functions and ...
#!python3 class Error(Exception): pass class IncompatibleArgumentError(Error): pass class DataShapeError(Error): pass
x = 9 def f(x): return x
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findTilt(self, root: TreeNode) -> int: tilt = [0] def dfs(node): if node is...
def test_filtering_sequential_blocks_with_bounded_range( w3, emitter, Emitter, wait_for_transaction): builder = emitter.events.LogNoArguments.build_filter() builder.fromBlock = "latest" initial_block_number = w3.eth.block_number builder.toBlock = initial_block_number ...
""" reverse words author oinegexruam@ """ def reverse_word(word): word_reverse = '' for i in range(1, len(word) + 1): index_reverse = len(word) - i word_reverse += word[index_reverse] return word_reverse reverse_word(str(input('type a word: ')))
"""Scale a group of active objects up/down as required""" class ScalingGroup: """Scale collection of objects up/down to meet criteria""" def __init__(self, object_pool): self.object_pool = object_pool self.instances = [] def scale_to(self, number): """Adjust number of instances to...
arquivo = open("dados.txt", "r") conteudo = arquivo.read() print("Todo o conteúdo do arquivo") print(repr(conteudo), '\n') conteudo_releitura = arquivo.read() print("Releitura de todo o conteúdo do arquivo") print(repr(conteudo_releitura), '\n') arquivo.close() #FECHAMOS E REABRIMOS O ARQUIVO PARA PODER O CURSOS SE...
num_acc=int(input()) accounts={} for i in range(num_acc): p,b = input().split() accounts[p] = int(b) #print (accounts) num_t=int(input()) trans=[] for i in range(num_t): pf,pt,c,t = input().split() trans.append((int(t),pf,pt,int(c))) trans = sorted(trans) for i in trans: accounts[i[1]]-=i[3] accounts[i[2]]+=i[3]...
count = 1 def show_title(msg): global count print('\n') print('#' * 30) print(count, '.', msg) print('#' * 30) count += 1
# result = 5/3 # if result: data = ['asdf', '123', 'Aa'] names = ['asdf', '123', 'Aa'] # builtin functions that operate on sequences # zip # max # min # sum sum([1, 2, 3]) # generator expressions print(sum(len(x) for x in data)) # all # any print(all(len(x) > 2 for x in data)) print(any(len(...
__copyright__ = "2015 Cisco Systems, Inc." # Define your areas here. you can add or remove area in areas_container areas_container = [ { "areaId": "area1", "areaName": "Area Name 1", "dimension": { "length": 100, "offsetX": 0, "offsetY": 0, "u...
# apis_v1/documentation_source/voter_guide_possibility_retrieve_doc.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- def voter_guide_possibility_retrieve_doc_template_values(url_root): """ Show documentation about voterGuidePossibilityRetrieve """ required_query_parameter_list = [ ...
Errors = { 400: "BAD_REQUEST_BODY", 401: "UNAUTHORIZED", 403: "ACCESS_DENIED", 404: "NotFoundError", 406: "NotAcceptableError", 409: "ConflictError", 415: "UnsupportedMediaTypeError", 422: "UnprocessableEntityError", 429: "TooManyRequestsError", ...
response = {"username": "username", "password": "pass"} db = list() def add_user(user_obj): password = response.get("password") if len(password) < 5: return "Password is shorter than 5 characters." else: db.append(user_obj) return "User has been added." print(add_user(response)) ...
#errorcodes.py #version 2.0.6 errorList = ["no error", "error code 1", "mrBayes.py: Could not open quartets file", "mrBayes.py: Could not interpret quartets file", "mrBayes.py: Could not open translate file", "mrBayes.py: Could not interpret translate fi...
size_matrix = int(input()) matrix = [] pls = [] for i in range(size_matrix): matrix.append([x for x in input()]) for row in range(size_matrix): for col in range(size_matrix): if matrix[row][col] == 'B': pls.append((row, col)) count_food = 0 for row in range(size_matrix): for col in r...
"""createwxdb configuration information. """ #: MongoDb URI where fisb_location DB is located. MONGO_URI = 'mongodb://localhost:27017/'
+ utility('transmissionMgmt',50) + requiresFunction('transmissionMgmt','transmissionF') + utility('transmissionF',100) + requiresFunction('transmissionF','opcF') + implements('opcF','opc',0) + consumesData('transmissionMgmt','engineerWorkstation','statusRestData',False,0,True,1,True,0.5) #Allocation/Deployments +isTyp...
class AsyncSerialPy3Mixin: async def read_exactly(self, n): data = bytearray() while len(data) < n: remaining = n - len(data) data += await self.read(remaining) return data async def write_exactly(self, data): while data: res = await self.writ...
def test_clear_group(app): while 0 != app.group.count_groups(): app.group.delete_first_group() else: print("Group list is already empty")