content
stringlengths
7
1.05M
STREAM_ERROR_SOURCE_USER = "stream_error_source_user" STREAM_ERROR_SOURCE_STREAM_PUMP = "stream_error_source_stream_pump" STREAM_ERROR_SOURCE_SUBSCRIPTION_GAZE_DATA = "stream_error_source_subscription_gaze_data" STREAM_ERROR_SOURCE_SUBSCRIPTION_USER_POSITION_GUIDE = "stream_error_source_subscription_user_position_guide...
"""Filter Package -------------- This package is the root module for spectral filtering utilities. """
def digit_sum(num: str): res = 0 for c in num: res += int(c) return res def digit_prod(num: str): res = 1 for c in num: res *= int(c) return res def main(): memo = {} T = int(input()) for t in range(1, T + 1): A, B = [int(x) for x in input().split(" ")] ...
"""Organizations package. Modules: organizations shortname_orgs """
BOT_TOKEN = "1910688339:AAG0t3dMaraOL9u31bkjMEbFcMPy-Pl6rA8" RESULTS_COUNT = 4 # NOTE Number of results to show, 4 is better SUDO_CHATS_ID = [1731097588, -1005456463651] DRIVE_NAME = [ "Root", # folder 1 name "Cartoon", # folder 2 name "Course", # folder 3 name "Movies", # .... "Series", # ....
if __name__ == '__main__': n = int(input()) i = 0 while n > 0: print(i ** 2) i = i + 1 n = n - 1
""" # LARGEST NUMBER Given a list of non-negative integers nums, arrange them such that they form the largest number. Note: The result may be very large, so you need to return a string instead of an integer. Example 1: Input: nums = [10,2] Output: "210" Example 2: Input: nums = [3,30,34,5,9] Output: "9534330" E...
#11. Find GCD of two given Numbers. m = int(input("Enter the First Number: ")) n = int(input("Enter the Second Number: ")) r = m while(m!=n): if(m>n): m=m-n else: n=n-m print("G.C.D is ",m)
############ ## Solution ############ def e_step(Y, psi, A, L, dt): """ Args: Y (numpy 3d array): tensor of recordings, has shape (n_trials, T, C) psi (numpy vector): initial probabilities for each state A (numpy matrix): transition matrix, A[i,j] represents the prob to switch from i to...
#Shipping Accounts App #Define list of users users = ['eramom', 'footea', 'davisv', 'papinukt', 'allenj', 'eliasro'] print("Welcome to the Shipping Accounts Program.") #Get user input username = input("\nHello, what is your username: ").lower().strip() #User is in list.... if username in users: #print a price ...
""" @author: lyh @time: 2020-08-15 @file:students @version:1.0 """ def func(): print("使用pycharm提交代码") func()
# A class to represent the adjacency list of the node class AdjNode: def __init__(self, data): self.vertex = data self.next = None class Graph: def __init__(self, vertices): self.V = vertices self.graph = [None] * self.V self.verticeslist = [] def add_edge(self, ...
""" Contains configurations options so secret, that they may not even be commited to git! """ ADMIN_PASSWORD = "secret" SECRET_KEY = "secret key"
description = 'Vaccum sensors and temperature control' devices = dict( vacuum=device( 'nicos_ess.estia.devices.pfeiffer.PfeifferTPG261', description='Pfeiffer TPG 261 vacuum gauge controller', hostport='192.168.1.254:4002', fmtstr='%.2E', ), )
#!/usr/bin/env python3 """ The copyrights of this software are owned by Duke University. Please refer to the LICENSE.txt and README.txt files for licensing instructions. The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent """ """ Welcome message for ASCENT software "...
SECRET_KEY = "123" INSTALLED_APPS = [ 'sr' ] SR = { 'test1': 'Test1', 'test2': { 'test3': 'Test3', }, 'test4': { 'test4': 'Test4 {0} {1}', }, 'test5': { 'test5': "<b>foo</b>", } }
# coding=utf-8 """ tests.functional.module ~~~~~~~~~~~~~~ Functional tests """
# -*- coding: utf-8 -*- numero_empleado = int(input()) numero_hrs_mes = int(input()) pago_por_hora = float('%.2f' % ( float(input()) )) pago_por_mes = pago_por_hora*numero_hrs_mes pago_por_mes = '%.2f'%(float(pago_por_mes)) print ("NUMBER = " + str(numero_empleado)) print ("SALARY = U$ " + str(pago_por_mes))
""" 変数(定数)置き場です 変数(定数) ---- zero_bpm : float -> 0BPMのタイミングポイントです、正確には0ではありませんがほぼ0です inf_bpm : float -> ∞BPM(10億BPM以上?)のタイミングポイントです max_offset : int -> 最大offset値です、空ノーツを生成するときにしか使い所がありません min_offset : str -> 最小offset値です、使い所がありません key_asset : List[List[int]] -> キーとポジションのリストです。1つ目がキーの値です、0, 11, 13, 15, 17, 19以上は...
print('Descubra a média de 2 notas: \nObs: Utilize ponto para separas as casas decimais.') a1 = float(input('Digite a nota da primeira avaliação: ')) a2 = float(input('Digite a nota da segunda avaliação: ')) m = (a1 + a2) / 2 print('A média das notas é igual a {:.1f}'.format(m))
{ "targets": [ { "target_name": "wiringpi", "sources": [ "wiringpi.cc" ], "include_dirs": [ "/usr/local/include" ], "ldflags": [ "-lwiringPi" ] } ] }
#!/usr/bin/env python # coding: utf-8 # # [Program pertama: "Hello World"](https://academy.dqlab.id/main/livecode/157/283/1247) # In[1]: print("Hello World!") # # [Program Pertamaku](https://academy.dqlab.id/main/livecode/157/283/1248) # In[2]: print("Halo Dunia") print("Riset Bahasa Python") # # [Struktur P...
"""Core exceptions.""" class Unauthenticated(Exception): """Thrown when user is not authenticated.""" pass class MalformedRequestData(Exception): """Thrown when request data is malformed.""" pass class InputError(Exception): """Thrown on input error.""" pass class FileTypeError(Except...
bot_name = 'your_bot_username' bot_token = 'your_bot_token' redis_server = 'localhost' redis_port = 6379 bot_master = 'your_userid_here'
class NavigationHelper: def __init__(self, app): self.app = app def open_home_page(self): wd = self.app.wd wd.get(self.app.base_url) def return_to_home_page(self): wd = self.app.wd wd.find_element_by_link_text("home").click()
_base_ = [ './retina.py' ] model= dict( type='CustomRetinaNet', #pretrained=None, #backbone=dict( # Replacding R50 by OTE MV2 # _delete_=True, # type='mobilenetv2_w1', # out_indices=(2, 3, 4, 5), # frozen_stages=-1, # norm_eval=True, # False in OTE setting # ...
class BaseComponent(object): def __init__(self): self.version = self.__version__ def forward(self, tweet: str): raise NotImplementedError @property def __version__(self): raise NotImplementedError
# -*- coding: utf-8 -*- GENDERS = { 1: (1, u'男'), 2: (2, u'女'), 3: (3, u'保密') }
def create_spam_worker_name(user_id): return f'user_{user_id}_spam_worker' def create_email_worker_name(user_id): return f'user_{user_id}_email_worker' def create_worker_celery_name(worker_name): return f"celery@{worker_name}" def create_spam_worker_celery_name(user_id): return create_worker_celer...
def aditya(): return "aditya" def shantanu(num): if num>10: return "shantanu" else: return "patankar"
def personalData(): """ Asks the user for their name and age. Uses a try except block to cast their age to an int prints out their name ad age. :return: """ user_name = input("Enter your name: ") user_age = input("Enter your age") #use a try except block when casting to an int. ...
# Define a Multiplication Function def mul(num1, num2): return num1 * num2
''' Write a Python program to accept a filename from the user and print the extension of that. ''' ext = input("Enter a file name: ") files = ext.split('.') print(files[1])
def kth_largest1(arr,k): if k > len(arr): return None for i in range(k-1): arr.remove(max(arr)) return max(arr) def kth_largest2(arr,k): if k > len(arr): return None n = len(arr) arr.sort() return(arr[n - k]) print(kth_largest2([4,2,8,9,5,6,7],2))
# the way currently the code is written it is possible to change the value accidently or it can be changed accidently class Customer: def __init__(self, cust_id, name, age, wallet_balance): self.cust_id = cust_id self.name = name self.age = age self.wallet_balance = wallet_balance ...
#!/usr/bin/env python3.7 # -*- coding: utf-8 -*- # https://leetcode.com/problems/reverse-integer/ inputs = [123, -123, 120, 1534236469] def reverse(x): """ Given a 32-bit signed integer, reverse digits of an integer. Assume we are dealing with an environment which could only store integers within the 3...
def match(output_file, input_file): block = [] blocks = [] for line in open(input_file, encoding='utf8').readlines(): if line.startswith('#'): block.append(line) else: if block: blocks.append(block) block = [] block1 = [] blocks1 =...
class MysqlDumpParser: def __init__(self, table: str): """ :param: str table The name of the table to parse, in case there are multiple tables in the same file """ self.table = table self.columns = [] @staticmethod def is_create_statement(line): return line.u...
# quicksort def partition(arr,low,high): i = ( low-1 ) # index of smaller element pivot = arr[high] # pivot for j in range(low , high): # If current element is smaller than or # equal to pivot if arr[j] <= pivot: # increment index of ...
class Solution: def threeSumClosest(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ nums.sort() rls = nums[0] + nums[1] + nums[2] for i in range(len(nums)-2): j, k = i+1, len(nums)-1 while j < k:...
# A mapping between model field internal datatypes and sensible # client-friendly datatypes. In virtually all cases, client programs # only need to differentiate between high-level types like number, string, # and boolean. More granular separation be may desired to alter the # allowed operators or may infer a different...
constants = { # --- ASSETS FILE NAMES AND DELAY BETWEEN FOOTAGE "CALIBRATION_CAMERA_STATIC_PATH": "assets/cam1 - static/calibration.mov", "CALIBRATION_CAMERA_MOVING_PATH": "assets/cam2 - moving light/calibration.mp4", "COIN_1_VIDEO_CAMERA_STATIC_PATH": "assets/cam1 - static/coin1.mov", "COIN_1_VIDEO...
def timeConversion(s): if "P" in s: s = s.split(":") if s[0] == '12': s = s.split(":") s[2] = s[2][:2] print(":".join(s)) else: s[0] = str(int(s[0])+12) s[2] = s[2][:2] print(":".join(s)) else: s = s.split(":...
def for_loop4(str, x): result = 0 for i in str: if i == x: result += 1 return result def main(): print(for_loop4('athenian', 'e')) print(for_loop4('apples', 'a')) print(for_loop4('hello', 'a')) print(for_loop4('alphabet', 'h')) print(for_loop4('aaaaa', 'b')) if __...
""" Tuples - iterable - immutable - strings are also immutable """ car = ('honda', 'city', 'white', 'DL09671', '78878GFG', 2016) print(car) print(type(car)) print(len(car)) for item in car: print(item) print(car[0])
# Author : Nekyz # Date : 30/06/2015 # Project Euler Challenge 3 # Largest palindrome of 2 three digit number def is_palindrome (n): # Reversing n to see if it's the same ! Extended slice are fun if str(n) == (str(n))[::-1]: return True return False max = 0 for i in range(999,100,-1): fo...
# -*- coding: utf-8 -*- def remove_duplicate_elements(check_list): func = lambda x,y:x if y in x else x + [y] return reduce(func, [[], ] + check_list)
class LightingSource(Enum, IComparable, IFormattable, IConvertible): """ Indicates the lighting scheme type in rendering settings. enum LightingSource,values: ExteriorArtificial (23),ExteriorSun (21),ExteriorSunAndArtificial (22),InteriorArtificial (26),InteriorSun (24),InteriorSunAndArtificial (25) "...
# coding: utf-8 mail_conf = { "host": "", "sender": "boom_run raise error", "username": "", "passwd": "", "mail_postfix": "", "recipients": [ "", ] } redis_conf = { "host": "127.0.0.1", "port": 6379, }
# # PySNMP MIB module BEGEMOT-PF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BEGEMOT-PF-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:37:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
# -*- coding:utf-8 -*- p = raw_input("Escribe una frase: ") for letras in p: print(p.upper())
# -*- coding: utf-8 -*- # A idéia para este problema é criar uma lista com os estados da região norte no formato de string, depois disso # é checado se o estado inserido está contido na lista e é exibido o resultado. # Lista de estados da ragião norte rn = ["acre", "amapa", "amazonas", "para", "rondonia", "roraima", ...
def find_words_in_phone_number(): phone_number = "3662277" words = ["foo", "bar", "baz", "foobar", "emo", "cap", "car", "cat"] lst = [] cmap = dict(a=2, b=2, c=2, d=3, e=3, f=3, g=4, h=4, i=4, j=5, k=5, l=5, m=6, n=6, o=6, p=7, q=7, r=7, s=7, t=8, u=8, v=8, w=9, x=9, y=9, z=9) for w...
CMarketRspInfoField = { "ErrorID": "int", "ErrorMsg": "string", } CMarketReqUserLoginField = { "UserId": "string", "UserPwd": "string", "UserType": "string", "MacAddress": "string", "ComputerName": "string", "SoftwareName": "string", "SoftwareVersion": "string", "AuthorCode": "s...
# cook your dish here print("137=2(2(2)+2+2(0))+2(2+2(0))+2(0)") print("1315=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)") print("73=2(2(2)+2)+2(2+2(0))+2(0)") print("136=2(2(2)+2+2(0))+2(2+2(0))") print("255=2(2(2)+2+2(0))+2(2(2)+2)+2(2(2)+2(0))+2(2(2))+2(2+2(0))+2(2)+2+2(0)") print("1384=2(2(2+2(0))+2)+2(2(2+2(0)...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __project__ = 'leetcode' __file__ = '__init__.py' __author__ = 'king' __time__ = '2020/1/10 22:37' _ooOoo_ o8888888o 88" . "88 (| -_- |) ...
def área(largura, altura): print(f'\nA área de um terreno {largura}m x {altura}m é de {largura * altura}m².\n') print(f'\n{"Controle de Terrenos":^25}', '-' * 25, sep='\n') área(float(input("LARGURA (m): ")), float(input("ALTURA (m): ")))
#!/usr/bin/env python """ Copyright 2012 GroupDocs. 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...
def get_current_players(current_room): host_user = current_room['host_user'] users = current_room['game']['users'] players = [player for player in users] players.append(host_user) return players
mi_dicc = { "Alemania": "Berlin", "Francia": "París", "Reino Unido": "Londres", "España": "Madrid" } print(mi_dicc["Francia"]) # París print(mi_dicc["España"]) # Madrid print(mi_dicc) # {'Alemania': 'Berlin', # 'Francia': 'París', # 'Reino Unido': 'Londres', # 'España': 'Madrid'} mi_dicc["Italia...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
class DuckyScriptParser: ''' This class is a parser for the DuckyScript language. It allows to generate a sequence of frame to inject keystrokes according to the provided script. ''' def __init__(self,content="",filename=""): if content != "": self.content = content else: self.content = open(filename,"r"...
def Awana_Academy(name, age): ## say to python that all the code that come after that line is going to be in d function print("Hello " + name + "you are " + age + "years old ") Awana_Academy("Alex " , "45") Awana_Academy("Donald ", "12")
# https://www.codewars.com/kata/55d2aee99f30dbbf8b000001/ ''' Details : A new school year is approaching, which also means students will be taking tests. The tests in this kata are to be graded in different ways. A certain number of points will be given for each correct answer and a certain number of points will be ...
# https://open.kattis.com/problems/babybites n = int(input()) inp = input().split() for i in range(0, n): if inp[i].isdigit(): if int(inp[i]) != i + 1: print('something is fishy') break else: print('makes sense')
#Let's use tuples to store information about a file: its name, #its type and its size in bytes. #Fill in the gaps in this code to return the size in kilobytes (a kilobyte is 1024 bytes) up to 2 decimal places. #Code: def file_size(file_info): name, type, size= file_info return("{:.2f}".format(size / 1024)) print...
class DictToObj(object): """ transform a dict to a object """ def __init__(self, d): for a, b in d.items(): if type(a) is bytes: attr = a.decode() else: attr = a if isinstance(b, (list, tuple)): setattr(self, att...
class Solution(object): def merge_sort(self,mylist): if len(mylist)<=1: return mylist n=len(mylist)//2#分為左右臨近的兩塊 left=mylist[:n] right=mylist[n:] return self.merge(self.merge_sort(left),self.merge_sort(right))#分別再對左右兩塊進行各自的左右分塊 def merge(self,left,right): ...
""" Given an array nums of 0s and 1s and an integer k, return True if all 1's are at least k places away from each other, otherwise return False. Input: nums = [1,0,0,0,1,0,0,1], k = 2 Output: true Explanation: Each of the 1s are at least 2 places away from each other. Input: nums = [1,1,1,1,1], k = 0 Output: true ""...
"""Clean Code in Python - Chapter 7: Using Generators > The Interface for Iteration * Distinguish between iterable objects and iterators * Create iterators """ class SequenceIterator: """ >>> si = SequenceIterator(1, 2) >>> next(si) 1 >>> next(si) 3 >>> next(si) ...
def safe_repr(obj): """Returns a repr of an object and falls back to a minimal representation of type and ID if the call to repr raised an error. :param obj: object to safe repr :returns: repr string or '(type<id> repr error)' string :rtype: str """ try: obj_repr = repr(obj) exc...
# -*- coding: utf-8 -*- # 1'den 1000'e kadar olan sayılardan mükemmel sayı olanları ekrana yazdırın. Bunun için bir sayının mükemmel olup olmadığını dönen bir tane fonksiyon yazın. # Bir sayının bölenlerinin toplamı kendine eşitse bu sayı mükemmel bir sayıdır. Örnek olarak 6 mükemmel bir sayıdır (1 + 2 + 3 = 6). def...
print('\033[31m=\033[m'*12, '\033[33mReajuste Salarial\033[m', '\033[31m=\033[m'*12) sal = float(input('\033[35mQual é o salario do Funcionário? R$' )) p = sal * 15/100 print('\033[4;32mUm funcionário que ganhava R$\033[34m{},\033[4;32m com 15% de aumento, passa a receber R$\033[34m{:.2f}.'.format(sal,(sal+p)))
"""These SESSION commands are used to enter and exit the various processors in the program. """ class ProcessorEntry: def aux2(self, **kwargs): """Enters the binary file dumping processor. APDL Command: /AUX2 Notes ----- Enters the binary file dumping processor (ANSYS aux...
# 141, Суптеля Владислав # 【Дата】:「09.03.20」 # 6. Написати рекурсивну процедуру перекладу натурального числа з десяткової системи числення в N-річної. # Значення N в основній програмі вводиться з клавіатури (2 ≤ N ≤ 16). n = int(input("「Введите число」: ")) a = int(input("「Введите основание системы счисления」: ")) def ...
""" .. module:: data_series :synopsis: Defines the DataSeries class. .. moduleauthor:: Scott W. Fleming <fleming@stsci.edu> """ #-------------------- class DataSeries(object): """ Defines a Data Series object, which contains the data (plot series) and plot labels for those series. """ def __i...
# -*- coding: utf-8 -*- # @File : observer.py # @Project : src # @Time : 2018/12/21 0:09 # @Site : https://github.com/MaiXiaochai # @Author : maixiaochai """ 1)观察者(observer)模式: 背后的思想是降低发布者与订阅者之间的耦合度,从而易于在运行时添加/删除订阅者。 2)拍卖会类似于观察者模式, 每个拍卖出价人都有一些拍牌,在他们想出价时就可以举起来。不论出价人在何时举起一块牌,...
class AdaptiveComponentInstanceUtils(object): """ An interface for Adaptive Component Instances. """ @staticmethod def CreateAdaptiveComponentInstance(doc, famSymb): """ CreateAdaptiveComponentInstance(doc: Document,famSymb: FamilySymbol) -> FamilyInstance Creates a FamilyInstan...
# -*- coding: utf-8 -*- def submatrixSum(M): """ Strnjena podmatrika z največjo vsoto komponent. Časovna zahtevnost: O(m^2 n), kjer je m × n dimenzija vhodne matrike. """ m = len(M) assert m > 0 n = len(M[0]) assert n > 0 and all(len(l) == n for l in M) s = {(-1, h): 0 for h in ...
def gmaps_url_to_coords(url): gmaps_coords = url.split('=') coords = (0.0, 0.0) # defaults to 0,0 if len(gmaps_coords) == 2: gmaps_coords = gmaps_coords[1] coords = tuple(map(lambda c: float(c), gmaps_coords.split(','))) return coords
# Copyright 2014 Google Inc. All rights reserved. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE filters or at # https://developers.google.com/open-source/licenses/bsd { 'includes': [ '../../common.gypi', ], 'targets': [ { 'target_name': 'filters',...
def no_teen_sum(a, b, c): retSum = 0 for i in [a, b, c]: if i <= 19 and i >= 13 and i != 15 and i != 16: continue retSum += i return retSum
"""Python implementation for doubly-linked list data structure.""" class DoublyLinkedList(object): """Sets properties and methods of a doubly-linked list.""" def __init__(self): """Create new instance of DoublyLinkedList.""" self.tail = None self.head = None self._length = 0 ...
def read_input(filename): with open(filename, 'r') as file: N, k = file.readline().strip().split() N, k = int(N), int(k) X = [] clusters = [] for _ in range(N): buffers = file.readline().strip().split() X.append([float(v) for v in buffers]) f...
def func(): yield 1 yield 2 yield 3 def main(): for item in func(): print(item) # print(func()) #<generator object func at 0x7f227f3ae3b8> obj1 = (1,2,3,) obj = (i for i in range(10)) print (obj) # print(obj[1]) # 'generator' object is not subscriptable obj2 ...
def is_palindrome(str, length): is_pali = True length -= 1 for i in range (0, length//2): if (str[i] != str[length - i]): is_pali = False break return is_pali str = input('please enter a string\n') message = "Palindrome!" if is_palindrome(str, len(str)) else "not pali" p...
# TODO -- co.api.InvalidResponse is used in (client) public code. This should # move to private. class ClientError(Exception): def __init__(self, status_code, message): Exception.__init__(self) self.status_code = status_code self.message = message def to_dict(self): return {"...
# Desafio 2 - Aula 5 : Primeiro 'input' e lista simplês com cores. nome = input('Me diga seu nome: ') cor = {'azul' : '\033[34m', 'limpa' : '\033[m'} print(f'Seu nome é,\033[34m{nome}{cor["limpa"]}!') print(f'Seu nome é \033[34m{nome}\033[m!')
groups_dict = { -1001384861110: "expresses" } log_file = "logs.log" database_file = "Couples.sqlite" couples_delta = 60 * 60 * 4
def sample_service(name=None): """ This is a sample service. Give it your name and prepare to be greeted! :param name: Your name :type name: basestring :return: A greeting or an error """ if name: return { 'hello': name} else: return {"error": "what's your name?"}
class Solution: def reverseStr(self, s: str, k: int) -> str: if not s or not k or k < 0: return "" s = list(s) for i in range(0, len(s), 2 * k): s[i: i+k] = reversed(s[i:i+k]) return ''.join(s)
d1, d2 = map(int, input().split()) s = d1 + d2 dic = {} for i in range(2, s + 1): dic[i] = 0 for i in range(1, d1 + 1): for j in range(1, d2 + 1): dic[i + j] += 1 top = 0 out = [] for key in dic: if dic[key] == top: out.append(key) elif dic[key] > top: top = dic[key] out ...
''' PARTIAL DEARRANGEMENTS A partial dearrangement is a dearrangement where some points are fixed. That is, given a number n and a number k, we need to find count of all such dearrangements of n numbers, where k numbers are fixed in their position. ''' mod = 1000000007 def nCr(n, r, mod): if n < r: retur...
#!/usr/bin/env python3 class Color(): black = "\u001b[30m" red = "\u001b[31m" green = "\u001b[32m" yellow = "\u001b[33m" blue = "\u001b[34m" magenta = "\u001b[35m" cyan = "\u001b[36m" white = "\u001b[37m" reset = "\u001b[0m"
# Classic crab rave text filter def apply_filter(input_stream, overlay_text, font_file, font_color, font_size): text_lines = overlay_text.split("\n") text_shadow = int(font_size / 16) # ffmpeg does not support multiline text with vertical align if len(text_lines) >= 2: video_stream = input_stre...
class ElementableError(Exception): pass class InvalidElementError(KeyError, ElementableError): def __init__(self, msg): msg = f"Element {msg} is not supported" super().__init__(msg)
""" 7 - Faça um programa que receba dois números e mostre o maior. Se por acaso, os dois números forem iguais, imprima a mensagem Números Iguais. """ numero1 = int(input("Digite o primeiro número: ")) numero2 = int(input("Digite o segundo número: ")) if numero1 > numero2: print(f'Entre os números {numero1} e {nu...
NTIPAliasFlag = {} NTIPAliasFlag["identified"]="0x10" NTIPAliasFlag["eth"]="0x400000" NTIPAliasFlag["ethereal"]="0x400000" NTIPAliasFlag["runeword"]="0x4000000"
for _ in range(int(input())): word = input() if len(word) > 10: print(word[0]+str(len(word)-2)+word[-1]) else: print(word)
xmin, ymin, xmax, ymax = 100, 100, 1000, 800 # Bit code (0001, 0010, 0100, 1000 and 0000) LEFT, RIGHT, BOT, TOP = 1, 2, 4, 8 INSIDE = 0 print(f"Xmin: {xmin}\nYmin: {ymin}\nXmax: {xmax}\nYmax: {ymax}") x1 = float(input("Enter x: ")) y1 = float(input("Enter y: ")) x2 = float(input("Enter x2: ")) y2 = float(input("...