Sail E0 Webinar
Question
What is the output of the code shown below?def d(f):    def n(*args):        return '$' + str(f(*args))    return n@ddef p(a, t):    return a + a*t print(p(100,0))
Options:
A .  100
B .  $100
C .  $0
D .  0
Answer: Option B


In the code shown above, the decorator helps us to prefix the dollar sign along with the value. Since the second argument is zero, the output of the code is: $100.



Was this answer helpful ?

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers