python pass by value and pass by pointer;change value of variable when calling function;
i want to change value of a variable like below c++ code in python is it any way ? void fun(int *anyint) { *anyint = 200; } int main(){ int var=100; cout<<"var before fun call "<<var<<endl; //o/p=>var=100 fun(&var); cout<<"var after fun call "<<var<<endl; //o/p=>var=200 } ----------------------------------- in python i didnt find any way to perform like above c++ code var = 100 def fun(anyvar): anyvar = 200 print("anyvar value inside fun ",anyvar) print("var value before fun call ",var) fun(var) print("var value after fun call ",var) i want to change the value of variable 'var' when calling the function 'fun()'; variable name 'var' is not fixed it may vary .is it any way? i'm new to Python ; Thanks in advance