Passing a List as an Argument

Share

We can send any data type as argument to a function (string, number, list, dictionary etc.), and it will be treated as the same data type inside the function.

E.g. if we send a List as an argument, it will still be a List when it reaches the function:

def cricket_team(teams):
for x in teams:
print(x)

players = [“rohit”, “kohli”, “bumrah”]

cricket_team(players)

Facebook Comments

Leave a Reply

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