Course Hero Logo

V hello def f v world return v printf printv world

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 2 - 6 out of 12 pages.

v = 'Hello'def f():v = 'World'return vprint(f())print(v)WorldHello
What is the output of the following code ?def multipliers():return [lambda x : i * x for i in range(4)]print([m(2) for m in multipliers()])[6,6,6,6]
What is the output of the following code ?
24Which of the following are true about functions in python ?
==============================What is the ouput of the following code ?
Which of the following is true about decorators ?
What is the output of the following code ?
139
What is the output of the following code ?
What is the output of the following code ?from functools import wrapsdef decorator_func(func):@wraps(func)def wrapper(*args, **kwargs):return func(*args, **kwargs)return wrapper@decorator_funcdef square(x):return x**2print(square.__name__)squareWhat is the output of the following code ?
What is the output of the following code ?
@propertydef x(self):return self.__x@x.setterdef x(self, val):self.__x = val@x.deleterdef x(self):del self.__xa = A(7)del a.xprint(a.x)Attribute ErrorWhich of the following method definitions can a Descriptor have ?any of __get__ , __set__ , __delete__What is the output of the following code ?class A:def __init__(self, x , y):self.x = xself.y = y@propertydef z(self):return self.x + self.ya = A(10, 15)b = A('Hello', '!!!')print(a.z)print(b.z)25Hello!!!

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 12 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
N/A

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture