content
stringlengths
7
1.05M
# 4. Задължителна литература # За лятната ваканция в спикъка със задължителна литература на Жоро има определен брой книги, но Жоро предпочита да играе с приятели навън. # Вашата задача е да помогнете на Жоро да изчисли колко часа на ден трябва да отделя, за да прочете необходимата литература, но и да прекарва максималн...
ca, na = map(int, input().split()) fila = [] caixas = [] lim = 0 tempo = 0 for cliente in range(na): chegada, tempo_atendimento = map(int, input().split()) fila.append([chegada, tempo_atendimento]) while fila: try: while (tempo >= fila[0][0]) and (len(caixas) < ca): pessoa = fila[0] caixas.append(pessoa[1]...
class Solution: def isValid(self, s: str) -> bool: if s[0] == ')': return False openClose = {'(':')', '{':'}', '[':']'} stack = [] for i in range(len(s)): if s[i] in '({[': stack.append(s[i]) else: if not stack...
"""Provides an abstraction around the database.""" def get_repo_list(cnx, branch): # pick all repos with status of 0 cur = cnx.cursor() cur.execute("SELECT `repo` FROM `github_deploy_repo` WHERE `status` = 0") repos = [repo.split('/', 2) for (repo,) in cur] cur.close() repos = [tuple(repo) for repo in rep...
a = str(input('Digite uma frase:').strip()) b = a.lower() c = b.count('a') #contar quantos 'a' tem na frase d = b.find('a') #posição da primeira letra e = b.rfind('a') print('A letra "a" apareceu {} vezes na frase' .format(c)) print('A primeira letra "a" aparece na posição {}'.format((d)+1)) print('A ultima ...
class ListNode: def __init__(self, x): self.val = x self.next = None def __str__(self): return "Node:%d" % self.val class Solution: # @param {ListNode} head # @param {integer} val # @return {ListNode} def removeElements(self, head, val): dummy = Lis...
""" :mod:`disco` -- API Reference ============================= .. toctree:: :titlesonly: :glob: * worker/index worker/classic """
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"get_spark_session": "00_00_core.ipynb", "get_directory_size": "00_00_core.ipynb", "get_size_format": "00_00_core.ipynb"} modules = ["core.py"] doc_url = "https://HansjoergW.github.io/bfh_...
def count(word): return f'{word} has {len(word)} characters.' if __name__ == '__main__': print(count(input('What is the input string?')))
#!/usr/bin/python3 for n1 in range(1,11): print("Tabla del " + str(n1)) print("-----------") for n2 in range(1,11): print(str(n1) + " por " + str(n2) + " es " + str(n1*n2))
#!/usr/bin/env python """wxPython GUI for VAMP project TODO: create (or copy?) a wx.Frame subclass for holding a matplotlib plot with navigation toolbar. """ #import uimain, tension, debug, geometry
class Solution: def candy(self, ratings: List[int]) -> int: ratingsLength = len(ratings) if ratingsLength == 0: return 0 candies = [1] * ratingsLength for i in range(1, ratingsLength): if ratings[i] > ratings[i - 1]: candies[i] = candies[i - 1]...
# Python 3.2 Bug from abc.py # Make sure we handle: # LOAD_FAST '__locals__' # STORE_LOCALS '' # Note this is similar to 05_abc_class.py but not the same: # object -> classmethod class abstractclassmethod(object): """A Python 3.2 STORE_LOCALS bug """ def __init__(self, callable): ...
# coding=utf-8 ''' 脚本运行简介: 脚本以单线程协程方式运行,IDE添加的`start` || `event`语句块为 Generator 函数 脚本存在两个队列,`main_queue` && `event_queue`,程序将循环执行`main_queue` 每次`main_queue`让出资源,将循环一遍`event_queue`。当`main_queue`全部执行完毕 (len(main_queue) == 0),结束程序。 `main_queue`总共执行一次,`event_queue`则可能执行若干次 ''' # 主队列。执行完毕后程序退出 __bell_main_queue = [] # 事件队列...
""" 给定一个包括 n 个整数的数组 nums 和 一个目标值 target。 找出 nums 中的三个整数,使得它们的和与 target 最接近。 返回这三个数的和。假定每组输入只存在唯一答案。 例如,给定数组 nums = [-1,2,1,-4], 和 target = 1.与 target 最接近的三个数的和为 2. (-1 + 2 + 1 = 2). 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/3sum-closest """ class Solution: def threeSumClosest(self, nums: List[int], tar...
""" https://leetcode.com/problems/kth-missing-positive-number/ Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Find the kth positive integer that is missing from this array. Example 1: Input: arr = [2,3,4,7,11], k = 5 Output: 9 Explanation: The missing positive int...
expected_output = { 'cores': { 1: { 'virtual_service': 'guestshell+', 'process_name': 'sleep', 'pid': 266, 'date': '2019-05-30 19:53:28', }, } }
# Copyright 2009 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../../../../build/common.gypi', ], 'targets': [ { 'target_name': 'service_runtime_x86_32', 'type': 'static...
n=int(input()) x=[0]+[*map(int,input().split())] dp=[0]*(n+5) dp[1]=x[1] ans=dp[1] for i in range(2,n+1): dp[i]=x[i] for j in range(1,i): if x[j]>x[i]: dp[i]=max(dp[i],dp[j]+x[i]) ans=max(ans,dp[i]) print(ans)
n = int(input()) slist = [] for i in range(2,n): iss = False for ii in range(2,i): if i%ii == 0: iss = True break; if not iss: slist.append(i) print(slist)
nome1 = "Dnaiel" nome2 = "Chico" if nome1 == nome2: print("Os nomes são iguais") else: print("Os nomes são diferentes") if (type(nome1) != type(nome2)): print("Os tipos são diferentes") else: print("Os tipos são iguais") num1 = 4 num2 = 3 if num1 != num2: print("Os numeros ...
def binary_classification_metrics(prediction, ground_truth): ''' Computes metrics for binary classification Arguments: prediction, np array of bool (num_samples) - model predictions ground_truth, np array of bool (num_samples) - true labels Returns: precision, recall, f1, accuracy - classi...
global driver def infect(driver_): global driver driver = driver_ class Widget: selector = None def __init__(self, driver): self.driver = driver def setup_class(self): if self.selector is None: raise Exception('You need to assign me a selector: %s' % self) se...
numerals = { "-":"负", ".":"点", 0:"零", 1:"一", 2:"二", 3:"三", 4:"四", 5:"五", 6:"六", 7:"七", 8:"八", 9:"九", 10:"十", 100:"百", 1000:"千", 10000:"万" } def to_chinese_numeral(n): if n==0: return '零' res=str(n) result="" if res[0]=="-": result+=...
# # PySNMP MIB module LIEBERT-GP-AGENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LIEBERT-GP-AGENT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:06:38 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
class ParsingError(Exception): pass class UnexpectedToken(ParsingError): def __init__(self, index): super().__init__() self.index = index
the_list = [1,2,3,4,5,6,7,8,9,10] def filter_evens(li): even_numbers = [items for items in the_list if items % 2 ==0] print(even_numbers) filter_evens(the_list)
# dictionaries fruit = { "orange": "a sweet, orange, citrus frtui", "apple": "good for making cider", "lemon": "a sour, yellow citrus fruit", "grape": "a small, sweet fruit growing in bunches", "lime": " a sour, green citruis fruit" } # print(fruit) # print(fruit["lemon"]) fruit["pear"] = "an odd s...
class Solution: def containsNearbyAlmostDuplicate(self, nums: List[int], k: int, t: int) -> bool: n = len(nums) l = [] for i, j in enumerate(nums): l.append((j, i)) l.sort(key = lambda x: x[0]) #print(l) i = 0 j = 1 while j < n...
# name을 파라미터로 입력 받아 첫 글자를 대문자로 반환하는 get_initial 함수를 생성합니다. # 파라미터: # name: 사람의 이름 # 리턴값: # 파라미터로 전달된 이름의 첫 글자를 대문자로 변환한 값 def get_initial(name): initial = name[0:1].upper() return initial # 이름을 요청하고 이니셜을 리턴 first_name = input('Enter your first name: ') middle_name = input('Enter your middle name: ') last_n...
exp_token = "dns" exp_dir = "./exp_diversity_noise" q_ratio = "0.2" test_ratio = "0.5" maj_ratio = 0.755558 prepare_data = False submit = True split_size = 1000 n_test = 100 n_test_maj = 100 * maj_ratio n_test_min = 100 - n_test_maj k_maj = 5 * maj_ratio k_min = 5. - k_maj alpha = "0.1" n_runs = 100 n_runs_test = 1000 ...
class ConsensusModule(torch.nn.Module): """docstring for ConsensusModule""" def __init__(self, consensus_type, dim = 1): super(ConsensusModule, self).__init__() self.consensus_type = consensus_type if consensus_type != 'rnn' else 'identity' self.dim = dim
n = int(input()) for i in range(n): alg = str(input()) e = str(input()).split() r = int(e[0]) g = int(e[1]) b = int(e[2]) if alg == 'eye' : p = int(0.3 * r + 0.59 * g + 0.11 * b) elif alg == 'mean': p = int((r + g + b) / 3) elif alg == 'max' : p = sorted([r, g, b])[2] elif alg == '...
class Pizza: def __init__(self, ingredients): self.ingredients = ingredients def __repr__(self): return f"Pizza({self.ingredients!r})" print(Pizza(["cheese", "tomatoes"]))
valor = float(input('Insira o valor da casa:')) salario = float(input('Insira o valor do seu sálario:')) anos = float(input('Insira em quantos anos você pretende pagar:')) parcela = valor / (anos * 12) sla = salario * 0.30 if parcela < sla: print('Você irá poder fazer o empréstimo.') print(f'E irá pagar uma me...
#Decoradores de Funções print("Algumas funções construídas por um programador") print("pode sofrer modificações ao longo do desenvolvimento") print("do aplicativo, o que significa que tudo o que um") print("programador escreve deve estar apto a sofre modificações.") print("Em python existe uma forma simples de adicion...
class GridViewColumn(DependencyObject, INotifyPropertyChanged): """ Represents a column that displays data. GridViewColumn() """ def OnHeaderStringFormatChanged(self, *args): """ OnHeaderStringFormatChanged(self: GridViewColumn,oldHeaderStringFormat: str,newHeaderStringFormat: str) ...
#setting RPPpath = r"D:\document\python projects\Autolipsync\scripttest2.rpp" TEMPLATEPath = r"D:\document\python projects\Autolipsync\template.exo" LIPPath = r"D:\document\python projects\Autolipsync\*.avi" ExportPath = "RPPtoEXO(Lyric).exo" FPS = 60
# %% def isprime(n): if n == 1: return False i = 2 while i*i <= n: if n % i == 0: return False i += 1 return True def solution(n, k): enc = [] while n != 0: enc.append(n % k) n = n // k curr = enc[-1] answer = 0 for v in enc[-2::-...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftANDleftGLOBALUNTILleftNEGleftLPARENRPARENATOMICLBRACKRBRACKNUMBER COMMA LPAREN RPAREN LBRACK RBRACK AND NEG ATOMIC GLOBAL UNTIL\n\texpression \t: expression AND expression\n\t\t\t\t| NEG e...
""" Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1->5->3->4->0 Output: -1->0->3->4->5 """ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = Non...
gender = input("いらっしゃいませ。性別は?") volume = int(input("ご飯の量は何g?")) print("あなたは %s性 で、ご飯の量は %dg ですね。" %(gender, volume)) if (gender == "男"): if (volume >= 900): print("やめたほうがいいんじゃない") else: print("ごゆっくり") elif (gender == "女"): if (volume >= 600): print("無理しないほうがいいよ") else: ...
''' Polynomials are given as a list i.e. 2x^3 - 6x^2 + 2x - 1 = [2, -6, 2, -1] ''' def polynomial(): coefficients = [] n = int(input("Enter number of coefficients: \n")) print("Enter coefficients: \n") for i in range(0, n): element = int(input()) coefficients.append(element) x = float(input("Value to eval...
""" Propagate the generated Swift header from a swift_library target This exists to work around https://github.com/bazelbuild/rules_swift/issues/291 """ def _swift_header_collector(ctx): headers = [ DefaultInfo( files = ctx.attr.library[CcInfo].compilation_context.headers, ), ] ...
""" Módulo para cálculos diversos """ def suma_total(monto=0): """ Calcula la suma total """ calculo_suma = 20 calculo_suma += monto return calculo_suma
class Router(object): def db_for_read(self, model, **hints): return 'read' def db_for_write(self, model, **hints): return 'default'
state_data = [{'id': 'AL', 'name': 'Alabama', 'code': 'AL', 'electoral_votes': 9, 'campaign_cost': 18, 'popular_vote': 2.1, 'groups': ['AA', 'OS']}, {'id': 'AK', 'name': 'Alaska', 'code'...
#!/usr/bin/python # function def my_function(): print("Hello world!") # call function def call_function(): print("Hello world!") call_function() # output: # Hello world! # parameters def pa_function(param): print("Hello", param) pa_function("Emily") pa_function("John") # output: # Hello Emily # Hello Jo...
words=['Wednesday', 'a lot', 'absence', 'accept', 'acceptable', 'accessible', 'accidentally', 'accommodate', 'accompanied', 'accomplish', 'accumulate', 'accuracy', 'achievement', 'acknowledgment', 'acquaintance', 'acquire', 'acquitted', 'across', 'actually', 'address', 'admission', 'adolescent', 'advice', 'advise', 'ad...
# -*- coding: iso-8859-1 -*- """ MoinMoin - Datasets Datasets are used by the DataBrowserWidget, and with the statistics code. @copyright: 2002 Juergen Hermann <jh@web.de> @license: GNU GPL, see COPYING for details. """ class Column: """ Meta-data for a column. """ _SLOTS = [ ...
def total_parity(n): """ Checks the binary parity of the value `n`. 01001 is even parity, 011001 is odd parity. :param n: any positive integer :returns: 1 for odd parity, 0 for even parity. """ if n == 0: return 0 N = int(np.ceil(np.log2(n))) if 2 ** N == n: N += 1 ...
#-*- coding:utf-8 class Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_restaurant(self): print(self.restaurant_name.title() + "'s cuisine type is " + self.cuisine_type + ".") def...
# -*- coding: utf-8 -*- # @Time : 2021/1/3 # @Author : handsomezhou #start:setting table_setting="setting" INDEX_ID=int(0) INDEX_KEY=int(1) INDEX_VALUE=int(2) INDEX_CREATE_TIME=int(3) INDEX_UPDATE_TIME=int(4) id = "id" key = "key" value = "value" create_time = "create_time" update_time = "update_time" CREATE_TABL...
def convert(num): num = int(num) new = bin(num)[2:] new = ((32 - len(new)) * '0') + new return new def maping_one(num, indexs): for i in range(len(num)): if (i not in indexs): indexs[i] = [0, []] if (num[i] == '1'): indexs[i][0] += 1 indexs[i][1]....
#!/usr/bin/python # -*- coding: utf-8 -*- """ Author : windpro E-mail : windprog@gmail.com Date : 15/8/26 Desc : """
# -*- coding: utf-8 -*- """ @author: Francis Franklin """
""" PASSENGERS """ numPassengers = 19157 passenger_arriving = ( (14, 8, 6, 8, 8, 0, 0, 1, 4, 0, 0, 2, 0, 7, 3, 3, 4, 3, 2, 0, 1, 0, 2, 2, 0, 0), # 0 (5, 5, 6, 5, 3, 2, 5, 2, 3, 5, 1, 1, 0, 7, 6, 5, 3, 8, 5, 1, 2, 2, 1, 0, 0, 0), # 1 (5, 9, 4, 2, 7, 4, 2, 1, 2, 0, 0, 0, 0, 10, 3, 5, 1, 6, 3, 3, 2, 3, 1, 0, 0, 0)...
def add_up(a, b): return a + b def test_add_up_succeed(): assert add_up(1, 2) == 3 def test_add_up_fail(): assert add_up(1, 2) == 4 def ignore_me(): assert "I will be" == "completely ignored"
destination = input() while destination != "End": needed_money = float(input()) saved_money = 0 while saved_money < needed_money: saved_money += float(input()) print(f"Going to {destination}!") destination = input()
while True: try: # get an integer for age age = int(input('What is your age? ')) 10/age print('You are',age, 'years old.') except ValueError as err: #if anything accept an int is enter print following error print(f''' please enter a number for your age. Error 10001 {err} '''...
# Return the remainder def remainder(x: int, y: int) -> int: return x % y # remainder_lambda = lambda x, y: x % y if __name__ == "__main__": print(remainder(1, 3))
nombreFichero = "fases.txt"; print("Ingresa los datos solicitados"); f1 = input("Ingresa la primera frase: "); f2 = input("Ingresa la segunda frase: "); f3 = input("Ingresa la tercera frase: "); fichero = open(nombreFichero, "w"); fichero.write("%s\n" % f1); fichero.write("%s\n" % f2); fichero.write("%s\n" % f3); fic...
expected_output = { "rollback_timer_reason": "no ISSU operation is in progress", "rollback_timer_state": "inactive", }
class VerificateInterface: def __init__(self, inputfile, outputfile, correctoutput): self.inputfile = inputfile self.outputfile = outputfile self.correctoutput = correctoutput self._status = None self._message = None def verificate(self, isolator): raise NotImple...
haarcascade_frontalface_Path = "./faceApi/models/OpenCV/haarcascade_frontalface_default.xml" # for cascade method # 8 bit Quantized version using Tensorflow ( 2.7 MB ) TFmodelFile = "./faceApi/models/OpenCV/tensorflow/TF_faceDetectorModel_uint8.pb" TFconfigFile = "./faceApi/models/OpenCV/tensorflow/TF_faceDetectorCon...
# Series data tune_series = ["open", "high", "low", "close", "volume"] # Parameters to tune tune_params = [ "acceleration", "accelerationlong", "accelerationshort", "atr_length", "atr_period", "average_lenght", "average_length", "bb_length", "channel_lenght", "channel_length", ...
"""Data creating and managing.""" def file2text(filepath, verbose=True): """Read all lines of a file into a string. Note that we destroy all the new line characters and all the whitespace charecters on both ends of the line. Note that this is very radical for source code of progra...
class UltrasonicRegisterTypes: CONFIG = 0 DATA = 1 UltrasonicA1 = { UltrasonicRegisterTypes.CONFIG: 0x0C, UltrasonicRegisterTypes.DATA: 0x0E, } UltrasonicA3 = { UltrasonicRegisterTypes.CONFIG: 0x0D, UltrasonicRegisterTypes.DATA: 0x0F, } UltrasonicRegisters = { "A1": UltrasonicA1, "A...
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
expected_output = { 'vrf': { 'default': { 'address_family': { 'ipv6': { 'routes': { '2001:db8:1234::8/128': { 'active': True, 'metric': 1, 'next_hop':...
DNA_TO_RNA_MAPPER = { 'G' : 'C', 'C' : 'G', 'T' : 'A', 'A' : 'U' } def to_rna(dna_strand): return ''.join([DNA_TO_RNA_MAPPER[letter] for letter in dna_strand])
#program to check whether a given integer is a palindrome or not. def is_Palindrome(n): return str(n) == str(n)[::-1] print(is_Palindrome(100)) print(is_Palindrome(252)) print(is_Palindrome(-838)) print(is_Palindrome('swims')) print(is_Palindrome(1001))
class CardType(object): NUMBER_CARD = 'number_card' PLUS = 'plus' PLUS_2 = 'plus_2' STOP = 'stop' CHANGE_DIRECTION = 'change_direction' CHANGE_COLOR = 'change_color' TAKI = 'taki' SUPER_TAKI = 'super_taki'
# Values. name = "Monty" order = [ {"qty": 1, "name": "Widget"}, {"qty": 3, "name": "Carpets"} ] # Our home-grown template language, based on # Python's string format syntax. fancy_templ = """ Hello {name}, You ordered: {{ for item in order }} * {item[qty]} x {item[name]} {{ endfor }} Thank you. """ def form...
# The tail of the list uses its next reference to point back to the head of the # list. class CircularQueue: """Queue implementation using circular linked list for storage.""" class _Node: """Lightweight, nonpublic class for storing a singly linked node.""" __slot__ = '_element', '_next' ...
#Define Class class Student: __name = "" __math = 0 __science = 0 __english = 0 __grade_average = 0 __grade_status = "" __status = True def __init__(self, name, math, science, english): try: self.__name = str(name) self.__math = float(math) ...
""" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 """ def get_rows_and_columns(sparql_results): if type(sparql_results) is not dict: return None if 'head' in sparql_results and 'vars' in sparql_results['head'] and 'results' in sparql_results an...
# Databricks notebook source # MAGIC %md # CCU002_03-D02-patient_skinny_unassembled # MAGIC # MAGIC **Description** Gather together the records for each patient in primary and secondary care before they are assembled into a skinny record for CCU002. The output of this is a global temp View which is then used by **CCU0...
def sync_consume(): while True: print(q.get()) q.task_done() def sync_produce(): consumer = Thread(target=sync_consume, daemon=True) consumer.start() for i in range(10): q.put(i) q.join() sync_produce()
list1 = [15, -1, 11, -5, -5, 5, 3, -1, -7, 13, -11, -11, 7, 13] # Base list even_list = [] # Creates blank list # Problem 3 code for i in list1: # Iterates through list1 assigning i to the next value each time through if i % 2 == 0: # If 'i' is divisible by 2 (even) then: even_list.append(i) # Add the...
#* Asked in Microsoft #? You 2 integers n and m representing an n by m grid, determine the number of ways you can get #? from the top-left to the bottom-right of the matrix y going only right or down. #? Example: #? n = 2, m = 2 #? This should return 2, since the only possible routes are: #? Right, down ...
class Solution: def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ dp = [False] * (len(s) + 1) dp[0] = True for i in range(0, len(s)): if dp[i]: for word in wordDict: ...
# # PySNMP MIB module Juniper-IPsec-Tunnel-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-IPsec-Tunnel-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:03:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
#배열의 최솟값을 찾는 알고리즘 def findMin(nums): min = nums[0] #처음 원소부터 마지막 원소까지 비교 for x in nums: if x < min: #만약 max가 nums[x]보다 클 경우, max를 num[x]로 변경 min = x return min def main(): print(findMin([0,1,2,3,4,5,-3,24,-56])) # min = -56 if __name__ == '__main__': main()
# -*- coding: utf-8 -*- """ OCR Utility Functions @author: Shiv Deepak <idlecool@gmail.com> """ # Store ocr metadata into the database #def shn_ocr_store_metadata(source, filename, comment): # module = "doc" # resourcename = "document" # tablename = "%s_%s" % (module, resourcename) # stream = St...
"""Print all the multiplication tables with numbers from 1 to 10""" def solution() -> None: for n in range(11): multiplicand = n for i in range(11): multiplier = i print(f'{multiplicand} x {multiplier} = {multiplicand * multiplier}') print() solution()
# coding:utf-8 """ Name : __init__.py.py Author : blu Time : 2022/3/7 17:39 Desc : """
# Desafio 3 - Aula 6 : Soma de dois numeros. numero1 = int(input('Diga um numero: ')) numero2 = int(input('Agora diga outro numero: ')) soma = (numero1+numero2) print('Os valores \033[33m{}\033[m e \033[33m{}\033[m \033[31msomados\033[m são iguais á: \033[34m{}'.format(numero1,numero2,soma))
n = int(input()) give = list(map(int, input().split())) take = [0]*n for i in range(n): take[i] = give.index(i+1) + 1 print(*take, sep = " ")
"""Sphinx configuration.""" project = "example-package-lth" author = "Le Tuan Hai" copyright = f"2022, {author}" extensions = [ "sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx_autodoc_typehints", ]
class FailedToSendMessage(Exception): """""" class CannotSendMessages(Exception): """""" class Forbidden(Exception): """""" class RedisNotConnected(RuntimeError): """"""
count = 0 while True: index = int(input()) if index == 0: break aldo, beto = 0, 0 count += 1 for i in range(index): x, y = map(int, input().split(' ')) beto += y aldo += x print("Teste %d" % count) if beto > aldo: print("Beto\n") else: print("Aldo\n")
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Pearl.Atom') def gem(): require_gem('Pearl.ClassOrder') require_gem('Pearl.Method') require_gem('Pearl.Nub') lookup_atom = lookup_normal_token provide_atom = provide_normal_token def count_newlines__zero(t): as...
class Nanote(): """Implementation of some Nanote logic in python for server-side validation""" sikrit = 895175784877 charsets = [" etaoinsrhl"," 1234567890"," 1234567890'"," etaoinsrhl'"," 1234567890'"," etaoinsrhl'"," 1234567890'"," etaoinsrhl'"," 1234567890]"," etaoinsrhl]"," 1234567890["," etaoinsrhl[","...
def gaussianQuadrature(function, a, b): """ Perform a Gaussian quadrature approximation of the integral of a function from a to b. """ # Coefficient values can be found at pomax.github.io/bezierinfo/legendre-gauss.html A = (b - a)/2 B = (b + a)/2 return A * ( 0.2955242247147529*function(-A*0.1488743389816312 ...
routes = [] def list_gizmos(): return 'Listing Gizmos' routes.append(dict( rule='/gizmos', view_func=list_gizmos)) def add_gizmo(): return 'Add Gizmo' routes.append(dict( rule='/gizmo', view_func=add_gizmo, options=dict(methods=['POST']))) def update_gizmo(): return 'Update Gizmo' rou...
SOFTWARE_DEVELOPMENT = "Software Development" ELECTRICAL_ENGINEERING = "Electrical Engineering" IT_OPERATIONS = "IT Operations & Helpdesk" INFORMATION_DESIGN_AND_DOCUMENTATION = "Information Design & Documentation" PROJECT_MANAGEMENT = "Project Management"
N, *p = map(int, open(0).read().split()) for x in p: if x == 2: print(2) else: print((x - 1) * (x - 1))
# -*- coding: utf-8 -*- """ Created on Tue Jul 14 16:20:05 2020 @author: Ashish """ friends = ["Rolf", "Bob", "Jen"] print("Jen" in friends) # -- movies_watched = {"The Matrix", "Green Book", "Her"} user_movie = input("Enter something you've watched recently: ") print(user_movie in movies_watched)...
# (c) Copyright 2021 Aaron Kimball """ Version info for Arduino Debugger. """ # This module **must not** import anything else! DBG_VERSION = [0, 3, 0] DBG_VERSION_STR = '.'.join(map(str, DBG_VERSION)) FULL_DBG_VERSION_STR = f'Arduino Debugger (adbg) version {DBG_VERSION_STR}' LICENSE = """Copyright 2022 Aaron Kimbal...