content
stringlengths
7
1.05M
#!/usr/bin/env python # coding: utf-8 # In[34]: def test(): print test() class Testing: def test(): print("hello") Testing.test() a = bool(input("enter the value: ")) if (a==False): print("Please enter some input") print(a) # scope of variables # In[ ]:
frase = input("Dime una frase: ") letra = input("Dime una letra que quieres que te busque: ") index = 0 contador = 0 while(index < len(frase)): if(frase[index].lower() == letra.lower()): contador += 1 index += 1 print(f"La letra {letra} aparece {contador} veces")
#!/usr/bin/env python3 # encoding: utf-8 """ @author: hzjsea @file: common.py.py @time: 2021/12/1 5:11 下午 """ # send_email
class RibbonItemType(Enum,IComparable,IFormattable,IConvertible): """ An enumerated type listing all the toolbar item styles. enum RibbonItemType,values: ComboBox (6),ComboBoxMember (5),PulldownButton (1),PushButton (0),RadioButtonGroup (4),SplitButton (2),TextBox (7),ToggleButton (3) """ def __eq__(self...
# Copyright 2018 Johns Hopkins University (author: Yiwen Shao) # Apache 2.0 class UnetConfig: """ A class to store certain configuration information that is needed to initialize a Unet. Making these network specific configurations store on disk can help us keep the network compatible in testing...
# Time: O(n) # Space: O(1) class Solution(object): def findDisappearedNumbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ for i in xrange(len(nums)): if nums[abs(nums[i]) - 1] > 0: nums[abs(nums[i]) - 1] *= -1 ...
# -*- coding: utf-8 -*- tvshow_messages = { 'label_add': "Ajout d\'une série", 'label_update': "Mise à jour de la série", 'label_select': "Sélection de la série", 'label_list': "Liste des séries", 'label_dashboard': "Tableau de bord des sér...
line = input() a, b = line.split() a = int(a) b = int(b) maxi = max(a, b) if a <= 0 and b <= 0: print('Not a moose') elif a == b: print(f'Even {a + b}') elif a != b: print(f'Odd {maxi + maxi}')
localDockerIPP = { "sites": [ {"site": "Local_IPP", "auth": {"channel": None}, "execution": { "executor": "ipp", "container": { "type": "docker", "image": "parslbase_v0.1", }, "provider": "local", ...
class Solution: def findDisappearedNumbers(self, nums: List[int]) -> List[int]: res = [] num_set = set(nums) for i in range(1,len(nums)+1): if i not in num_set: res.append(i) return res
#create a program that asks the user submit text repeatedly #The program will exit when user submit CLOSE #print the output as text file with open('./96_file/96_file.txt', 'w') as file: while True: user_input = input('Enter anything (to quite- type CLOSE) : '); if user_input == 'CLOSE': ...
"""This file contains variables that are used in filters.""" filename = 'sample_filename_here' # filter defult parameters smoothing = 'STEDI' noise_scale = 0.5 feature_scale = 0.5 nr_iterations = 20 save_every = 10 edge_thr = 0.001 gamma = 1 downsampling = 0 no_nonpositive_mask = False
class AllowSenderError(Exception): pass class AllowAuthError(Exception): pass class NotEnoughPoint(Exception): pass class AligoError(Exception): pass
n = int(input()) a = [] for x in range(n): a.append(int(input())) print(min(a)) print(max(a))
class NeuralNetAgent(object): def predict(self, board): """ 输入当前棋盘(相对),预测每个点的权值 """ pass def train(self, examples): """ 训练 """ pass def save_checkpoint(self, folder, filename): """ 保存当前的神经网络 """ pass def ...
def is_2xx(response_code): return 200 <= response_code < 300 def is_3xx(response_code): return 300 <= response_code < 400 def is_4xx(response_code): return 400 <= response_code < 500 def is_5xx(response_code): return response_code >= 500
# link:https://leetcode.com/problems/design-browser-history/ class BrowserHistory: def __init__(self, homepage: str): self.forw_memo = [] # forw_memo stores the future url self.back_memo = [] # back_memo stores the previous url self.curr_url = homepage def visit(self, url: str...
def get_formatted_name(first_name, last_name, middle_name=''): """Devolve um nome completo formatado de modo elegante.""" if middle_name: full_name = f'{first_name} {middle_name} {last_name}' else: full_name = f'{first_name} {last_name}'.title() return full_name.title() musician = get_...
""" This script is to practice on not in expression """ ACTIVITY = input("What would you like to do today? ") if "cinema" not in ACTIVITY.casefold(): print("But I want to go to the cinema")
# Python program to for appending a list file1 = open("myfile.txt","w") L = [] value=input("how many you want in a list") a=value.split() print(a) for i in a: L.append(i) print(L) file1.close() # Append-adds at last file1 = open("myfile.txt","a")#append mode for i in L: file1.write(i) file1.close() file1 =...
class Solution(object): def numIslands(self, grid): self.dx = [-1, 1, 0, 0] self.dy = [0, 0, -1, 1] if not grid: return 0 self.x_max, self.y_max, self.grid = len(grid), len(grid[0]), grid self.visited = set() return sum([self.floodfill_dfs(i, j) for i in range(self.x...
# to use this code: # 1. load into slice3dVWR introspection window # 2. execute with ctrl-enter or File | Run current edit # 3. in the bottom window type lm1 = get_lookmark() # 4. do stuff # 5. to restore lookmark, do set_lookmark(lm1) # keep on bugging me to: # 1. fix slice3dVWR # 2. build this sort of functionality ...
#3 - Criar um programa que recebe um depósito inicial e a taxa de juros mensal de uma aplicação e imprime os valores, mês a mês , para os 24 primeiros meses. Além disso, escreve o total ganho com os juros do período. deposito_inicial=float(input('Digite o valor em R$ de deposito inicial: ')) tx_juros=float(input('Digi...
#------------------------------------------------------------------------------ # Copyright (c) 2013, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #-------------------------------------------------...
# Author: Igor Vinicius Freitas de Souza # GitHub: https://github.com/igor1043 # E-mail: igorviniciusfreitasouza@gmail.com #Faça um programa que mostre a mensagem "Alo mundo" na tela. print("Alo mundo")
class Solution: def findLengthOfLCIS(self, nums): """ :type nums: List[int] :rtype: int """ result = 0 count = 0 for i in range(len(nums)): if i == 0 or nums[i-1] < nums[i]: count += 1 result = max(count, result) ...
FLAT, TILT_FORWARD, TILT_LEFT, TILT_RIGHT, TILT_BACK = range(5) def process_tilt(raw_tilt_value): """Use a series of elif/value-checks to process the tilt sensor data.""" if 10 <= raw_tilt_value <= 40: return TILT_BACK elif 60 <= raw_tilt_value <= 90: return TILT_RIGHT elif 170 <= r...
def author_name(): return "Ganesh" def author_education(): return "Purusing Engineering Pre-final Year" def author_socialmedia(): return "https://www.linkedin.com/in/ganeshuthiravasagam/" def author_github(): return "https://github.com/Ganeshuthiravasagam/"
def ex082(): numeros = [] pares = [] impares = [] condicao = 'S' while condicao == 'S': num = int(input('Digite um número: ')) numeros.append(num) if num % 2 == 0: pares.append(num) else: impares.append(num) ...
# start main program DIGITS = list(range(1, 10)) # create emtpy puzzle grid = [[0 for i in range(9)] for j in range(9)] # hard coded puzzle from North Haven Courier grid[0][0] = 1; grid[0][3] = 6; grid[0][5] = 5; grid[0][6] = 4; grid[0][8] = 3; grid[1][0] = 6; grid[1][2] = 7; grid[1][4] = 2; grid[1][7] = 1; g...
#example 1 dummy_list = ["one","two","three","four","five","six"] separator = ' ' result_string = separator.join(dummy_list) print(result_string) #example 2 dummy_list = ["one","two","three","four","five","six"] separator = ',' result_string = separator.join(dummy_list) print(result_string)
''' Write code to reverse a C-Style String. (C-String means that “abcd” is represented as !ve characters, including the null character.) ''' def reverse_cstyle_string(string_): i = 2 reverse_string = "" for _ in range(len(string_) - 1): reverse_string += string_[-i] i += 1 return reve...
class CameraInfo : ''' Camera Information. Attributes ---------- model: Camera model. firmware: Firmware version. uid: Camera identification. resolution: Camera resolution port: Serial port ''' def __init__(self, _model, _firm...
#campo minado global tabuleiro tabuleiro = [ ['•', '•', '•', '•', '•', '•', '•', '•', '•'], ['•', '•', '•', '•', '•', '•', '•', '•', '•'], ['•', '•', '•', '•', '•', '•', '•', '•', '•'], ['•', '•', '•', '•', '•', '•', '•', '•', '•'], ['•', '•', '•', '•', '•', '•', '•', '•', '•'], ['•', '•', '•', '•', '•', '•', '•', '•',...
def ComputeR10_1(scores,labels,count = 10): total = 0 correct = 0 for i in range(len(labels)): if labels[i] == 1: total = total+1 sublist = scores[i:i+count] if max(sublist) == scores[i]: correct = correct + 1 print(float(correct)/ total ) def...
class CallAfterCommitMiddleware(object): def process_response(self, request, response): try: callbacks = request._post_commit_callbacks except AttributeError: callbacks = [] for fn, args, kwargs in callbacks: fn(*args, **kwargs) return response
class Chapter12: """ 第12章 统计学习方法总结 """ def __init__(self): """ 第12章 统计学习方法总结 """ pass def note(self): """ chapter12 note """ print('第12章 统计学习方法总结') print('10种主要的统计学习方法:感知机、k近邻法、朴素贝叶斯法、决策树、', '逻辑斯谛回归与最大熵模型、支持向量机、提升方...
# execute with python ./part1.py def trees_met(map: list, right: int, down: int): trees = 0 idx_of_column = 0 idx_of_row = 0 length_of_row = len(map[0])-1 # so that we do not count the newline character!!! while idx_of_row < len(map)-1: idx_of_row = idx_of_row + down row = map[idx_o...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # this is a windows documentation stub. actual code lives in the .ps1 # file of the same name ANSIBLE...
""" Cache interface. """ class Cache: def __contains__(self, key): raise NotImplementedError() def __getitem__(self, key): raise NotImplementedError() def __setitem__(self, key, value): raise NotImplementedError()
""" version which can be consumed from within the module """ VERSION_STR = "0.0.15" DESCRIPTION = "pytimer is an easy to use timer" APP_NAME = "pytimer" LOGGER_NAME = "pytimer"
# Time: O(n^2) # Space: O(n) class Solution(object): def lenLongestFibSubseq(self, A): """ :type A: List[int] :rtype: int """ lookup = set(A) result = 2 for i in xrange(len(A)): for j in xrange(i+1, len(A)): x, y, l =...
def greeting(): text= "Hello World" print(text) if __name__== '__main__': greeting()
# # PySNMP MIB module SNMP-NOTIFICATION-MIB (http://pysnmp.sf.net) # ASN.1 source file:///usr/share/snmp/mibs/SNMP-NOTIFICATION-MIB.txt # Produced by pysmi-0.0.5 at Sat Sep 19 23:00:18 2015 # On host grommit.local platform Darwin version 14.4.0 by user ilya # Using Python version 2.7.6 (default, Sep 9 2014, 15:04:36) ...
n = int(input()) w = [list(map(lambda x: int(x)-1, input().split())) for _ in range(n)] syussya = [0] * (n*2) for s, _ in w: syussya[s] += 1 for i in range(1, n*2): syussya[i] += syussya[i-1] for s, t in w: print(syussya[t] - syussya[s])
USERS = {'editor':'editor', 'viewer':'viewer'} GROUPS = {'editor':['group:editors'], 'viewer':['group:viewers']} def groupfinder(userid, request): if userid in USERS: return GROUPS.get(userid,[])
# Autogenerated by devscripts/update-version.py __version__ = '2021.12.01' RELEASE_GIT_HEAD = '91f071af6'
# ------------------------------------------------------------------------------ # Access to the CodeHawk Binary Analyzer Analysis Results # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2016-2020 Kestrel Technology LLC # #...
class BaseActionNoise(object): """ Base class of action noise. """ def __init__(self, action_space): self.action_space = action_space def reset(self): pass
"""\ Core Random Tools ================= """ depends = ['core'] __all__ = [ 'beta', 'binomial', 'bytes', 'chisquare', 'exponential', 'f', 'gamma', 'geometric', 'get_state', 'gumbel', 'hypergeometric', 'laplace', 'logistic', 'lognormal', 'logseries', 'mu...
#encoding:utf-8 subreddit = 'Windows10' t_channel = '@r_Windows10' def send_post(submission, r2t): return r2t.send_simple(submission)
s, f, l = input('String='), input('First Letter='), input('Second Letter=') for i in range(1): f_in, l_in = s.rindex(f), s.index(l) if f_in == -1 or l_in == -1 or f_in > l_in: print(False) else: print(True)
class Solution: def romanToInt(self, s: str) -> int: return self.get_roman(self.roman_numerals(), s) @staticmethod def roman_numerals(): numerals = { 'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M'...
class BlackList: # black_list_startswith = [ # ".exports = '/*", # 9-21修改,这样挺多的 # 'exports.isDark', # 9-21修改,这样挺多的 # 't.exports = {\n double', # 'module.exports = {\n id', # # ,'function() { this.recipes' # 考虑一下,不一定要删除,总共就4条很长的数据 # ] black_list...
# https://www.hackerrank.com/challenges/py-set-mutations/problem s = [set(map(int, input().split())) for _ in range(2)][1] # 16 # len(s) # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 24 52 methods1 = { "update": s.update, "difference_update": s.difference_update, "intersection_update": s.intersection_update, ...
""" compartment_type_instances.py """ population = [ # Class diagram # Class {'Name': 'name', 'Horizontal alignment': 'CENTER', 'Vertical alignment': 'CENTER', 'Pad top': 5, 'Pad bottom': 10, 'Pad left': 5, 'Pad right': 5, 'Text style': 'TITLE', 'Node type': 'class', 'Diagram type': 'class', 'Sta...
#!/usr/bin/python3 def mode(array: list) -> float: """ Calculates the mode of a given array, if two or more elements have the highest frequency then mode is the smallest value among them. """ if len(set(array)) == len(array): mode = min(array) else: maxi = 0 val = [] ...
# EOF (end-of-file) indicates no more input for lexical analysis. INTEGER, PLUS, MINUS, EOF = 'INTEGER', 'PLUS', 'MINUS', 'EOF' class ParserError(Exception): """Exception raised when the parser encounters an error.""" pass class Token: """A calculator token. Attributes: kind (str): The kind...
#!/usr/local/bin/python3.7 #!/usr/bin/env python3 #!/usr/bin/python3 for i1 in range(32, 127): c1 = chr(i1) print(("%d %s" % (i1, c1)))
# terrascript/resource/grafana.py __all__ = []
""" In Python, a string can be split on a delimiter. Example: >>> a = "this is a string" >>> a = a.split(" ") # a is converted to a list of strings. >>> print a ['this', 'is', 'a', 'string'] Joining a string is simple: >>> a = "-".join(a) >>> print a this-is-a-string Task You are given a string. Split the string on ...
## Number Zoo Patrol ## 6 kyu ## https://www.codewars.com//kata/5276c18121e20900c0000235 def find_missing_number(numbers): numbers = set(numbers) if len(numbers) == 0: return 1 for i in range(1,max(numbers)+2): if i not in numbers: return i
# datasetPreprocess.py # Preprocessing should should have a fit and a transform step def convert_numpy(df): return df.to_numpy() def drop_columns(df, ids): return df.drop(ids, axis = 1) def recode(df): df["Bound"] = 2*df["Bound"] - 1 return df def squeeze(array): return array.squeeze()
# bergWeight.by # A program that asks user for the weight of a single Berg Bar and the total number of # bars made that month as inputs. # Outputs the total weight of pounds and ounces of all Berg Bar for the month # Name: Ben Goldstone # Date 9/8/2020 weightOfSingleBar = float(input("What was the weight of a single Be...
# Time: O(1) # Space: O(1) # Calculate the sum of two integers a and b, # but you are not allowed to use the operator + and -. # # Example: # Given a = 1 and b = 2, return 3. class Solution(object): def getSum(self, a, b): """ :type a: int :type b: int :rtype: int """ ...
account_error = {"status": "error", "message": "username or password error!"}, 400 teacher_not_found = {"status": "error", "message": "teacher not found!"}, 400 topic_not_found = {"status": "error", "message": "topic not found!"}, 400 file_not_found = {"status": "error", "message": "file not found!"}, 400 upload_error ...
def test(): assert ( "for doc in nlp.pipe(TEXTS)" in __solution__ ), "Itères-tu sur les docs générés par nlp.pipe ?" __msg__.good("Joli !")
""" persistence_engine.py ~~~~~~~~~~~~ Implements put, get, delete methods for PersistenceStage. Using an actual persistence engine (i.e. MySQL, BDB), one would implement the three methods themselves. """ class PersistenceEngine(object): """ Basic persistence engine implemented as a regular Pytho...
class Solution: # @return a string def countAndSay(self, n): pre = "1" for i in range(n-1): pre = self.f(pre) return pre def f(self, s): ans = "" pre = s[0] cur = 1 for c in s[1:]: if c == pre: cur = cur + 1...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: b.lin@mfm.tu-darmstadt.de """ def CreateInputFileEulerangles (InputFileName, object ,Phi,Theta,Psi): data = open(InputFileName,'w') data.write("\n[./B%d]\ \n type = ComputeElasticityTensor\ \n euler_angle_1 = %s\ ...
class Solution: def addDigits(self, num): """ :type num: int :rtype: int """ return 1 + (num - 1) % 9 if __name__ == '__main__': solution = Solution() print(solution.addDigits(38)); else: pass
""" 定义一些单因子分析常用常量 """ PRICE_TYPE = ["open", "high", "low", "close", "avg"] FQ_TYPE = ["pre", "qfq", "前复权", "hfq", "post", "后复权", "none", "不复权", "bfq"] INDUSTRY_CLS = ["jq_l1", "jq_l2", "sw_l1", "sw_l2", "sw_l3", "zjw", "none"] WEIGHT_CLS = [ "avg", "mktcap", "cmktcap", "ln_mktcap", ...
class Solution: def minWindow(self, s: str, t: str) -> str: if t == "": return "" count,window = {},{} res = [-1,-1] ;reslen = float("inf") for c in t : count[c] = 1 + count.get(c,0) have,need = 0, len(count) l = 0 ...
def find_product(lst): b = 1 ans = [] for i, v in enumerate(lst): tmp = 1 for j in lst[i+1:]: tmp *= j ans.append(tmp * b) b *= v print(ans) return ans assert find_product([1,2,3,4]) == [24,12,8,6] assert find_product([4,2,1,5, 0]) == [0,0,0,0,40]
CONFIG = dict({ 'demo_battery': [ { 'protocol': 'UDP', 'setup': 'single', 'mode': 'simple', 'size': '1MB', 'test_count': 1 } ], 'full_battery': [ { 'protocol': 'UDP', 'setup': 'single', 'mode': 'simple', 'size': '1MB', 'test_count': 3 }, { 'protocol': 'UDP', 'setup': 'si...
expected_output = { 'key_chain': { 'ISIS-HELLO-CORE': { 'keys': { '1': { 'accept_lifetime': '00:01:00 january 01 2013 infinite', 'key_string': 'password 020F175218', 'cryptographic_algorithm': 'HMAC-MD5'}}, ...
x, y, w, h = map(int, input().split()) answer = min(x, y, w-x, h-y) print(answer)
def part1(pairs): depth = 0 h_pos = 0 for cmd, val in pairs: val = int(val) if cmd == "forward": h_pos += val elif cmd == "up": depth -= val elif cmd == "down": depth += val else: raise Exception return h_pos * dept...
userName = input('Ingresar usuario ') password = int(input('Ingresa pass: ')) if (userName == 'pablo') and (password == 123456): print('Bienvenido') else: print('Acceso denegado')
# # PySNMP MIB module CISCO-MOBILE-IP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-MOBILE-IP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:07:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
# https://www.codewars.com/kata/string-cleaning/ def string_clean(s): output = "" for symbol in s: if not(symbol.isdigit()): output += symbol return output
"""default values for the command line interface """ variables = ["T", "FI", "U", "V", "QD", "QW", "RELHUM"] plevs = [100, 200, 500, 850, 950]
#! /usr/bin/python class PySopn: # Initialize instance def __init__(self, iface, port): self.interface = interface self.port = port self.socket = PySopn_eth(iface, port) # Set configuration def configSet(self, config): pass # Open def open(self): self...
class Controller: user = '' mdp = '' url = '' port = 0 timeout = 0 def __init__(self, user, mdp, url, port, timeout): self.user = user self.mdp = mdp self.url = url self.port = int(port) self.timeout = int(timeout)
categories_db = \ { 'armors': { 'items': [ 'cuirass', 'banded-mail', 'scale-mail', 'ring-mail', 'chainmail', 'half-plate', 'moon...
# 3-3 Problem1, Problem2, Problem3 sum = 0 for i in range(1, 101): sum += i print('{}'.format(sum)) A = [70, 60, 55, 75, 95, 90, 80, 80, 85, 100] mean = 0.0 for point in A: mean += point mean /= len(A) print('{}'.format(mean)) numbers = [1, 2, 3, 4, 5] result = [n * 2 for n in numbers if ...
class Solution: def addStrings(self, num1: str, num2: str) -> str: n1 = 0; n2 = 0; o = 0 for c in num1[::-1]: n1 += int(c)*10**o o += 1 o = 0 for c in num2[::-1]: n2 += int(c)*10**o o += 1 return str(n1+n2)
#!/usr/bin/env python3 # Write a program that computes the running sum from 1..n # Also, have it compute the factorial of n while you're at it # No, you may not use math.factorial() # Use the same loop for both calculations n = 5 rsum=0 fac=1 for i in range(1,n+1): rsum += i fac *= i print (n, rsum, fac) #goal pri...
dados = [[], [], []] for l in range(0, 3): for c in range(0, 3): dados[l].append(int(input(f'Digite um valor para [{l}, {c}]: '))) print('>'*80) for l in range(0, 3): for c in range(0, 3): print(f'[{dados[l][c]:^5}] ', end='') print() print('>'*80) soma = soma2 = 0 maior = 0 for l in rang...
""" mcir.py Copyright 2015 Andres Riancho This file is part of w3af, http://w3af.org/ . w3af 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 version 2 of the License. w3af is distributed in the hope that it wil...
#class method class Employee: raise_amount = 1.04 num_of_emps = 0 def __init__ (self, first, last , pay): self.first = first self.last = last self.email = first + "." + last + "@company.com" self.pay = pay Employee.num_of_emps += 1 def full_n...
# test loading constants in viper functions @micropython.viper def f(): return b'bytes' print(f()) @micropython.viper def f(): @micropython.viper def g() -> int: return 123 return g print(f()())
def format_period(start_month, start_year, end_month, end_year): ''' Formatar o perído de consulta em string Params: start_month (int): valor do mês inicial start_year (int): valor do ano inicial end_month (int): valor do mês final end_year (int): val...
""" /dms/rssfeedmanager/ Verwaltung der RSS-Feeds innerhalb des Django content Management Systems Hans Rauch hans.rauch@gmx.net Die Programme des dms-Systems koennen frei genutzt und den spezifischen Beduerfnissen entsprechend angepasst werden. """
x = ['apple', 'banana', 'mango', 'orange', 'peach', 'grapes'] def createNewList(l): newList = [] i = 1 while i < 6: newList.append(l[i]) i = i + 1 if i % 2 == 1: i = i + 1 print(newList) createNewList(x)
''' Crie um programa que tenha uma tupla única com nomes de produtos e seus respectivos preços, na sequência. No final, mostre uma listagem de preços, organizando os dados em forma tabular. ''' names_and_prices = ('Caneta', 1.50, 'Borracha', 0.75, 'Lapiseira', 1.20, 'Mochila', 89.90) produto = 0 for p in range(1, len...
#!/usr/bin/env python # encoding: utf-8 """ edit_distance.py Created by Shengwei on 2014-07-28. """ # https://oj.leetcode.com/problems/edit-distance/ # tags: medium, string, dp """ Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 st...
def find(needle, haystack): for i in range(len(haystack)-len(needle)+1): flag=True for j,char in enumerate(needle): if char=="_": continue elif char!=haystack[i+j]: flag=False break if flag: return i retu...
''' Como pedido na primeira video-aula desta semana, escreva um programa que recebe uma sequência de números inteiros e imprima todos os valores em ordem inversa. A sequência sempre termina pelo número 0. Note que 0 (ZERO) não deve fazer parte da sequência. ''' lista = [] while True: numero = int(input('Digite um ...
__title__ = 'compas_fab' __description__ = 'Robotic fabrication package for the COMPAS Framework' __url__ = 'https://github.com/gramaziokohler/compas_fab' __version__ = '0.5.0' __author__ = 'Gramazio Kohler Research' __author_email__ = 'gramaziokohler@arch.ethz.ch' __license__ = 'MIT license' __copyright__ = 'Copyright...