简体   繁体   中英

Adding numbers in a list python

the code:

I have created a loop to print the above values but I need to add them and find the average. can someone please help me?

try this:

>>> import networkx as nx
>>> su = 0
>>> N = 100
>>> m = 2
>>> x = 0
>>> mean = lambda data: sum(data)/len(data)
>>> mean([nx.degree_assortativity_coefficient(
>>>       nx.barabasi_albert_graph(N,m)) for i in range(0,10)])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM