Issue
def BSformula(num1):
"""my formula"""
(num1 - 2.0) * (2 / num1)
def main():
number = input("value")
answer = BSformula(number)
print(answer)
main()
When I run it it always prints "None"
>>>
value: 6
None
>>>
How would I assign the answer to a variable? or can I only print it in the def BSformula??
Solution
Just use the keyword return
.
def BSformula(num1):
"""my formula"""
return (num1 - 2.0) * (2 / num1)
Answered By - lilezek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.