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)
Posts
Showing posts with the label string
PYTHON Language Programming
- Get link
- X
- Other Apps
PYTHON language programming is: - flexible, - portable, - easy, - free, - accessible, - intuitive, - versatile, - universal, - convenient, - ordinary, - common. PYTHON programming language has taken over the best of all the programming languages before it. It is simple, efficient, dense and attractive. The input() statement is used to enter the data. The print() instruction is used to present the results. Variable names are constructed the same as all other programming languages: - the first character is required a letter, - the other characters are letters, numbers or underscores, - uppercase letters differ from lowercase letters, - any words other than the reserved words of the PYTHON language. - the length of the name does not exceed 31 characters. The string is preceded and followed by quotation marks. The string is preceded and followed by an apostrophe. Correct variable names: a i j temp Triangle surface_cercle volume_cube Name_P...