I made a function that is being called recursively, and the condition for it to keep being called is a user input.
The recursion is working but the final value of the variable is being returned as None. I am a beginner at Python and i am trying to learn Functions and Recursion before going to Classes, OOP, Wrappers, etc.
Here is my code:
Main Py:
import funcoes_moeda
def switch(valor):
    case = int(input('Escolha uma opcao... (0 para encerrar) : '))
    if case == 1:
        valor = funcoes_moeda.aumentar(valor)
        print('Valor aumentado: {}'.format(valor))
        switch(valor)
    elif case == 2:
        pass
    elif case == 3:
        pass
    elif case == 4:
        pass
    else:
        return valor
valor = float(input('Insira o valor: '))
print("Escolha a funcao a ser aplicada no valor inserido: \n" \
    "1 - Aumentar Valor \n" \
    "2 - Diminuir Valor \n" \
    "3 - Dobrar Valor \n" \
    "4 - Dividir Valor \n" \
    "0 - Encerrar o Prorama"
    )
valor = switch(valor)
print('Funcao foi aplicada. O valor final ficou: {}'.format(valor))
Imported Functions:
def aumentar(valor):
    quantia_aumentada = float(input('Insira a quantidade que voce deseja acrescentar: '))
    valor += quantia_aumentada
    return valor
def diminuir():
    pass
def dobro():
    pass
def metade():
    pass
When i tried executing this, what i got was:
Insira o valor: 100.00
Escolha a funcao a ser aplicada no valor inserido:
1 - Aumentar Valor
2 - Diminuir Valor
3 - Dobrar Valor
4 - Dividir Valor
0 - Encerrar o Prorama
Escolha uma opcao... (0 para encerrar) : 1
Insira a quantidade que voce deseja acrescentar: 100.00
Valor aumentado: 200.0
Escolha uma opcao... (0 para encerrar) : 1
Insira a quantidade que voce deseja acrescentar: 100.00
Valor aumentado: 300.0
Escolha uma opcao... (0 para encerrar) : 0
Funcao foi aplicada. O valor final ficou: None
For a test case, you can use:
Chose 100.00, option 1 (2 times is enough), increment 100.00 each call. Expected output: Current value = 300.00 (Because 100 + 100 + 100)
But i got None at the last print...
Please. What am i doing wrong??? :( Thank you for all the help.
PS: I tried going through the following answers, but i was not able to solve this problem because the explanation was for the problems in the question, and i found it was a litle different than mine..
1 > Recursive function returning none - Dint understand.
2 > python recursive function returning none instead of string - This is treating a CSV file.
 
     
     
    