Nov-06-2020, 09:39 PM
this might be a dumb question but i have this function can i set what i want it to return using a variable.
for example if i call my minute_ function i set x = 2 can i have another variable indicating what i want it to return.
i want to return either minute = x * second()or min_as_second = m * second() depending on the situation.
im just trying to avoid if statements or is that the only way?
for example if i call my minute_ function i set x = 2 can i have another variable indicating what i want it to return.
i want to return either minute = x * second()or min_as_second = m * second() depending on the situation.
im just trying to avoid if statements or is that the only way?
def minute_(x): m = second() * 60 # = 60 minute = x * second() min_as_second = m * second() return min_as_second