0
Can we perform list count by creating a function? If yes, then please give an example
6 Respuestas
+ 2
Your question is not quite clear. what language you are talking about? please give a sample of input data and what you expect to get out.
+ 2
You don't need to create an own function for this.
lst = [1,2,3]
print(len(lst))
# output : 3
# or if you need the number:
lst_len = len(lst)
# lst_len will be 3
0
def listLength(x):
print(len(x))
return(len(x))
Or
public List<int> listLength (List<int> exList){ Console.WriteLine(exList.Length);
Return exList;
}
0
I'm talking about python 3
0
My first example is for python 3.
0
You just have to call it: listLength(your list here)