Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Python code snippet?
a=’hello’
q=10
vars()

What will be the output of the following Python code snippet?
a=’hello’
q=10
vars()
a) {‘a’ : ‘hello’, ‘q’ : 10, ……..plus built-in names set by Python….}
b) {……Built in names set by Python……}
c) {‘a’ : ‘hello’, ‘q’ : 10}
d) Error

Answer: a
Explanation: The built in function vars() returns a dictionary containing all the variables that exist in the place. Hence the output of the code shown above is: {‘a’ : ‘hello’, ‘q’ : 10, ……..plus built-in names set by Python….}

Join The Discussion