content
stringlengths
7
1.05M
# https://www.codechef.com/START11C/problems/FACEDIR n = int(input()) for _ in range(n): v = int(input()) v %= 4 if v == 0: print("North") elif v==1: print("East") elif v==2: print("South") else: print("West")
DATA = [ '123.108.237.112/28', '123.108.239.224/28', '202.253.96.144/28', '202.253.99.144/28', '210.228.189.188/30']
valor = False if valor: pass # para escrever alguma coisa depois ... #Tbm é a msm coisa else: print('Tchau')
# the print keyword is used to display a message print('Hello world!') # Strings can be enclosed in single quotes print('Hello world single quotes') # Strings can also be enclosed in double quotes print("Hello world - double quotes") # using print to display integer / whole numbers print(188) # using print to displ...
print("Вычисление периметра и площади прямоугольника.") strA = input("Ведите длину стороны A, в мм. : ") strB = input("Ведите длину стороны B, в мм. : ") a = int(strA); b = int(strB) r = (a + b) * 2 print("Сторона A =", a,"Сторона B =", b, ": P прямоугольника =", r) r = a * b print("Сторона A =", a,"Сторона B =", b, ":...
# -*- coding: utf-8 -*- #Using Python3 #Drowing dynamic table rows = input("Enter the number of rows: ") columns = input("Enter the number of columns: ") celNum = input("Enter number in cells: ") rows = int(rows) columns = int(columns) celNum = int(celNum) #Labels print("Table", end = " ") #print on the same line f...
# DROP TABLES airport_codes_table_drop = "DROP TABLE IF EXISTS airport_codes" immigration_table_drop = "DROP TABLE IF EXISTS immigration" state_codes_table_drop = "DROP TABLE IF EXISTS state_codes" # user_table_drop = "DROP TABLE IF EXISTS users" # song_table_drop = "DROP TABLE IF EXISTS songs" # artist_table_drop = "...
def MergeSort(A): if len(A) > 1: mid = len(A) // 2 lefthalf = A[:mid] righthalf = A[mid:] print(lefthalf, " ", righthalf) MergeSort(lefthalf) MergeSort(righthalf) i = j = k = 0 while i < len(lefthalf) and j < len(righthalf): if lefthalf[i]...
print("Program to find the sum of two binary numbers \n\n") a=input("Enter binary number ") b=int(a,2) print (b) c=int(input("Enter numerical natural number")) d=bin(c)[2:] print (d) input()
""" Contains all error classes """ ############################################################ # read errors ############################################################ class RecordSizeError(Exception): """ Exception raised when assert_eor finds EOR == False. This means that the data read does not matc...
n=int(input('Digite um número inteiro: ')) dois= n * 2 tres= n * 3 quatro= n * 4 cinco= n * 5 seis= n * 6 sete= n * 7 oito= n * 8 nove= n * 9 dez= n * 10 print('A tabuada do número {} é: \n {} \n {} \n {} \n {} \n {} \n {} \n {} \n {} \n {} \n {}'.format(n, n ,dois, tres, quatro, cinco, seis, sete, oito, nove, dez))
# # PySNMP MIB module XEDIA-L2DIAL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XEDIA-L2DIAL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:36:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
class Variable(object): def __init__(self, identity, constraints = None): self.identity = identity self.constraints = constraints or set() def __eq__(self, other): return self.identity == (other.identity if other is Variable else other) def __hash__(self): return hash(se...
def divisors(num): divisors = [] try: if num < 0: raise ValueError("Ingresa un número positivo") for i in range(1, num + 1): if num % i == 0: divisors.append(i) return divisors except ValueError as err: print(err) def run(): try: ...
""" Qt3 UI emulation module. Selection of widgets that emulate behavior from Qt3/Eneboo. """
class ChromosomeConfig: def __init__(self, cross_type, mut_type, cross_prob, mut_prob): self.__cross_type = cross_type self.__mut_type = mut_type self.__cross_prob = cross_prob self.__mut_prob = mut_prob @property def cross_type(self): return self.__cross_type ...
def pytest_generate_tests(metafunc): for scenario in metafunc.cls.scenarios: metafunc.addcall(id=scenario[0], funcargs=scenario[1]) scenario1 = ('basic', {'attribute': 'value'}) scenario2 = ('advanced', {'attribute': 'value2'}) class Foo(object): pass class TestSampleWithScenarios(Foo): scenari...
def mensaje(): print("Estoy aprendiendo python") print("Estoy aprendiendo python") print("Estoy aprendiendo python") mensaje() mensaje() mensaje() print("Ejecutando codigo fuera del cuerpo de la funcion") mensaje()
class Solution(object): def lengthOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ if nums is None or not nums: return 0 dp = [1] * len(nums) for curr, val in enumerate(nums): for prev in range(curr): if nums...
# Visitor Permissions - ORDER = 0x000000001 PAY = 0x000000002 # Customer Permissions - Can order, Pay, and comment on food COMMENT = 0x000000004 # Delivery Person Permissions - Bid, choose routes, comment on customer BID = 0x000000008 ROUTES = 0x000000010 CUSTOMER_COMMENT = 0x000000020 # Cook Permissions - food q...
# Crie um programa onde o usuario possa # digitar varios valores numericos e cadastre-os # em uma lista. Caso o numero ja exista la dentro, # ele nao sera adicionado. # No final, serao exibidos todos os valores # unicos digitados, em ordem crescente listagem = list() r = 'S' while True: while r == 'S': n = ...
score=['10','20','30','100점'] i=0 while i<len(score): print(score[i]) i=i+1
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ------------------------------------------------- @ Author : pengj @ date : 2019/1/6 11:10 @ IDE : PyCharm @ GitHub : https://github.com/JackyPJB @ Contact : pengjianbiao@hotmail.com -----------------...
""" entradas temperatura-->float-->a Salidas deporte-->str-->d """ a = float(input("Digite su temperatura :")) if(a > 85): print("Natacion") elif(a > 71 and a <= 85): print("Tenis") elif(a > 32 and a <= 70): print("Golf") elif(a > 10 and a <= 32): print("Esqui") elif(a <= 10): print("Marcha") else: print("N...
"""Workspace rules (GHC binary distributions)""" load("@bazel_skylib//:lib.bzl", "paths") _GHC_BINS = { "8.2.2": { "linux-x86_64": ("https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-x86_64-deb8-linux.tar.xz", "48e205c62b9dc1ccf6739a4bc15a71e56dde2f891a9d786a1b115f0286111b2a"), }, "8.0.2": { "linux-x86...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Dummy tests.""" def test_dummy(): assert True
def is_even(number): number = int (number) return number % 2 == 0 number = input('add number: ') print(is_even(number))
class credit_card(object): def __init__(self, name, sec_code, code): credit = 0 self.name = name self.sec_code = sec_code self.code = code self.credit = float(credit) def add_credi(self, credit): self.credit += float(credit) def remove_credi(self, credit): ...
# SPDX-License-Identifier: MIT # Copyright (c) 2020 Akumatic # #https://adventofcode.com/2020/day/11 def readFile() -> list: with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: return [list(line.strip()) for line in f.readlines()] def get_positions(seats: list, cache: dict, x: int, y: int): ...
# Created by MechAviv # Map ID :: 402000620 # Sandstorm Zone : Refuge Border if sm.hasQuest(34929): sm.spawnNpc(3001509, 298, 200) sm.showNpcSpecialActionByTemplateId(3001509, "summon", 0) sm.spawnNpc(3001512, 374, 200) sm.showNpcSpecialActionByTemplateId(3001512, "summon", 0) sm.spawnNpc(3001513, 4...
def line_0(kwargs): kwargs['a'] = 1 kwargs['b'] = kwargs['a'] + 1 kwargs['c'] = kwargs['b'] * kwargs['b'] if kwargs['a'] == 1: kwargs['d'] = 1 else: kwargs['d'] = 0 return kwargs
def bubble_sort(l, start, end, hook_func=None): ''' @brief 冒泡排序算法,排序区间[start, end] @param l 需要进行排序的list @param start 开始位置 @param end 结束位置 @param hook_func hook函数这里主要是用作可视化 ''' count = 0 for i in range(start, end + 1): for j in range(start, end - i): if ...
# -------------- ##File path for the file file_path #Code starts here def read_file(path): file = open(path,"r") sentence = file.readline() file.close() return sentence sample_message = read_file(file_path) print(sample_message) # -------------- #Code starts here def read_file(fi...
# -*- encoding: utf-8 -*- bind = 'unix:mta-system.sock' workers = 2 timeout = 300 loglevel = 'debug' capture_output = True accesslog = 'gunicorn-access.log' errorlog = 'gunicorn-error.log' enable_stdio_inheritance = True
while True: try: n = input("Entre com um número inteiro: ") x = int(n) break except ValueError: print("Não é um inteiro! Tente novamente.") print("Muito Bem!")
""" A small set of utitlit functions, that we could also have gotten from cloudmesh.common. """ def readfile(filename, mode='r'): """ returns the content of a file :param filename: the filename :return: """ if mode not in ['r', 'rb']: raise ValueError(f"incorrect mode : expected 'r' or ...
# THIS FILE IS AUTO-GENERATED, DO NOT EDIT config = {'all': {'comment': 'Entry point', 'type': 'nested', 'lists': ['2', '3', '4'], 'ensure_unique': True, 'ensure_unique_prefix': 4, 'max_slug_length': 50}, '2': {'comment': 'Two words (may also contain prepositions)', 'type': 'nested', 'lists': ['an']}, '3': {'comment': ...
#!/usr/bin/python # # Copyright (C) 2006 Google Inc. # # 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 ...
#https://www.unimed.coop.br/viver-bem/pais-e-filhos/estatura-por-idade def altura(idade, genero): num = 0 idade = idade idade = int(idade) num = idade-1 if genero == 'masculino': lista_altura_média_homens = [ [71.0,75.7,80.5],#1 [81.7,87.8,93.9],#2 [90.6,9...
def getQuestions(dir): questions = [] with open(dir, 'r', encoding='utf-8') as f: for line in f: questions.append(line.strip()) return questions def getTriples(dir): triples = [] with open(dir, 'r', encoding='utf-8') as f: for i, line in enumerate(f): line_...
class MyTooManyWhoisQuerisError(Exception): pass class MyWhoisBanError(Exception): pass
def simple(func): func.__annotation__ = "Hello" return func @simple def foo(): pass def complex(msg): def annotate(func): func.__annotation__ = msg return func return annotate @complex("Hi") def bar(): pass foo bar class C(object): @staticmethod def smeth(arg0...
{ "targets": [ { "target_name": "EspressoLogicMinimizer", "cflags": ["-std=c99", "-Wno-misleading-indentation", "-Wno-unused-result", "-Wno-format-overflow", "-Wno-implicit-fallthrough"], "sources": [ "bridge/addon.cc", "bridge/bridge.c", ...
class Instance(): def __init__(self): self.words=[] self.labels=[] self.words_size=0 self.words_index = [] self.label_index = []
LEAGUE_IDS = { "BL": 394, "BL2": 395, "BL3": 403, "FL": 396, "FL2": 397, "EPL": 398, "EL1": 425, "LLIGA": 399, "SD": 400, "SA": 401, "PPL": 402, "DED": 404, "CL": 405 }
class Solution: def findRestaurant(self, list1, list2): """ :type list1: List[str] :type list2: List[str] :rtype: List[str] """ dic={} for item1 in list1: for item2 in list2: if item1==item2: dic[item1]=list1.ind...
{ "targets": [ { "target_name": "polyglot", "sources": [ "polyglot.cpp" ] } ] }
#7-8 & 7-9 # Create our orders list sandwich_orders = ['ham', 'bologna','pastrami', 'cheese', 'blt', 'pastrami', 'turkey', 'pastrami'] finished_sandwiches = [] # Deli is out of pastrami, so we will remove all pastrami orders. print("\nThe deli is out of pastrami sandwiches.") while 'pastrami' in sandwich_orders: s...
''' --- Part Two --- The Elves in accounting are thankful for your help; one of them even offers you a starfish coin they had left over from a past vacation. They offer you a second one if you can find three numbers in your expense report that meet the same criteria. Using the above example again, the three e...
#http://code.activestate.com/recipes/52219-associating-multiple-values-with-each-key-in-a-dic/ #https://www.oreilly.com/library/view/python-cookbook/0596001673/ch01s06.html def repeatedValue(): # this method allows duplicate values for the same key d = dict() # To add a key->value pair, do this: #d.set...
""" Tools for managing a federated Carbon cluster. """ class CarbonateException(Exception): pass
STATUS_ACTIVE = 1 STATUS_INACTIVE = 2 STATUS_PENDING = 3 STATUS_FAILED = 9 STATUS_DONE = 10 STATUS_DELETED = 11 STATUS_FLOW_OPEN = 1 STATUS_FLOW_PROCESSING = 2 STATUS_FLOW_PROCESSED = 3 STATUS_FLOW_COMMITTED = 4 STATUS_FLOW_ABORTED = 11 TAP_ACCESS_PUBLIC = 1 TAP_ACCESS_SUBSCRIBERS = 2 TAP_ACCESS_PRIVATE = 3 DATA_STA...
# The following is just an example used in class. The actual code is below: # running = True # while running: # # try: # query = input('Enter 1 to search phonebook, enter 2 to quit: ') # except ValueError: # print('Imput must be a number. Please try again.') # continue # # if query ...
class ParticleSettingsTextureSlot: clump_factor = None damp_factor = None density_factor = None field_factor = None gravity_factor = None kink_amp_factor = None kink_freq_factor = None length_factor = None life_factor = None mapping = None mapping_x = None mapping_y = Non...
# Some globals gane defaults DEFAULT_DICE_SIDES_NUMBER = 6 # Nb of side of the Dices SCORING_DICE_VALUE = [1, 5] # List of the side values of the dice who trigger a standard score SCORING_MULTIPLIER = [100, 50] # List of multiplier for standard score THRESHOLD_BONUS = 3 # Threshold of the triggering for bonus in ...
# # PySNMP MIB module HP-ICF-INST-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-INST-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:34:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
class Constants: # Constants related to the core physics of the game FIELD_LENGTH = 1800 FIELD_HEIGHT = 800 BALL_RADIUS = 8 NUM_PLAYERS = 5 GAME_LENGTH = 1800 GOAL_WIDTH = 20 MAX_BALL_VELOCITY = 10 MAX_PLAYER_VELOCITY = 5 NUM_PLAYERS = 5 PLAYER_RADIUS = 24 STARTING_POSIT...
class Layer: def __init__(self, name, parent): self.name = name self.parent = parent self.children = [] def add_child(self, child): self.children.append(child)
# Answer 1. listy = [1,5,6,4,1,2,3,5] sub_list = [1,1,5] # print("Original List :" + str(listy)) # print("Original sub_list : " + str(sub_list)) flag = 0 # if(all(x in listy for x in sub_list)): # flag = 1 if (set(sub_list).issubset(set(listy))): flag = 1 if (flag): print("It's a Match") else: ...
def event_handler(obj, event): if event == lv.EVENT.VALUE_CHANGED: print("State: %s" % ("Checked" if obj.is_checked() else "Unchecked")) cb = lv.cb(lv.scr_act()) cb.set_text("I agree to terms and conditions.") cb.align(None, lv.ALIGN.CENTER, 0, 0) cb.set_event_cb(event_handler)
K, X = map(int, input().split()) out_list = [] for i in range(X-(K-1), X+(K)): out_list.append(str(i)) print(" ".join(out_list))
"""BoilerplatePython. https://boilerplatepython.readthedocs.io/ https://github.com/Robpol86/boilerplatepython https://pypi.org/project/boilerplatepython """ __author__ = "@Robpol86" __license__ = "BSD-2-Clause" __version__ = "0.0.1"
""" Header class, a dictionary that contains information about the file content """ class Header(dict): """ Header class, a dictionary that contains information about the file content """ def is_proper(self): "Whether it is an header created by lyncs_io" return "_lyncs_io" in self
class Solution: def minimumEffort(self, tasks: List[List[int]]) -> int: tasks.sort(key=lambda x: x[1]-x[0]) answer=0 for actual, req in tasks: answer=max(answer+actual,req) return answer
class ParserMeta(type): registry = {} def __new__(cls, name, bases, ns): result = type.__new__(cls, name, bases, ns) if name != 'Parser': domains = ns['domains'] for domain in domains: cls.registry[domain] = result return result class Unknown...
""":mod:`wand.exceptions` --- Errors and warnings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module maps MagickWand API's errors and warnings to Python's native exceptions and warnings. You can catch all MagickWand errors using Python's natural way to catch errors. .. seealso:: `ImageMagick Exceptions...
class Solution: def characterReplacement(self, s, k): """ :type s: str :type k: int :rtype: int """ dic, start, end = {}, 0, 0 for end in range(1, len(s)+1): if not s[end-1] in dic: dic[s[end-1]] = 1 else: dic[s[end-1]] += 1 ...
# Trabajando con ciclos for x = 1 y = 12 z = 2 print("Mi nombre es ") for item in range(x, y, z): print(f"@Mangusoft se repetira {item}") # if item == 3: # break
class Symbol: def __init__( self, lexeme, type, category, value, scope, extends, implements, params ): self.__lexeme__ = lexeme self.__type__ = type self.__category__ = category self.__value__ = value self.__scope__ = scope self.__extends__ = extends ...
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param head: ListNode head is the head of the linked list @param m: An integer @param n: An integer @return: The head of the reversed L...
# Implement a method tht accepts 3 integer values "a, b and c". # The method should return True if a triangle can be built with the sides of given length and False in any other case. # All triangles must have surface greater than 0 to be accepted def is_triangle(a, b, c): return True if a+b>c and a+c>b and c+b>a ...
number1 = input("Please enter a number and press enter: ") number2 = input("Please enter another nunber and press enter ") number1 = int(number1) number2 = int(number2) print("number1 + number2 =", number1+number2)
def solution(A, K): shift = K % len(A) if shift == 0: return A shifted_array = [] for i in range(-shift, len(A) - shift): shifted_array.append(A[i]) return shifted_array
pilha = [] exp = str(input('Digite a expressão: ')) for parenteses in exp: if parenteses == '(': pilha.append('(') elif parenteses == ')': if len(pilha) > 0: pilha.pop() break print('_' * 30) if len(pilha) == 0: print('Expressão VÁLIDA!') else: print('Expressão IN...
s = list(input()) a = "".join(s[:5]) b = "".join(s[6:13]) c = "".join(s[14:21]) print(a,b,c)
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"Helpers": "Helpers.ipynb", "notify": "Helpers.ipynb", "keys": "Helpers.ipynb", "scanDb": "Helpers.ipynb", "toDf": "Helpers.ipynb", "fromSeries": "Helpers.ipynb", ...
""" Este archivo contiene todas las funciones del desafio a mimir """ def mimir(dia_semana, vacacion): """ El parametro dia_semana es True si estamos en un dia de la semana, el parametro vacacion es True si estamos en vacaciones. Podemos mimir si no es dia de semana o si estamos en vacaciones. De...
def Contract_scalar_2x5(\ t0_6,t1_6,t2_6,t3_6,\ t0_5,t1_5,t2_5,t3_5,\ t0_4,t1_4,t2_4,t3_4,\ t0_3,t1_3,t2_3,t3_3,\ t0_2,t1_2,t2_2,t3_2,\ t0_1,t1_1,t2_1,t3_1,\ t0_0,t1_0,t2_0,t3_0,\ o1_5,o2_5,\ o1_4,o2_4,\ o1_3,o2_3,\ o1_2,o2_2,\ o1_1,o2_1\ ): ######################...
""" Jupyter notebook config https://jupyter-notebook.readthedocs.io/en/stable/config.html """ def scrub_output_pre_save(model, **kwargs): """ Scrub notebook output before saving https://gist.github.com/binaryfunt/f31a7ecc8d698dd0edbec1489f2ab055 """ # Only run on notebooks if model["type"] != ...
class TreeNode(object): def __init__(self, value): self.value = value self.left = None self.right = None # store the number of left child for each tree Node self.num_of_left = 0 # store the max height difference self.max_diff = float('-inf') self.ma...
class Config(object): VERSION = "0.1.1" TEMPLATES_PATH = "config/" HEADERS = "headers.template" MAIL_FROM = "notify@example.com" MAIL_TO = "root@example.org" SUBJECT = "Mail from mailer.py\n\n" TEMPLATE = "default.message"
''' Write a program which takes an array of n integers, where A[i] denotes the maximum you can advance from index l, and returns whether it is possible to advance to the last index starting from the beginning of the array. ''' def can_reach_end(array): # Time: O(n) | Space: O(1) furthest_reached = 0 last_ind...
def pubkeys(obj): keys = list() for key in (key for key in dir(obj) if not key.startswith('_')): keys.append(key) return keys
num_queries = int(input()) def executeQuery(num_queries): stack = list() string = "" k = 0 for i in range(num_queries): q = input().split() if(q[0] == '4'): string = stack.pop() elif(q[0] == '1'): stack.append(string) string += q[1] el...
""" Return sum of iterable and start value -------------------------------------- Input: value optional: start value Return: sum of values """ numbers = [0, 1, 2, 3, 4, 5] print('numbers: {}\n sum: {}'.format(numbers, sum(numbers))) start_value = 10 print('numbers: {} + start value: {}\n sum: ...
ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" with open("p022_names.txt") as f: names = f.read().split(",") names = [x.replace("\"", "") for x in names] names.sort() total = 0 for i, name in enumerate(names): score = 0 for letter in name: score += ALPHABET.index(letter) + 1 total += (i + 1) * score print(total) ...
# data = [1,2,3,4,5,6,7] data = [2,1,4,6,7,5,3,9,10,8] print(data) def heap_min(data): length = len(data) for i in range(length-1,-1, -1): if data[i] < data[i//2]: data[i],data[i//2] = data[i//2],data[i] return data def sort(data): ll = [] length = len(data) for i in range(0,length): data = heap_min(data...
""" Node is defined as class node: def __init__(self, data): self.data = data self.left = None self.right = None """ def check_binary_search_tree_(root, minBound = 0, maxBound = 10000): if root.left is not None: if root.left.data >= root.data: return False if not minBound <...
#Intersection: Given two (singly) linked lists, determine if the two lists intersect. #Return the intersecting node. Note that the intersection is defined based on reference, #not value. That is, if the kth node of the first linked list is the exact same node (by #reference) as the jth node of the second linked list...
def factorial(a): if a == 1: return 1 else: return (a * factorial(a-1)) num = 7 print("The factorial of", num, "is", factorial(num))
""" from predict import get_most_likely_author from iris import iris_predict_one, score # STUFF FROM CLASS. DOESN'T HAVE base.html @app.route('/add_author') def add_author(): twitter_handle = request.args['twitter_handle'] new_user = upsert_user(twitter_handle, nlp) return '{}\'s tweets added to the datab...
batch = [[1, 5, 6, 2], # shape (8,4) [3, 2, 1, 3], [5, 2, 1, 2], [6, 4, 8, 4], [2, 8, 5, 3], [1, 1, 9, 4], [6, 6, 0, 4], [8, 7, 6, 4]] # https://nnfs.io/lqw # https://nnfs.io/vyu # https://nnfs.io/jei # https://nnfs.io/bkw
class Messenger(object): def __init__(self, logger, messageDisplay): self.logger = logger self.messageDisplay = messageDisplay #Test this... def sendMessage(self, message): self.logger.info(message) def sendUpdate(self, message): # this should update the button te...
# Python - 2.7.6 def solution(n): # 範圍限制,大於等於4000以上的無對應符號,所以不處理 if n <= 0 or n >= 4000: return '' symbols = 'IVXLCDM' result = '' # 轉換方式為 # 將symbol兩個作為一組,並加上下一組的較小的那一個 # step group # 1 IV + X # 2 XL + C # 3 CD + M i = 0 while n: ...
def welcome(): print("welcome to pyMassSpecTools") def cli(): welcome()
class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' print(bcolors.OKBLUE + bcolors.BOLD + "Hello I am you calculator" + bcolors.ENDC)...
''' Created on 2014-11-30 @author: ouyangsiqi ''' class Card: ''' This class is the parking card ''' __cardId = 0 __levelId = 0 __spaceId = 0 def __init__(self, cardId, levelId, spaceId): ''' Constructor ''' self.__cardId = cardId self.__levelId = l...
ENTRY_POINT = 'right_angle_triangle' #[PROMPT] def right_angle_triangle(a, b, c): ''' Given the lengths of the three sides of a triangle. Return True if the three sides form a right-angled triangle, False otherwise. A right-angled triangle is a triangle in which one angle is right angle or 90 degr...
#!/usr/bin/env python # To run the script put 'python ./script.py' in terminal lines = [line.rstrip('\n') for line in open('sv_en.txt')] svArray = [] enArray = [] for s in lines: first,second = s.split(' = ') svArray.append( first ); enArray.append( second ); thefile = open('en.txt', 'w') for item in enArray: ...
async def gotAddet(bot, guild): sID = await bot.db.fetchval('SELECT sid FROM config.guild WHERE sid = $1', guild.id) if sID is None: query = "WITH exec0 AS (INSERT INTO config.guild (sid, sname) VALUES ($1, $2)) INSERT INTO config.modules (sid) VALUES ($1)" await bot.db.execute(query, guild.id, ...