content
stringlengths
7
1.05M
""" The field help_text has been renamed into description. """ def migrate(data): if 'version' not in data: data['version'] = 0 return data
load("@rules_cc//cc:defs.bzl", "cc_binary") load("@rules_cuda//cuda:defs.bzl", "requires_cuda_enabled", _cuda_library = "cuda_library") def cuda_library(name, **kwargs): """Macro wrapping a cc_library which can contain CUDA device code. Args: name: target name. **kwargs: forwarded to cuda_library ...
""" 《百钱百鸡》问题 百钱百鸡是我国古代数学家张丘建在《算经》一书中提出的数学问题: 鸡翁一值钱五,鸡母一值钱三,鸡雏三值钱一。百钱买百鸡,问鸡翁、鸡母、鸡雏各几何? 翻译成现代文是:公鸡5元一只,母鸡3元一只,小鸡1元三只, 用100块钱买一百只鸡,问公鸡、母鸡、小鸡各有多少只? Version:0.1 Author:cjp """ # 上面使用的方法叫做穷举法,也称为暴力搜索法 for gj in range(0,20): # 公鸡 for mj in range(0,33): # 母鸡 xj = 100 - gj - mj # 小鸡 数量等于100-公鸡数-母鸡数 if...
# TODO: Threading / Parallel without blocking the UI class IncrementalSearch: """ Universal incremental search within a list of documents. """ def __init__(self, documents, extract_fn): self.query = "" self.documents = documents # Extracted texts related to the documents by ind...
a = 5 b = 10 def zmien(a,b): c = a a = b b = c print("a:",a) print("b:",b) print("a:",a) print("b:",b) zmien(a,b)
n, k = map(int, input().split()) n_lst = list(map(int, input().split())) n_lst.sort(reverse=True) print(sum(n_lst[:k]))
obj_map = [["glass", 0.015, [0, 0, 0], [0, 0, 0.05510244]], # 0.06 ["donut", 0.01, [0, 0, 0], [0, 0, 0.01466367]], ["heart", 0.0006, [0.70738827, -0.70682518, 0], [0, 0, 0.8]], ["airplane", 1, [0, 0, 0], [0, 0, 2.58596408e-02]], ["alarmclock", 1, [0.70738827, -0.70682518, 0], [0,...
def AddLinear2TreeBranch(G,v1,v2,l): vert1 = v1 vert2 = v2 for i in range(l): vnew = max(G.vertices()) + 1 G.add_edges([[vert1, vnew],[vert2,vnew]]) vert1 = vert2 vert2 = vnew return G def Pinwheel(n): G = Graph() G.add_edges([[0,1],[1,2],[2...
#################### # POST /account/ # #################### def test_create_account(flask_client): shrek = { "username": "Shrek", "email": "ceo@swamp.com" } res = flask_client.post('/account/', json=shrek) assert res.status_code == 200 created_user = res.get_json() # Asse...
def autonomous_setup(): pass def autonomous_main(): print('Running auto main ...') def teleop_setup(): pass def teleop_main(): print('Running teleop main ...')
""" 4字典:可变 5集合: """ def ba_dict(): fam_info = {'lxy': (25, 'male', 'stu'), 'pjj': (26, 'female', 'tester'), 'tdd': (3, 'female', 'dog')} # 通过键可以获取字典中对应的值 print(fam_info['lxy']) # 对字典进行遍历(遍历的其实是键再通过键取对应的值) for elem in fam_info: print('{}\t--->\t{}'.fo...
class APrawcoreException(Exception): """Base exception class for exceptions that occur within this package.""" class InvalidInvocation(APrawcoreException): """Indicate that the code to execute cannot be completed.""" class RequestException(APrawcoreException): # yoinked this from praw def ...
expected_output = { "active_translations": {"dynamic": 1, "extended": 1, "static": 0, "total": 1}, "cef_punted_pkts": 0, "cef_translated_pkts": 4, "dynamic_mappings": { "inside_source": { "id": { 3: { "access_list": "99", "inter...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazelrio//:deps_utils.bzl", "cc_library_shared") def setup_ni_2022_2_3_dependencies(): maybe( http_archive, "__bazelrio_edu_wpi_first_ni-libraries_chipobject_li...
# # @lc app=leetcode id=712 lang=python3 # # [712] Minimum ASCII Delete Sum for Two Strings # # @lc code=start class Solution: def minimumDeleteSum(self, s1: str, s2: str) -> int: m, n = len(s1), len(s2) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(m - 1, -1, -1): ...
"""Provides the log level constants for the dss.pubsub packackage. """ EMERG = 80 ALERT = 70 CRITICAL = 60 ERROR = 50 WARNING = 40 NOTICE = 30 INFO = 20 DEBUG = 10 ALL = 0 _level_names = { EMERG : 'EMERG', ALERT : 'ALERT', CRITICAL : 'CRITICAL', ERROR : 'ERROR', WARNING : 'WARNING', N...
""" Problem Name: Array Rotation CodeChef Link: https://www.codechef.com/LTIME95C/problems/ARRROT/ Problem Code: ARRROT """ n = int(input()) li = list(map(int, input().split())) q = int(input()) li2 = list(map(int, input().split())) s = sum(li) x = 0 for i in li2: x = (2 * s) s = x print(x % (1000...
#!/usr/bin/env python # coding: utf-8 """ Critical value polynomials and related quantities for the bounds test of Pesaran, M. H., Shin, Y., & Smith, R. J. (2001). Bounds testing approaches to the analysis of level relationships. Journal of applied econometrics, 16(3), 289-326. These were computed using 32,000...
installed_apps = ( 'core', 'resources', 'arenas', 'sciences', 'military', 'profiles', 'matches', 'combat', )
sayi=int(input("bir sayı girin: "))#5 fak=1 for i in range(2,sayi+1): #2,3,4,5 fak*=i #2 6 24 120 print("faktoriyel=",fak)
cont = 0 param = 10 while True: cont = 0 num = int(input('Quer ver a tabuada de qual valor? ')) if num < 0: break while cont < 10: cont = cont + 1 tab = num * cont print(f'{num} x {cont} = {tab}') print('PROGRAMA ENCERRADO')
""" import main_menu # Pack of def for checking files: def readfile(filename): # Read a file and print what's in there. try: a = open(filename, 'rt') except: print(f"File couldn't be ready") else: return f'\033[1:34m{a.read()}\033[m' def appending(filename, info): # Append a n...
class Node(): """this is the Node class that will be used for heap data structures""" def __init__(self, value, parent=None): self.value = value self.parent = parent self.children = [] def __str__(self): return "Value: " + str(self.value) def add_children(self, value):...
# ler o Primeiro Termo e a Razão de uma PA. Mostrar os 10 primeiros termos dessa progressão. pa = [int(input('Digite o primeiro termo de sua PA: '))] r = int(input('E qual seria a razão?: ')) for f in range(1, 10): pan = pa[0] + f * r pa.append(pan) print(f'Números da PA: {pa}')
frase = 'Curso em Vídeo Python' print(frase.title()) print('''Welcome! Are you completely new to programming? If not then blablablablablabla blabl ablabal abkabakbak hahushkjsjkhsjsh sjhhsks hskjhsjkhs sjhkshkhsks skhskdjskhjd sjkhskjh jdkldj dhkdhkd dkjdkjd dkdlkd''')
# # MacOS Packaging logic # # This is intended as the first step in comprehensive package build on MacOS. It replaces the # following style of command: # # pkgbuild \ # --identifier (domain).$(PKG_NAME) \ # --component-plist $(PLIST) \ # --scripts $(SCRIPTS) \ # --version $(VER_BAZE...
pipe = make_pipeline(preprocessor, LinearRegression()) res = -cross_val_score( pipe, with_age, with_age['Age'], n_jobs=1, cv=100, scoring='neg_mean_absolute_error' ) sns.distplot(res) sns.distplot(with_age.Age) print(f'{res.mean()} +/- {res.std()}')
# Traer la lista de tareas: lista_tareas = [ [6, "Distribución"], [2, "Diseño"], [1, "Concepción"], [7, "Mantenimiento"], [4, "Producción"], [3, "Planificación"], [5, "Pruebas"] ] # Comando para ordenar la lista: lista_tare...
#Finding the percentage if __name__ == '__main__': n = int(raw_input()) student_marks = {} for _ in range(n): line = raw_input().split() name, scores = line[0], line[1:] scores = map(float, scores) student_marks[name] = scores query_name = raw_input() scores=student_...
# Problem : https://codeforces.com/problemset/problem/855/B n, p, q, r = map(int, input().split()) arr = [int(i) for i in input().split()] Pmax = [-10**9] * n Pmax[0] = p * arr[0] for i in range(1, n): Pmax[i] = max(Pmax[i-1], p * arr[i]) Smax = [-10**9] * n Smax[n-1] = r * arr[n-1] for i in range(n-2, -1, -1...
#Exercício Python 023: Faça um programa que leia um número de 0 a 9999 e # mostre na tela cada um dos dígitos separados. n = int((input('Digite um numero! '))) print('Unidade:', (n[3])) print('Dezena:', (n[2])) print('Centena:',(n[1])) print('Milhar:', (n[0]))
class WhatThePatchException(Exception): pass class HunkException(WhatThePatchException): def __init__(self, msg, hunk=None): self.hunk = hunk if hunk is not None: super(HunkException, self).__init__( "{msg}, in hunk #{n}".format(msg=msg, n=hunk) ...
''' Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Example 1: Given nums = [1,1,1,2,2,3], Your function...
#Project Euler Question 18 #By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. #3 #7 4 #2 4 6 #8 5 9 3 #That is, 3 + 7 + 4 + 9 = 23. #Find the maximum total from top to bottom of the triangle below: grid = """75 95 64 17 47 82 1...
class Request: pickup_deadline = 0 def __init__(self, request_id, start_lon, start_lat, end_lon, end_lat, start_node_id, end_node_id, release_time=None, delivery_deadline=None, pickup_deadline=None): self.request_id = request_id self.start_lon = start_lon self.start_lat = start_lat ...
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified). __all__ = ['do_something'] # Cell def do_something(): print('brztt')
class C1: def __init__(self, value): self.value = value def __bytes__(self): return self.value c1 = C1(b"class 1") print(bytes(c1))
############################################################### ############# FIND THE LAND LORDS ############### ############################################################### #Residential props ['100','113','150','160','210','220','230','240','330'] #df_tcad['res'] = (df_tcad.res | df_tcad.land_use.is...
# # @lc app=leetcode id=1143 lang=python3 # # [1143] Longest Common Subsequence # # https://leetcode.com/problems/longest-common-subsequence/description/ # # algorithms # Medium (58.79%) # Likes: 4759 # Dislikes: 56 # Total Accepted: 295.2K # Total Submissions: 502K # Testcase Example: '"abcde"\n"ace"' # # Given...
class Solution: def closestDivisors(self, num: int) -> List[int]: def largest(n): res = [1, n] for i in range(2, int(n**0.5)+1): if n % i == 0: res = [i, n//i] return res r1, r2 = largest(num+1) r3, r4 = largest(num+2) ...
def new(name): print("Hi, " + name) player = { "name": "Cris", "age": 40 }
LAST_SEEN = { "Last 1 Hour": 1, "Last 2 Hours": 2, "Last 6 Hours": 6, "Last 12 Hours": 12, "Last 24 Hours": 24, "Last 48 Hours": 48, "Last 72 Hours": 72, "Last 7 Days": 7, "Last 14 Days": 14, "Last 21 Days": 21, "Last 30 Days": 30, "Last 60 Days": 60, "Last 90 Days": ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Problem 050 Set .add() Source : https://www.hackerrank.com/challenges/py-set-add/problem """ countries = set() [countries.add(input()) for country in range(int(input()))] print(len(countries))
""" geoname create by judy 2019/08/23 """ class Geoname(object): def __init__(self, geonameid, name): if geonameid is None: raise Exception('Region geonameid cant be None.') if name is None: raise Exception('Region name cant be None.') self.geonameid = geonameid ...
# # PySNMP MIB module TERADICI-PCOIPv2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TERADICI-PCOIPv2-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:15:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
# Easter Sunday is the first Sun day after the first full moon of spring. To compute # the date, you can use this algorithm, invented by the mathe matician Carl Friedrich # Gauss in 1800: # 1.  Let y be the year (such as 1800 or 2001). # 2.  Divide y by 19 and call the remainder a . Ignore the quotient. # 3.  Divid...
__version__ = "0.1.0" __name__ = "python-gmail-export" __description__ = "Python Gmail Export" __url__ = "https://github.com/rjmoggach/python-gmail-export" __author__ = "RJ Moggach" __authoremail__ = "rjmoggach@gmail.com" __license__ = "The MIT License (MIT)" __copyright__ = "Copyright 2021 RJ Moggach"
""" CSE 103 Tutorial_7 Yubo Cai 31/03/2022 """ # ###################################################################################################################################### # Exercise 1 - Preconditions and postconditions 前置条件和后置条件 """ 1. x <= 0 2. x = 3 3. x = i 4. x = 3 - y 5. x = 1 ∧ y = 47 6. y >...
def laceStringsRecur(S1, S2): """ s1 and s2 are strings. Returns a new str with elements of s1 and s2 interlaced, beginning with s1. If strings are not of same length, then the extra elements should appear at the end. """ def helpLaceStrings(s1, s2, out): print('s1: ', s1, 's2: ', s...
# todas as variaveis vao virar comida pois passa pela global def comida(): global ovos ovos = 'comida' bacon() def bacon(): ovos = 'bacon' pimenta() def pimenta(): print(ovos) # Programa Principal ovos = 12 comida() print(ovos)
boletim=[] while True: nome=input('Nome:') nota1=float(input('Nota 1: ')) nota2=float(input('Nota 2: ')) media=(nota1 + nota2)/2 boletim.append([nome,[nota1, nota2],media]) c=input('Continuar[S/N]:').upper().strip()[0] if c== 'N': break print('-='*14) print(f'{"NO.A...
# Numbers # Define two integers x = 12 y = 8 # Define two variables that will hold the result of these equations sum = x+y difference = x-y print(f"{x} plus {y} is {sum}.") print(f"{x} minus {y} is {difference}.") # There are other operators, such as "*" for multiplication, # "/" for division, and "%" for modulus....
""" https://www.practicepython.org Exercise 33: Birthday Dictionaries 1 chili This exercise is Part 1 of 4 of the birthday data exercise series. The other exercises are: Part 2, Part 3, and Part 4. For this exercise, we will keep track of when our friend’s birthdays are, and be able to find that information based on...
# Ejercicio 2.4. nro_one = int(input("Ingrese primer nro: ")) nro_two = int(input("Ingrese segundo nro: ")) for i in range(nro_one, nro_two + 1): if i % 2 == 0: print(i)
n = int(input()) sequencia = [0] if n > 1: sequencia.append(1) for i in range(2, n): sequencia.append(sequencia[-1] + sequencia[-2]) print(' '.join(str(x) for x in sequencia))
""" Description: instantiate object """ class EntityState: """ Physical/external base state of all entities. """ def __init__(self): # physical position self.p_pos = None # physical velocity self.p_vel = None class Entity: """ Properties and state of physical wo...
i = 0 def foo(): i = i + 1 # UnboundLocalError: local variable 'i' referenced before assignment print(i) foo() # i does not reference to global variable
#!/usr/bin/env python3 # ~*~ coding: utf-8 ~*~ onetoten = range(1, 11) for count in onetoten: print(count) ## Shorter version: #for count in range(1, 11): # print(count)
class Solution(object): def TwoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ for i in range(len(nums)): for j in range(len(nums)): if i != j: if nums[i] + nums[j] == target: ...
# Exercício 5.12 - Altere o programa anterior de forma a perguntar também o valor # depositado mensalmente. Esse valor será depositado no início de cada mês, e você # deve considerá-lo para o cálculo de juros do mês seguinte. valor_inicial = float(input('\nInforme o valor do depósito inicial: R$')) deposito_mensal = f...
class Solution: # @param A : integer # @return a strings def convertToTitle(self, A): alphalist = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] outputstring = '' base = 26 ...
#https://galaiko.rocks/posts/2018-07-08/ def f(num): return 1 if int(num) <= 26 else 0 def count_possibilites(enc): length = len(enc) if length == 1: return 1 elif length == 2: return f(enc) + 1 else: return f(enc[:1]) * count_possibilites(enc[1:]) + f(enc[:2]) * count_possi...
#https://www.codewars.com/kata/convert-boolean-values-to-strings-yes-or-no def bool_to_word(boolean): return "Yes" if boolean == True else "No"
""" This problem was recently asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one pass? """ # BRUT FORCE SOLUTION # # arr = [10, 15, 3, 7] # for i ...
###################################################################### # # Copyright (C) 2013 # Associated Universities, Inc. Washington DC, USA, # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Fo...
#!/usr/bin/env python3 def handler(event, context): print("Hello World!") print("=====Event=====") print("{}".format(event)) print("=====Context=====") print("{}".format(context))
# Mackie CU pages Pan = 0 Stereo = 1 Sends = 2 Effects = 3 Equalizer = 4 Free = 5
WIDTH = 800 HEIGHT = 800 BLACK = (60, 60, 60) WHITE = (255, 255, 255) HIGHLIGHT = (200, 0, 0) WINDOW_NAME = 'PyChess' ROWS = 8 COLUMNS = 8 SQUARE_SIZE = int(WIDTH/ROWS)
# BS mark.1-55 # /* coding: utf-8 */ # Author: WithcerGeralt # Ported from BlackSmith m.2 # (c) simpleApps, 2011 def decodeHTML(data): data = stripTags(data) data = uHTML(data) return data.strip() def gismeteo(mType, source, body): if body: ls = body.split() Numb = ls.pop(0) if ls and Numb.isdigit(): C...
n=int(input()) s=input() a=s.split() sett=set(a) lis=list(sett) x=[int(i) for i in lis] x.remove(max(x)) print(max(x))
""" The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 6689...
# -- Project information ----------------------------------------------------- project = "Sphinx Book Theme" copyright = "2020, Executable Book Project" author = "Executable Book Project" master_doc = "index" extensions = ["myst_parser"] html_theme = "sphinx_book_theme" html_theme_options = { "home_page_in_toc"...
# # For your reference: # # SinglyLinkedListNode: # int data # SinglyLinkedListNode next # def findMergeNode(head1, head2): """ Go forward the lists every time till the end, and then jumps to the beginning of the opposite list, and so on. Advance each of the pointers by 1 every time, until t...
# # PySNMP MIB module FNET-OPTIVIEW-WAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FNET-OPTIVIEW-WAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:00:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
n = int (input('Cuantos numeros de fibonacii?')) i = 0 a, b = 0, 1 while i < n : print(a) a, b = b, a+b i = i + 1
#!/usr/bin/env python3 ############################################################################################ # # # Program purpose: Prints letter 'U' to the console. # # Program ...
__all__ = ('') """ Parent class to keep all statistical queries uniform """ class StatisticalTechnique(): def __init__(self, freqmap, latest_freqmap): self.freqmap = freqmap self.latest_freqmap = latest_freqmap self.scores = dict() def get_name(self): pass def process(s...
def inc(x): return x + 1 def catcher(event): print(event.origin_state)
# Created by Egor Kostan. # GitHub: https://github.com/ikostan # LinkedIn: https://www.linkedin.com/in/egor-kostan/ def numericals(s): """ For each symbol in the string if it's the first character occurrence, replace it with a '1', else replace it with the amount of times you've already seen it...
with open("original.txt", 'a') as jabber: for i in range(2, 13): for j in range(1, 13): print(f"{j:>2} times {i} is {i * j}", file=jabber) print("=" * 40, file=jabber)
def all_descendants(class_object, _memo=None): if _memo is None: _memo = {} elif class_object in _memo: return yield class_object for subclass in class_object.__subclasses__(): for descendant in all_descendants(subclass, _memo): yield descendant
# -*- coding: utf-8 -*- """ Optimus project for basic. Contains basic template, assets and settings without i18n enabled. """
s = float(input('Informe o salário: ')) a = float(input('Informe o aumento em %: ')) t = s + (s * a) / 100 print(f'Novo salário: R$ {t}')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 2 18:04:28 2020 @author: boscolau """ class Buyer: # Default constructor def __init__(self, first_name: str, last_name: str, email: str): """ Initialize with specific values. Parameters ---------- ...
# -*- coding: utf-8 -*- """ ___ _ ___ ___ ___ __ _ _ _ | \(_)__ _ _ _ __ _ ___ | \| _ \ __| / _(_) |___ __ _ ___ _ _ ___ _ _ __ _| |_ ___ _ _ | |) | / _` | ' \/ _` / _ \ | |) | / _| | _| | / -_) / _` / -_) ' \/ -_) '_/ _` | _/ _ \ '_| |___//...
""" Implementa as funcoes personalizadas """ # Retira parenteses, tracos e espacos de um numeo de telefone def numpurotelefone(textodigitado): numpuro = textodigitado.replace('+', '') numpuro = numpuro.replace('(', '') numpuro = numpuro.replace(')', '') numpuro = numpuro.replace('-', '') numpuro =...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Budgets Management', 'category': 'Accounting', 'description': """ This module allows accountants to manage analytic and crossovered budgets. ========================================================...
# Write a program to take input marks of two subject and print aggregate. S1=int(input("Enter 1st Marks:")) S2=int(input("Enter 2nd Marks:")) Total = S1 + S2; Avg = Total/2; print("Total marks = ", Total) print("Average marks = ", Avg)
""" Ticket numbers usually consist of an even number of digits. A ticket number is considered lucky if the sum of the first half of the digits is equal to the sum of the second half. Given a ticket number n, determine if it's lucky or not. Example For n = 1230, the output should be isLucky(n) = true; For...
# Take 2 of int, char or string, return the grater of 2 def greater(in_type, two_args): if in_type == "int": for i in range(len(two_args)): two_args[i] = int(two_args[i]) elif in_type == "char": for i in range(two_args): two_args[i] = two_args[i][0] two_args...
class Result: INDEX = 0 COLUMN = 1 DOCUMENT = 2
def class_extensions(): def _additional_used_columns(self, parms): """ :return: Start and stop column if specified. """ result = [] for col in ["start_column", "stop_column"]: if col in parms and parms[col] is not None: result.append(parms[col]) ...
def compute_acc(results): labels = [pair[1] for pair in results] predicts = [pair[2] for pair in results] assert len(labels) == len(predicts) acc = 0 for label, predict in zip(labels, predicts): if label == predict: acc += 1 return acc / len(labels)
users = { 'juho': { 'name': 'Juho', 'username': 'juho', 'hashed_password': 'ei-selkokielinen-salasana', 'role': 'opettaja' }, 'olli': { 'name': 'Olli Opiskelija', 'username': 'olli', 'hashed_password': 'ei-selkokielinen-salasana', 'role': 'stud...
configs = { "python" : { "filesuffix" : ".py", "commentstart" : "'''", "commentend" : "'''", "indent" : " ", "blockstart" : "", "blockend" : "", "fu...
# Conjuntos são valores que nunca se repetem. conjunto = {1, 2, 3, 4, 5} conjunto2 = {5, 6 ,7, 8} conjunto_uinao = conjunto.union(conjunto2) #une um conjunto ao outro print('União: {}' .format(conjunto_uinao)) conjunto_interseccao = conjunto.intersection(conjunto2) #faz a intersecção do conjunto. print('Intersecção: {...
# Remove Linear, annual, and semiannual trends # Note: The keyword annual also removes semiannual trends # To only remove semiannual but not annual trends, # replace 'annual' with 'semiannual' ap_tf_type = AutoList(['linear','annual']) # Create Trend Filter to remove linear, annual, and semi-annual trend fl_tf = skdis...
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """ Functions to manipulate packed binary representations of number sets. To save space, coverage stores sets of line numbers in SQLite using a packed binary repre...
class Solution: def minCostClimbingStairs(self, cost: List[int]) -> int: n = len(cost) f = [None] * (n + 1) f[0] = 0 f[1] = 0 for i in range(2, n + 1): f[i] = min(f[i - 1] + cost[i - 1], f[i - 2] + cost[i - 2]) return f[n] ...
def selectZb (Zb,fit,xb,t,p,nparticulas): # Seleciona a melhor forma encontrada pela partícula até o memento # # [Zb,xb,t] = selectZb (Zb,fit,xb,t,p,np) # # Zb: melhor forma da partícula # xb: melhor posição da partícula encontrada até o momento # t: parâmetro para atualização d...