content
stringlengths
7
1.05M
description = '' pages = ['header'] def setup(data): pass def test(data): navigate('http://store.demoqa.com/') header.verify_product_categories('Accessories, iMacs, iPads, iPhones, iPods, MacBooks') capture('Verify product categories') def teardown(data): pass
while True: e = str(input()).split() a = int(e[0]) b = int(e[1]) if a == 0 == b: break print(2 * a - b)
# # PySNMP MIB module CISCO-LWAPP-LINKTEST-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-LINKTEST-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:05:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
'''Play on numbers with arthitemetic''' def simple_math_calc(): """Do simple mathematical calculation""" num_value1 = 10 num_value2 = 20 num_pi = 22/7 print(num_pi) print('{0} + {1} = {2}'.format(num_value1, num_value2, num_value1+num_value2)) input1 = input("Enter first number for addition...
""" This folder is modified from https://github.com/sungyubkim/MINE-Mutual-Information-Neural-Estimation- from mutual information estimation """
#!python def linear_search(array, item): """return the first index of item in array or None if item is not found""" # implement linear_search_iterative and linear_search_recursive below, then # change this to call your implementation to verify it passes all tests return linear_search_iterative(array, i...
class BaseTestFunction(object): r"""Base class for all test functions in optimization. For more details, please refer to `this Wikipedia page`_. .. _this Wikipedia page: https://en.wikipedia.org/wiki/Test_functions_for_optimization The subclass should implement at least the follo...
# Test that returning of NotImplemented from binary op methods leads to # TypeError. try: NotImplemented except NameError: print("SKIP") raise SystemExit class C: def __init__(self, value): self.value = value def __str__(self): return "C({})".format(self.value) def __add__(sel...
# -*- coding: utf-8 -*- """Track earth satellite TLE orbits using up-to-date 2010 version of SGP4 This Python package computes the position and velocity of an earth-orbiting satellite, given the satellite's TLE orbital elements from a source like `Celestrak <http://celestrak.com/>`_. It implements the most recent ver...
# POWER OF THREE LEETCODE SOLUTION: # creating a class. class Solution(object): # creating a function to solve the problem. def isPowerOfThree(self, n): # creating a variable to track the exponent. i = 0 # creating a while-loop to iterate until the desired number. ...
if False: print("Really, really false.") elif False: print("nested") else: if "seems rediculous": print("it is.")
nome = str(input('Qual e o seu nome?')) if nome =='Gustavo': print('Que nome lindo voce tem!') else: print('Seu nome e tao normal!') print('Bom dia {}!'.format(nome))
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
class Solution: def findRestaurant(self, list1, list2): """ :type list1: List[str] :type list2: List[str] :rtype: List[str] """ inverse1 = {e: i for i, e in enumerate(list1)} overlap = collections.defaultdict(list) # stored by index sum for j, e in en...
class DescriptorTypesEnum(): _ECFP = "ecfp" _ECFP_COUNTS = "ecfp_counts" _MACCS_KEYS = "maccs_keys" _AVALON = "avalon" @property def ECFP(self): return self._ECFP @ECFP.setter def ECFP(self, value): raise ValueError("Do not assign value to a DescriptorTypesEnum field") ...
# 23 - Faça um programa que leia um número de 0 a 9999 # e mostre na tela cada um dos dígitos separados. num = int(input('Digite um numero: ')) u = num // 1 % 10 d = num // 10 % 10 c = num // 100 % 10 m = num // 1000 % 10 print('Analisando o número {}'.format(num)) print('Milhar: {}, centena: {}, dezena: {}, unidade: ...
day_events_list = input().split("|") MAX_ENERGY = 100 ORDER_ENERGY = 30 REST_ENERGY = 50 energy = 100 coins = 100 is_not_bankrupt = True for event in day_events_list: single_events_list = event.split("-") name = single_events_list[0] value = int(single_events_list[1]) if name == "rest": gaine...
class WebpreviewException(Exception): """ Base Webpreview Exception. """ pass class EmptyURL(WebpreviewException): """ WebpreviewException for empty URL. """ pass class EmptyProperties(WebpreviewException): """ WebpreviewException for empty properties. """ pass clas...
def main(j, args, params, tags, tasklet): params.merge(args) doc = params.doc # tags = params.tags actor=j.apps.actorsloader.getActor("system","gridmanager") organization = args.getTag("organization") name = args.getTag("jsname") out = '' missing = False for k,v in {'organizatio...
class color: black = "\033[30m" red = "\033[31m" green = "\033[32m" yellow = "\033[33m" blue = "\033[34m" magenta = "\033[35m" cyan = "\033[36m" white = "\033[37m" class bright: black_1 = "\033[1;30m" red_1 = "\033[1;31m" green_1 = "\033[1;32m" yellow_1 = "\033[1;33m" blue_1 = "\033[1;34m" ...
# -*- coding: utf-8 -*- """ dicts contains a number of special-case dictionaries. .. testsetup:: * import kutils.dicts as kd """ class AttrDict(dict): """ AttrDict represents a dictionary where the keys are represented as attributes. >>> d = kd.AttrDict(foo='bar') >>> d.foo 'bar' >>>...
class Hotel: def __init__(self, name, roomType, price) -> None: super().__init__() self._name: str = name self._roomType: str = roomType self._price: float = float(price) def __str__(self) -> str: return "酒店:{} {} {:.2f}RMB/晚".format(self._name, self._roomType, self._p...
##This does nothing yet... class Broker(object): def __init__(self): self.name = 'ETrade' self.tradeFee = 4.95
def direct_path(string): """ Given a Linux Path "/users/john/documents/../desktop/./../" return the direct equivalent path "/users/john/" O(n) time O(n) space """ pile = [] for directory in string.split('/'): if directory: if directory == '.': pass else: if directory == '..': pile.pop() ...
class Neuron(object): def __init__(self, *args, **kwargs): super(Neuron, self).__init__()
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
num = int(input('Digite uma numero:')) b = bin(num) o = oct(num) h = hex(num) print('''Escolha [1] binario [2] octal [3] hex ''') opcao = int(input('sua Opcao: ')) if opcao == 1: print('{} convertido {}'.format(num,b[2:])) elif opcao == 2: print('{} convertido {}'.format(num,o[2:])) elif opcao == 3: print('...
''' Created on 2015年8月2日 @author: sunshyran ''' class AbstractClient(object): def __init__(self, invoker_handler): self.handler = invoker_handler self.handler.startup() def stop(self): self.handler.shutdown() def request(self, invoker, ...
############################################################################ # # Copyright (C) 2016 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. # # Commercial License Usage # Licensees holding valid commercial Qt licenses may use this file in # accordance with the co...
#!/usr/bin/env python3 #-*- encoding: UTF-8 -*- # 2) Escreva um programa que leia um valor em metros e o exiba convertido em milímetros. def main(): medida = int(input("Informe a medida em metros: ")) print("A medida é %dmm" %(medida * 1000)) if __name__ == "__main__": main()
def extra_end(str): if len(str) <= 2: return (str * 3) return (str[-2:]*3)
class Obstacle(object): def __init__(self, position): self.position = position self.positionHistory = [position] self.ObstaclePotentialForces = []
math_symbolss = (('=', 'equal'), ('≠' , 'not equal'), ('≈', 'approximately equal'), ('#', 'number'), ('>', "greater than"), ('<', 'Less than'), ('+', 'plus'), ('-', 'minus'), ('*' , 'multiple'), ('×' , 'multiple'), ('÷', 'division'), ('/', 'division'), ('^', 'power'), ('%', 'percentage'), ('°' , 'degree'), ('π', 'pi'),...
# commute_time = input("How long is your commute? (in minutes) ") # print( # ''' # –––––––––––––––––––––––––––––––––––––––––– # |Enter the letter for your means of transit| # | - - - - - - - - - - - - - - - - - - - - -| # |w - walk | # |b - bicycle | # |p...
print('-=-=-=-= DESAFIO 104 -=-=-=-=') print() def leiaInt(msg): print('-'*45) inteiro = str(input(msg)) while not inteiro.isnumeric(): print(f'\033[31mERRO! Digite um número inteiro válido.\033[m') inteiro = str(input(msg)) if inteiro.isnumeric(): break return inte...
# Copyright (c) 2022 Dai HBG """ 该文件定义了所有Cython版本得默认算子字典 """ default_operation_dic = {'1': ['csrank', 'zscore', 'neg_2d', 'neg_3d', 'csindneutral', 'csind', 'absv_2d', 'absv_3d', 'log_2d', 'log_3d', 'logv_2d', 'logv_3d'], '1_num': ['wdirect', 'tsrank_2d', 'tsra...
""" At_initial_setup module template Copy this module up one level to /gamesrc/conf, name it what you like and then use it as a template to modify. Then edit settings.AT_INITIAL_SETUP_HOOK_MODULE to point to your new module. Custom at_initial_setup method. This allows you to hook special modifications to the initial...
# # PySNMP MIB module CISCO-UNIFIED-COMPUTING-LLDP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-LLDP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:16:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pyt...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # input input_data = [] with open('input.txt', 'r') as f: lines = f.readlines() input_data = [l.strip().split(')') for l in lines] # structures orbits_down = dict(zip([inp[1] for inp in input_data], [inp[0] for inp in input_data])) # task 1 to...
# -*- coding: utf-8 -*- PORT = 7373 CFG_PREP = '/set ' CFG_PREP_LEN = len(CFG_PREP) PROTOCOL_RE = '^SCC_0.1:([0-9]+);(?:([a-zA-Z0-9_\-!§$%&()#+*~]+);){2}>>(.+)$' def protocol(sender, recepient, message): return 'SCC_0.1:' + str(len(message)) + ';' + str(sender) + ';' + str(recepient) + ';>>' + str(message)
""" DockCI exceptions """ class InvalidOperationError(Exception): """ Raised when a call is not valid at the current time """ pass class AlreadyBuiltError(Exception): """ Raised when a versioned build already exists in the repository """ pass class AlreadyRunError(InvalidOperationE...
def Num14681(): x = int(input()) y = int(input()) result = 0 if x > 0: if y > 0: result = 1 else: result = 4 else: if y < 0: result = 3 else: result = 2 print(str(result)) Num14681()
#Given an array of integers, find the one that appears an odd number of times. #There will always be only one integer that appears an odd number of times. def find_it(arr): res = 0 for element in arr: res = res ^ element return res
#网络类型 # net_model = ['CNN','MobileNet','ResNet','FCNet','VAE','Auto_encoder'] net_model = ['CNN','MobileNet','ResNet','FCNet'] #激活函数 Activation_Function = ['E-Sigmod','Tanh','ReLU','ELU','PReLU','Leaky ReLU'] #优化器 optimizer = ['Adam','SGD','BGD','Adagrad','Adadelta','RMSprop'] #损失函数 Net_losses = ['mse','cross_entr...
def Filtra_Tupla(lista): # Serão adicionadas à saída tuplas cujo valor # não seja vazio. saida = [tupla for tupla in lista if tupla] return saida tuplas = [(), (0, "ABC", 24), (), (1, "BCD", 46), (2, "CDE", 70), (3, "DEF", 13), ()] print(Filtra_Tupla(tuplas)) # SAIDA: # >> [(0, 'ABC'...
__author__ = 'samantha' def checkio(words): #l = list() #for word in words.split(): # l.append(word.isalpha()) print(words) res = False l = [wd.isalpha() for wd in words.split()] #r = [l[i:i+3] for i in range(0,len(l)-3) ] #print ('r=',r) print ('l=',l) if len(l)>3: p...
# Crie um programa que leia o nome completo de uma pessoa e mostre: # O nome com todas as letras maiúsculas e minúsculas. # Quantas letras ao todo (sem considerar espaços). # Quantas letras tem o primeiro nome. n = str(input('Digite seu nome completo: ')).strip() print('Analisando o seu nome...') print('Seu nome em ma...
class FrontendPortTotalThroughput(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_frontend_port_total_iops(idx_name) class FrontendPortTotalThroughputColumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_frontend_ports()
DEBUG = True MOLLIE_API_KEY = '' REDIS_HOST = 'localhost' COOKIE_NAME = 'Paywall-Voucher' CSRF_SECRET_KEY = 'NeVeR WoUnD a SnAke KiLl It'
def field_validator(keys, data_): """ Validates the submitted data are POSTed with the required fields :param keys: :param data_: :return: """ data = {} for v in keys: if v not in data_: data[v] = ["This field may not be null."] if len(data) != 0: return {...
# Copyright 2017 Rice University # # 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...
""" Refaça o Exercício 051, lendo o primeiro termo e a razão de uma PA, mostrando os 10 primeiros termos da progressão usando a estrutura while. """ ptermo = int(input('Digite o primeiro termo da PA: ')) razao = int(input('Digite a razão: ')) c = 0 termo = 0 print('PA: ', end='') while c != 10: termo = ptermo + c ...
__all__ = ['VERSION'] VERSION = '7.6.0' SAVE_PATH = '~/.spotifydl' SPOTIPY_CLIENT_ID = "4fe3fecfe5334023a1472516cc99d805" SPOTIPY_CLIENT_SECRET = "0f02b7c483c04257984695007a4a8d5c"
#!/usr/bin/env python3 print("Hello Inderpal Singh!") print("Welcome to python scripting.") print("Learning python opens new doors of opportunity.")
while True: try: bil = input("masukan bilangan: ") bil = int(bil) break except ValueError: print("anda salah memasukan bilangan") print("anda memasukan bilangan %s, data harus angka" % bil ) print("anda memasukan bilangan", bil)
class ViewportInfo(object,IDisposable,ISerializable): """ Represents a viewing frustum. ViewportInfo() ViewportInfo(other: ViewportInfo) ViewportInfo(rhinoViewport: RhinoViewport) """ def ChangeToParallelProjection(self,symmetricFrustum): """ ChangeToParallelProjection(self: ViewportInfo,...
n = int(input('Insira um número: ')) if n % 2 != 0 and n != 0 and n != 1: print('Primo!') elif n == 2: print('Primo!') else: print('Par!')
""" A selection of job objects used in testing. """ EMPTY_JOB = '''\ <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description></description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blo...
# Comma Code # Say you have a list value like this: # spam = ['apples', 'bananas', 'tofu', 'cats'] # Write a function that takes a list value as an argument and returns a string wit # h all the items separated by a comma and a space, with and inserted before the l # ast item. For example, passing the previous spam list...
a = [1, 0, 5, -2, -5, 7] soma = a[0] + a[1] + a[5] print(soma) a[4] = 100 print(a) for v in a: print(v)
sums_new_methodology = { "Total revenue": { "A01", "A03", "A09", "A10", "A12", "A16", "A18", "A21", "A36", "A44", "A45", "A50", "A54", "A56", "A59", "A60", "A61", "A80", ...
class Solution: def solve(self, nums, k): nums = [0]+nums for i in range(1,len(nums)): nums[i] += nums[i-1] sums = [[nums[i] - x for x in sorted(nums[:i])[:k]] for i in range(1,len(nums))] return sorted(sum(sums,[]))[-k:]
class MyParser: def __init__(self, text_1, text_2): self.text_1 = text_1 self.text_2 = text_2 def parse_text(self, text): stack = [] for char in text: if char != '#': stack.append(char) else: if len(stack) > 0: ...
# Copyright 2019 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
class Solution: # 1, 2, 3, 4, 5 # n = 5 # Rotate - k = 2 - Left - 4, 5, 1, 2, 3 # Rotate - k = 3 (n - 2) - Right - 4, 5, 1, 2, 3 def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void """ n = len(nums) if (n == ...
# -*- coding: utf-8 -*- """ 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 判断是否回文,可以依次获取数字的首尾数字进行比较。数字首位可从循环获取,尾部通过% 获取。 """ class Solution: def is_palindrome(self, x): if x < 0: return False div = 1 # 循环获取div为了下面步骤得到首位数字 while x / div >= 10: div *= 10 ...
#!/usr/bin/python3 # Both the Minimax and the Alpha-beta algorithm represent the players # as integers 0 and 1. The moves by the two players alternate 0, 1, 0, 1, ..., # so in the recursive calls you can compute the next player as the subtraction # 1-player. # The minimizing player is always 0 and the maximizing 1. # ...
""" Make a program that reads the width and height of a wall in meters, calculate its area and the amount of paint needed to paint it, knowing that each liter of paint, paints an area of 2m². """ wallWidth = float(input('Largura da parede: ')) wallHeight = float(input('Altura da parede: ')) print('Sua parede tem a d...
if __name__ == '__main__': n = int(input()) arr =list(map(int, input().split(" "))) i = max(arr) for i in range(0,n): if max(arr) == i: arr.remove(max(arr)) arr.sort(reverse=True) print(arr[0])
n=int(input()) p=[[int(i)for i in input().split()] for _ in range(n)] p.sort(key=lambda x: x[2]) a,b,c=p[-1] for y in range(101): for x in range(101): h=c+abs(a-x)+abs(b-y) if all(k==max(h-abs(i-x)-abs(y-j),0) for i,j,k in p): print(x,y,h) exit()
# Copyright (c) 2021 Hashz Software. class ArgNotFound: def __init__(self, arg): print("ArgNotFound: %s" % arg)
""" 213. House Robber II You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have security system connected and it ...
#These information comes from Twitter API #Create a Twitter Account and Get These Information from apps.twitter.com consumer_key = 'R1feyoEHAw2Lg32k4OKyyn01v' consumer_secret = 'KdxSi79P7PAjhmY4OYU2VfeKUcaUt4WmyJMb7Oew0nE1M7Ji5h' access_token = '145566333-KIndElco5MlHXPIGWeGkvjVXlMchLyQI2bMD8BJT' access_secret = 'iqf...
class lightswitch: is_on = False def Flip(self): #self refers to the instance of the object. needs to be included only when using class, to ensure that it is defined only within the class self.is_on = not self.is_on #field/attribute print(self.is_on) def FlipMany(self, number:...
if __name__ == "__main__": TC = int(input()) for t in range(0,TC): N = int(input()) max_score = -1 tie = False win = 0 for n in range(0,N): T = [0] * 6 C = list(map(int, input().split())) for c in range(1,len(C)): T...
def value_at(poly_spec, x): num=1 total=0 for i,j in enumerate(poly_spec[::-1]): total+=j*num num=(num*(x-i))/(i+1) return round(total, 2)
class BaseGenerator: """Base class for generators. Generators should provide of synthesis measurements for a location. For performance reasons generation of data should be initialized by the :meth:`uwb.generator.BaseGenerator.gen`. and :meth:`uwb.generator.BaseGenerator.get_closest_position` should pro...
REV_CLASS_MAP = { 0: "rock", 1: "paper", 2: "scissors", 3: "none" } # 0_Rock 1_Paper 2_Scissors def mapper(val): return REV_CLASS_MAP[val] def calculate_winner(move1, move2): if move1 == move2: return "Tie" if move1 == "rock": if move2 == 2: ...
class ArtistNotFound(Exception): pass class AlbumNotFound(Exception): pass
standard = { 'rulebook_white': { 'name':'Rulebook White T', 'style': { 'color': '#666666', 'background': '#fff', 'border-color': '#000', }, }, 'rulebook_pink': { 'name':'Rulebook Pink', 'style': { 'color': '#ffffdd', ...
def recurFibonaci(number): if number <= 1: return number else: return recurFibonaci(number - 1) + recurFibonaci(number - 2) numberTerms = 10 if numberTerms <= 0: print("enter positive integers") else: print("fibonaci sequence ") for i in range(numberTerms): print(recurFibon...
cadena_ingresada = input("Ingrese la fecha actual en formato dd/mm/yyyy: "); separado = cadena_ingresada.split('/'); print(separado); print( f'Dia: {separado[0]}', '-', f'Mes: {separado[1]}', '-', f'Anio: {separado[2]}' ); c = cadena_ingresada; print( f'Dia: {c[0]}{c[1]}', '-', f'Mes: {c[3]}{c[...
carros = [] carros.append("audi") carros.append("bmw") carros.append("subaru") carros.append("toyota") carros.append("chevrolet") carros.append("honda") # if elif else for carro in carros: if carro == "honda": print(carro.upper() + " !") elif carro == "BMW": print(carro.upper()) ...
# Digit factorials def factorial(n): if n == 0: return 1 return n*factorial(n-1) def digitized_factorial_sum(num): if num == 1 or num == 2: return False return sum([factorial(int(digit)) for digit in str(num)]) == num # Need bounds on the numbers to be checked if their sum of factoria...
# Question 2 - Shouting! def main(): # You don't need to modify this function. name = input('Please enter your name: ') # The computer is pleased to see you! Shout out to the user shout_name = shout(name) print('This program is happy to see you, {}'.format(shout_name)) def shout(name): ...
''' Refaça o DESAFIO 035 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado: - EQUILÁTERO: todos os lados iguais - ISÓSCELES: dois lados iguais, um diferente - ESCALENO: todos os lados diferentes ''' print('------- ANALISANDO TRIANGULO ---------') n1 = float(input('Digite o Primeir...
#python3 # Compute the last digit of the sum of squares of Fibonacci numbers till Fn def fib_mod_sum(n): mod_seq = [0, 1] # mod is 10 -> pisano period is 60 pp = 60 fib_i = n % pp for _ in range(1, fib_i): mod_seq.append((mod_seq[-1] + mod_seq[-2])) fn_seq = mod_seq[:fib_i + 1] r...
__title__ = 'django-uuslug' __author__ = 'Val Neekman' __author_email__ = 'info@neekware.com' __description__ = "A Django slugify application that also handles Unicode" __url__ = 'https://github.com/un33k/django-uuslug' __license__ = 'MIT' __copyright__ = 'Copyright 2022 Val Neekman @ Neekware Inc.' __version__ = '2.0....
class Quadrado: def __init__(self, lado): self.lado = lado def perimetro(self): return 4 * self.lado def area(self): return self.lado * self.lado class Retangulo: def __init__(self, base, altura): self.base = base self.altura = altura def area(self): return self.base * self.altura ...
# https://codeforces.com/problemset/problem/510/A n, m = input().split() whileloop_count = 1 dotline = 0 k = int(m)-1 while whileloop_count <= int(n): if whileloop_count % 2 != 0: print("#"*int(m)) elif whileloop_count % 2 == 0 and dotline % 2 == 0: print(("."*k+"#")) dotline += 1 el...
minha_lista = [1,2,3,4,5] sua_lista = [item ** 2 for item in minha_lista] print(minha_lista) print(sua_lista)
""" Activity Selection problem You are given n activities with their start and finish times. Select the maximum number of activities that can be performed by a single person, assuming that a person can only work on a single activity at a time. Example: Example 1 : Consider the following 3 activities sorted by by fin...
"""Faça um programa que leia o peso de várias pessoas, guardando tudo em uma lista. No final mostre: A) Quantas pessoas forma cadastradas. B) Uma listagem com as pessoas mais pesadas. C) Uma listagem com as pessoas mais leves.""" sair = '' contador = maior = menor = 0 pesolista = [] peso = [] while True: peso.app...
#!/usr/bin/python # -*- coding:utf-8 -*- class Cursor: def __init__(self, x=0, y=0): self.x = x self.y = y self.x_max = 5 self.y_max = 32 def up(self, buff): return Cursor(self.x - 1, self.y).clamp(buff) def down(self, buff): return Cursor(self.x + 1, self....
# coding=utf-8 # so this should look something like this: $ gunicorn --workers=2 app.memory.app:app ¯\_(ツ)_/¯ MEMORY_SIZE = 10000000 def app(environ, start_response): """Simplest possible application object""" data = b'Hello, World!\n' status = '200 OK' response_headers = [ ('Content-type','te...
# Fern Zapata # https://github.com/fernzi/dotfiles # Qtile Window Manager - User settings terminal = 'alacritty' launcher = 'rofi -show drun' switcher = 'rofi -show window' file_manager = 'pcmanfm-qt' wallpaper = '~/Pictures/Wallpapers/Other/Waves.png' applications = dict( messenger='discord', mixer='pavucontrol...
#--- # title: Zen Markdown Demo # author: Dr. P. B. Patel # date: CURRENT_DATE # output: # format: pdf #--- ## with sql # %%{sql} """SELECT * FROM stocks""" #``` # %%{run=true, echo=true, render=true} zen.to_latex() #``` # with custom con string # %%{sql, con_string=my_con_string, name=custom_df} """SELECT * ...
# -*- coding: utf-8 -*- """ Created on Mon Jan 04 2021 - 10:22 Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed A complimentary exercise from the book companion, the OCW video lecture series - Lecture 6 Song Lyrics parser https://ocw.mit.edu/courses/electrical-engineering-and-c...
# http://www.geeksforgeeks.org/find-number-of-triangles-possible/ def number_of_triangles(input): input.sort() count = 0 for i in range(len(input)-2): k = i + 2 for j in range(i+1, len(input)): while k < len(input) and input[i] + input[j] > input[k]: k = k + 1 ...
def primeCheck(n): # 0, 1, even numbers greater than 2 are NOT PRIME if n==1 or n==0 or (n % 2 == 0 and n > 2): return "Not prime" else: # Not prime if divisable by another number less # or equal to the square root of itself. # n**(1/2) returns square root of n ...