Mensagens

A mostrar mensagens de março, 2019

Lendo excel com Python

import pandas as pd import xlrd x=pd.read_excel( r"C:\Users\Utilizador\Desktop\excel\Taxa " r"de Câmbio Dolar.xls" ) print (x)

Calcular o preço final de um produto

Imagem
import tkinter class compintapp_tk(tkinter.Tk): def __init__ ( self ,parent): tkinter.Tk. __init__ ( self ,parent) self .parent = parent self .initialize() def initialize( self ): self .grid() ## Title --------------------------------------- titlelbl = tkinter.Label( self , text = "Calcular o " "Preço Final" , anchor = "center" , fg = "white" , bg = "blue" ) titlelbl.grid( column = 0 , row = 0 , columnspan = 3 , sticky = 'EW' ) ## End Title & subtitle labels --------------------------------------- ## Input Labels -------------------------------------------------- cprodutolbl = tkinter.Label( self , text = "Custo do" " Produto :" , ...

Calcular o ROI Com a Correção no Tempo

import math investimento= float ( input ( 'Indique o Investimento Inicial:' )) retorno = float ( input ( 'Indique o Retorno do Investimento:' )) taxaatualização = float ( input ( 'Indique a Taxa de Juros ' '(em %):' )) anos = int ( input ( 'Indique o Tempo de Retorno:' )) taxajuro=taxaatualização/ 100 retornoa= retorno/ pow (( 1 +taxajuro),anos) roi = ((retornoa - investimento)/investimento)* 100 if roi== 0 : print ( 'O Retorno foi igual ao Valor do Investimento' ) elif roi< 0 : print ( 'O Retorno sobre oInvestimento foi de {:.2f}%' '' .format(roi)) print ( 'O Retorno foi inferior ao Valor do Investimento.' 'Foi um mau Investimento.' ) else : print ( 'O Retorno sobre o Investimento foi de {:.2f}%' '' .format(roi))

Calcular o ROI

O termo ROI é uma sigla para a expressão em inglês “Return over Investment”, ou “Retorno sobre Investimento”. Por meio desse indicador, é possível saber quanto dinheiro a empresaestá ganhando     (ou perdendo) em cada investimento realizado. investimento= float ( input ( 'Indique o Investimento Inicial:' )) retorno = float ( input ( 'Indique o Retorno do Investimento:' )) roi = ((retorno - investimento)/investimento)* 100 if roi== 0 : print ( 'O Retorno foi igual ao Valor do Investimento' ) elif roi< 0 : print ( 'O Retorno sobre Investimento foi de {:.2f}%' '' .format(roi)) print ( 'O Retorno foi inferior ao Valor do ' 'Investimento. ' 'Foi um mau Investimento.' ) else : print ( 'O Retorno sobre o Investimento foi de {:.2f}%' '' .format(roi))  

Teoria dos Jogos e Dilema dos Prisioneiros

Imagem
from random import * menu = '| | Confessa | Não Confessa |' menu2 = '|--------------|----------------|---------------|' menu3 = '| Confessa | 10;10 | 0;30 |' menu4 = '| Não Confessa | 0;30 | 5;5 |' menu5 = '-------------------------------------------------' nome = ' Bonnie ' print ( ' \n\n ' ) print (nome.center( 80 , ' ' )) print (menu5.center( 80 , ' ' )) print (menu.center( 80 , ' ' )) print (menu2.center( 80 , ' ' )) print (menu3.center( 80 , ' ' )) print ( ' \t\t Cleyde' ,menu2.center( 40 , ' ' )) print (menu4.center( 80 , ' ' )) print (menu5.center( 80 , ' ' )) Bonnie = int ( input ( 'Para Bonnie CONFESSAR carregue em 1. \n ' 'Para Bonnie NÃO CONFESSAR carrgue 2 \n ' 'Escolha a opção: ' )) Cley...

Simulador de Empréstimo

