facing problem while running functions in the python

54 views Asked by At

I am new to programming, I started to learn python, I have downloaded VS code and Pycharm IDE to run python, my normal code is running successfully but when I define any function in the code , it does not show any output(does not show any error either). Please help me how can I resolve this. Thanks a lot

def get_taxes(earnings):
    if earnings < 12000:
        tax_owed = .25 * earnings
    else:
        tax_owed = .30 * earnings
    return tax_owed
    print(get_taxes(10000))
1

There are 1 answers

3
AudioBubble On

Functions must be called after they are defined, or else the code within does nothing. For example:

def print_hi(name):
    print("Hello", name)

would not return anything when run. You have to call it, like so:

print_hi("World")