fork download
  1. def main():
  2. variable = 0
  3. print('Address of variable = {}\nValue of variable = {}\n'.format(id(variable), variable))
  4. pass_by_python(variable)
  5. print('Address of variable = {}\nValue of variable = {}\n'.format(id(variable), variable))
  6.  
  7. def pass_by_python(data):
  8. print('Entering pass_by_python()\n\nAddress of data = {}\nValue of data = {}\n'.format(id(data), data))
  9. data = 1
  10. print('Address of data = {}\nValue of data = {}\n\nExiting pass_by_python()\n'.format(id(data), data))
  11.  
  12. if __name__ == '__main__':
  13. main()
Success #stdin #stdout 0.02s 5744KB
stdin
Standard input is empty
stdout
Address of variable = 3079069264
Value of variable = 0

Entering pass_by_python()

Address of data = 3079069264
Value of data = 0

Address of data = 3079069280
Value of data = 1

Exiting pass_by_python()

Address of variable = 3079069264
Value of variable = 0