import math principal = float (( input ( 'Montante do empréstimo: ' ))) annual_rate = float (( input ( 'Taxa de juro anual nominal' '(in %): ' ))) years = int (( input ( 'Anos do empréstimo: ' ))) rate = (annual_rate / 100 )/ 12 rate1 = pow ( 1 +rate,years* 12 ) monthly_payment = (principal*rate1*rate)/(rate1- 1 ) print ( ' \n\n Monthly Payment:' ) print ( '{:.2f} Euros \n\n ' .format(monthly_payment)) time = years* 12 x = 0 balance = principal print ( 'N° de prestações Prestação mensal ' ' Amortização de capital Juros ' ' Capital em dívida ' ) while x <time: juro=balance*rate autualization=monthly_payment-juro balance = balance-autualization x=x+ 1 if x< 10 : print ( ' {} {:.2f} ' ' {:.2f} {:.2f} ' ' ' ' {...

Juros Simples VS Juros Composto usando tkinter

Imagem
import tkinter class compintapp_tk(tkinter.Tk): def __init__ ( self ,parent): tkinter.Tk. __init__ ( self ,parent) self .parent = parent self .initialize() def initialize( self ): self .grid() ## Title --------------------------------------- titlelbl = tkinter.Label( self , text = "Calculadora de" "Taxa de Juro" , anchor = "center" , fg = "white" , bg = "blue" ) titlelbl.grid( column = 0 , row = 0 , columnspan = 3 , sticky = 'EW' ) ## End Title & subtitle labels --------------------------------------- ## Input Labels -------------------------------------------------- principallbl = tkinter.Label( self , text = "Investimento" "Inicial:" , anchor = "w" , fg = "white" , bg = "...

Calcular a Taxa de Juro Simples usando tkinter

import tkinter class compintapp_tk(tkinter.Tk): def __init__ ( self ,parent): tkinter.Tk. __init__ ( self ,parent) self .parent = parent self .initialize() def initialize( self ): self .grid() ## Title --------------------------------------- titlelbl = tkinter.Label( self , text = "Calculadora da" "Taxa de Juro Simples" , anchor = "center" , fg = "white" , bg = "blue" ) titlelbl.grid( column = 0 , row = 0 , columnspan = 3 , sticky = 'EW' ) ## End Title & subtitle labels --------------------------------------- ## Input Labels -------------------------------------------------- principallbl = tkinter.Label( self , text = "Investimento" " Inicial:" , anchor = "w" , fg = "white" , bg =...

Calcular a Taxa de Juro Composto usando tkinter

import tkinter class compintapp_tk(tkinter.Tk): def __init__ ( self ,parent): tkinter.Tk. __init__ ( self ,parent) self .parent = parent self .initialize() def initialize( self ): self .grid() ## Title --------------------------------------- titlelbl = tkinter.Label( self , text = "Calculadora da Taxa" "de Juro Composto" , anchor = "center" , fg = "white" , bg = "blue" ) titlelbl.grid( column = 0 , row = 0 , columnspan = 3 , sticky = 'EW' ) ## End Title & subtitle labels --------------------------------------- ## Input Labels -------------------------------------------------- principallbl = tkinter.Label( self , text = "Investimento" "Inicial:" , anchor = "w" , fg ...

Juros Simples e Juros Composto

import math def simples(): investimento = float (( input ( ' \n\n Investimento Inicial:' ))) tjurospercentagem = float (( input ( 'Taxa de Juros (em %) :' ))) tjuro=tjurospercentagem/ 100 anos = int ( input ( 'Anos:' )) varfuturo= investimento*( 1 +tjuro*anos) jurototal = investimento*tjuro*anos juroano =investimento*tjuro print ( ' \n\n\t\t O valor futuro é de {:.2f}' .format(varfuturo)) print ( ' \n\t\t Os juros totais é de {:.2f}' .format(jurototal)) print ( ' \n\t\t Os juros ao ano é de {:.2f}' .format(juroano)) def composto(): investimento1 = float (( input ( ' \n\n Investimento Inicial:' ))) tjurospercentagem1 = float (( input ( 'Taxa de Juros (em %) :' ))) tjuro1=tjurospercentagem1/ 100 anos1 = int ( input ( 'Anos:' )) varfuturo1= investimento1* pow ( 1 +tjuro1, 3 ) jurototal1 = investimento1*( pow ( 1 +tjuro1, 3 )- 1 ) print ( ' \n\n\t\t O valor fut...

Calculadora do Pagamento Mensal de Empréstimo usando tkinter

from tkinter import * # Import tkinter import math class LoanCalculator: def __init__ ( self ): window = Tk() # Create a window window.title( "Loan Calculator" ) Label(window, text = "Annual Interest Rate" ).grid( row = 1 , column = 1 , sticky = W) Label(window, text = "Number of Years" ).grid( row = 2 , column = 1 , sticky = W) Label(window, text = "Loan Amount" ).grid( row = 3 , column = 1 , sticky = W) Label(window, text = "Monthly Payment" ).grid( row = 4 , column = 1 , sticky = W) Label(window, text = "Total Payment" ).grid( row = 5 , column = 1 , sticky = W) self .annualInterestRateVar = StringVar() Entry(window, textvariable = self .annualInterestRateVar, justify = RIGHT).grid( row = 1 , column = 2 ) self .numberOfYearsVar = StringVar() Entry(window, textvari...

Calculadora do Pagamento Mensal de Empréstimo

import math years = int (( input ( 'Please enter number of' ' years of loan ' ))) annual_rate = float (( input ( 'Please enter the interest' 'rate (in %) ' ))) principal = float (( input ( 'Please enter the' ' amount of loan ' ))) rate = (annual_rate / 100 )/ 12 rate1 = pow ( 1 +rate,years* 12 ) monthly_payment = (principal*rate1*rate)/(rate1- 1 ) print ( ' \n\n Monthly Payment:' ) print ( '{:.2f} Euros' .format(monthly_payment))  

Faça o teste e descubra qual a sua situação financeira!

from logging import exception import os def teste(): resultado = 0 print ( ' \n ---------------------------------------------' '--------------------------- \n\t\t Faça o teste e descubra ' 'qual a sua situação financeira! \n ------------------- '-----------------------------------------------------' ' \n\n ' ) print ( ' \n O que ganha por mês é suficiente para arcar com os' ' seus gastos?' ) print ( ' \t 1 - Consigo pagar minhas contas e ainda guardo mais' ' 10% dos meus ganhos todo mês' ) print ( ' \t 2 - É suficiente, mas não sobra nada' ) print ( ' \t 3 - Gasto todo o meu dinheiro e ainda uso cartão' 'de crédito ou peço emprestado a parentes e amigos' ) resp1 = int ( input ( 'Resposta 1: ' )) try : if resp1 == 1 : resultado = resultado...