content
stringlengths
7
1.05M
class Val: def __init__(self, val): self.val = val def __repr__(self): return 'Val(%s)' % self.val.__repr__() class Array: def __init__(self, shape): self.shape = shape def __repr__(self): return 'Array%s' % self.shape.__repr__() def idl_repr(self): s = '[...
class BulkBankValidation: end_point = "/payout/v1/bulkValidation/bankDetails" req_type = "POST" def __init__(self, *args, **kwargs): self.bulkValidationId = kwargs["bulkValidationId"] self.entries = kwargs["entries"]
# # PySNMP MIB module HP-ICF-OSPF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-OSPF # Produced by pysmi-0.3.4 at Wed May 1 13:34:55 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
# Prints reversed list numbers = [] while True: n = int(input('Digite um valor: ')) numbers.append(n) choice = str(input('Deseja continuar? [S/N] ').strip().lower()[0]) if choice in 'n': break print('-=' * 30) print(f'Você digitou {len(numbers)} valores.') numbers.sort(reverse=True) print(f'Os valores em ordem de...
#!/usr/bin/env python # This script is intended to be run from within the OSCar MIDI Sysex Grammar file currentGrammar = currentMapper.getCurrentGrammar() multiByteID = currentGrammar.getStructureByName("Multi Byte ID") singleByteID = currentGrammar.getStructureByName("Single Byte ID") currentPos = currentMapper.get...
# # @lc app=leetcode id=37 lang=python3 # # [37] Sudoku Solver # # @lc code=start class Solution: # @param board, a 9x9 2D array # Solve the Sudoku by modifying the input board in-place. # Do not return any value. def solveSudoku(self, board): def isValid(x,y): tmp=board[x][y]; boa...
""" Registry. This implementation was borrowed from happy[1] project by Chris Rossi. [1]: http://bitbucket.org/chrisrossi/happy """ __all__ = ["Registry", "SimpleAxis", "TypeAxis"] class Registry(object): """ Registry implementation.""" def __init__(self, *axes): self._tree = _TreeNode() s...
#!/usr/bin/python3 class People(): name = '' age = 0 __weight = 0 def __init__(self, n, a, w): self.name = n self.age = a self.__weight = w def speak(self): print("%s says that I am %d years old"%(self.name, self.age)) class Student(People): grade = 0 d...
def search_in_list(letter, list): answer = ["error", "correct format"] for s in list: if letter == s: answer = ["ok", "correct format"] return answer #validates that the input have the format we want def validate_format(card): number = len(card) list1 = ["2", "3", "4", "...
# Uso do While cont = 0 while cont == 100: print(cont) cont += 1
class Solution: def killProcess(self, pid, ppid, kill): indexes, res = collections.defaultdict(list), [kill] for i, p in enumerate(ppid): indexes[p].append(i) stack = [kill] while stack: for i in indexes[stack.pop()]: res.append(pid[i]) ...
def load(h): return ({'abbr': 192, 'code': 192, 'title': 'Reserved for local use'}, {'abbr': 193, 'code': 193, 'title': 'Reserved for local use'}, {'abbr': 194, 'code': 194, 'title': 'Reserved for local use'}, {'abbr': 195, 'code': 195, 'title': 'Reserved for local use'}, ...
"""a binary search tree, in which for every node x and it's left and right nodes y and z, respectively. y <= x >= z""" class BinaryTreeNode: """docstring for BT Node""" def __init__(self, data=None, left=None, right=None): self.data = data self.left = left self.right = right # TRAVERSING OPERATION def preor...
""" Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tuple matters). Find the number of boomerangs. You may assume that n will be at most 500 and coordinates of points ar...
""" Classical Armenian Phonology. Sources: - `<https://www.unicode.org/charts/PDF/U0530.pdf>`_ - Macack, Martin (2017) The phonology of Classical Armenian in Klein, Joseph and Friz. (2017) Handbook of Comparative and Historical Linguistics, 41.2. """ __author__ = ["Caio Geraldes <caio.geraldes@usp.br>"] MONOPHTON...
# # Copyright (C) 2018 The Android Open Source Project # # 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 la...
class SimpleEdge(): vertex_a = None vertex_b = None name = None def __init__(self, name=None, vertex_a=None, vertex_b=None): if (name == None): name = vertex_a.__str__() + vertex_b.__str__() self.name = name self.vertex_a = vertex_a self.vertex_b = vertex_b ...
program_name = "Matheus's Calculator" print(f'{program_name:#^30}') numeric_operator = '' sair = '' while True: try: number_1 = float(input('Enter a number:')) except: print('Invalid character') continue try: number_2 = float(input('Enter another number: ')) except: ...
class Solution: def __init__(self): self.xMoves = [2, 1, -1, -2, -2, -1, 1, 2] self.yMoves = [1, 2, 2, 1, -1, -2, -2, -1] def solveKKnight(self, N): self.N = N self.board = [[-1] * N for x in range(N)] self.board[0][0] = 0 resExist = self.solveKKnightUtil(0,...
print('Calcule a média de 2 notas abaixo:') nota_1 = float(input('Primeira nota: ')) nota_2 = float(input('Segunda nota: ')) media = (nota_1 + nota_2) / 2 if media < 5: print('Que triste! Sua média não atingiu o mínimo de 5 pontos.') print('Situação: reprovado!') elif media >= 5 and media < 7: print('Voc...
for x in range(10): print('from 0 to 9:') print(x) print('\n') for x in range(5, 12): print('from 5 to 11:') print (x) print('\n') # 3 numbers are used to put the range and the last number signifies the amount of plus need to be added to each number for x in range(10, 40, 5): print('...
# process local states local = range(34) # L states L = {"x0" : [0, 16], "x1" : [1, 17], "k0" : [22], "k1" : [23], "kf" : [30], "m0" : [4, 5, 20, 21], "m1" : [3, 5, 19, 21]} # initial states initial = [0, 1, 16, 17, 26, 27] # rules rules = [] rules.append({'idx': 0, 'from': 0, 'to': 2, 'guard': "(and (< x0 (- n t)) (<...
e = int(input()) set_e = set(input().split()) f = int(input()) set_f = set(input().split()) total = set_e.union(set_f) print(len(total))
#!/usr/bin/env python # coding=utf-8 # py lint: disable= """ data that can be used for multiple test conditions """ # from typing import Iterable # import re # from _pytest._code.code import ExceptionInfo # import pytest # from automata_universe import AutomataUniverse NEIGHBOURHOOD_1D = ((-1,),(1,)) NEIGHBOURHOOD_2...
class ClaseGenerica: def __init__(self, **kwargs): for k, v in kwargs.items(): setattr(self, k, v) def __str__(self): attrs = ["{}={}".format(k, v) for (k, v) in self.__dict__.items()] classname = self.__class__.__name__ return "%s: %s" % (classname, ",".join(attrs))...
class ElementInfo: def __init__(self, element, elementType, name=None, parent=None, extraOptions=None, createAfter=None, customImportPath=None): # The actual GUI element self.element = element # Name of the element type self.type = elementType # Visible Name (Node-Name) of ...
{ "targets": [ { "target_name": "grandiose", "sources": [ "src/grandiose_util.cc", "src/grandiose_find.cc", "src/grandiose_send.cc", "src/grandiose_receive.cc", "src/grandiose.cc" ], "include_dirs": [ "include" ], 'conditions': [ ...
description = 'setup for the velocity selector' group = 'optional' tango_base = 'tango://phys.maria.frm2:10000/maria/' devices = dict( selector_speed = device('nicos.devices.tango.WindowTimeoutAO', description = 'Selector speed control', tangodevice = tango_base + 'selector/speed', unit =...
class Szopa: pomalowaneBudynki = 0 def __init__(self, bok_a, bok_b, wys_h): self.podstawa_a = bok_a self.podstawa_b = bok_b self.wysokosc_h = wys_h Szopa.pomalowaneBudynki += 1 def Pomaluj(self): return 2*(self.podstawa_a + self.podstawa_b) * self.wysokosc_h szop...
# color palette for nyu40 labels (correspond to ScanNetV2 ground truth labels) def create_color_palette_gt(): return [ (0, 0, 0), (174, 199, 232), # wall (152, 223, 138), # floor (31, 119, 180), # cabinet (255, 187, 120), # bed (188, 189, 34), # chair (140, 8...
RES_MESSAGE_KEY_NAME = 'message' REQ_USER_EMAIL_KEY_NAME = 'email' REQ_USER_PASSWORD_KEY_NAME = 'password' REQ_USER_FIRST_NAME_KEY_NAME = 'first_name' REQ_USER_LAST_NAME_KEY_NAME = 'last_name' REQ_USER_PHONE_KEY_NAME = 'phone' REQ_USER_PROFILE_PICTURE_DATA_KEY_NAME = 'profile_image_data' REQ_USER_BIRTHDAY_KE...
# 1. Реализовать функцию, принимающую два числа (позиционные аргументы) и выполняющую их деление. Числа запрашивать у # пользователя, предусмотреть обработку ситуации деления на ноль. def show_division(user_input_1, user_input_2): """Функция показывает результат деления первого агрумента на второй""" try: ...
# Populate these fields on your local machine. client_id = '' client_secret = '' redirect_uri = ''
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2021, Cisco Systems # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" --- module: authorization_profile_info short_description: Information module for Authorization Profile description: - Get all ...
l = [['felipe', 99], ['tamara', 50], ['fernando', 60]] l1 = sorted(l) l = sorted(l) print(l) print(l1)
_base_ = [ '../../_base_/models/mocov1/r18.py', '../../_base_/datasets/imagenet/mocov1_sz224_bs64.py', '../../_base_/default_runtime.py', ] # interval for accumulate gradient update_interval = 1 # total: 4 x bs64 x 1 accumulates = bs256 # optimizer optimizer = dict(type='SGD', lr=0.03, weight_decay=1e-4,...
{ 'variables': { 'ENGINE_ROOT': '<(GOOGLE3)/i18n/input/engine', }, 'conditions': [ ['OS!="win"', { 'variables': { 'PROTOC': '<!(which protoc)', }, }], ], 'targets': [ { 'target_name': 'stubs', 'type': '<(library)', 'sources': [ '<(ENGINE_ROOT)/stub...
def extractDmtranslationscnWordpressCom(item): ''' Parser for 'dmtranslationscn.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('TSLDB', 'The Strongest Legend of Dragon Ball',...
class Solution: def equalSubstring(self, s: str, t: str, maxCost: int) -> int: N = len(s) max_substring = 0 total_cost = 0 left = 0 for right in range(N): total_cost += self._get_cost(s[right], t[right]) while total_cost > maxCost and left < N: ...
#!/usr/bin/env python3 """Project 0x03. Probability""" class Binomial: """Class that represents an Binomial distribution""" e = 2.7182818285 pi = 3.1415926536 def __init__(self, data=None, n=1, p=0.5): """Constructor of Binomial Parameters: data (list): list of the data to ...
n=int(input()) if n%2==1: print(max(n, n*(n-1)*(n-2))) else: if n%3==0: print(max(n, (n-1)*(n-2)*(n-3))) else: print(max(n, n*(n-1)*(n-3)))
# ref: https://www.zhihu.com/question/381784377/answer/1099438784 table = 'fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' tr = {} for i in range(58): tr[table[i]] = i s = [11, 10, 3, 8, 4, 6] xor = 177451812 add = 8728348608 def b2a(x): r = 0 for i in range(6): r += tr[x[s[i] - 2]] * ...
''' 153. Find Minimum in Rotated Sorted Array https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/ similar problem: "154. Find Minimum in Rotated Sorted Array II" https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ Suppose an array sorted in ascending order is rotated at some pivot u...
def remove_repetidos(lista): """ Recebe uma lista de inteiros e remove os repetidos e retorna uma lista ordenada. >>> remove_repetidos([2, 4, 2, 2, 3, 3, 1]) [1, 2, 3, 4] >>> remove_repetidos([1, 2, 3, 3, 3, 4]) [1, 2, 3, 4] :param lista: list :return: list """ list...
#Ex.06 N = int(input('Número de termos da P.A.: ')) a1 = int(input('1° termo: ')) an = int(input('Último termo: ')) som = (a1 + an) * N / 2 print(int(f'A soma dos termos é {som}'))
# Prompt: Given a bst, connect each node with its level order successor. The last node of each level should point to the first node of the next level # Approach: Traverse through the tree. Set curr.right? equal to the next sibling node. # O(n)t | O(n)s def connectSiblings(head): queue = [head] while queue: ...
test_data = {"data":{ "region" : { "name":"africa", "avgAge":19.7, "avgDailyIncomeInUSD":4, "avgDailyIncomePopulation":0.73, }, "periodType":"days", "timeToElapse":38, "reportedCases":2747, "population":92931687, "totalHospitalBeds":678874, }} def estimator(data): _data = data ...
def find_longest_word(words_list): word_len = [] for n in words_list: word_len.append((len(n), n)) word_len.sort() return word_len[-1][1] print(find_longest_word(["PHP", "Exercises", "Backend"]))
def outer(): x = 10 def inner(): y = 20 inner() return x + y my_func = outer print(my_func()) # h1_tag = html_tag('h1') # print h1_tag # def html_tag(tag): # def print_tag(text): # return '<{0}>{1}</{0}>'.format(tag,text) # return print_tag # h1_tag = html_tag('h1') # print ...
""" Leetcode 20 - Valid Parentheses https://leetcode.com/problems/valid-parentheses/ 1. Time: O(n) Memory: O(n) (n is length of s) """ class Solution1: """ 1. MINE | Stack """ def is_valid(self, s: str) -> bool: match_dict = {'}': '{', ')': '(', ']': '['} stack = [] for x in s: ...
''' The collections.Sequence abstract base class does not provide support for comparing two sequences to each other. Modify our Sequence class from Code Fragment 2.14 to include a definition for the __eq__ method, so that expression seq1 == seq2 will return True precisely when the two sequences are element by element e...
class PropertyDescriptorCollection(object,ICollection,IEnumerable,IList,IDictionary): """ Represents a collection of System.ComponentModel.PropertyDescriptor objects. PropertyDescriptorCollection(properties: Array[PropertyDescriptor]) PropertyDescriptorCollection(properties: Array[PropertyDescriptor],r...
''' Given a binary array nums, return the maximum number of consecutive 1's in the array. Example 1: Input: nums = [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3. Example 2: Input: nums = [1,0,1,1,0,1] Output: 2 ...
"""Get map size. Set _n to the number of elements stored in _mymap. This is not always equal to the map capacity. Source: programming-idioms.org """ # Implementation author: bukzor # Created on 2018-04-08T07:21:23.163901Z # Last modified on 2018-04-08T07:21:23.163901Z # Version 1 n = len(mymap)
class Solution: def sortedSquares(self, nums): square_list = [x*x for x in nums] square_list.sort() return square_list def sortedSquares1(self, nums): pos_list = [] neg_list = [] for x in nums: if x < 0: neg_list.insert(0, x * x) ...
# O Sr. Manoel Joaquim possui uma grande loja de artigos de R$ 1,99, com cerca de 10 caixas. Para agilizar o cálculo de quanto cada cliente deve pagar ele desenvolveu um tabela que contém o número de itens que o cliente comprou e ao lado o valor da conta. Desta forma a atendente do caixa precisa apenas contar quantos i...
class HandleRef(object): """ Wraps a managed object holding a handle to a resource that is passed to unmanaged code using platform invoke. HandleRef(wrapper: object,handle: IntPtr) """ @staticmethod def ToIntPtr(value): """ ToIntPtr(value: HandleRef) -> IntPtr Returns the internal integ...
# Time: O(n) # Space: O(1) class Solution(object): def getSumAbsoluteDifferences(self, nums): """ :type nums: List[int] :rtype: List[int] """ prefix, suffix = 0, sum(nums) result = [] for i, num in enumerate(nums): suffix -= num resul...
# quick sort O(nlogn) - Average if pivot is choosen wisely # O(n^2) - Worse # O(logn) - space complexity # this implementaion has worst space complexity of O(n^2) def quick_sort(arr, low, high): if low < high: pivot = partition(arr, low, high) quick_sort(arr, low, pivot - 1) qui...
#Source : https://leetcode.com/problems/add-two-numbers/ #Author : Yuan Wang #Date : 2021-02-19 ''' ********************************************************************************** *You are given two non-empty linked lists representing two non-negative integers. *The digits are stored in reverse order, and each o...
def flaeche(a, b): rechtecksflaeche = a * b # Rechteck mit den Seiten a und b dreiecksflaeche = a * b / 2 # Dreieck mit Grundlinie a und Höhe b return rechtecksflaeche, dreiecksflaeche a = 3 b = 5 resultat = flaeche(a,b) # Gibt Tupel zurück print(resultat) print(resultat[1]) rechteck, dreieck ...
# File: TMQuestion.py """This module defines a class to represent a single question.""" class TMQuestion: MARKER = "-----" def __init__(self, name, text, answers): """Creates a new TMQuestion object with these attributes.""" self._name = name self._text = text self._answers =...
# coding: utf8 """ 题目链接: https://leetcode.com/problems/string-to-integer-atoi/description. 题目描述: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cas...
class InvalidYoutubeURLError(Exception): def __init__(self, message, errors = None): super().__init__(message) self.errors = errors class TranscriptNotFoundError(Exception): def __init__(self, message, errors = None): super().__init__(message) self.errors = errors class Invalid...
top = min(gs1.top, gs2.top) bottom = max(gs1.bottom, gs2.bottom) gs1.tight_layout(fig, rect=[None, 0 + (bottom-gs1.bottom), 0.5, 1 - (gs1.top-top)]) gs2.tight_layout(fig, rect=[0.5, 0 + (bottom-gs2.bottom), None, 1 - (gs2.top-top)], h_pad=0.5)
def test_get_work_livre(work_object_livre): details = work_object_livre.get_details() assert isinstance(details, dict) assert len(details) == 16 def test_rating_work_livre(work_object_livre): main_rating = work_object_livre.get_main_rating() assert isinstance(main_rating, str) assert main_rati...
# # Solution to Project Euler problem 216 # Copyright (c) Project Nayuki. All rights reserved. # # https://www.nayuki.io/page/project-euler-solutions # https://github.com/nayuki/Project-Euler-solutions # # As per the problem statement, define t(n) = 2n^2 - 1 and assume that always n > 1. # Hence t(n) >= 7, and the...
def print_rhombus(n: int): # global namespace GROWING: int = 1 # local namespace SHRINKING: int = -1 # fn-in-fn: closure def print_line(i: int, direction: int): # local namespace if i == 0: return line = ' ' * (n - i) + '* ' * i print(line.rstrip()) if i =...
#Escreva um programa que escreva na tela, de 1 até 100, de #1 em 1, 3 vezes. A primeira Vez deve usar a estrutura de #repetição for, a segunda while, e a terceira do while. for c in range(1,101): print(c) i=1 while(i<=100): print(i) i+=1 u=1 while(u!=100): print(u) u+=1
#!/usr/bin/env python3 with open('../notes/gamebits/gamebits.txt', 'rt') as inFile: for line in inFile: line = line.split('|') if not line[0].startswith('0'): continue print('<bit id="0x%s" table="%s" unk1="0x%s" unk2="0x%s" max="0x%s" name="%s">%s</bit>' % ( line[0], ...
class Individual(object): def __init__(self, gedcom, db): data = gedcom # .to_dict() self.id = data.xref self.name = data.get_fact('NAME') self.birth = data.get_fact('BIRT') # print(self.birth.to_dict()) self.parent_family = "" self.parents = [] fa...
#!/usr/bin/python3 lines = [1, 2, 3, 4, 5, 6, 7, 8, 9] i = len(lines + lines) +len("me") + len(lines) - 1 + len("") j = len("hello") k = int("5") + int(5) string = "string" print (len("string")) print ("%d %s length, %d integer sum" % (i+j, string, k), end = ' end\n') a = [3, 6, 8, 2, 78, 1, 23, 45, 9] b = sorted(...
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = input() # 勝てる手の組み合わせを持つ辞書型を生成する win_hand = {"r": "p", "s": "r", "p": "s"} ANS = [] # 勝てる手の配列を作成する for i in range(N): ANS.append(win_hand[T[i]]) # 配列を1つの文字列にする ans = "".join(ANS) # 制約のある手以降を探索 for i in range(K, N): # K回前の手と同じなら出した手をxに置換...
def print_serialization(pstats): # pylint: disable=too-many-locals print("ncalls tottime percall % cumtime percall function") total_pct = 0.0 for path_line_func, data in pstats.sort_stats("module", "cumulative").stats.items(): path, line, func = path_line_func # pylint: disable=unu...
class Solution: def addBinary(self, a: str, b: str) -> str: #解法1,位运算 x, y = int(a, 2), int(b, 2) while y: answer = x ^ y carry = (x & y) << 1 x, y = answer, carry return bin(x)[2:]
class MyClass: def __init__(self, s): self.s = s def function(c: MyClass) -> str: return c.copy().upper() function(MyClass('string'))
print('Escreva um programa que pergunte a quantidade de Km percorridos por um carro alugado e a quantidade de dias pelos quais ele foi alugado.') print(' Calcule o preço a pagar, sabendo que o carro custa R$60 por dia e R$0.15 por Km rodado.\n') quilometro = int(input('Quantos quilometros o carro andou: ')) dias = int(...
class Article: def __init__(self, url): ''' Base class to auto extract main information :param url: article's url to crawl data ''' self.url = url # some information need to extract self.title = "" self.text = "" self.authors = [] sel...
# The isBadVersion API is already defined for you. # @param version, an integer # @return a bool # def isBadVersion(version): class Solution: def firstBadVersion(self, n): MAX = n MIN = 1 while MAX >= MIN: MID = (MAX+MIN)//2 #bad if isBadVer...
class _RBNode: """Implements a Binary Node with additional color bit""" def __init__(self, key, value, isRed, left=None, right=None): self.key, self.value = key, value self.left, self.right = left, right self.isRed = isRed class RedBlackTree: """Implements https://en.wikipedia.org/...
# -*- coding: utf-8 -*- def set_FEMM_circuit_prop(femm, circuits, Clabel, I=None): """Create or update the property of a circuit Parameters ---------- femm : FEMMHandler client to send command to a FEMM instance circuits: list list the name of all circuits Clabel: str ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # J.V.Ojala 26.11.2021 # marketday (coinstar) class Market_day(): def __init__(self, date, start, end, volume=None, bearish=False): self.date = date self.open_value = start self.close_value = end self.is_bearish = start > end ...
""" Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Solution: 1. two pass. Get the length of the linked list at first pass, delete the node at t...
class ParseError(Exception): """ Unable to parse data type """ pass
# -*- coding: utf-8 -*- class MockSettings(object): def __init__(self, **kwargs): [self.__setattr__(key, val) for key, val in kwargs.items()]
pkgname = "dosfstools" pkgver = "4.2" pkgrel = 0 build_style = "gnu_configure" configure_args = ["--enable-compat-symlinks"] hostmakedepends = ["pkgconf"] makedepends = ["eudev-devel", "linux-headers"] pkgdesc = "DOS filesystem tools" maintainer = "q66 <q66@chimera-linux.org>" license = "GPL-3.0-or-later" url = "https:...
WHITE = "\033[1;37m" YELLOW = "\033[1;33m" GREEN = "\033[1;32m" BLUE = "\033[1;34m" CYAN = "\033[1;36m" RED = "\033[1;31m" MAGENTA = "\033[1;35m" BLACK = "\033[1;30m" DARKWHITE = "\033[0;37m" DARKYELLOW = "\033[0;33m" DARKGREEN = "\033[0;32m" DARKBLUE = "\033[0;34m" DARKCYAN = "\033[0;36m" DARKRED = "\033[...
#Faça um programa, com uma função que necessite de um #argumento. A função retorna o valor de caractere ‘P’, #se seu argumento for positivo, e ‘N’, se seu argumento #for zero ou negativo. def verifNum(num): if(num<=0): return 'n' elif(num>0): return 'p' numero=int(input("Informe um numero pos...
# -*- coding: utf-8 -*- """ Created on Wed Jul 28 14:05:50 2021 @author: user24 """ '''  CoinCase クラスの基本仕様  500 円、100 円、50 円、10 円、5 円、1 円が、それぞれ何枚あるかインスタンス変数で管理。  add_coins メソッドで硬貨を追加する。 引数は硬貨の種類と枚数の 2 つのデータ。  get_count メソッドで、指定した硬貨が、何枚あるかを取得する。  引数は硬貨の種類、戻り値は枚数の 2 つのデータ。  get_amount メソッドで硬貨の総額を取得する。  戻り値は...
PI = 3.14 if __name__ == '__main__': print("init successful")
# Copyright 2018 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 la...
{ "targets": [{ "target_name": "tree", "sources": [ "src/treegen.cpp" ], "include_dirs": [ "src" ], "cflags_cc+": [ '-std=c++0x' ] }] }
def fib_recursive(n: int) -> int: if n < 2: return 1 else: return fib_recursive(n - 1) + fib_recursive(n - 2) def fib_non_recursive(n: int) -> int: CALL, HANDLE = 0, 1 call_stack = [(CALL, n)] return_stack = [] while call_stack: action, data = call_stack.pop() i...
def constfn(val): def f(_): return val return f class PPOExpConfig: def __init__(self): self.PROJECT = "" self.TAGS = ["PPO"] self.WORLD_SIZE = 1 self.DEVICE = "cuda" self.NUM_ENVS = 2 # 32 * (8 // self.WORLD_SIZE) self.TOTAL_TIMESTEPS = 256e6 ...
# Iterators: Objetos que são iteráveis class RGB: def __init__(self): self.cores = ['red', 'green', 'blue'][::-1] #Definindo a classe que será instanciada como um objeto iterável def __iter__(self): return self # Definindo a classe como sendo um iterator def __next__(self): ...
# Vertailuoperaattorit # Yhtä suuri print(5 == 5) print("kissa" == "kissa") # Eri suuri print(5 != 4) print("kisa" != "kissa") print("Kissa" != "kissa") # Suurempi print(5 > 4) # Suurempi tai yhtä suuri print(5 >= 4) print(5 >= 5) # Pienempi print(7 < 8) # Pienempi tai yhtä suuri print(7 <= 8) print(7 <= 7) # M...
#Ler um número e mostrar se ele é primo ou não num = int(input("Digite um número inteiro: ")); cont = 0; for c in range(1, num + 1): if num % c == 0: print(f"\033[33m{c}\033[m", end=' '); cont += 1; else: print(f"\033[31m{c}\033[m", end=' '); if cont == 2: print(f"\nO...
project_schema = { 'project_name': 'string', 'owner_id': 'string', 'members': [ 'string' ], 'comments': [ { 'body': 'text', 'user': 'string', 'posted': 'timestamp' } ], 'project_repo': 'string', 'project_description': 'text', ...
def n_primos(x): continuar = 1 count = 0 while continuar ==1: for aqui in reversed(range(2,x+1)): if all(aqui%d !=0 for d in range(2,aqui)): count += 1 return count continuar = 0
# # PySNMP MIB module HUAWEI-BRAS-DPI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-BRAS-DPI-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:31:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...