- #1
member 428835
Hi PF
Given the following
it is obvious function f2 does not explicitly need variables var1 and var2. However, it needs the result of f1, which relies on var1 and var2. Is there a way to write the f2 function without having to pass into it var1 and var2? Could this be handled better with classes?
Given the following
Python:
def f1(var1, var2):
var3 = var1 + var2
return var3
def f2(var1, var2, var4)
var4 = 10
var5 = f1(var1, var2)*var4
return var5
it is obvious function f2 does not explicitly need variables var1 and var2. However, it needs the result of f1, which relies on var1 and var2. Is there a way to write the f2 function without having to pass into it var1 and var2? Could this be handled better with classes?