python中如何统计列表B、c中数字的个数。

我用python3.7.2生成了2个列表,B存放100以内的偶数,c存放100以内的奇数。如何统计B、c中数字的个数?


```python
B=[]
c=[]
dict = {}
for j in range(1,100):
    if j%2==0:
        B.append(j)
    else:
        c.append(j)
        
print('List of even number: ',B)
print('List of odd number: ',c)





我试过这个方法,但是不行

```python
set01=set(B)
dict01={}
for item in set01:
    dict01.update({item:B.count(item)})
print(dict01)    

df=[4,5,6]
print(len(df))

使用len()函数就好啦,下面改好了:

B=[]
c=[]
for j in range(1,100):
    if j%2==0:
        B.append(j)
    else:
        c.append(j)
        
print('List of even number: ',len(B))
print('List of odd number: ',len(c))

img