Lately, some of my code has led me to a question about using outputs of functions as variables, then to use those same variables as parameters in other functions. All when defining main. I believe this can lead to errors when debugging and confusion when using a file as a module.
An example is below:
def add_two_numbers(x, y):
z = x + y
return z
def now_divide_two(z, s):
t = z / s
return t
First method:
def main():
added = add_two_numbers(5, 10)
final_output = now_divide_two(added, 3)
print(final_output)
Second method:
def main():
final_output = now_divide_two(add_two_numbers(5,10), 3)
print(final_output)
Style guides and good practice suggest the first method is superior to the second. Yet, I still feel that they are both "unpythonic". With that, let's assume functions become more complicated, but still require the principle of using each others outputs as the next one's parameters. What is the recommended methodology for running functions in main?