This would result in a NameError. The variable n is local to function func and can’t be accessesd outside. So, printing it won’t be possible.
a. n = 1 print n++ ## no such operator in python (++) b. n = 1 print ++n ## no such operator in python (++) c. n = 1 print n += 1 ## will work d. int n = 1 print n = n+1 ##will not work as assignment can not be done in print command like this e. n =1 n = n+1 ## will work
By value (check if you want to, I also did the same. It is somewhat more complicated than I have written here (Thanks David for pointing). Explaining all here won’t be possible. Some good links that would really make you understand how things are:
Python memory management
Viewing the memory
''.join(s.split()) ## join without spaces the string after splitting it
s = a + ‘[' + b + ':' + c + ']‘
seems like a string is being concatenated. Nothing much can be said without knowing types of variables a, b, c. Also, if all of the a, b, c are not of type string, TypeError would be raised. This is because of the string constants (‘[' , ']‘) used in the statement.