content
stringlengths
7
1.05M
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # JTSK-350112 # complex.py # Shun-Lung Chang # sh.chang@jacobs-university.de class Complex(object): def __init__(self, real, imag): self._real = real self._imag = imag def __add__(self, other): if type(self) != type(other): ...
def gc_genome_skew(dna): gc_skew=[] gc_diff=0 for i in range(len(dna)): gc_skew.append(gc_diff) if dna[i]=='C': gc_diff-=1 if dna[i]=='G': gc_diff+=1 oric_list=[] min_value = min(gc_skew) for i in range(len(gc_skew)): if(gc_s...
#Operaciones: print ("Ejercicio 1: Operaciones numéricas") dividendo = 7 divisor = 3 #Si queremos obtener el resto de una dvisión empleamos el símbolo %. ej: restoDivisión = dividendo % divisor print (restoDivisión) #Si queremos obtener el conciente, entonces empleamos la barra cociente = dividendo / divisor pr...
ext = ('zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez', 'onze', 'doze', 'treze', 'quatorze', 'quinze', 'dezesseis', 'dezessete', 'dezoito', 'dezenove', 'vinte') val = int(input('Digite um valor:')) while not 0 <= val <= 20: val = int(input('Digite um valor:')) print(f'o...
# Python 3.x class AgeException(Exception): def __init__(self, msg, age): super().__init__(msg) self.age = age class TooYoungException(AgeException): def __init__(self, msg, age): super().__init__(msg, age) class TooOldException(AgeException): def __init__(self, msg, age): ...
""" 该代码仅为演示函数签名所用,并不能实际运行 """ save_info = { # 保存的信息 "iter_num": iter_num, # 迭代步数 "optimizer": optimizer.state_dict(), # 优化器的状态字典 "model": model.state_dict(), # 模型的状态字典 } # 保存信息 torch.save(save_info, save_path) # 载入信息 save_info = torch.load(save_path) optimizer.load_state_dict(save_info["optimizer"]) mode...
""" Script to show sample use of ipf_api_client and nagios_api_client """ """ export IPF_URL="" export IPF_TOKEN="" d=IPFDevice('L66EXR1') d.hostname d.ipaddr export NAGIOS_URL="" export NAGIOS_TOKEN="" n=NAGIOSClient() n.host_list() n.hostgroup_list() n.create_hostgroup("site") s=NAGIOSHost(name=d.hostname,ipaddr=d....
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def insertionSortList(self, head: ListNode) -> ListNode: if not head: return head dummy=ListN...
""" This module contains the templates for different search requests (conjunction, data products, ephemeris) """ CONJUNCTION_SEARCH_TEMPLATE = { "start": "2020-01-01T00:00:00", "end": "2020-01-01T23:59:59", "ground": [ { "programs": [ "string" ], ...
fibonacci_cache= {} def fibonacci(n): # If we have cached the value, then return it if n in fibonacci_cache: return fibonacci_cache[n] # Compute the Nth term if n == 1: value = 1 elif n == 2: value = 1 elif n >2: value = fibonacci(n-1) + fibonacci(n-2) #Cache the value and return it f...
x = [0.0, 3.0, 5.0, 2.5, 3.7] #an array is a list of numbers print(type(x)) #removing the third element x.pop(2) #it pops off the (index) print(x) #removes the 2.5 element x.remove(2.5) print(x) #add an element to the end x.append(1.2) print(x) #get a copy y = x.copy() #produces a 'deep' ...
def imc(a,p): return p / (a**2) peso = float(input("Digite seu peso: ")) altura = float(input("Digite sua altura: ")) imc = imc(altura, peso) if(imc < 17): print("Muito abaixo do peso\n") elif(imc >= 17 and imc <= 18.49): print("Abaixo do peso\n") elif(imc >= 18.5 and imc < 25): print("Peso normal\n") ...
# DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed bigtable_client_unit_tests = [ "admin_client_test.cc", "app_profile_config_test.cc", "bigtable_version_test.cc", "cell_test.cc", "client_options_test.cc", "cluster_config_test.cc", "column_family_test.cc", "c...
# Assign functions to a variable def add(a, b): return a + b plus = add value = plus(1, 2) print(value) # 3 # Lambda value = (lambda a, b: a + b)(1, 2) print(value) # 3 addition = lambda a, b: a + b value = addition(1, 2) print(value) # 3 authors = [ 'Octavia Butler', 'Isaac Asimov', 'Neal Stephens...
# my_script print(f"My __name__ is: {__name__}") def i_am_main(): print("I'm main!") def i_am_imported(): print("I'm iported!") if __name__ == "__main__": i_am_main() else: i_am_imported()
#!/usr/bin/env python ''' * Author : Hutter Valentin * Date : 08.05.2019 * Description : Hector agent monitoring * Help : ANSI color from https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python ''' class colors: HEADER = '\033[95m' BLUE = '\033[94m' CBLUE = '\33[34m'...
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the given BST @param k: the given k @return: the kth smallest element in BST """ def kthSmallest(self, root, k): ...
n = input('digite algum : ') print('o tipo primitivo desse valor e :',type(n)) print('isso e um numero ?',n.isnumeric()) print('isso e uma letra ?',n.isalpha()) print('isso e espaço ?',n.isspace()) print('isso e numero e letra ?',n.isalnum()) print('estar em maiusculas ?',n.isupper()) print('estar em minusculas ?',n.is...
""" SpectralFlux.py Compute the spectral flux between consecutive spectra This technique can be for onset detection rectify - only return positive values Ported from https://github.com/jsawruk/pymir: 30 August 2017 """ def spectralFlux(spectra, rectify=False): spectral_flux = [] # Compute flux for zeroth sp...
print("analise estatistico de grupos") somaid =0 feminino =0 masculino =0 while True: print("_"*20) idade = int(input("Informe sua idade:")) sexo = str(input("informe seu sexo:[M/F]")).upper() print("-"*20) if idade >= 18: somaid = somaid + 1 if sexo == "M": masculino = masculi...
def test_get_symbols(xtb_client): symbols = list(xtb_client.get_all_symbols()) assert len(symbols) > 0 def test_get_balance(xtb_client): balance = xtb_client.get_balance() assert balance.get('balance') is not None def test_ping(xtb_client): response = xtb_client.ping() assert response
# user.py class User: """ Class representing an user. Parameters ---------- TODO Attributes ---------- Methods ------- """ def __init__(self, name, uuid=None): self.name = name self.uuid = self._get_uuid(uuid) def _get_uuid(self, uuid): ""...
class AgregationController: def __init__(self): """ """ def subscribe(self, url): """ :param url: URL :return: boolean """ def notify(self, message, id): """ :param message: Message :param id: List<TgUID> :return: void ...
def PagesInfo(): pagename = { "page": "", "page_code": "", "label1": "名称", "label2": "", "label3": "", "label4": "", "label5": "", "label6": "", "label7": "", "label8": "", "label9": "", "label10": "", "qrcodelis...
#Solution code for exercise 1 #We make a loop to make the element by element product of two lists, we then compare to numpy def list_product(list1,list2): new_list=list1 if(len(list1)==len(list2)): try: for i,row in enumerate(list1): for j,el in enumerate(row): ...
#Verificar si un numero es cuadrado #sin usar metodo sqrt def findSqrt (num): l=0 r=num-1 while l<=r: mid = l+(r-l)//2 if mid*mid == num: return True if mid*mid < num: l=mid+1 if mid*mid > num: r=mid-1 return False print(findSqrt(14))
def iob_ranges(words, tags): """ IOB -> Ranges """ assert len(words) == len(tags) ranges = [] def check_if_closing_range(): if i == len(tags) - 1 or tags[i + 1].split('_')[0] == 'O': ranges.append({ 'entity': ''.join(words[begin: i + 1]), 'typ...
##创建自定义类 class Person: def set_name(self,name): self.name=name; def get_name(self): return self.name def say_hello(self): print("hello"+self.name); def to_str(self): print(self.name()) person=Person(); person.set_name("lily") print(str(person)); ##属性函数与方法 ##函数与方法的区别:方法位于...
# Вася делает тест по математике: вычисляет значение функций в различных точках. # Стоит отличная погода, и друзья зовут Васю гулять. # Но мальчик решил сначала закончить тест и только после этого идти к друзьям. # К сожалению, Вася пока не умеет программировать. Зато вы умеете. # Помогите Васе написать код функции, вы...
""" Task Given an integer, n, perform the following conditional actions: If n is odd, print Weird If n is even and in the inclusive range of 2 to 5, print Not Weird If n is even and in the inclusive range of 6 to 20, print Weird If n is even and greater than 20, print Not Weird Input Format A single line containing a...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isValidBST(self, root: TreeNode) -> bool: self.prev = None def valid(node): if node: if n...
class Solution: def lengthOfLastWord(self, s: str) -> int: s = s.strip() wordList = s.split(' ') try: lastWord = wordList[-1] return len(lastWord) except IndexError: return 0 sol = Solution() print(sol.lengthOfLastWord("hello world"))
valid_statues = ['active', 'inactive'] class ServiceIdentities: def __init__(self, britive): self.britive = britive self.base_url = f'{self.britive.base_url}/users' def list(self, filter_expression: str = None) -> list: """ Provide an optionally filtered list of all service id...
class A: def method(self): print('This belongs to class A') class B(A): def method(self): print('This belongs to class B') pass class C(A): def method(self): print('This belongs to class C') pass class D(B,C): def method(self): p...
def astr(jour, mois): if (mois == 3 and (jour >= 21 and jour <= 31)) or (mois == 4 and (jour >= 1 and jour <= 20)): return "Belier" elif (mois == 4 and (jour >= 21 and jour <= 30) or (mois == 5 and (jour >= 1 and jour <= 21))): return "Taureau" elif (mois == 5 and (jour >= 22 and jo...
""" 4.3 – Contando até vinte: Use um laço for para exibir os números de 1 a 20, incluindo-os. """ for num in range(1, 21): print(num)
# Given a singly linked list, write a function which takes in the first node # in a singly linked list and returns a boolean indicating if the linked list # contains a "cycle". # A cycle is when a node's next point actually points back to a previous node # in the list. This is also sometimes known as a circularly link...
class segmenter: def __init__(self): self.index_count = 0 self.Tx_buff = [] self.data = [] def load_data(self,s): self.data = s def append_data(self,s): self.data.append(s) def prep_buff(self): self.index_count = 0 l = len(self.data) diff = l - self.index_count if diff ...
ano = int(input('Digite um ano: ')) if (ano%4==0 and ano%100!=0) or (ano%400==0): print('O ano de {} é Bissexto!'.format(ano)) else: print('O ano de {} NÃO é bissexto'.format(ano))
class Solution: def flipAndInvertImage(self, image: List[List[int]]) -> List[List[int]]: image_width = len(image) for idx, row in enumerate(image): image[idx] = [] for element in row: image[idx] = [1 - element] + image[idx] return image
N = int(input()) odds = [i for i in range(1, N+1) if i % 2 != 0] result = [] for odd in odds: z = [] for i in range(1, odd+1): if odd % i == 0: z.append(i) if len(z) == 8: result.append(z) print(len(result))
# -*- coding: utf-8 -*- voir https://docs.python.org/2/tutorial/interpreter.html#source-code-encoding def interface(jeu): """Retourne les éléments de l'interface pour le menu "Game Over", défini également les boutons dans la variable jeu. Paramètre: - dict jeu: Dictionnaire contenant les valeurs asso...
""" 0131. Palindrome Partitioning Medium Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: Input: "aab" Output: [ ["aa","b"], ["a","a","b"] ] """ class Solution: def partition(self, s: str) -> List[List[str]]:...
# 11 - Given 2 (integer) lists, calculate if they're equal element by element and print it on the terminal. equal = True L1 = [67, 82, 100, 28, 22, 68] L2 = [18, 27, 33, 13, 83, 61] n = len(L1) for i in range(0, n): if L1[i] != L2[i]: equal = False if equal: print("Lists are equal.") else: print("Lists a...
""" @Pedro Santana Abreu (https://linktr.ee/pedrosantanaabreu) @Curso em Vídeo (https://cursoemvideo.com) PT-BR: Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite. """ # Recebendo i...
""" 1. Lambda definition """ # def add(a, b): # return a + b # Lambda with name add = lambda a,b : a + b c = add(3, 5) print(c) # Anonymous Lambda result = (lambda a, b: a + b)(9, 10) print(result)
# pylint: disable=invalid-name VERSION = '1.0' default_app_config = 'django_walletpass.apps.DjangoWalletpassConfig'
# # Example file for working with conditional statements # (For Python 3.x, be sure to use the ExampleSnippets3.txt file) def main(): x, y = 10, 100 if x < y : str = "x is less than y" elif x > y: str = "y is less than x"; else: str = "x is equal to y" print(str) st =...
""" Create by yy on 2019/9/21 """ __title__ = 'psql-yy' __description__ = 'A tool which is used to connect postgresql, designed by yy' __url__ = 'https://github.com/guaidashu/psql_yy' __version_info__ = ('0', '1', '6') __version__ = '.'.join(__version_info__) __author__ = 'guaidashu' __author_email__ = 'song42960@gmai...
# Trie Node class TrieNode: def __init__(self, letter): self.letter = letter self.children = {} self.is_end_of_word = False class Trie: def __init__(self): self.root = TrieNode("*") # Root node # -----------------------------------------------------------------------...
# # PySNMP MIB module AT-DHCPSN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-DHCPSN-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:29:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
# From dashcore-lib class SimplifiedMNList: pass class SimplifiedMNListDiff: pass class MerkleBlock: pass class BlockHeader: pass
class Provider(BaseProvider): """ Generates fake ISBNs. ISBN rules vary across languages/regions so this class makes no attempt at replicating all of the rules. It only replicates the 978 EAN prefix for the English registration groups, meaning the first 4 digits of the ISBN-13 will either be 978-0 or 9...
class TexFile: """Represents a body of .tex template. Can change its parameters and gives you body for captions and formulas. List of parameters: sans_font: Set sans font of the document. roman_font, mono_font: The same. pre_packages: These packages will be included into preamble at its beginning. Is array...
# Operadores Aritméticos print('Multiplicação *', 10*10) # quando usados numeros, são operadores normais. print('Mutiplicação * ', 10* 'A') # quando usados com strings, eles servem ocmo repetidores. print('Adção + ', 10+10) # quando usados numeros é feita a soma, mas quando usados strings é feita a concatenação. prin...
# Listas são criadas com [] lista = ["item 1", "item 2", "item 3"] # Imprimir a lista print(lista) # Atribuir valores da lista à variáveis v1 = lista[0] v2 = lista[1] v3 = lista[2] # Imprimir apenas 1 item da lista print(lista[0]) # Atualizar lista lista[2] = "new item 3" # Deletar um item da lista del lista[1] #...
# SPDX-License-Identifier: BSD-3-Clause __all__ = ( 'guid', 'GPT_PART_TYPES', 'UEFI_CORE_PART_TYPES' , 'WINDOWS_PART_TYPES' , 'HPUX_PART_TYPES' , 'LINUX_PART_TYPES' , 'FREEBSD_PART_TYPES' , 'DARWIN_PART_TYPES' , 'SOLARIS_PART_TYPES' , 'NETBSD_PART_TYPES' , 'CHROMEOS_PART_TYPES' , 'COREOS_...
def echo(user , lang , sys) : print('User:', user, 'Language:', lang, 'Platform:', sys) echo('Mike' , 'Python' , 'Window') echo(lang = 'Python' , sys = 'Mac OS' , user = 'Anne') def mirror(user = 'Carole' , lang = 'Python') : print('\nUser:' , user , 'Language:' , lang) mirror() mirror(lang = 'Java') mirro...
TOTAL_CHARACTERS = """ SELECT COUNT(name) FROM charactercreator_character; """ TOTAL_SUBCLASS = """ SELECT (SELECT COUNT(*) FROM charactercreator_cleric ) as cleric, (SELECT COUNT(*) FROM charactercreator_fighter ) AS fighter, (SELECT COUNT(*) ...
""" 보드 구현 전반에 사용되는 상수 모음. """ # Post Activities ACTIVITY_VIEW = 'VIEW' ACTIVITY_VOTE = 'VOTE' # 보드 역할 BOARD_ROLE = { 'DEFAULT': 'DEFAULT', 'PROJECT': 'PROJECT', 'DEBATE': 'DEBATE', 'PLANBOOK': 'PLANBOOK', 'ARCHIVING':'ARCHIVING', 'WORKHOUR': 'WORKHOUR', 'SPONSOR': 'SPONSOR', 'SWIPER':'...
''' Задача «Отрицательная степень» Условие Дано действительное положительное число a и целоe число n. Вычислите a^n. Решение оформите в виде функции power(a, n). Стандартной функцией возведения в степень пользоваться нельзя. ''' def power(a, n): res = 1 n1 = abs(n) if n > 0: for i in range(1, in...
numbers = [] while True: num = input('Enter a number: ') if num == 'done': break try: num = int(num) numbers.append(num) except ValueError: print('Invalid input') largest = max(numbers) smallest = min(numbers) print(f'Maximum is {largest}') print(f'Minimum is {smallest}')...
def reverseLeftWords(s: str, n: int) -> str: return s[n:] + s[:n] def reverseLeftWords(s: str, n: int) -> str: str_list = [] length = len(s) for i in range(n, n + length): str_list.append(s[i % length]) return ''.join(str_list)
# O(log n) def recursiveBinarySearch(vector, left_index, right_index, wanted): if left_index <= right_index: pivot = round(left_index + (right_index - left_index) / 2) if (vector[pivot] == wanted): return pivot elif vector[pivot] < wanted: return recursiveBinarySearch(vector, pivot+1, right_index...
#!/usr/bin/python3 """Alta3 Research | RZFeeser Review of Lists and Dictionaries""" # define a short data set (in real world, we want to read this from a file or API) munsters = {'endDate': 1966, 'startDate': 1964,\ 'names':['Lily', 'Herman', 'Grandpa', 'Eddie', 'Marilyn']} # {} creates dict # Your solut...
with open('assets/day09.txt', 'r') as file: lines = [line for line in file.read().splitlines()] depths = [[9] + [int(d) for d in line] + [9] for line in lines] depths = [[9] * len(depths[0])] + depths + [[9] * len(depths[0])] minimums = [] for y in range(1, len(depths) - 1): for x in range(1, len(depths[y]) ...
CONTENT = """huc basin <!--10n 60s--> 01 New England 0101 St. John 010100 St. John 01010001 Upper St. John 01010002 Allagash 01010003 Fish 01010004 Aroostook 01010005 Meduxnekeag 0102 Penobscot 010200 Penobscot 01020001 West Branch Penobscot 01020002 East Branch Penobscot 01020003 Mattawamkeag 01020004 Piscataquis 0102...
# Copyright 2020 Joshua Laniado and Todd O. Yeates. __author__ = "Joshua Laniado and Todd O. Yeates" __copyright__ = "Copyright 2020, Nanohedra" __version__ = "1.0" # SYMMETRY COMBINATION MATERIAL TABLE (T.O.Y and J.L, 2020) sym_comb_dict = { 1: [1, 'C2', 1, ['r:<0,0,1,a>', 't:<0,0,b>'], 2, '<0,0,0>', 'C2', 1, ['r...
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.size = 0 self.head = None self.last = None def get(self, index): if index < 0 or index >= self.size: raise Exception("超出链表节点范围!") ...
# -*- coding:utf-8 -*- ''' User defined Configuration for the application. ''' DB_CFG = { 'db': 'maplet', 'user': 'maplet', 'pass': '131322', } SMTP_CFG = { 'name': '云算笔记', 'host': "smtp.ym.163.com", 'user': "admin@yunsuan.org", 'pass': "pass", 'postfix': 'yunsuan.org', } SITE_CFG = ...
#pydoc - generate automat documentation class Saludos: """ Esta es la documentación de la clase silla Tendra dos funciones buenos_dias y adios y ambas será necesario pasarle un parametro con el nombre de la persona """ def buenos_dias(self, nombre): """ Sirve para dar los buenos días a ...
n, k = map(int, input().split()) y = sorted(map(int, input().split())) sol = 0 for i in y: if k <= (5-i): sol += 1 print(sol//3)
# Enter your code here. Read input from STDIN. Print output to STDOUT #with name and number input, divide both and enter into dict phonebook = {} number = int(input()) for _ in range(0, number): item = str(input()).split(" ") name = item[0] phonenumber = int(item[1]) phonebook[name] = phonenumber #...
{ "targets":[ { "target_name":"pcap_addon", "sources":[ "./src/winpcap/pcap_addon.cc", "./src/winpcap/pcapObjFactory.cc", "./src/winpcap/commLib.cc"], "include_dirs": [ "<!(node -e \"require('nan')\")", ...
# Program: impostos_exemplo1.py # Author: Ramon R. Valeriano # Description: Todas as funções, metodos para se calculos os impostos # Developed: 16/04/2021 - 21:13 # Updated: 16/04/2021 - 21:23 - Vamos deixar nossos orientado a objetos class ISS: def calcula(self, orcamento): return orcamento.valor * 0.1...
# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control version = '1.9.0' version_tuple = (1, 9, 0)
# -*- coding: utf-8 -*- """ Generate features from pandas dataframe, with columns statistics. ------------------- Return dataframe, columns=[by, col] """ def get_count(df, by): return df.groupby(by=by).count().iloc[:,0] def get_sum(df, col, by): return df.groupby(by=by).sum()[col] def get_mean(df, col, ...
LINKING_PROPERTY = "Transaction/generated/LinkedTransactionId" INPUT_TXN_FILTER = "type in 'Buy','Purchase','Sell','FwdFxSell', 'FwdFxBuy','FxBuy','FxSell','StockIn'" ENTITY_PROPERTY = "Portfolio/test/Entity" BROKER_PROPERTY = "Portfolio/test/Broker" COUNTRY_PROPERTY = "Instrument/test/Country" PROPERTIES_REQUIRED = [...
""" Given a lowercase string, s, return the index fo the first character that appears just once in a string. If every character appears more than once, return -1 Example input: s: "Who wants hot watermelon?" Example Output: 8 Explanation: "who wants hot watermelon?" ^ 012345678 The first charactter ...
class Solution: def reformatNumber(self, number: str) -> str: number = number.replace(' ','') number = number.replace('-','') output = '' count = len(number) remain = count % 3 print(remain) if remain == 0: last = number[len(numbe...
numero = int(input('digite um numero: ')) u = numero // 1 % 10 d = numero // 10 % 10 c = numero // 100 % 10 m = numero // 1000 % 10 print('analisando numero {}'.format(numero)) print('unidades: {}'.format(u)) print('dezenas: {}'.format(d)) print('centenas: {}'.format(c)) print('milhares: {}'.format(m))
SOURCE = "http://tabinstore.fr" HEADER = "User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11" MAX_IMG_SIZE = 71680 # In Bytes
""" Exercício Python 034: Escreva um programa que pergunte o salário de um funcionário e calcule o valor do seu aumento. Para salários superiores a R$1.250,00, calcule um aumento de 10%. Para os inferiores ou iguais, o aumento é de 15%. """ print('=-' * 10, 'Desafio 34', '-=' * 10) salario = float(input('Qual o atual ...
print('=' * 30) print('{:^30}'.format('Expressão')) print('=' * 30) print('') e = str(input("Digite sua expressão: ")).strip() p1 = e.count("(") p2 = e.count(")") if p1 == p2: print("Sua expressão está correta !") else: print("Sua expressão está incorreta !")
li = [] inp = input() li = inp.split(' ' , 5) print(1-int(li[0]),' ',1-int(li[1]),' ',2-int(li[2]),' ',2-int(li[3]),' ',2-int(li[4]),' ',8-int(li[5]), end = '')
# Ternary numeric notation is quite popular in Berland. To telegraph the ternary number the Borze alphabet is used. Digit 0 is transmitted as «.», 1 as «-.» and 2 as «--». You are to decode the Borze code, i.e. to find out the ternary number given its representation in Borze alphabet. # Input # The first line contains...
x,y = 8, 4 if x > y: print("x es mayor que y") print("x es el doble de y") if x > y: print("x es mayor que y") else: print("x es menor o igual que y") if x < y: print("x es menor que y") elif x == y: print("x es igual a y") else: print("x es mayor que y")
set_name(0x8012EA14, "GameOnlyTestRoutine__Fv", SN_NOWARN) set_name(0x8012EA1C, "vecleny__Fii", SN_NOWARN) set_name(0x8012EA40, "veclenx__Fii", SN_NOWARN) set_name(0x8012EA6C, "GetDamageAmt__FiPiT1", SN_NOWARN) set_name(0x8012F0DC, "CheckBlock__Fiiii", SN_NOWARN) set_name(0x8012F22C, "FindClosest__Fiii", SN_NOWARN) set...
""" Third party dependencies for this project. """ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def zola_deps(): """ Fetches the dependencies for the zola project. """ if "zola-v0-14-1-x86-64-unknown-linux-gnu" not in native.existing_rules(): http_archive( name = "z...
# ===================== 路径配置 ============================ folder_path = "folder/path/" tex_raw_path = folder_path + "raw.tex" tex_out_path = folder_path + "out.tex" # ================== 实验报告表头信息 ============================ stid = "173530xx" major = "物理学" grade = "17级" name = "木一" # ================== tex 导言区设置 =...
#Printing stars in 'W' shape! ''' * * * * * * * ** ** * * ''' i=0 j=3 for row in range(4): for col in range(7): if(col==0 or col==6) or (col==4 and row==1) or (col==5 and row==2): print('*',end='') elif row==i and col==j: print('*', end='') i+=1 ...
def get(): return [ 'const', 'var', 'import', 'require', 'using', 'load', 'from', 'as' ]
''' Stepik001132ITclassPyсh02p01st08THEORY02_20200610.py ''' a, b, c = 'x', 'y', 'z' print('{} {} {}'.format(a, b, c)) a, b, c = "xyz" print('{} {} {}'.format(a, b, c)) a, b, c = 1, 2, 3 print('{} {} {}'.format(a, b, c)) a, b, *c, d, e = 1, 2, 3, 4, 5, 6, 7 print('{} {} {} {} {}'.format(a, b, c, d, e)) print(*c,sep...
def inlookuptable(value: str, lookuptable: str): with open(lookuptable, "r") as lookuptablestream: for table in lookuptablestream: if table.strip("\n") == value: return True return False
# Labels for Nodes and Relationships BOT_LABEL = "Bot" USER_LABEL = "User" TWEET_LABEL = "Tweet" WROTE_LABEL = "WROTE" RETWEET_LABEL = "RETWEETED" QUOTE_LABEL = "QUOTED" REPLY_LABEL = "REPLIED" FOLLOW_LABEL = "FOLLOWS" QUERY = "match (b:Bot) - [r] - (t:Tweet) - [r2] - (t2:Tweet)" \ "call apoc.cypher.run('with `t` as ...
def my_first_module_func(): print('you are using my first created module') def console_log(message): print(message)
def cuadrado1(num1): return num1**2 cuadrado2 = lambda num1: num1 ** 2 print(cuadrado1(5)) print(cuadrado2(5))
MODE_5X11 = 0b00000011 class I2cConstants: def __init__(self): self.I2C_ADDR = 0x60 self.CMD_SET_MODE = 0x00 self.CMD_SET_BRIGHTNESS = 0x19 self.MODE_5X11 = 0b00000011 class IS31FL3730: def __init__(self, smbus, font): self.bus = smbus self.font = font s...
def sum_list(numbers): total = 0 for i in numbers: total += i return total print(sum_list([1, 2, -8])) """ Write a Python program to sum all the items in a list """
#Imagine you are building a compiler. Before running any code, the compiler must check that the parentheses in the program are balanced. Every opening bracket must have a corresponding closing bracket. We can approximate this using strings. #Given a string containing just the characters '(', ')', '{', '}', '[' and ']'...