So I inquired about utilising a function as a variable in computer science today. For example, I may write a function called returnMe(i) and an array to call it from. For example, if h = [help,returnMe], I may say h1 and it will call returnMe ("Bob"). I apologise for being a little too enthusiastic about this. Is there a way to define a function that only appears in the array using something like h.append(def function)?
EDIT:
Here's some code I created using it! So, I just finished a fantastic FizzBuzz with your answer, and I want to thank you again! As an example, consider the following code:
funct = []
s = ""
def newFunct(str, num):
return (lambda x: str if(x%num==0) else "")
funct.append(newFunct("Fizz",3))
funct.append(newFunct("Buzz",5))
for x in range(1,101):
for oper in funct:
s += oper(x)
s += ":"+str(x)+"\n"
print s