将函数的答案赋值给变量?(in python 2.4.4)

Assigning the answer of a function to a variable?(in python 2.4.4)

def BSformula(num1):
    """my formula"""
    (num1 - 2.0) * (2 / num1)

def main():
    number = input("value")
    answer = BSformula(number)
    print(answer)
main()   

当我 运行 它总是打印 "None"

>>>
value: 6
None
>>>

如何将答案分配给变量? 或者我只能在 def BSformula 中打印它吗??

只需使用关键字 return.

def BSformula(num1):
    """my formula"""
    return (num1 - 2.0) * (2 / num1)