Reputation: 45
Hey I just starting learning python, i'm using the 2.7. To practice what I've learned so far I decided to write a small script for a coin converter. It was going well until I got this problem. I get an indentation error on line 9, in the elif part. Can you help me figure it out?
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":
#do something
elif opcao == "2":
tipo_conv
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()
conversor()
Upvotes: 2
Views: 50
Reputation: 11961
If you want to write an if
statement without any executable code use the pass
keyword. This indicates that you will write some code in the block at a later stage.
if opcao == "1":
pass
elif opcao == "2":
......
Your program should then run.
Upvotes: 2