GuiOlaio Posted October 31, 2021 at 03:03 PM Report Share #624381 Posted October 31, 2021 at 03:03 PM (edited) Estou a fazer um programa simples, com tabelas, em python. Eu queria que os dados inseridos aparecessem organizados numa tabela, mas quando dou run, os dados aparecem me em 12 tabelas diferentes. Código: from tabulate import tabulate years=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] C1=int(input("Indique o capital inicial:")) r=int(input("Indique a taxa de juro:")) for n in years: s=r*0.01 Cf=C1*(1+s)**n table=[['Tempo (em anos)', 'Capital Final (em €)'],[n , Cf]] print(tabulate(table, tablefmt="fancy_grid", headers="firstrow")) Edited October 31, 2021 at 03:05 PM by GuiOlaio Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now