content
stringlengths
7
1.05M
layers = { "title": "DEA Water Observations", "abstract": "Digital Earth Australia (DEA) Water Observations from Space (WOfS)", "layers": [ { "include": "ows_refactored.inland_water.wofs.individual.ows_c3_wo_cfg.layer", "type": "python", }, { "inc...
class FunnyRect(): def setCenter(self, x,y): self.cx = x self.cy = y def setSize(self, a): self.a = a def render(self): rect(self.cx, self.cy, self.a, self.a) def colors(self,b): fill(b) funnyRect = FunnyRect() funnyRect1 = FunnyRect() counter = 0 d...
class MyCustomClass: prop1 = 1 prop2 = "a" prop3 = {1, 2, 3} def test_snapshot_custom_class(snapshot): assert MyCustomClass() == snapshot class MyCustomReprClass(MyCustomClass): def __repr__(self): state = "\n".join( f" {a}={repr(getattr(self, a))}," for a in sor...
ll = [] print(ll) # immutable operation ll.append(1) # mutable operation ll.insert(0, -1) # mutable operation print(ll[0]) # immutable operation print(ll) # immutable operation ll.pop() # mutable operation print(ll) # immutable operation ll[0] = -111 # mutable operation print(ll) # immutable operation tt ...
"""DAY 1/Fib.py Задача: Составить список из 10 первых чисел Фибоначчи (без рекурсии)""" # Так как решить задачу надо без рекурсии, будем пользоваться массивом и for fib = [1, 1] index = 1 for x in range(8): # так как первые два числа у нас уже есть new_fib = fib[1+x]+fib[1+x-1] fib.append(new_fib)...
# # @lc app=leetcode.cn id=1195 lang=python3 # # [1195] distribute-candies-to-people # None # @lc code=end
# Design Snake Game class SnakeGame(object): def __init__(self, width, height, food): """ Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first f...
class Lagrange(): def lagrange(self, points, x): result = { 'error': False, 'errorMessage': None, 'functionOutput': None, 'terms': None, 'polynomial': None, 'resultMessage': None, 'solutionFailed': False } n ...
device_str = " r3-L-n7, cisco, catalyst 2960, ios , extra stupid stuff " #string # NON LIST COMPREHENSION WAY device = list() #we are crating a empty list [0,1,2,3,4] for item in device_str.split(","): #item 0, ittem 1, item 2 etc... device.append(item.strip()) #remove begining and ending spaces for every item...
def process_scope(dom, json_dict): scope_sections = dom.xpath("scope") if len(scope_sections) > 0: json_dict["scope"] = [] for book in scope_sections[0].xpath("bookScope"): if book.text: json_dict["scope"].append(book.text)
#sets 2 variables a and b as age one and age 2. One is enterd it will swap the ages to b,a def swap(age1, age2): a = age1 b = age2 if a <= b: return a, b else: return b, a def swapfunction(): input1 = input("first age") input2 = input("second age") a, b = swap(input1, input2)...
# # @lc app=leetcode id=322 lang=python3 # # [322] Coin Change # # https://leetcode.com/problems/coin-change/description/ # # algorithms # Medium (27.95%) # Total Accepted: 261.6K # Total Submissions: 810K # Testcase Example: '[1,2,5]\n11' # # You are given coins of different denominations and a total amount of mon...
BASE_URLS = [ "www.journals.elsevier.com/aasri-procedia/", "www.elsevier.com/journals/abstract-bulletin-of-paper-science-and-technology/1523-388x", "www.journals.elsevier.com/academic-pediatrics/", "www.journals.elsevier.com/academic-radiology/", "www.journals.elsevier.com/accident-analysis-and-prevention/", "www.elsev...
# Expected Payment's direction class DirectionTypes: CREDIT = 'credit' DEBIT = 'debit' # PaymentOrders class PaymentOrderTypes: ACH = 'ach' WIRE = 'wire' CHECk = 'check' BOOK = 'book' rtp = 'rtp' # account types class AccountTypes: CHECKING = 'checking' SAVINGS = 'savings' OTHE...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. class FICDataVault: def __init__(self): # Common Data self.uid = int() # Used to find the object. ...
# # PySNMP MIB module IANA-RTPROTO-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IANA-RTPROTO-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:02:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
expected_output = { "vrf": { "default": { "address_family": { "ipv4": { "routes": { "0.0.0.0/0": { "candidate_default": True, "active": True, "route": "...
class PyLarkError(Exception): def __init__(self, scope: str, func: str, code: int, msg: str): super().__init__( f"pylark error, scope={scope}, func={func}, code={code}, msg={msg}" ) self.scope = scope self.func = func self.code = code self.msg = msg
#!/usr/bin/env python """ Problem 7 10001st prime By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10,001st prime number? Answer = 104743 """ def main(): upper_limit = 10001 counter = 1 prime_list = [] prime_list.append(2) while ...
budget = float(input()) needed_funds = 0 product = input() counter = 0 total_price = 0 is_budget_over = False while product != 'Stop': counter += 1 product_price = float(input()) if counter % 3 == 0: product_price = product_price / 2 if budget < product_price: is_budget_over = True ...
def perfect_number(num): sum_divisors = 0 for i in range(1, num): if i > 0: if num % i == 0: sum_divisors += i if sum_divisors == num: return 'We have a perfect number!' else: return 'It\'s not so perfect.' number = int(input()) print(perfect_number(n...
class Solution: def defangIPaddr(self, address: str) -> str: return "[.]".join((address.split("."))) slu = Solution() print(slu.defangIPaddr("1.1.1.1"))
# ---------------------------------------------- # Convert a temperature in Fahrenheit to Celsius # ---------------------------------------------- Fahrenheit = 85.2 Celsius = (Fahrenheit - 32) * 5.0 / 9.0 print("Temperature:", Fahrenheit, "Fahrenheit = ", Celsius, " Celsius")
# QUAL É O PREÇO DA PASSAGEM? d = float(input('Qual é a distância da viagem, em km? _ ')) if d <= 200: i = 0.50 print('Essa é uma viagem curta!') else: i = 0.45 print('Essa é uma viagem longa!') print('Cobraremos R$ {:.2f} por cada km rodado.'.format(i)) print('O preço final da passagem é R$ {:.2f}.'...
print('====== DESAFIO 79 ======') lista = list() user = 's' while user == 's': n = int(input('Digite um valor: ')) value = lista.count(n) if value < 1*1: lista.append(n) print('Valor adicionando com sucesso...') else: print('Valor duplicado! Não vou adicionar...') user = str(...
# # @lc app=leetcode.cn id=1410 lang=python3 # # [1410] traffic-light-controlled-intersection # None # @lc code=end
num_tries = 0 def binarysearch(numlist, target): global num_tries if len(numlist) == 0: print("The target is not in this list.") else: midpoint_index = len(numlist) // 2 if numlist[midpoint_index] == target: num_tries += 1 print("The target", target, "was fou...
load("@bazel_skylib//lib:paths.bzl", "paths") load("//ocaml:providers.bzl", "CompilationModeSettingProvider",) load("//ocaml/_functions:utils.bzl", "get_opamroot", "get_sdkpath", ) load(":impl_common.bzl", "tmpdir") ########## RULE: OCAML_INTERFACE ################ def _ocaml_lex_impl(ctx): debu...
class Vertex: def __init__(self, key): """在类的构造方法中,直接初始化id(key字符串)以及邻接字典。""" self.id = key self.connectedTo = {} def addNeighbor(self, nbr, weight=0): """添加邻接顶点,将邻接顶点对象以及相连边的权重作为参数传入""" self.connectedTo[nbr] = weight def __str__(self): return str(self.id) + ...
#: E711:7 if res == None: pass #: E711:7 if res != None: pass #: E711:8 if None == res: pass #: E711:8 if None != res: pass #: E711:10 if res[1] == None: pass #: E711:10 if res[1] != None: pass #: E711:8 if None != res[1]: pass #: E711:8 if None == res[1]: pass # #: E712:7 if res == Tru...
medida = float(input("Diga a distância em metros")) cm = medida * 100 mm = medida * 1000 print("%.2f m é igual a %.0f cm"% (medida, cm)) print("%.2f m é igual a %.0f cm"% (medida, mm))
""" These are intended to be helpful references that will take up a lot of space if included in the main modules, so I'm breaking them out into a separate module...maybe some utility functions will be in order at some point, such as figuring out which attributes all elements have in common, etc. https://developer.intu...
# taken from https://github.com/lepinkainen/pyfibot/ OBSERVATION_CODES = { 10: "utua", 20: "sumua", 21: "sadetta", 22: "tihkusadetta", 23: "vesisadetta", 24: "lumisadetta", 25: "jäätävää tihkua", 30: "sumua", 31: "sumua", 32: "sumua", 33: "sumua", 34: "sumua", 40: "sa...
# Data cfg dataset_type = 'MarvelDatasetBBox' background_type = 'ImageNetDataset' # data_root = 'your_data_path/imagenet/train' # data path base_scale = (256, 256) fore_scale = (128, 255) img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=False) preprocess_pipeline = dict( ...
# # PySNMP MIB module RFC1286-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1286-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:48:48 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...
def findDecision(obj): #obj[0]: Passanger, obj[1]: Coupon, obj[2]: Education, obj[3]: Occupation, obj[4]: Bar, obj[5]: Restaurant20to50, obj[6]: Direction_same, obj[7]: Distance # {"feature": "Passanger", "instances": 51, "metric_value": 0.9526, "depth": 1} if obj[0]>0: # {"feature": "Education", "instances": 47, "...
# Copyright 2020 Chen Bainian # Licensed under the Apache License, Version 2.0 __version__ = '0.2.2'
# NUCLEOTIDES BASES = ['A' 'C', 'G', 'T'] dna_letters = "GATC" dna_extended_letters = "GATCRYWSMKHBVDN" rna_letters = "GAUC" rna_extended_letters = "GAUCRYWSMKHBVDN" dna_ambiguity = { "A": "A", "C": "C", "G": "G", "T": "T", "M": "AC", "R": "AG", "W": "AT", "S": "CG", "Y": "CT",...
""" Assignment 1 Write a short script that will get some information from the user, reformat the information and print it back to the terminal. """ name = input("What is your name? ") favorite_color = input("What is your favorite color? ") print(f"{name}'s favorite color is {favorite_color}.")
expected_output = { "bgp_id": 5918, "vrf": { "default": { "neighbor": { "192.168.10.253": { "address_family": { "vpnv4 unicast": { "activity_paths": "23637710/17596802", "activ...
# File: proofpoint_consts.py # Copyright (c) 2017-2020 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # PP_API_BASE_URL = "https://tap-api-v2.proofpoint.com" PP_API_PATH_CLICKS_BLOCKED = "/v2/siem/clicks/blocked" PP_API_PATH_CLICKS_PERMITTED = "/v2/siem/clicks/permitted" PP...
def caeser(message, key): x = list((map(ord,message))) def foo(a): if 96 < a < 123: if a + key < 123: return chr(a + key) else: return chr(a + key - 123 + 97) else: return chr(a) return ''.join(map(foo,x)).upper()
# Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). # # For example, this binary tree [1,2,2,3,4,4,3] is symmetric: # # 1 # / \ # 2 2 # / \ / \ # 3 4 4 3 class TreeNode: def __init__(self, x): self.val = x self.left = None self.rig...
class Solution(object): def combinationSum2(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] >>> sln = Solution() >>> sln.combinationSum2([1, 1, 2, 3], 3) [[3], [1, 2]] >>> sln.combinationSum2([1, 2, ...
# Artifact management. # Forensic artifacts are a way of semantically specifying various parts of # information to collect from a system. They encode domain specific information # into an easily sharable specification. # For more information, see https://github.com/ForensicArtifacts def index(): return dict() ...
""" The substrate. """ class Substrate(object): """ Represents a substrate: Input coordinates, output coordinates, hidden coordinates and a resolution defaulting to 10.0. """ def __init__(self, input_coordinates, output_coordinates, hidden_coordinates=(), res=10.0): self.input_coordinates = i...
def adder(good, bad, ugly, **kwargs): tmp = good + bad + ugly for k in kwargs.keys(): tmp += kwargs[k] return tmp
#Solution1 def power_of_four(input_number): if input_number==1 or input_number==4: return True if input_number<0 or input_number<4: return False while input_number>4: input_number = input_number/4 remainder = input_number % 4 if remainder>0: return False return True #Tests def p...
#Lojas Quase Dois - Tabela de preços #1 - R$ 1.99 #2 - R$ 3.98 ... #50 - R$ 99.50 cont = 0 cont1 = 0 cont2 = 0 for i in range(1, 51): cont2 += 2 cont += 1 cont1 += 0.01 print(f' #{cont} - R${(cont2 - cont1):.2f}')
""" Junta todas las constantes del sistema y los metodos que involucran la salida al GUI Esta por separado para evitar importes circulares. """ class Globals: """Proporciona la variable global que se utilizara para mandar al contexto de la GUI y la manipulacion de la variable se definen mas abajo""" resul...
"""python 集合操作""" S1 = set("apple") S2 = {'e', 'p', 'l', 'a'} print('set("apple") == {\'e\', \'p\', \'l\', \'a\'}', S1 == S2) S1.add('s') print("S1.add('s') = :", S1) print("S1.difference(S2) = ", S1.difference(S2)) print("S1 - S2 = ", S1 - S2)
data = """ (7 * 5 * 6 + (9 * 8 + 3 * 3 + 5) + 7) * (6 + 3 * 9) + 6 + 7 + (7 * 5) * 4 (4 + 9 + (8 * 2) + 5) * 8 + (3 + 2 * 3 * 7 * (7 * 4 * 5) * 9) * 2 3 + 7 + (9 + 6 + 4 * 7 * 3 + 5) * 9 3 + 3 * (5 + (7 * 5 + 4 * 8 + 9 * 2) + 3) * 8 * 7 (8 + 3 + 7 * 7) + (3 + 8) * 4 + 2 2 + 9 * (7 + 3 * 3 * 8) + 9 + 3 2 * ((5 + 7 + 9 +...
def somar(): a = float(input("digite um valor: ")) b = float(input("digite outro valor: ")) soma = a + b print(soma) '''import calculadora ou form calculadora import somar #se eu colocar * no somar, nao precisa "calculadora".somar calculadora.somar()''' somar()
def constrainToInterval(val, low, high): return max(low, min(val, high)) def moveVectorTowardByAtMost(fromVec, toVec, maxDelta): """ Return the vector which is obtained by moving from fromVec toward toVec by a total distance of maxDelta. If the distance from fromVec to toVec is less than maxDelta, ...
num = int(input('Digite um número inteiro: ')) cont = 0 for c in range(1, num + 1): if num % c == 0: cont += 1 if cont == 2: print('O número \033[31m{}\033[m É PRIMO.'.format(num)) else: print('O número \033[31m{}\033[m NÃO É PRIMO.'.format(num))
class Trie: def __init__(self): self.root = Node() def search(self, s): node = self.root for c in s: node = node.next[ord(c) - ord('a')] if not node: return False return node.next[26] != None def insert(self, s): node ...
# @TODO complete the point class class Point: def __init__(self, x, y): self.x = x self.y = y def distanceFrom(self, p2): return ((self.x - p2.x)**2 + (self.y - p2.y)**2)**0.5 # @todo complete the Line class class Line: def __init__(self, p1, p2): self.p1 = p1 sel...
""" the basic idea is that track every movement of the first player, if the other player can not make a movement, then movement the first player made is a winning movement. the optimization is to use memorization to memorize the string state that we have seen. this is a backtracking problem with memorization optimizati...
""" lec9 class """ class car: #class name maker = 'toyota' #attribute def __init__(self,input_model): self.model = input_model def report(self): #return the attribute of the instance return self.maker,self.model #my_car= car('corolla') #print(my_car.repor...
def qb_date_format(input_date): """ Converts date to quickbooks date format :param input_date: :return: """ return input_date.strftime("%Y-%m-%d") def qb_datetime_format(input_date): """ Converts datetime to quickbooks datetime format :param input_date: :return: """ re...
class Solution: def decodeString(self, s: str) -> str: res, _ = self.dfs(s, 0) return res def dfs(self, s, i): res = '' while i < len(s) and s[i] != ']': if s[i].isdigit(): times = 0 while i < len(s) and s[i].isdigit(): ...
carros = ['monza','fusca','jipe','corsa','calhambeque','punto','marea'] print(carros) verificar = input("Qual item deseja verificar? ") if verificar in carros: print("Sim, está na lista!") else: print("Não está na lista")
class Node: def __init__(self, dado=None) -> None: self.__dado: object = dado self.__prox = None @property def dado(self) -> object: return self.__dado @property def prox(self) -> object: return self.__prox @dado.setter def dado(self, novoDado) -> None: ...
def is_palindrome(x): s = str(x) return s == s[::-1] def solve(): products = [] for i in range(100, 1000): for j in range(i, 1000): products.append(i * j) products = sorted((i * j for i in range(100, 1000) for j in range(i, 1000)), reverse = True) for p in products: ...
def format_metric(text: str): return text.replace('.', '_') def format_period(text: str): return text.split(',', 1)[0] def try_or_else(op, default): try: return op() except: return default
class QuestRedeemResponsePacket: def __init__(self): self.type = "QUESTREDEEMRESPONSE" self.ok = False self.message = "" def read(self, reader): self.ok = reader.readBool() self.message = reader.readStr()
list1 = ['abcd', 786, 2.33, 'baidu', 70.2] tinylist = [123, 'baidu'] print(list1) print(list1[0]) print(list1[1:3]) print(list1[2:]) print(tinylist * 2) print(list1 + tinylist)
''' https://leetcode.com/problems/bulls-and-cows/ 299. Bulls and Cows You are playing the Bulls and Cows game with your friend. You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info: The numb...
current = 0 def f(): global current if current == 50: return print(current) current += 1 f() f()
""" Tema: Complejidad Algoritmica. Notacion asintotica - Recursividad multiple Curso: Pensamiento Computacional, 2da entrega. Plataforma: Platzi. Profesor: David Aroesti. Alumno: @edinsonrequena. """ def fibonacci(n): ''' Recursividad multiple O(2^n) ''' if n == 0 or n == 1: return 1 return...
""" Question Source:Leetcode Level: Medium Topic: Stack Solver: Tayyrov Date: 14.03.2022 """ def simplifyPath(path: str) -> str: path = path.split("/") ans = [] for p in path: if p == "." or p == "": continue elif p == "..": if ans: ...
class Solution(object): def permuteUnique(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ perms = set() self.recursive(nums, [], perms) return perms def recursive(self, nums, perm, perms): if len(nums) == 0: perms.a...
#factorial.py n=int(input("enter number..")) #calculating factorial of n f=1 for i in range(1,n+1): f=f*i print ('factorial of {} = {}'.format(n,f))
def hitung(): umur=int(input("masukan umur kamu:")) jj = umur *369* 24 * 60 * 60 print(f"kamu sudah hidup selama{jj}.detik") print("Selamat datang di program hitung detik umur") hitung()
size(300, 300) _total_w = 0 def flow(w, h): global _total_w if _total_w + w*2 >= WIDTH: translate(-_total_w, h) _total_w = 0 else: translate(w, 0) _total_w += w x, y = 10, 10 rect(x, y, 50, 50) flow(60, 60) rect(x, y, 50, 50, 0.6) flow(60, 60) oval(x, y, 50, 50) flow(60, 6...
class Solution: def recoverFromPreorder(self, S: str) -> TreeNode: if not S: return l = S.split('-') s, depth = [[TreeNode(l[0]), 0]], 1 for item in l[1:]: if not item: depth += 1 continue node = TreeNode(item) while...
{ 'targets': [ { 'include_dirs': ['/usr/include', '/usr/local/include'], 'libraries': ['-L/usr/lib', '-L/usr/local/lib'], 'target_name': 'gzbz2', 'sources': ['compress.cc'], 'link_settings': { 'libraries': [ '-lbz2' ] }, 'conditions': [ [...
# Uses python3 def get_fibonacci_huge_naive(n, m): if n <= 1: return n previous = 0 current = 1 for _ in range(n - 1): previous, current = current, previous + current return current % m def get_fibonacci_period(m): P = [0] prv, cur = 0, 1 while (prv, cur) != (1, 0...
class DriverNotSet(EnvironmentError): """ webdriver not initialized """ class NoSession(RuntimeError): """ forgot to call new_session()""" class ElementNotFound(ValueError): """ no element to process """ class TabDiscarded(RuntimeError): """ tab no longer exists""" class FireFoxCrashed(Environme...
#----------------------------------------------------------------------------- # Runtime: 44ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def intToRoman(self, num: int) -> str: result = [] if num >= 1000: resu...
#Faça um programa que leia as duas notas de um aluno, calcule e mostre sua média. nota1 = float(input("Primeira nota: ")) nota2 = float(input('Segunda nota: ')) print('A média é {:.1f}'.format((nota1+nota2)/2))
""" RCIR Module Consits of representations for Candidate, Voter and Election """ print("This is the RCIR module")
# is_hot = False # is_clod = False # # # if is_hot: # print("it is hot day ") # print("drink plentry of water ") # elif is_clod: # print("it is clod day ") # print("Wear warm Clothes") # else: # print("it is a Lovely day ") # print("Enjoy Your Day ") # has_high_income = False # has_good_credi...
class AnyObject(object): """ def get_address(self): order_list = self.parentsDict.order_list address = list() for i in range(len(order_list))[::-1]: if isinstance(self.parentsDict[order_list[i]], Collection): continue elif isinstance(se...
""" ----------- Discussion: ----------- Paper: ------ NLP-based ontology learning from legal texts. A case study paper Ontology -------- Formally-defined vocabulary for a particular domain of interest used to capture knowledge about that (restricted) domain of interest. The ontology describes the concepts in the do...
# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2020 Ericsson AB name = "paf"
lista = [] while True: lista.append(int(input('Digite um valor: '))) r = ' ' while r not in 'SN': r = str(input('Deseja continuar [S/N]: ').strip().upper()[0]) if r not in 'SN': print('Resposta inválida...') if r == 'N': break lista.sort(reverse = True) print('='*40) ...
# -*- coding: utf-8 -*- class Solution: def bitwiseComplement(self, N: int) -> int: return int(''.join('1' if c == '0' else '0' for c in format(N, 'b')), 2) if __name__ == '__main__': solution = Solution() assert 2 == solution.bitwiseComplement(5) assert 0 == solution.bitwiseComplement(7) ...
description = 'Placeholders for devices not yet present.' group = 'lowlevel' devices = dict( xs = device('nicos.devices.generic.VirtualMotor', description = 'Sample x position', abslimits = (0, 730), unit = 'mm', curvalue = 2500 ), xd2 = device('nicos.devices.generic.Virtua...
n = int(input('Digite um número: ')) nquadrado = n * 2 ntriplo = n * 3 nraiz = n ** (1/2) print('Seu número é {}, o dobro é {}, o triplo é {} e a raiz quadrada é {:.2f}'.format(n, nquadrado, ntriplo, nraiz))
# -*- coding: utf-8 -*- # 2021/10/29 # create by: snower class Parser(object): def __init__(self, content): self.content = content def parse(self): raise NotImplementedError
num = int(input("Digite um número: ")) aux = num - 1 while aux != 0: num = aux * num aux = aux - 1 print("O fatorial desse número é: {}".format(num))
#!/usr/bin/python # -*- coding: utf-8 -*- List = [] #Skapar kortlek def create_card(var): card = [] for i in range(var): card.append(i); return card #Körning def main(): try: var = int(input("Kortstorlek: ")) if len(create_card(var)) % 2 != 0: print("Felaktig inma...
class GreatClass: def __init__(self, x): self.x = x def do_stuff(self): pass class LilGreatClass: def __init__(self, things, stuff): self.things = things self.stuff = stuff
""" Loan Calculator You take a loan from a friend and need to calculate how much you will owe him after 3 months. You are going to pay him back 10% of the remaining loan amount each month. Create a program that takes the loan amount as input, calculates and outputs the remaining amount after 3 months. Sample Input: 2...
NUMBER_OF_PAGE = 2 NUM_PROCESS = 2 PROXY_KEYS = [ 'TL030k6rJqgOxjlfy3PCTf5IdjA45aO78qQF6u', 'TLWEtB53b0z9I5JCvIzLEE70VKbzTlr7VD2XDX' ] TM_PROXY_KEYS = [ # '99e602a2e61ba76e82259d278d9da514', # '75e9091ad09f08045ca09e3b96272b00' ] # nhập list url cần refer đến ở đây. LIST_URL = [ # 'sof...
# Grid elements STRUCT = 0 P1 = 1 P2 = 2 WALL = 3 HOLE = 4 # Timeout (in ms) ROUND_TIMEOUT = 6000.0 GLOBAL_TIMEOUT = 60000.0 # Gauges state and speed # Gauge state is in gauge units GAUGE_STATE_INIT = 65535 # Gauges speed are in gauge units per milliseconds ROUND_GAUGE_SPEED_INIT = GAUGE_STATE_INIT/R...
# A simple User model for logging in/registering # Created by: Mark Mott class User: # A single underline denotes a private method/variable. # Default is a Guest user def __init__(self, username='Guest', password='guest', permission=0): print(username) self.username = username self.p...
""" topic_config """ def read_config(): """ read JSON config file for topic options """ topic_data = { "platform_type": ["buoy", "station", "glider"], "ra": [ "aoos", "caricoos", "cencoos", "gcoos", "glos", "marac...
#!/usr/bin/python # -*- coding: utf-8 -*- # created: 2015-04-15 class WebConst(object): ROUTER_PARAM_PATH = '_http_router_url' ROUTER_PARAM_OPT = '_http_router_opt' ROUTER_PARAM_VIEW_FUNC_PARAMS = '_http_router_view_params' ROUTER_VIEW_FUNC_KWS_REQUEST = 'request' ROUTER_VIEW_FUNC_KWS_METHOD = 'm...