Hi I have a variables that is declared outsides fucntions. How can I use and change these variables inside function usign Python? thank you
Hi, This is the syntax to concatenate strings: $text1 = "hello"; $text2 = "world"; $text = $text1 . ' ' . $text2; For your code, use this: function UppercaseText($text_list) { $GlobalText = ""; $TableSize = sizeof($text_list);; for ($i = 0; $i < $TableSize; $i++) { $BigText[] = strtoupper($text_lRead more
Hi,
This is the syntax to concatenate strings:
1 2 3 4 | $text1 = "hello"; $text2 = "world"; $text = $text1 . ' ' . $text2; |
For your code, use this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function UppercaseText($text_list) { $GlobalText = ""; $TableSize = sizeof($text_list);; for ($i = 0; $i < $TableSize; $i++) { $BigText[] = strtoupper($text_list[$i]); $GlobalText .= strtoupper($text_list[$i]); if ($i != $TableSize-1) { $GlobalText .= " "; } } //return $BigText; return $GlobalText; } $text_list = ['the', 'train', 'was', 'late']; var_dump(UppercaseText($text_list)); |
Have a good day
See less


Follow this example to create a variable outside functions, and use it inside the functions: MyVariable = 99 #this is a global variable def changeAndPrint_GlobalVariable(): global MyVariable #use global variable in this function with "global" keyword print('Global variable "MyVariable" before changeRead more
Follow this example to create a variable outside functions, and use it inside the functions:
This code will print:
See less