A list can also be sent to a function as an argument. So if we pass a list to a function, the function has to handle it like a list.
Consider the below snippet.
Output is 12.
But if we invoke to the function in below way:
Python will response in below way.
This is caused by the fact that a single integer value mustn't be iterated through by the “for” loop.
A list can also be a result of a function. It mean, any entity recognizable by Python can be a function result.
Consider the below snippet.
Output is
No comments:
Post a Comment