Local and global variable

I didn’t get the concept of local and global variable. please explain briefly.

Hello Shivam, first of all see the basic meaning of these words. Global means we can access that variable anywhere in the program and we need to define it globally and defining it globally means that we need to define it in global scope and local means that it can be under any function or the class and we are restricted to use in that scope only. And in case we need to use global variable inside the function or the class we can use the global keyword.
I hope it is clear to you. In case it is clear to you pls mark it as resolve and provide the rating as well as feedback so that we can improve ourselves.
In case there is still some confusion pls let me know, I will surely try to help you out.
Thanks :slight_smile:
Happy Coding !!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.