What is this code returning? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is this code returning?

#please explain me this code and tell me the use of dir() keyword. def this_function_is_an_object(num): return "Cheese is {} times better than everything else".format(num) print(dir(this_function_is_an_object))

15th Mar 2021, 8:11 AM
pratham jain
pratham jain - avatar
1 Answer
+ 3
Dir lists all the methods and variables available for that object . Here "this_function_is_an_object" is an object of class "function". 𝗘𝗱𝗶𝘁: All those methods you see are of class " function" and base class "object" since function inherits the base class "object".
15th Mar 2021, 8:33 AM
Abhay
Abhay - avatar