content
stringlengths
7
1.05M
def findMinHeightTrees(n, edges): ''' :param n: int :param edges: List[List[int]] :return: List[int] ''' # create n empty set object tree = [set() for _ in range(n)] # u as vertex, v denotes neighbor vertices # set add method ensure no repeat neighbor vertices for u, v in edges...
def solution(number): sum = 0 for x in range(1,number): if x % 3 == 0: sum +=x elif x % 5 == 0: sum +=x elif x % 3 and x % 5 == 0: continue return sum
class AbstractCrawler: def __init__(self, num, init): self.num = num self.init = init def crawl(self, es, client, process): raise NotImplementedError("This should be implemented.")
height = int(input()) for i in range(1, height + 1): value = 3 * height - i - 1 for j in range(1,i+1): if(i == height): print(height + j - 1,end=" ") elif(j == 1): print(i,end=" ") elif(j == i): print(value,end=" ") else: ...
cla = ('Atlético-MG', 'Flamengo', 'Palmeiras', 'Fortaleza', 'Corinthians', 'Bragantino', 'Fluminense', 'América-MG', 'Atlético-GO', 'Santos', 'Ceará SC', 'Internacional', 'São Paulo', 'Athletico-PR', 'Cuiabá', 'Juventude', 'Grêmio', 'Bahia', 'Sport Recife', 'Chapecoense') print(f'Os 5 primeiros colocados ...
x = 5 print(type(x)); x = "6" print(type(x)) x = 5.0 print(type(x)) x = 3.45 print(type(x))
class Solution: def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ return list(map(int, str(int(''.join(map(str, digits))) + 1)))
# -*- coding: utf-8 -*- # Contributors : [srinivas.v@toyotaconnected.co.in,srivathsan.govindarajan@toyotaconnected.co.in, # harshavardhan.thirupathi@toyotaconnected.co.in, # ashok.ramadass@toyotaconnected.com ] """Utilities for testing used across Zokyo""" __all__ = ['pytest_err_msg'] def pytest_err_msg(err): "...
#Crie um programa que laia o nome de uma cidade e diga se ela começa ou não com o nome "SANTO". cidade = input('Digite nome de uma cidade ') divisao_name = cidade.split() print('Nome da cidade digitado tem Santos no inicio? {}'.format('SANTOS' in divisao_name[0].upper()))
"""Knapsack solution using the branch and bound method.""" class Item: """Representation of one item from the total set of objects that can be chosen.""" def __init__(self, weight: int, value: int): # Todo: Make this a dataclass. self.__weight = weight self.__value = value def __r...
class PythonApiException(Exception): pass class RepositoryException(PythonApiException): pass
e = 10e-6 for b in range(10, 100): for a in range(10, b): r = a / b a1 = a % 10 a10 = (a // 10) % 10 b1 = b % 10 b10 = (b // 10) % 10 if a1 == b1 and a1 != 0 and b1 != 0: c = a10 d = b10 elif a1 == b10: c = a10 ...
# https://codeforces.com/contest/520/problem/A def check_freq(x): freq = {} for c in set(x): freq[c] = x.count(c) return freq _ = input() word = input().lower() if len(check_freq(word)) == 26: print("YES") else: print("NO")
print('Olá, sou Morgana, sou expert em divisão') print('(Caso tenha mais valores que necessário coloque 0)') n1=int(input('Valor 1:')) n2=int(input('Valor 2:')) n3=int(input('Valor 3:')) n4=int(input('Número pelo qual vc deseja dividir:')) d=n1+n2+n3 s=d/n4 print('O resultado é {}, espero ter ajudado'.format(s))
"""Exceptions module.""" class A10SAError(Exception): """Base A10SA Script exception.""" class ParseError(A10SAError): """A script parsing error occured."""
s=0 for i in range(0,3): for j in range(0,3): for k in range(0,3): s+=1 print(s)
bags = {} def get_bags(): with open("7/input.txt", "r") as file: data = file.read().split('\n') for line in data: parts = line.split(" contain ") color = parts[0].replace(" bags", "") contains = [] if parts[1] != "no other bags.": contains_bags = p...
load(":common.bzl", "get_nuget_files") load("//dotnet/private:context.bzl", "make_builder_cmd") load("//dotnet/private/actions:common.bzl", "cache_set", "declare_caches", "write_cache_manifest") load("//dotnet/private:providers.bzl", "DotnetRestoreInfo", "MSBuildDirectoryInfo", "NuGetPackageInfo") def restore(ctx, dot...
def sum_digits(digit): return sum(int(x) for x in digit if x.isdigit()) print(sum_digits('texto123numero456x7')) #https://pt.stackoverflow.com/q/42280/101
"""Top-level package for Butane.""" __author__ = """Travis F. Collins""" __email__ = 'travis.collins@analog.com' __version__ = '0.0.1'
def update_c_deprecated_attributes(main, file): """ This updates deprecated attributes in the conanfile Only add attributes here which do have a 1:1 replacement If there is no direct replacement then extend/write a check script for it and let the developer decide manually Automatic r...
# # PySNMP MIB module NTNTECH-CHASSIS-CONFIGURATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTNTECH-CHASSIS-CONFIGURATION-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:25:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
load("@bazel_gazelle//:deps.bzl", "go_repository") def go_repositories(): go_repository( name = "com_github_deepmap_oapi_codegen", importpath = "github.com/deepmap/oapi-codegen", sum = "h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=", version = "v1.8.2", ) go_repository( ...
def get_days(datetime_1,datetime_2,work_timing,weekends,holidays_list): # Here a datetime without full work time still is count as a day first_day = datetime_1 days = 1 while(first_day.day < datetime_2.day): if((first_day.isoweekday() not in weekends) and (first_day.strftime("%Y-%m-%d") not in holid...
class DBController(): def insert(): pass def connect(): pass
n = int(input("Digite um número para \ncalcular seu Fatorial: ")) print(f"calculando {n}! = ", end = "") i = n fat = 1 while (i > 0): print(i, end = "") print(" x " if i > 1 else " = ", end="") fat *= i i -= 1 print(f"{fat}")
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 12 empirical models of protein evolution adopted from `PAML 4.9e <http://abacus.gene.ucl.ac.uk/software/paml.html>`_: """ cprev10 = """ 105 227 357 175 43 4435 669 823 538 10 157 1745 768 400 10 499 152 1055 3691 10 3122 665 243 653 431...
"""Constants for the Sagemcom integration.""" DOMAIN = "sagemcom_fast" CONF_ENCRYPTION_METHOD = "encryption_method" CONF_TRACK_WIRELESS_CLIENTS = "track_wireless_clients" CONF_TRACK_WIRED_CLIENTS = "track_wired_clients" DEFAULT_TRACK_WIRELESS_CLIENTS = True DEFAULT_TRACK_WIRED_CLIENTS = True ATTR_MANUFACTURER = "Sag...
def make_move(): board = [input().split() for _ in range(n)] my_ptr = 'R' if player == 'RED' else 'B' my_x = my_y = None for i, row in enumerate(board): for j, val in enumerate(row): if val == my_ptr: my_x = i my_y = j delta = [[0, -1, 'L'], [-1, 0...
# n의 각 자릿수의 합을 리턴 def sum_digits(n): # base case if n < 10: return n # recursive case n, remainder = divmod(n, 10) return remainder + sum_digits(n) # 테스트 print(sum_digits(22541)) print(sum_digits(92130)) print(sum_digits(12634)) print(sum_digits(704)) print(sum_digits(3755))
class Solution: def largestRectangleArea(self, heights): """ :type heights: List[int] :rtype: int """ if len(heights) == 1: return heights[0] stack = [] # (index, height) max_area = 0 for i, height in enumerate(heights): ...
# Order (x1, x2, y1, y2) # ------ TEST CASE 'Count digits' ------ # Create text nodes t0 = Node(coordinate=[704,951,211,325], text='inicio') t1 = Node(coordinate=[551,1140,555,683], text='n=0, cont=0') t2 = Node(coordinate=[760,885,938,1030], text='n') t3 = Node(coordinate=[615,879,1358,1455], text='n > 0') t4 = Node(c...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
class ImportLine: def __init__(self, fromString: str, importString: str): self.__from = fromString self.__import = importString def getFrom(self) -> str: return self.__from def getImport(self) -> str: return self.__import def isSame(self, line2: 'ImportLine') -> b...
nome = 'Djonatan ' sobrenome = 'Schvambach' print(nome + sobrenome) idade = 25 altura = 1.76 e_maior = idade > 18 print('Nome ' + nome + sobrenome + ' Idade ' + str(idade) + ' maior de Idade ? ' + str(e_maior) ) peso = 58 imc = peso / altura ** 2 print(imc)
# Source : https://leetcode.com/problems/longest-common-prefix/ # Author : foxfromworld # Date : 04/10/2021 # First attempt class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: strs.sort(key=len) result = "" char = set() for i in range(len(strs[0])): ...
{ "targets": [ { "target_name": "memcachedNative", "sources": [ "src/init.cc", "src/client.cpp" ], "include_dirs": [ "<!(node -e \"require('nan')\")" ], 'link_settings': { 'libraries': [ '<!@(pkg-config --libs libmemcached)' ...
class InventoryFullError(Exception): """Exception raised when player inventory is full""" pass
def sisi(): a = 10.0; b = {}; c = "string" return a, b, c sisi()
s=input().split() graph_path = list() graph_path.append(s) for i in range(len(s)-1): graph_path.append(input().split()) print('path input done.') #print(graph_path) s=input().split() weight_path = list() weight_path.append(s) for i in range(len(s)-1): weight_path.append(input().split()) print('weight input don...
def word(): word = "CSPIsCool" x = "" for i in word: x += i print(x) def rows(): rows = 10 for i in range(1, rows + 1): for j in range(1, i + 1): print(i * j, end=' ') print() def pattern(): rows = 6 for i in range(0, rows): for j in range(rows - 1, i, -1): print(j, '...
def fatorial(n): while n >= 0 : fatorial = 1 while n > 1: fatorial = fatorial * n n = n - 1 print(f"Fatorial: {fatorial}") def valor(): n = int(input("Informe um numero inteiro positivo: ")) if n <0: print("Fim da execução") else: fatoria...
# by adegunlehinabayomi@gmail.com # ______COVID-19 Impact Estimator_______ reportedCases = data_reported_cases population = data-population timeToElapse = data-time-to-elapse totalHospitalBeds = data-total-hospital-beds c_i = 0 iBRT = 0 #return reportedCases, population, timeToElapse, totalHospitalBeds # C...
class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: int """ counts = {} for x in nums: if counts.get(x) is None: counts[x] = 1 else: counts[x] += 1 fo...
possibleprograms = ["Example.exe", "ExampleNr2.exe", "Pavlov-Win64-Shipping.exe"] programdisplaynames = { "Example.exe": "Example", "ExampleNr2.exe": "Whatever name should be displayed", "Pavlov-Win64-Shipping.exe": "Pavlov" } presets = [ [["Spotify.e...
class _BotCommands: def __init__(self): self.StartCommand = 'start' self.MirrorCommand = 'mirror' self.UnzipMirrorCommand = 'unzipmirror' self.TarMirrorCommand = 'tarmirror' self.CancelMirror = 'cancel' self.CancelAllCommand = 'cancelall' self.ListCommand = 'l...
############################################################################### # Name: make.py # # Purpose: Define Makefile syntax for highlighting and other features # # Author: Cody Precord <cprecord@editra.org> # ...
def CorsMiddleware(app): def _set_headers(headers): headers.append(('Access-Control-Allow-Origin', '*')) headers.append(('Access-Control-Allow-Methods', '*')) headers.append(('Access-Control-Allow-Headers', 'origin, content-type, accept')) return headers def middleware(environ,...
#IMPRIMIR UMA PALAVRA INSERIDA INVERTIDAMENTE if __name__ == "__main__": palavra = input() for index in range(len(palavra) - 1, -1, -1): print(palavra[index], end='')
class Solution: def minMalwareSpread(self, graph: List[List[int]], initial: List[int]) -> int: if not graph: return -1 N = len(graph) clean = set(range(N)) - set(initial) parents = list(range(N)) size = [1] * N def find(x): if parents[x] != x: ...
#!/usr/bin/env python class Test(object): def send(self, title, message): print(title, message) def AND(x1, x2): w1, w2, theta = 1, 1, 0 tmp = x1*w1 + x2*w2 if tmp <= theta: return 0 elif tmp > theta: return 1 def main(): # test = Test() # test.send('title', 'mess...
class Person: id = None name = None def __init__(self, id=None, name=None): self.id = id self.name = name
def sort_gift_code(code: str) -> str: my_letter = [] for letter in code: my_letter.append(letter) return ''.join(sorted(my_letter))
n = int(input()) idx = [0]*(n+1) arr = [int(i) for i in input().split()] m = int(input()) quer = [int(i) for i in input().split()] for i in range(n): idx[arr[i]] = i+1 vasya = 0 petya = 0 for q in quer: vasya += idx[q] petya += n-idx[q]+1 print(vasya, petya) # Time complexity of above code O(n+m) # ...
'''Desenvolva uma lógica que leia o peso e a altura de uma pessoa, calcule seu indice de massa corporal(IMC) e mostre seu status, de acordo com a tabela abaixo: - IMC abaixo de 18,5: Abaixo do peso - Entre 18,5 e 25: Peso Ideal - 25 até 30: Obesidade - Acima de 40: Obesidade mórbida''' # weight - peso em english weigh...
"""Enunciado Faça a multiplicação entre dois números usando somente soma. """ num1 = int(input("Digite um valor inteiro: ")) num2 = int(input("Digite outro valor inteiro: ")) c = multiplicacao = 0 while c < num2: multiplicacao = num1 + multiplicacao c = c + 1 print(f"{multiplicacao}")
# # PySNMP MIB module PACKETEER-RTM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PACKETEER-RTM-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:36:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
i = 0 #defines an integer i while(i<119): #while i is less than 119, do the following print(i) #prints the current value of i i += 10 #add 10 to i
# print(111) def main(): p = { 'a':1, 'b':2, 'c':3, 'd':4, 'e':5 } print(p) print('i' in p.keys()) if __name__ == '__main__': main()
# Escreva um programa que pergunte o salario de um funcionário e calcule o valor do seu aumento # Para salários superiores a R$ 1250,00 calcule um almento de 10% # Para salários inferiores ou iguais é aumento de 15% salAtual = float(input(f'Informe o seu salário atual: ')) ajusteMaior = 0.10 ajusteMenor = 0.15 salM...
DEPRECATION_WARNING = ( "WARNING: We will end support of the ArcGIS interface by the 1st of May of 2019. This means that there will " "not be anymore tutorials nor advice on how to use this interface. You could still use this interface on " "your own. We invite all CEA users to get acquainted with the CEA D...
# 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 ...
# coding: utf-8 test_group = 'test_group' test_event = 'test_event' test_value_str = 'test_value' test_value_int = 123 test_value_int_zero = 0 test_value_float = 123.0 test_value_float_zero = 0.0 test_value_none = None test_label = 'test_label' test_value_list = [ test_value_str, test_value_int, test_value_floa...
def test(): # Test assert( students == {'Ahmed': 87, 'Waleed': 69, 'Hesham': 92, 'Khaled': {'Math': 86, 'English': 74}} ), "اجابة خاطئة: لم تقم باضافة الطالب خالد ودرجاته الى قاموس الطلاب بشكل صحيح" assert('students["Khaled"]["English"]' in __solution__ or "students['Khaled']['English']" in __so...
# This file is auto-generated. Do not edit! DAQmx_Buf_Input_BufSize = 0x186C DAQmx_Buf_Input_OnbrdBufSize = 0x230A DAQmx_Buf_Output_BufSize = 0x186D DAQmx_Buf_Output_OnbrdBufSize = 0x230B DAQmx_SelfCal_Supported = 0x1860 DAQmx_SelfCal_LastTemp = 0x1864 DAQmx_ExtCal_RecommendedInterval = 0x1868 DAQmx_ExtCal_LastTemp = 0...
principal=int(input("Enter the Principal amount")) year=int(input("Enter the no. of Years")) rateofinterest=int(input("Enter the Rate of Interest. Just enter the number")) amount=principal*((1+rateofinterest/100)**year) compoundinterest = amount-principal print(f"Compound Interest is {compoundinterest} Rupees") p...
fr = str(input('Digite uma frase:')).upper().lstrip().rstrip() #abreviando pela esquerda e direita c = fr.count('A') #contando o numero de vezes que a aparece print('A letra A aparece {} vezes na frase.'.format(c)) print('A letra A apareceu pela primeira vez na posição {}'.format(fr.find('A')+1)) print('A letra A apare...
def div42by(divideBy): return 42 / divideBy print (div42by(2)) print (div42by(12)) print (div42by(0)) print (div42by(1))
result = {title: str(i) for i, titles in DATA.items() for title in titles}
# -*- coding: utf-8 -*- """ Created on Tue Oct 8 16:55:35 2019 @author: Kelvin """ def spill(init,a,indices): a[a>init['spillsize']]=0 # Finding indices of spill-over elements, up, down, right, left row_centre=indices[0] row_down=[x+1 for x in indices[0]] row_up=[x-1 for x in indices[0]] c...
INCIDENTS_RESULT = [ {'ModuleName': 'InnerServicesModule', 'Brand': 'Builtin', 'Category': 'Builtin', 'ID': '', 'Version': 0, 'Type': 1, 'Contents': { 'ErrorsPrivateDoNotUse': None, 'data': [ { 'CustomFields': {'dbotpredictionprobability': 0, ...
class Event: def __init__(self, label=None, half=None, time=None, team=None, position= None, visibility=None): self.label = label self.half = half self.time = time self.team = team self.position = position self.visibility = visibility def to_text(self): return self.time + " || " + self.label + " - ...
lower = int(input('Min: ')) upper = int(input('Max: ')) for num in range(lower, upper + 1): sum = 0 n = len(str(num)) temp = num while temp > 0: digit = temp % 10 sum += digit ** n temp //= 10 if num == sum: print(num)
def test_home_page(client): """test home page""" response = client.get("/") assert b"Create Your Own Resolution" in response.data assert b"Resolution List" in response.data def test_statistic_page(client): """test statistic page""" response = client.get("/statistic") assert b"Create Yo...
def linearRegression(px,py): sumx = 0 sumy = 0 sumxy = 0 sumxx = 0 n = len (px) for i in range(n): x = px[i] y = py[i] sumx += x sumy += y sumxx += x*x sumxy += x*y a=(sumxy-sumx*sumy/n)/(sumxx-(sumx**2)/n) b=(sumy-a*sumx)/n print(su...
''' 43-Desenvolva uma lógica que leia o peso e altura de uma pessoa,calcule seu imc e mostre seu status de acordo com a tabela abaixo: ->Abaixo de 18.5:Abaixo do peso ->25 até 30:Sobrepeso ->Entre 18.5 e 25:Peso ideal ->30 até 40:Obesidade ->Acima de 40:Obesidade mórbida ...
expected_output = { "vrf": { "default": { "interfaces": { "GigabitEthernet1": { "address_family": { "ipv4": { "dr_priority": 1, "hello_interval": 30, "n...
# Tic-Tac-Toe 3x3 game game = [[" ", " ", " "], [" ", " ", " "], [" ", " ", " "]] players = ["X", "O"] current_player = 0 GAME_CONTINUES = -1 DRAW = -2 # if a player won, number of that player is returned def print_state(game_state): for line in range(3): print(*game_state[line], sep=" |...
BUCKWALTER_MAP = { '\'': '\u0621', '|': '\u0622', '>': '\u0623', 'O': '\u0623', '&': '\u0624', 'W': '\u0624', '<': '\u0625', 'I': '\u0625', '}': '\u0626', 'A': '\u0627', 'b': '\u0628', 'p': '\u0629', 't': '\u062A', 'v': '\u062B', 'j': '\u062C', 'H': '\u062...
# OpenWeatherMap API Key weather_api_key = "6006d361789a66a63d965d32098db97e" # Google API Key g_key = "AIzaSyBkES3rvs8W2Uv7OJXtnd7i86WvOSEJp7A"
class GraphAlgos: """ Wrapper class which handle the graph algorithms more efficiently, by abstracting repeating code. """ database = None # Static variable shared across objects. def __init__(self, database, node_list, rel_list, orientation = "NATURAL"): # Initialize the stati...
_4digit: grove.TM1637 = None def on_forever(): global _4digit if input.button_is_pressed(Button.A): _4digit = grove.create_display(DigitalPin.C16, DigitalPin.C17) _4digit.bit(1, 3) basic.pause(1000) _4digit.bit(2, 3) basic.pause(1000) _4digit.bit(3, 3) ...
class Solution: def gardenNoAdj(self, N: int, paths: List[List[int]]) -> List[int]: res = [0] * N G = [[] for i in range(N)] for x,y in paths: G[x-1].append(y-1) G[y-1].append(x-1) for i in range(N): res[i] = ({1,2,3,4} - {res[j] for j in G[i]}).po...
input_file = open("input.txt", "r") entriesArray = input_file.read().split("\n") depth_measure_increase = 0 for i in range(1, len(entriesArray), 1): if int(entriesArray[i]) > int(entriesArray[i-1]): depth_measure_increase += 1 print(f'{depth_measure_increase=}')
class TranslationMissing(Exception): # Exception for commands which currently do not support translation. def __init__(self, name): super().__init__( f"Translation for the command {name} is not currently supported" )
MONGO_SERVER_CONFIG = { 'host': 'mongo', 'port': 27017, 'username': 'spark-user', 'password': 'spark123' } MONGO_DATABASE_CONFIG = { 'DATABASE_NAME': 'video_games_analysis', 'COLLECTION_NAME': 'games' }
""" atpthings.util.dataframe ------------------------ """ def add_one(number: int = 8) -> int: """Add one :param number: write number :type number: int :return: return the number :rtype: int """ return number + 1 def add_two(number: int) -> int: """Add two :param number: write...
f = str(input('Digite uma frase: ')) f = f.lower().strip() numero = f.count('a') primeira = f.find('a') ultima = f.rfind('a') print('A letra A aparece {} vezes'.format(numero)) print('A letra A aparece pela primeira vez na posição {}'.format(primeira+1)) print('A letra A aparece pela última vez na posição {}'.format(...
# Authors: Hyunwoo Lee <hyunwoo9301@naver.com> # Released under the MIT license. def read_data(file): with open(file, 'r', encoding="utf-8") as f: data = [line.split('\t') for line in f.read().splitlines()] data = data[1:] return data
class Rounder: def round(self, n, b): m = n%b return n-m if m < (b/2 + b%2) else n+b-m
# Copyright (c) 2012 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Build the specific library dependencies for validating on x86-64 { 'includes': [ '../../../../../build/common.gypi', ], 'target_defaults...
n = int(input('\n\tDigite um número: ')) print('\n\tTabuádo do {}:'.format(n)) for i in range(0, 11): print('\t {} x {} = {}'.format(n, i, n*i)) input('\n\nPressione <enter> para continuar')
n1 = int(input('enter first number: ')) n2 = int(input('enter second number: ')) print('Sum: ', int(n1+n2))
n1=480 n2=10 soma=0 for i in range (0,30,1): div=n1/n2 if i%2==0: soma=soma+div else: soma=soma-div n1=n1-5 n2=n2+1 print(soma)
class Student: """ Create a student. """ def __init__(self, name): self.name = name def __repr__(self): return 'This student is easy 4.0' #__str__ has high priority than __repr__ def __str__(self): return 'Zhang A +' def _get_name(self): print('This is...
package = { 'name': 'haorm', 'version': '0.0.8', 'author': 'singein', 'email': 'singein@outlook.com', 'scripts': { 'default': 'echo 请输入明确的命令名称' } }
''' ALU for CPU ''' bit = 0 | 1 byte = 8 * bit def adder(num1: bit, num2: bit, carry: bit) -> [bit, bit]: x = num1 ^ num2 s = x ^ carry a = x & carry b = num1 & num2 c = a | b return [c, s] def adder4bit(num1: byte, num2: byte) -> [bit, byte]: carry, a = adder(int(num1[3]), int(num2[3]),...
def dot(self, name, content): path = j.sal.fs.getTmpFilePath() j.sal.fs.writeFile(filename=path, contents=content) dest = j.sal.fs.joinPaths(j.sal.fs.getDirName(self.last_dest), "%s.png" % name) j.do.execute("dot '%s' -Tpng > '%s'" % (path, dest)) j.sal.fs.remove(path) return "![%s.png](%s.png)...
class PagedList(list): def __init__(self, items, token): super(PagedList, self).__init__(items) self.token = token
""" @deprecated will be remove next minor """ class Singleton(type): """ @deprecated will be remove next minor """ _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) re...