python--iter()+next()+sum()

qq_45911550發表於2020-12-07

1.first of all, let’s talk about the usage of next()
look at this picture:
在這裡插入圖片描述Amazing! why we only get a element from it once? I don’t know, but it is useful.

Now we learn the use of the sum() function who always work with iter.
the programmer is:
sum(iterable[,start])

the args of iterable may be list,tuple,set and so on;
start: plus the args pointed

there are some example:
在這裡插入圖片描述
在這裡插入圖片描述the function in matrix:
在這裡插入圖片描述