content
stringlengths
7
1.05M
data_size_plus_header = 1000001 train_dir = 'train' subset_train_dir = 'sub_train.txt' fullfile = open(train_dir, 'r') subfile = open(subset_train_dir,'w') for i in range(data_size_plus_header): subfile.write(fullfile.readline()) fullfile.close() subfile.close()
long_number = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627661428280644448664523874930358...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- """ Loki module for Exchange Input: inputSTR str, utterance str, args str[], resultDICT dict Output: resultDICT dict """ DEBUG_Exchange = True userDefinedDICT = {"歐元":"EUR", ...
class Game: def __init__(self,span=[0,100],sub_fun="Square"): self.span=span self.func_dict = { "Square":lambda x: pow(x,2), "Odd":lambda x: 1 + (x-1)*2, "Even":lambda x: x*2, "Identity":lambda x: x, "Logarithm":lambda x: pow(10,x-1) ...
# -*- coding: utf-8 -*- # @Time : 2021/01/05 22:53:23 # @Author : ddvv # @Site : https://ddvvmmzz.github.io # @File : about.py # @Software: Visual Studio Code __all__ = [ "__author__", "__copyright__", "__email__", "__license__", "__summary__", "__title__", "__uri__", "__ver...
#!/usr/bin/env python # -*- coding: utf-8 -*- def main(): A,B,M = map(int,input().split()) A_prise = list(map(int,input().split())) B_prise = list(map(int,input().split())) Most_low_prise = min(A_prise)+min(B_prise) for i in range(M): x,y,c = map(int,input().split()) Post_coupon_ori...
#!/usr/bin/env python3 # 2018-10-13 (cc) <paul4hough@gmail.com> ''' pips: - testinfra - molecule - tox ''' class test_role_ans_dev (object): ''' test_role_ans_dev useless class ''' assert packages.installed( yaml.array( pkgs[common], pkgs[os][common], ...
"""1122. Relative Sort Array""" class Solution(object): def relativeSortArray(self, arr1, arr2): """ :type arr1: List[int] :type arr2: List[int] :rtype: List[int] """ #### pos = {num:i for i, num in enumerate(arr2)} return sorted(arr1, key=lambda x: p...
"""About this package.""" __all__ = [ "__title__", "__summary__", "__uri__", "__version__", "__author__", "__email__", "__license__", "__copyright__", ] __title__ = "argo-events" __summary__ = "Community Maintained Python client for Argo Events" __uri__ = "https://github.com/argoproj-l...
# Escreva um programa que pergunte a quantidade de Km # percorridos por um carro alugado e a quantidade de dias pelos # quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro # custa R$60 por dia e R$0.15 por Km rodado. km = float(input("Quantos km percorreu?: ")) dia = int(input("Quantos dias ele foi alu...
# # @lc app=leetcode id=657 lang=python3 # # [657] Robot Return to Origin # # https://leetcode.com/problems/robot-return-to-origin/description/ # # algorithms # Easy (73.67%) # Likes: 1228 # Dislikes: 692 # Total Accepted: 274.1K # Total Submissions: 371K # Testcase Example: '"UD"' # # There is a robot starting ...
# get_incrementer.py """Helper function to create counter strings with a set length throughout.""" __version__ = '0.2' __author__ = 'Rob Dupre (KU)' def get_incrementer(num, num_digits): if num >= 10**num_digits: print('NUMBER IS LARGER THAN THE MAX POSSIBLE BASED ON num_digits') return -1 els...
def main(): n = int(input("Digite um número inteiro: ")) resto = n % 2 if resto == 0: print("Par") else: print("Impar") main()
def test_open_home_page(driver, request): url = 'opencart/' return driver.get("".join([request.config.getoption("--address"), url])) element = driver.find_elements_by_xpath("//base[contains(@href, 'http://192.168.56.103/opencart/]") assert element == 'http://192.168.56.103/opencart/' assert driver.f...
"""Tests for compiler options processing functions.""" load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") load("//test:utils.bzl", "stringify_dict") # buildifier: disable=bzl-visibility load("//xcodeproj/internal:opts.bzl", "testable") process_compiler_opts = testable.process_compiler_opts def _process_...
TOMASULO_DEFAULT_PARAMETERS = { "num_register": 32, "num_rob": 128, "num_cdb": 1, "cdb_buffer_size": 0, "nop_latency": 1, "nop_unit_pipelined": 1, "integer_adder_latency": 1, "integer_adder_rs": 5, "integer_adder_pipelined": 0, "float_adder_latency": 3, "float_adder_rs": 3...
# 设置类 class Settings(): '''保存设置信息''' def __init__(self): '''初始化游戏的静态设置''' self.screen_width = 850 self.screen_heght = 600 self.bg_color = (230, 230, 230) # 玩家飞船数量设置 self.ship_limit = 3 # 子弹设置 self.bullet_width = 3 self.bullet_...
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ ret = NodeLis...
# answer = 5 # print("please guess number between 1 and 10: ") # guess = int(input()) # # if guess < answer: # print("Please guess higher") # elif guess > answer: # print ( "Please guess lower") # else: # print("You got it first time") answer = 5 print ("Please guess number between 1 and 10: ") guess = in...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class VserverNetworkInterface(object): """Implementation of the 'Vserver Network Interface.' model. Specifies information about a logical network interface on a NetApp Vserver. The interface's IP address is the mount point for a specific data pr...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def isPalindrome(self, head): """ :type head: ListNode :rtype: bool """ if not head or not head.next: ...
print("linear search") si=int(input("\nEnter the size:")) data=list() for i in range(0,si): n=int(input()) data.append(n) cot=0 print("\nEnter the number you want to search:") val=int(input()) for i in range(0,len(data)): if(data[i]==val): break; else: cot=co...
#!/usr/bin/python3 """ This script is just to clean up Base64 if is has � present in the output. Example: $�G�r�o�U�P�P�O�L�i�C�Y�S�E�t�t�I�N�G�s� �=� �[�r�E�F�]�.�A�S�s�e�M�B�L�Y�.�G�E�t�T�y�p�E� $GroUPPOLiCYSEttINGs = [rEF].ASseMBLY.GEtTypE """ with open("./target.txt", "r") as f_obj: data = f_obj.read() ...
#Pio_prefs prefsdict = { ###modify or add preferences below #below are the database preferences. "sqluser" : "user", "sqldb" : "database", "sqlhost" : "127.0.0.1", #authorization must come from same address - extra security #valid values yes/no "staticip" : "no", #below is to do logging of qrystmts....
# Time: O(n) # Space: O(h) # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None # iterative stack solution class Solution(object): def maxAncestorDiff(self, root): """ :type root: TreeNode ...
""" Declarations for the .NET SDK Downloads URLs and version These are the URLs to download the .NET SDKs for each of the supported operating systems. These URLs are accessible from: https://dotnet.microsoft.com/download/dotnet-core. """ DOTNET_SDK_VERSION = "3.1.100" DOTNET_SDK = { "windows": { "url": "ht...
''' Module for basic averaging of system states across multiple trials. Used in plotting. @author: Joe Schaul <joe.schaul@gmail.com> ''' class TrialState(object): def __init__(self, trial_id, times, systemStates, uniqueStates, stateCounterForStateX): self.trial_id = trial_id self.times...
# 现在单位成本价,现在数量 current_unit_cost = 78.1 current_amount = 1300 # 计算补仓后成本价 def calc_stock_new_cost(add_buy_amount,add_buy_unit_cost): # 补仓买入成本 buy_stock_cost = add_buy_amount*add_buy_unit_cost # 补仓后总投入股票成本 = 现数量 * 现成本单价 + 新数量 * 新成本单价 new_stock_cost = current_amount * current_unit_cost + buy_stock_cost ...
trees = [] with open("input.txt", "r") as f: for line in f.readlines(): trees.append(line[:-1]) # curr pos x, y = 0, 0 count = 0 while True: x += 3 y += 1 if y >= len(trees): break if trees[y][x % len(trees[y])] == '#': count += 1 print(count)
#35011 #a3_p10.py #Miruthula Ramesh #mramesh@jacobs-university.de n = int(input("Enter the width")) w = int(input("Enter the length")) c = input("Enter a character") space=" " def print_frame(n, w): for i in range(n): if i == 0 or i == n-1: print(w*c) else: pr...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 18 10:36:17 2019 @author: tuyenta """ s = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896...
a = int(input()) sum = 0 while True: if ( a == 0): print (int(sum)) break if ( a <= 2): print (-1) break if (a%5 != 0): a = a - 3 sum = sum + 1 else: sum = sum + int(a/5) a = 0
"""IntegerHeap.py Priority queues of integer keys based on van Emde Boas trees. Only the keys are stored; caller is responsible for keeping track of any data associated with the keys in a separate dictionary. We use a version of vEB trees in which all accesses to subtrees are performed indirectly through a hash table...
def add_num(x, y): return x + y def sub_num(x, y): return x - y class MathFunctions(object): pass
if __name__ == '__main__': N = int(input()) main_list=[] for iterate in range(N): entered_string=input().split() if entered_string[0] == 'insert': main_list.insert(int(entered_string[1]),int(entered_string[2])) elif entered_string[0] == 'print': print(main_lis...
with open('input.txt', 'r') as file: input = file.readlines() input = [ step.split() for step in input ] input = [ {step[0]: int(step[1])} for step in input ] def part1(): x = 0 y = 0 for step in input: x += step.get('forward', 0) y += step.get('down', 0) y -= step.get('up', 0)...
def f(x): if x: x = 1 else: x = 'zero' y = x return y f(1)
class Pattern_Twenty_Six: '''Pattern twenty_six *** * * * * *** * * * * *** ''' def __init__(self, strings='*'): if not isinstance(strings, str): strings = str(strings) for i in range(7): if i i...
# -*- coding: utf-8 -*- """ Created on Tue Jul 21 16:41:09 2020 @author: rafae Exercício Você deve criar uma classe carro que vai possuir dois atributos compostos por outras duas classes: 1) motor; 2) Direção. O motor terá a responsabilidade de controlar a velocidade. Ele oferece os seguintes atributos: 1) Atribu...
def debug_transformer(func): def wrapper(): print(f'Function `{func.__name__}` called') func() print(f'Function `{func.__name__}` finished') return wrapper @debug_transformer def walkout(): print('Bye Felicia') walkout()
def preprocess(text): text=text.replace('\n', '\n\r') return text def getLetter(): return open("./input/letter.txt", "r").read()
print('Gerador de PA\n','==-'*10) primeiro = int(input('Primeiro termo:')) razao = int(input('Razao da PA:')) termo = primeiro c = 1 total = 0 mais = 10 while mais != 0: total = total + mais while c <= total: print(f'{termo} ->', end='') c += 1 termo += razao print('PAUSA') mais ...
MainWindow.clearData() MainWindow.openPreWindow() box = CAD.Box() box.setName('Box_1') box.setLocation(0,0,0) box.setPara(10,10,10) box.create() cylinder = CAD.Cylinder() cylinder.setName('Cylinder_2') cylinder.setLocation(0,0,0) cylinder.setRadius(5) cylinder.setLength(10) cylinder.setAxis(0,0,1) cylinder...
class Parrot(): def __init__(self, squawk, is_alive=True): self.squawk = squawk self.is_alive = is_alive african_grey = Parrot('Polly want a Cracker?') norwegian_blue = Parrot('', is_alive=False) def squawk(self): if self.is_alive: return self.squawk else: ...
def solution(S, K): # write your code in Python 3.6 day_dict = {0:'Mon', 1:'Tue', 2:'Wed', 3:'Thu', 4:'Fri', 5:'Sat', 6:'Sun'} return day_dict[list(day_dict.values()).index(S)+K] S='Wed' K=2 print(solution(S,K))
n = int(input('Me diga um número qualquer: ')) re = n % 2 if re == 0: print('O número {} é PAR!'.format(n)) else: print('O número {} é ÍMPAR!'.format(n))
produtos = {1: 4.0, 2: 4.5, 3: 5.0, 4: 2.0, 5: 1.5} produto, quantidade = [int(num) for num in input().split()] total = produtos[produto] * quantidade print('Total: R$ {:.2f}'.format(total))
# Code Listing #3 """ Prime number iterator class """ class Prime(object): """ A prime number iterator for first 'n' primes """ def __init__(self, n): self.n = n self.count = 0 self.value = 0 def __iter__(self): return self def __next__(self): """ Return ne...
""" 2.6 – Citação famosa 2: Repita o Exercício 2.5, porém, desta vez, armazene o nome da pessoa famosa em uma variável chamada famous_person. Em seguida, componha sua mensagem e armazene-a em uma nova variável chamada message. Exiba sua mensagem. """ famous_person = "René Descartes" message = "As paixões são todas boa...
def merge_dicts(*dicts): """ Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. """ result = {} for d in dicts: result.update(d) return result def evaluate_term(term, **kwargs): return term.evaluate(**kwargs)...
arr=[int(x) for x in input().split()] sum=0 for i in range(1,(arr[2]+1)): sum+=arr[0]*i if sum<=arr[1]: print(0) else: print(sum-arr[1])
# Binary search of an item in a (sorted) list def binary_search(alist, item): first = 0 last = len(alist) - 1 found = False while first <= last and not found: middle = (first + last) // 2 if alist[middle] == item: found = True else: if item < alist[midd...
""" Experiments with infix operator dispatch >>> kadd = KnowsAdd() >>> kadd + 1 (<KnowsAdd object>, 1) >>> kadd * 1 """ class KnowsAdd: def __add__(self, other): return self, other def __repr__(self): return '<{} object>'.format(type(self).__name__)
def resolve(): ''' code here ''' N = int(input()) A_list = [int(item) for item in input().split()] hp = sum(A_list) #leaf is_slove = True res = 1 # root prev = 1 prev_add_num = 0 delete_cnt = 0 if hp > 2**N: is_slove = False elif A_list[0] == 1: i...
class Solution: def reverseWords(self, s: str) -> str: s = s.split(" ") s = [i for i in s if i != ""] return " ".join(s[::-1])
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # if root.left and root.right: # if v <= root.left.val or v >= root.right.val: return False # elif ...
class hparams: sample_rate = 16000 n_fft = 1024 #fft_bins = n_fft // 2 + 1 num_mels = 80 hop_length = 256 win_length = 1024 fmin = 90 fmax = 7600 min_level_db = -100 ref_level_db = 20 seq_len_factor = 64 bits = 12 seq_len = seq_len_factor * hop_length d...
# Material buttonType = ['Arrow button', 'Radio button', 'Switch button', 'Option'] requestLUT = [ { 'name' : 'Radio', 'on' : 'OSD_ImgFolder/radio_on.png', 'off' : 'OSD_ImgFolder/radio_off.png', 'default' : 'off', 'hint_path' : 'OSD_ImgFolder/L4 off.png', 'hint': 0 }, { 'nam...
"""8. String to Integer (atoi) Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be specified vaguely (ie, no given input sp...
database = "database" user = "postgres" password = "password" host = "localhost" port = "5432"
def mul(a, b): return a * b mul(3, 4) #12 def mul5(a): return mul(5,a) mul5(2) #10 def mul(a): def helper(b): return a * b return helper mul(5)(2) #10 def fun1(a): x = a * 3 def fun2(b): nonlocal x return b + x return fun2 test_fun = fun1(4) test_fun(7) #19
# Oblicza delte a = int(input("Podaj [a]:")) b = int(input("Podaj [b]:")) c = int(input("Podaj [c]:")) d = b**2-4*a*c if d > 0: print("2 rozwiązania") elif d == 0: print("1 rozwiązanie") else: print("0 rozwiązań") for i in range(): if i != 0: print(i, end=" ")
seagate_sense_codes = {0: {0: {0: {0: 'No error.', 'L1': 'No Sense', 'L2': 'No Sense'}, 31: {0: 'No Specific FRU code.', 'L1': 'No Sense', 'L2': 'Logical unit transitioning to another power condition'}}, ...
""" try: from .NotReceived import NotReceived from .errors import * from .classreader import * from .checkpoint import Checkpoint except Exception as e: from NotReceived import NotReceived from errors import * from classreader import * from checkpoint import Checkpoint """ """ import sys print(sys.path)"""
frase = str(input('Digite a frase: ')).strip().upper() palavras = frase.split() juntarPalavras = ''.join(palavras) trocar = juntarPalavras[::-1] print(trocar)
def log_normal_pdf(sample, mean, logvar, raxis=1): log2pi = tf.math.log(2. * np.pi) return tf.reduce_sum( -.5 * ((sample - mean) ** 2. * tf.exp(-logvar) + logvar + log2pi), axis=raxis) def compute_loss(model, x): mean, logvar = model.encode(x) z = model.reparameterize(mean, logvar) x_logit = mod...
my_name = "Jan" my_age = 23 print(f"Age: { my_age }, Name: { my_name }")
__all__ = ("ComparsionMixin", "LazyLoadMixin") class ComparsionMixin(object): """ Mixin to help compare two instances """ def __eq__(self, other): """ Compare two items """ if not issubclass(type(other), self.__class__): return False if (self.bod...
# Yunfan Ye 10423172 def Fibonacci(n): if n == 1: return 1 elif n == 2: return 1 else: return Fibonacci(n - 1) + Fibonacci(n - 2) # arr = [1,2,3,4,5,6,7,8,9,10] # for i in arr: # print(Fibonacci(i))
class UrlPath: @staticmethod def combine(*args): result = '' for path in args: result += path if path.endswith('/') else '{}/'.format(path) #result = result[:-1] return result
class Error(): def __init__(self): print("An error has occured !") class TypeError(Error): def __init__(self): print("This is Type Error\nThere is a type mismatch.. ! Please fix it.")
class Node(object): def __init__(self, value, next=None, prev=None): self.value = value self.next = next self.prev = prev class LinkedList(object): def __init__(self): self.head = None self.tail = None self.length = 0 def push(self, value): new_node...
# # Escrevendo arquivos com funções do Python # def escreveArquivo(): arquivo = open('NovoArquivo.txt', 'w+') arquivo.write('Linha gerada com a função Escrevendo Arquivo \r\n') arquivo.close() #escreveArquivo()] def alteraArquivo(): arquivo = open('NovoArquivo.txt', 'a+') # a de append que dizer e...
def params_create_rels_unwind_from_objects(relationships, property_identifier=None): """ Format Relationship properties into a one level dictionary matching the query generated in `query_create_rels_from_list`. This is necessary because you cannot access nested dictionairies in the UNWIND query. UN...
# Check if the value is in the list? words = ['apple', 'banana', 'peach', '42'] if 'apple' in words: print('found apple') if 'a' in words: print('found a') else: print('NOT found a') if 42 in words: print('found 42') else: print('NOT found 42') # found apple # NOT found a # NOT found 42
__author__ = 'renderle' class OpenWeatherParser: def __init__(self, data): self.data = data def getValueFor(self, idx): return self.data['list'][idx] def getTemperature(self): earlymorningValue = self.getValueFor(0)['main']['temp_max'] morningValue = self.getValueFor(1)['...
X = [] Y = [] cont = 0 n = True while n: a,b = input().split(" ") a = int(a) b = int(b) if a == b: n = False cont-=1 else: X.append(a) Y.append(b) cont+=1 i = 0 while i < cont: if X[i] > Y[i]: print('Decrescente') elif X[i] < ...
def test_example(): num1 = 1 num2 = 3 if num2 > num1: print("Working")
class Node: def __init__(self,v): self.next=None self.prev=None self.value=v class Deque: def __init__(self): self.front=None self.tail=None def addFront(self, item): node=Node(item) if self.front is None: #case of none items se...
# ============================================================================= # MISC HELPER FUNCTIONS # ============================================================================= def push_backslash(stuff): """ push a backslash before a word, dumbest function ever""" stuff_url = "" if stuff i...
class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ for i in nums: if i == 0: nums.append(i) nums.remove(i)
class Solution(object): def setZeroes(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ m, n = len(matrix), len(matrix[0]) col_zero = any(matrix[i][0] == 0 for i in range(m)) row_zero = an...
''' A package to manipulate and display some random structures, including meander systems, planar triangulations, and ribbon tilings Created on May 8, 2021 @author: vladislavkargin ''' ''' #I prefer blank __init__.py from . import mndrpy from . import pmaps from . import ribbons '''
#!/usr/bin/python3 '''Day 9 of the 2017 advent of code''' def process_garbage(stream, index): """Traverse stream. Break on '>' as end of garbage, return total as size of garbage and the new index """ total = 0 length = len(stream) while index < length: if stream[index] =...
name = input('Please enter your name:\n') age = int(input("Please enter your age:\n")) color = input('Enter your favorite color:\n') animal = input('Enter your favorite animal:\n') print('Hello my name is' , name , '.') print('I am' , age , 'years old.') print('My favorite color is' , color ,'.') print('My favorite...
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/vis-02-curtailment.ipynb (unless otherwise specified). __all__ = ['get_wf_ids', 'flatten_list', 'get_curtailed_wfs_df', 'load_curtailed_wfs', 'add_next_week_of_data_to_curtailed_wfs'] # Cell flatten_list = lambda list_: [item for sublist in list_ for item in ...
'''Rafaça o DESAFIO 009, mostrando a tabuada de um número que o usuário escolher, só que agora utilizando um laço for.''' n = int(input('Digite um número para ver sua tabuada: ')) print('-' * 12) for tabu in range(0, 11): print('{} x {:2} = {}'.format(n, tabu, n*tabu)) print('-' * 12)
# Apresentação print('Programa para identificar a que cargos eletivos') print('uma pessoa pode se candidatar com base em sua idade') print() # Entradas idade = int(input('Informe a sua idade: ')) # Processamento e saídas print('Esta pessoa pode se candidatar a estes cargos:') if (idade < 18): print...
""" 0081. Search in Rotated Sorted Array II Medium Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]). You are given a target value to search. If found in the array return true, otherwise return false. Example 1: Input...
"""Top-level package for sta-etl.""" __author__ = """Boris Bauermeister""" __email__ = 'Boris.Bauermeister@gmail' __version__ = '0.1.0' #from sta_etl import *
''' No 2. Buatlah fungsi tanpa pengembalian nilai, yaitu fungsi segitigabintang. Misal, jika dipanggil dg segitigabintang(4), keluarannya : * ** *** **** ''' def segitigabintang(baris): for i in range(baris): print('*' * (i+1))
api_output_for_empty_months = """"Usage Data Extract", "", "AccountOwnerId","Account Name","ServiceAdministratorId","SubscriptionId","SubscriptionGuid","Subscription Name","Date","Month","Day","Year","Product","Meter ID","Meter Category","Meter Sub-Category","Meter Region","Meter Name","Consumed Quantity","Reso...
#!/usr/bin/python3 m1 = int(input("Enter no. of rows : \t")) n1 = int(input("Enter no. of columns : \t")) a = [] print("Enter Matrix 1:\n") for i in range(n1): row = list(map(int, input().split())) a.append(row) print(a) m2 = int(n1) print("\n Your Matrix 2 must have",n1,"rows and",m1,"columns \n") n2 ...
# ============================================================================= # TexGen: Geometric textile modeller. # Copyright (C) 2015 Louise Brown # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Found...
# -*- coding: UTF-8 -*- logger.info("Loading 1 objects to table invoicing_plan...") # fields: id, user, today, journal, max_date, partner, course loader.save(create_invoicing_plan(1,6,date(2015,3,1),1,None,None,None)) loader.flush_deferred_objects()
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
# Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree. # # For example, given the following Node class: class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left ...
# 16. Evalúe la siguiente función matemática: f(a,b,c,d,e) = ((a! + b! + c!) / d!) + e^c / e! # Ejemplo: Si a = 5, b = 1, c= 4 , d = 3, e = 2 → despliega: 32,17 def factorial(numero): fact = 1 for i in range (1, numero+1): fact *= i return (fact) def formula(a, b, c, d, e): termino1 ...
store.set_global_value('hotkey', '<meta>+r') if re.match('.*(Hyper)', window.get_active_class()): logging.debug('terminal refresh buffer') engine.set_return_value('<ctrl>+<shift>+r') else: logging.debug('normal') engine.set_return_value('<ctrl>+r') engine.run_script('combo')
# Defining the left function def left(i): return 2*i+1 # Defining the right function def right(i): return 2*i+2 # Defining the parent node function def parent(i): return (i-1)//2 # Max_Heapify def max_heapify(arr,n,i): l=left(i) r=right(i) largest=i if n>l and arr[largest]<arr[l] : ...