Doubt regarding python

  1. i want to ask agar ham koi x define krte hai loop mai ya function mai…toh uska scope uske andar tak hi rahega??
    like c++ mai varialble ka scope bs curly braces ya uske fuction k andar rehthe hai…ye same concept python m bhi hai???

  2. jab ham python mai function k argument pass krte hai toh toh vo pass b value hota hai na??

Hey @Ujjwal.madaan, there are four major types of variable scope and is the basis for the LEGB rule . LEGB stands for Local -> Enclosing -> Global -> Built-in . To read and understand these scope of variables in detail, I request you to go through this link.

And all parameters ( arguments ) in the Python language are passed by reference. It means if you change what a parameter refers to within a function, the change also reflects back in the calling function.

I hope this helps ! :+1:
Please mark the doubt as resolved in your doubts section !
Happy Learning ! :slightly_smiling_face:

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.