This code ( below ) will generate error SyntaxError: invalid syntax as varaiable name can't start with number.
reassigned to different types
The function type() returns the variable type ( integer, float, string etc ) If a variable is used as Integer, if subsequently we assign string value to it, then the variable type will change to string.
This feature is not allowed in may other programming languages
Check the code above, since we have not assigned or used the variable my_end_name before so the line print(my_2nd_name) generates error. ( Variables are case sensitive )
Operations within similar variables
This code will generate error as we can't add integer and a string.
TypeError: unsupported operand type(s) for +: 'int' and 'str'
If we un-comment the line saying b=5 , then output we will get is 50.
We can convert string to integer by using int() function and use str() to convert integer to string variable.
a='45' # a is a string variable , it is not an integer
#print(a+b) # error, as we can't add one string with integer variable
print(a+str(b)) # this is fine
print(int(a)+b) # this is fine
Scope of the variable
Can we use the variable in different programs? Answer is No , the variable is no more available after the program is terminated. Even within the program, there is a difference between availability of local variables and global variable. You can read more on local and global variables in python functions and in global local & nonlocal variables .
In python all are objects only. Here is one integer object a ( variable ) . We will delete the object by using del and again try to print the value.