Programe is:
#
# Function list and parameter list
#
def Function_1(Word):
print(' One parameter', Word)
return 1
def Function_2(Word):
Word1 = Word[0] + Word[1]
print(Word1)
return 2
def Function_3(Word):
Word2 = Word[0] + Word[1] + Word[2]
print(Word2)
return 3
functions = [Function_1, Function_2, Function_3]
results = [0,0,0]
WORD1 = "aaaa"
WORD2 = "bbbb"
WORD3 = "cccc"
i = 0
parameters = [[WORD1], [WORD1,WORD2], [WORD1, WORD2, WORD3]]
#parameters = ((WORD1), (WORD1,WORD2), (WORD1, WORD2, WORD3))
for ijj in (functions):
results[i] = ijj(parameters[i])
print (results[i], "\n")
i += 1
print(' Final running!')
Results are:
========= RESTART: /Users/ionivan/Documents/ListFunctionParametersX.py =========
One parameter ['aaaa']
1
aaaabbbb
2
aaaabbbbcccc
3
Final running!
(April 02, 2022)
#
# Function list and parameter list
#
def Function_1(Word):
print(' One parameter', Word)
return 1
def Function_2(Word):
Word1 = Word[0] + Word[1]
print(Word1)
return 2
def Function_3(Word):
Word2 = Word[0] + Word[1] + Word[2]
print(Word2)
return 3
functions = [Function_1, Function_2, Function_3]
results = [0,0,0]
WORD1 = "aaaa"
WORD2 = "bbbb"
WORD3 = "cccc"
i = 0
parameters = [[WORD1], [WORD1,WORD2], [WORD1, WORD2, WORD3]]
#parameters = ((WORD1), (WORD1,WORD2), (WORD1, WORD2, WORD3))
for ijj in (functions):
results[i] = ijj(parameters[i])
print (results[i], "\n")
i += 1
print(' Final running!')
Results are:
========= RESTART: /Users/ionivan/Documents/ListFunctionParametersX.py =========
One parameter ['aaaa']
1
aaaabbbb
2
aaaabbbbcccc
3
Final running!
(April 02, 2022)
Comments
Post a Comment