Python. Can someone please explain what is obj from list.count(obj)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python. Can someone please explain what is obj from list.count(obj)?

30th Apr 2019, 8:49 AM
JohnSia2005
4 Answers
+ 2
It's a variable. It can be anything. It counts how often the value that is stored in 'obj' appears in 'list'
30th Apr 2019, 8:59 AM
Anna
Anna - avatar
0
Anna Can you give me an example?
30th Apr 2019, 9:06 AM
JohnSia2005
0
l = [1, 2, 3, 4, 1, 2, 3, 2, 1, 2] var = 2 print(l.count(var))
30th Apr 2019, 9:21 AM
Anna
Anna - avatar
0
Thx
30th Apr 2019, 9:23 AM
JohnSia2005