content
stringlengths
7
1.05M
#!/usr/bin/python3 """ Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Input: [0,1] Output: 2 Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1. Example 2: Input: [0,1,0] Output: 2 Explanation: [0, 1] (or [1, 0]) is a lon...
#!/usr/bin/env python f = 0 with open("day1.input") as file: for line in file: cng = int(line.rstrip("\n\r")) f += cng print(f)
class Game(): def __init__(self): self.agent_list = [] self.index = 0 def add_agent(self, agent): self.agent_list.append(agent) def index_of_agent(self, agent): for index, a in enumerate(self.agent_list): if a == agent: ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # 习题2.2-2 选择排序 def get_minimum_index(seq): minimum_value = seq[0] minimum_index = 0 for i in range(1, len(seq)): if seq[i] < minimum_value: minimum_value = seq[i] minimum_index = i return minimum_index def select_sort(se...
def is_isogram(string): len_string = len(string) if len_string == 0: return True for i in range(0, len_string): for j in range(i+1, len_string): if string[i].lower() == string[j].lower() and string[i] != '-' and not string[i].isspace(): return False ...
__all__ = [ "__version__", "__author__", "__author_email__" ] __version__ = "0.3.9" __author__ = "nyanye" __author_email__ = "iam@nyanye.com"
# Asking for height and weight input weight = float(input("Weight in kilograms: ")) height = float(input("Height in meters: ")) # Calculating BMI (formula is weight/height^2) bmi = round(weight/height ** 2) # Determining which BMI category they fall into and outputting category to user if bmi < 18.5: pr...
def rate_limit(limit: int, key=None): """ Decorator for configuring rate limit and key in different functions. :param limit: :param key: :return: """ def decorator(func): setattr(func, 'throttling_rate_limit', limit) if key: setattr(func, 'throttling...
# https://www.hackerrank.com/challenges/py-set-add/problem if __name__ == '__main__': n = int(input()) s = set() for _ in range(n): s.add(input()) print(len(s))
# Define create_spreadsheet(): def create_spreadsheet(title, row_count): print( "Creating a spreadsheet called " + title + " with " + str(row_count) + " rows" ) # Call create_spreadsheet() below with the required arguments: create_spreadsheet("Applications", 10) create_spreadsheet("Departments", 100)
def bfs(root): found = False print(f'Visiting {root}...') visited.append(root) for parent in visited: for child in tree.get(parent).get('children'): if child == goal: print(f'Goal node found! ({goal})') found = True break e...
class HallwayConfig: def __init__(self, size: int = 5, max_steps: int = 32): self.size = size self.max_steps = max_steps
# zwei 06/04/2014 # __getitem__ generator class graph: def __init__(self): self.neighbors = [1,2,3,4,5] def __getitem__(self, node): for i in self.neighbors: yield i def callgetitem(): for i in g[1]: result = i return result g = graph() for n in range(1000): re...
class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ low = 0 for i in range(len(nums)): if nums[i] != val: nums[low] = nums[i] low += 1 return l...
def function_description(function): return ("Function Name: {function_name}\n" "documentation:\n{documentation}" .format(function_name=function.__name__, documentation=function.__doc__))
# you can write to stdout for debugging purposes, e.g. # print "this is a debug message" def solution(E, L): # write your code in Python 2.7 """ default fee = 2 first hour or partial hour fee = 3 after successive full or patial hour or full = 4 E 10:00, L 13:21 = 2 + 3 + 4*2 + 4 =17 """ ...
''' Exercício Python 47: Crie um programa que mostre na tela todos os números pares que estão no intervalo entre 1 e 50. ''' for c in range(2, 52, 2): if c % 2 == 0: print(c, end=' ')
# Re-export of Bazel rules with repository-wide defaults load("@io_bazel_rules_sass//:defs.bzl", _sass_binary = "sass_binary", _sass_library = "sass_library") load("@npm//@angular/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package") load("@npm//@bazel/jasmine:index.bzl", _jasmine_node_test = "jasmin...
dimensions_fields_mapping = { 'PODOCUMENTENTRY': [ 'ITEMID', 'ITEMNAME', 'ITEMDESC', 'QTY_REMAINING', 'UNIT', 'PRICE', 'PROJECTID', 'LOCATIONID', 'CLASSID', 'BILLABLE', 'DEPARTMENTID', 'CUSTOMERID', ], 'PODOCUMEN...
class PatchType(object): """Class representing a PATCH request to Kinto. Kinto understands different PATCH requests, which can be represented by subclasses of this class. A PATCH request is interpreted according to its content-type, which applies to all parts of the request body, which typically ...
lista = [[], []] for c in range(0, 7): n = int(input(f'Digite o {c+1}° valor: ')) if n % 2 == 0: lista[0].append(n) elif n % 2 == 1: lista[1].append(n) print('-='*30) print(f'Os valores pares digitados foram: {sorted(lista[0])}' f'\nOs valores ímpares digitados foram: {sorted(lista[1])...
""" Refaçã o Desafop 051, lendo o primeiro termo e a razão de uma pa mostrando os 10 primeiros termos da progressão usando a estrutura while.""" termo1 = int(input('Digite o primeiro termo da p.a: ')) # entrada do valor da prmeira posição da PA razao = int(input("Digite a razão da p.a: ")) # entrada da razão da P....
a = float(input('\033[1;33mDigite o primeiro segmento: \033[m')) b = float(input('\033[1;34mDigite o segundo segmento: \033[m')) c = float(input('\033[1;31mDigite o terceiro segmento: \033[1;35m')) print('\033[37m-=-\033[37m'*15) #Verifica se os segmentos podem formar um triângulo if a < (b + c) and b < (a + c) an...
class Node: def __init__(self,data=None,next=None): #have two class mempers self.data = data self.next = next class LinkedList: def __init__(self): self.head = None def insert(self,data): node = Node(data,self.head) self.head = node def __str__(se...
def typing_emoji(typing): if typing == "Grass": return "🌱" elif typing == "Fire": return "🔥" elif typing == "Water": return "💧" elif typing == "Flying": return "🦅" elif typing == "Bug": return "🐞" elif typing == "Normal": return "🐾" elif ...
# # PySNMP MIB module ZXROS-AMAT-IF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZXROS-AMAT-IF-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:48:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
N, Q = map(int, input().split()) L = [0 for i in range(Q)] R = [0 for i in range(Q)] D = [0 for i in range(Q)] for i in range(Q): L[i], R[i], D[i] = map(int, input().split()) D[i] = str(D[i]) mod = 998244353 S = ['1' for i in range(N)]
def get_formatter_options(show_source=False, output_file=None, tee=False): obj = object() obj.show_source = show_source obj.output_file = output_file obj.tee = tee return obj def is_int(text): try: int(text) except ValueError: return False return True def is_real(text...
# # Explore # - The Adventure Interpreter # # Copyright (C) 2006 Joe Peterson # class Command: #location = None #commands = [] #condition = None #actions = [] def __init__(self): self.location = None self.commands = [] self.condition = None self.actions = []...
# encoding: utf-8 """ hashtable.py Created by Thomas Mangin on 2009-09-06. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ class HashTable(dict): def __getitem__(self, key): return dict.__getitem__(self, key.replace('_', '-')) def __seti...
def get_lcos(num): current = longest = 0 def reset_current(): nonlocal current, longest if current > longest: longest = current current = 0 while num: if num % 2: current += 1 else: reset_current() num = num >> 1 rese...
n = sexo = 'M' maioridade = mulheres = homens = 0 print('=-' * 20) print('ANALISE DE DADOS') print('=-' * 20) while True: idade = int(input('Digite sua idade: ')) sexo = str(input('Qual o seu sexo: [M/F] ')).upper().split()[0] if idade >= 18: maioridade += 1 if sexo == 'M': homens += 1 ...
a = int(input("enter the first number: ")) b = int(input("enter the second number: ")) c = int(input("enter the third number: ")) d = int(input("enter the fourth number: ")) e = a + b f = c + d g = e / f print(f'{g:.2f}')
# bilibili command not working with !(9,13)_(89,0,255) GRID_SIZE = 40 DIMENSION = 16 ROOMID = 22021 URL = "https://api.live.bilibili.com/xlive/web-room/v1/dM/gethistory" # rgb regex !1-16,1-16_0-255,0-255,0-255 RGB_REG = '^\!([1-9]|[1][0-6])\,([1-9]|[1][0-6])\_([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\,([01]?[0-9][0-9]?...
class NewAddBookEntry: 'new address book entry class' def __init__(self, nm, ph): self.name = Name(nm) self.phone = Phone(ph) print('created instance for:', self.name)
# 1. Write a Python program to sum all the even numbers in a list def sum_even(nums): sum = 0 for num in nums: if not num & 1: sum += num return sum def main(): list1 = [2, 8, 7, 2, 69, 42, 65] print(" List :", list1) print("Sum of items :", sum_even(list1)) if __n...
IP_addresses = [ "53.239.114.76", "210.139.118.14", "219.244.176.34", "92.66.150.44", "129.214.130.92", "201.162.172.112", "253.81.123.95", "191.17.33.30", "103.45.116.156", "137.19.78.70", "207.209.106.220", "154.94.120.111", "193.191.199.241", "173.63.87.241", "171.206.243.138", "214.0.115.26", "77.37.112.1...
#function that consider last element as pivot, #place the pivot at its exact position, and place #smaller elements to left of pivot and greater #elements to right of pivot. def partition (a, start, end): i = (start - 1) pivot = a[end] # pivot element for j in range(start, end): ...
""" ID: FIBD Title: Mortal Fibonacci Rabbits URL: http://rosalind.info/problems/fibd/ """ def total_wabbits(months, lifespan): """ Counts the total number of pairs of rabbits that will remain after the specific(months) month if all rabbits live for some (lifespan) months. Args: months (int):...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Quizzes on Tracks', 'category': 'Marketing/Events', 'sequence': 1007, 'version': '1.0', 'summary': 'Quizzes on tracks', 'website': 'https://www.odoo.com/page/events', 'description'...
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyPureSasl(PythonPackage): """This package provides a reasonably high-level SASL client written in pure Pyt...
#!/usr/bin/env python3 # Read in my input: first = True first_num = None previous = None sum = 0 nums = [] carets = [] with open('input.txt', 'r') as f: while True: char = f.read(1) nums.append(char) carets.append('.') # import pdb; pdb.set_trace() if char.isdigit(): ...
# https://leetcode.com/problems/search-insert-position/ """ Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. """
class Document(object): """ Document is a pickable container for the raw document and all related data rawData holds the native newsPlease file """ def __init__(self, title='', desc='', text='', date=None, raw_data=None): if title is None: title = '' if desc is None: ...
def boo(str,a,b): if str==">": return a>b elif str==">=": return a>=b elif str=="<": return a<b elif str=="<=": return a<=b elif str=="==": return a==b elif str=="!=": return a!=b i = 0 while True: a,b,c = input().split() if b=="E": break ...
information = { "convert.merge_converted_pdf": {"label": "Merge converted PDF", "description": "Merges individual PDF files into one."}, "convert.set_pdf_metadata": {"label": "Set PDF metadata", "description": "Sets PDF metadata based"}, "...
'''Herança As classes podem herdar comportamentos e estados de outra classe, seguindo o exemplo acima, poderiamos ter a Classe Automóvel e a classe carro herdar os estados e comportamentos acima, se tornando uma sub classe de Automóveis.''' class Carro(): def __init__(self, litros, velocidade=0): self.litros =...
# -*- coding: utf-8 -*- """ Tops Directory """
def demo_preproc(rawdoc): return rawdoc
"""PORTED FROM NETWORKX""" __all__ = [ "SnapXException", "SnapXError", "SnapXTypeError", "SnapXKeyError", ] class SnapXException(Exception): """Base class for exceptions in SnapX.""" class SnapXError(SnapXException): """Exception for a serious error in SnapX""" class SnapXTypeError(TypeError...
# Julka - https://www.acmicpc.net/problem/8437 a = int(input()) b = int(input()) print((a+b) // 2) print((a-b) // 2)
""" lib/__init__.py FIT3162 - Team 10 - Final Year Computer Science Project Copyright Luke Silva, Aichi Tsuchihira, Harsil Patel 2019 """
""" A Least Recently Used (LRU) Cache allows the storage of data where a record is kept of when the data was last touched. Older data is overwritten when the maximum capacity of the cache is reached. """ class LRUCache: def __init__(self, capacity: int): self.capacity = capacity self.length = 0 ...
# Achando a mediana para dados agrupados com intervalos de classe. lin= int ( input (" Digite o limite inferior da classe mediana: ")) ff = int ( input (" Digite o total de frequencia absoluta : ")) fant= int ( input (" Digite a frequencia acumulada anterior à classe mediana : ")) fmd= int ( input (" Digite a frequenci...
def even_odd(*nums): result_list = [] command = nums[-1] for i in range(len(nums)-1): num = nums[i] if (num % 2 == 0 and command == "even") or (num % 2 != 0 and command == "odd"): result_list.append(num) return result_list
################### Scope #################### enemies = 1 def increase_enemies(): enemies = 2 print(f"enemies inside function: {enemies}") increase_enemies() print(f"enemies outside function: {enemies}") # Local Scope def drink_potion(): potion_strength = 2 print(potion_strength) drink_potion() # ...
#!/usr/bin/env python3 def organisation_url_filter(org_id): url_base = "/organisation/" return url_base + org_id.replace(":", "/")
# Crie um programa que registra as notas de uma pessoa na escola (como o boletim) # em um arquivo. # # Em seguida, leia todos os valores para imprimir o menor valor, o maior e a média. # Dica: Se você usar listas, pode usar as funções min() e max(). lista = [8.6 ,7.6 ,9.5 ,4.5 ,9.8 ,10 ] with open ('/home/brenom...
# 'ABC' -> 2 # 'DEF' -> 3 # 'GHI' -> 4 # 'JKL' -> 5 # 'MNO' -> 6 # 'PQRS' -> 7 # 'TUV' -> 8 # 'WXYZ' -> 9 # Espaço -> 0 # Espera -> _ def words(phrase): result = "" for l in phrase: if len(result) and letter(l)[0] == result[-1]: result += '_' result += letter(l) return result ...
# Python 2.6 # In contrast to Python 2.7 there might be no "COME_FROM" so we add rule: # ret_or ::= expr JUMP_IF_TRUE expr # where Python 2.7 has # ret_or ::= expr JUMP_IF_TRUE expr COME_FROM class BufferedIncrementalEncoder(object): def getstate(self): return self.buffer or 0
# -*- coding: utf-8 -*- # @Time : 2021/9/15 10:45 # @File : validate_key.py # @Author : Rocky C@www.30daydo.com username='' password=''
def ficha(jog='<desconhecido>', gol=0): print(f'O jogador {jog} fez {gol} gols.') nome = str(input('Nome do jogador: ')) gols = str(input('Quantidade de gols no campeonato: ')) if gols.isnumeric(): gols = int(gols) else: gols = 0 if nome.strip() == '': ficha(gol=gols) else: ficha(nome, gols)
# # PySNMP MIB module Nortel-Magellan-Passport-LanDriversMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-LanDriversMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:18:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
# -*- coding: utf-8 -*- __author__ = """Artem Golubin""" __email__ = 'me@rushter.com' __version__ = '0.3.1'
def includeme(config): config.add_static_view('static', 'learning_journal:static', cache_max_age=3600) config.add_route('list', '/') config.add_route('detail', '/journal/{id:\d+}') config.add_route('create', '/journal/new-entry') config.add_route('update', '/journal/{id:\d+}/edit-entry') config....
# 产品 class Product: def __init__(self, id: str, name: str, price: float, num: int, specifications: str, notes: str): # ID self.id: str = id # 名称 self.name: str = name # 进价 self.price: float = price # 库存数量 self.num: int = num # 规格 self....
# Copyright 2017 ZTE Corporation. # # 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 ...
"""Top-level package for geo_calcs.""" __author__ = """Drew Heasman""" __email__ = 'heasman.drew@gmail.com' __version__ = '0.1.0'
for i in range (1,10000): s=0 for k in range(1,i): if i%k==0: s=s+k if i==s: print(i)
class Baseball_Team: def __init__(self, name, win, lose, draw): self.name = name self.win = win self.lose = lose self.draw = draw def calc_win_rate(self): return self.win/(self.win + self.lose) def show_team_result(self): print(f'{self.nam...
# coding:utf-8 """ appクラスの基底クラスです。 """ __author__ = "t.ebinuma" __version__ = "1.0" __date__ = "25 December 2018" class AppLogicBaseService: def __init__(self): pass
# API_URL = 'https://hyperkite.ai/api/' API_URL = 'http://localhost:5000/api/' TEST_STUDY_KEY = ''
# # Copyright 2019 The Bazel Authors. All rights reserved. # # 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 ...
############################################################################################### # 确实有点难想,本来仿照【等差数列划分】也是这个思路,遍历以nums[i]结尾,并且前一个数为nums[j],但我没有用【计数】来表示 # 而是用的每个子序列的长度,而且还得分情况讨论,极其复杂 ########### # 时间复杂度:O(n^2) # 空间复杂度:O(n^2) #############################################################################...
# Função que cria matriz com um único valor def cria_matriz(num_linhas, num_colunas, valor): matriz = [] for i in range(num_linhas): linha = [] for j in range(num_colunas): linha.append(valor) matriz.append(linha) print(matriz) print() cont = 0 while cont <...
class RGBs(object): def __init__(self, rgbcs): self.colors = [] for rgbc in rgbcs: rgb = rgbc[:-1] for i in range(rgbc[-1]): self.colors.append(rgb) def list(self): return self.colors
lista = list() dados = list() total = maior = menor = 0 while True: dados.append(input('Nome da pessoa: ')) dados.append(int(input('Peso da pessoa: '))) r = input('Quer continuar? [S/N]: ').upper().strip() total += 1 if r not in 'NS': print('Opção invalida:') r = input('Quer continu...
#!/usr/bin/python3 # ****************************************************************************** # Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. # licensed under the Mulan PSL v2. # You can use this software according to the terms and conditions of the Mulan PSL v2. # You may obtain a c...
t=int(input()) while(t): t-=1 n=int(input()) n1=n//10 re=n1*(n1+1) re//=2 print(re*10)
class Node: def __init__(self, val): self.val = val self.next = None def main(s, is_part2=False): vals = [int(c) for c in s] if is_part2: num_iters = int(10e6) vals.extend(range(max(vals)+1, int(1e6)+1)) else: num_iters = 100 min_val, max_val = min(vals), ma...
#!/usr/bin/python """ Perhaps a little ambitious, this will be a Scratch style Sprite Actor sim Sprite 1 image = cat: costumes = [ ("costume1" : ... ), ("costume2" : ... ), ... ("costumeN" : ... ), ] sounds = [ ("sound1" : "meow.wav" ), ("sound2" : "purr.wav"), ...
#Задача 2. Вариант 46 #Напишите программу, которая будет выводить на экран наиболее понравившееся вам высказывание, #автором которого является Абу-ль-Фарадж бин Харун. #Не забудьте о том, что автор должен быть упомянут на отдельной строке. #Gryadin V. D. print("Пьянство-мать всех пороков.") print("\n Абу-ль-Фарадж ...
# pythonMutateString.py def mutate_string(string, position, character): # Yet another, Python one liner... return string[:position] + character + string[position + 1:]
a=("Hello world\n\n") print(a) name=("Stan") age=("20+") c=(f"My name is {name}.\nI am {age} years of age.Young, Rigth?\n\n") print(c) d=("The maximum number in this list: [12, 4, 56, 17, 8, 99] is 99") f=(12+4+56+17+8+99)/6 e=( f"The mean: [12, 4, 56, 17, 8, 99] is {f} \n\n") print(d) print(e) print("A for Apple") ...
#reads an int 'a' number os lines #reads each line and adds the entire document a = int(input()) s = 0 while(a): line = input() line = (" ".join(line.split())).split(' ') for i in range(0,len(line)): s += int(line[i]) a -= 1 print(s)
#Calculadora de C pra Python print("Welcome the Calculation") print() num1 = float(input("Digite um numero: ")) num2 = float(input("Digite um segundo numero: ")) escolha = input("Digite a operaçao selecionada: ") print() soma = (num1 + num2 ) subtracao = (num1 - num2) multiplicacao = (num1 * num2) divisao = (num1 / num...
# Syntax error in Py2 def foo(): yield from ( foo )
def f(l, r): global a if l + 1 >= r: return m = (l + r) // 2 s = m - l f(l, m) f(m, r) t = a[l:m] i = l j = 0 k = m while True: if t[j][0] <= a[k][0]: a[i] = t[j] a[i][2] += k - m i += 1 j += 1 if j...
class InputError(Exception): """ """ pass boundary_prop = dict() boundary_list = [ "MASTER_ROTOR_BOUNDARY", "SLAVE_ROTOR_BOUNDARY", "MASTER_SLAVE_ROTOR_BOUNDARY", "SB_ROTOR_BOUNDARY", "MASTER_STATOR_BOUNDARY", "SLAVE_STATOR_BOUNDARY", "MASTER_SLAVE_STATOR_BOUNDARY", "SB_STATOR...
class Kibibyte: def __init__(self, value_kibibytes: int): self._value_kibibytes = value_kibibytes self.one_kibibyte_in_bits = 8192 self._value_bits = self._convert_into_bits(value_kibibytes) self.id = "KiB" def _convert_into_bits(self, value_kibibytes: int) -> int: return value_kibibytes * self.one_kibib...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: counter=0 addends = [] for i in nums: y=nums y[counter]=None compnum = target-i if compnum in y: addends.append(counter) addends.append...
#------------------------------------------------------------------------------------------# # This file is part of Pyccel which is released under MIT License. See the LICENSE file or # # go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details. # #----------------------------------------...
# -*- coding: utf-8 -*- """ Created on Thu Dec 24 11:09:37 2020 @author: nacer """ """ Problem link : https://leetcode.com/problems/integer-to-roman/ """ class Solution: def intToRoman(self, n: int) -> str: result = writeDigit( ["I","V","X"], n%10 ) n = n // 10 result = ...
# -*- coding: utf-8 -*- """ Created on Tue Mar 2 13:36:37 2021 @author: oscar """ # Integración por Método de Simpson 1/3 Compuesto ''' Primeramente se definen los límites de integración con los cuales se quiere trabajar. ''' a=0.0 #Límite inferior b=100.0 #Límite superior ''' Se definen el ...
def number(): nl=[] for x in range(2000, 3500): if (x%7==0) and (x%5!=0): nl.append(str(x)) print (','.join(nl)) print ("NUMBER DIVISIBLE BY 7 BUT ARE NOT MULTIPLE OF 5") number()
r""" We treat an s-expression as a binary tree, where leaf nodes are atoms and pairs are nodes with two children. We then number the paths as follows: 1 / \ / \ / \ / \ / \ / \ 2 3 / \ ...
a = [2, 3, 4, 7] b = list(a) # b = [:] # b = a liga uma lista na outra b[2] = 8 print(f'Lista A: {a}') print(f'Lista B: {b}')
class LM75: def __init__(self, i2c, address=72): self.i2c = i2c self.address = address def get_temperature(self): data = self.i2c.readfrom_mem(self.address, 0, 2) temperature = data[0] + (data[1] / 256) return temperature def shutdown(self): self.i2c.writeto...
def fastmult1(m,n): def loop(m,n,ans): if n > 0: if n%2==0: return loop(2*m, n//2, ans) else: return loop(m, n-1, m+ans) else: return ans return loop(m,n,0)
del_items(0x80138630) SetType(0x80138630, "struct Creds CreditsText[50]") del_items(0x80138888) SetType(0x80138888, "int CreditsTable[224]") del_items(0x80139C60) SetType(0x80139C60, "struct DIRENTRY card_dir[16][2]") del_items(0x8013A160) SetType(0x8013A160, "struct file_header card_header[16][2]") del_items(0x80139BC...