Home / Interview / python :: General Questions

Interview :: python

51) Why do lambda forms in Python not have the statements?

Because it is used to make the new function object and return them in runtime.

52) How can you convert a number to string?

We can use the inbuilt function str() to convert a number into a string. If you want an octal or hexadecimal representation, we can use the oct() or hex() inbuilt function.

53) Mention the rules for local and global variables in Python?

Local variables: If a new value is assigned by a variable within the function's body, it is assumed to be local.

Global variables: These are the variables that are only referenced inside a function are implicitly global.