This my code simulates banking using functions, but I am not able to return the values of the function, when I hedge the value of the return in a variable it calls the whole function. In the program when I call the 'balance' function, it returns me the 'deposit' function and not the 'amount' value.
Any guidance? How can I do this? Is there a better way?
def deposito(dep):
clear()
montante=0.0
dep=0.0
dep=float(input("Quantia a ser depositada:"))
clear()
if (dep > 0):
print (" |",montante)
print ("+|",dep)
montante=montante+dep
print ("____________")
print (" |",montante,"\n\n")
else:
print("Quantia inválida")
voltar()
return montante
def saldo():
saldo=deposito()
print("O seu saldo é:", saldo())
def main():
op=0
while(op != range(0,4,1)):
clear()
print("Qual tipo de operação deseja realizar?\n")
print ("[1]Saldo")
print ("[2]Depósito")
print ("[3]Saque")
print ("[0]Sair\n")
op=str(input(""))
if(op == "1"):
saldo()
elif(op == "2"):
deposito()
elif(op == "3"):
saque()
elif(op == "0"):
exit
else:
clear()
print("Operação inválida")
time.sleep(1)