I'm writing my first script in python, it's a currency converter. there's only one last think I need but I can't get it to work.
here's the script
print " Conversor de moeda"
print " by DB \n"
def voltar():
opcao=raw_input("--------------------------------------------------------------------------\nPara converter outro valor Inserir 1 \nPara voltar ao menu Inserir 2")
if opcao == "1":
pass
elif opcao == "2":
pass
else:
voltar()
def conversor():
tipo_conv=raw_input("Inserir o número correspondente ao tipo de conversão desejado e carregar no enter: \n1 - Euros -> Dólares \n2 - Dólares -> Euros \n3 - Euros -> Libras \n4 - Libras -> Euros \n")
if tipo_conv == "1":
qtd=input("Inserir quantidade de Euros a converter:")
qtd2=qtd * 1.09212
print qtd, "Euros =" , qtd2, "Dólares"
voltar()
elif tipo_conv == "2":
qtd=input("Inserir quantidade de Dólares a converter:")
qtd2=qtd * 0.915650
print qtd, "Dólares =" , qtd2, "Euros"
voltar()
elif tipo_conv == "3":
qtd=input("Inserir quantidade de Euros a converter:")
qtd2=qtd * 0.751910
print qtd, "Euros =" , qtd2, "Libras"
voltar()
elif tipo_conv == "4":
qtd=input("Inserir quantidade de Libras a converter:")
qtd2=qtd * 1.32995
print qtd, "Libras =" , qtd2, "Euros"
voltar()
else:
print "Erro. Escolher uma das quatro opções disponíveis"
conversor()
def voltar():
opcao=raw_input("--------------------------------------------------------------------------\nPara converter outro valor - Inserir 1 \nPara voltar ao menu - Inserir 2 \n--------------------------------------------------------------------------\n")
if opcao == "1":
pass
elif opcao == "2":
conversor()
else:
voltar()
conversor()
it first asks the user to choose from the menu what kind of conversion they want. then it asks the amount they want to convert. after that it asks if they want to convert another amount or go back to the menu. I made the go back to the menu part work but can't write the part to go back to converting another amount of the previously converted coin. Any ideas?