Q. In the following code, which variables are in the same scope?


def func1():

    a = 1

    b = 2

def func2():

    c = 3

    d = 4

e = 5



Answer =

Here a, b, c, d are in same scope i.e. local scope.

4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Should we mention it as a,b local to func1() and c,d local to func2() ?

    ReplyDelete
    Replies
    1. No, if you do so then it will become parameter.

      Delete
  2. What about 'e'

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post