Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # a generator that yields items instead of returning a list
- def firstn(n):
- num = 0
- while num < n:
- yield num
- num += 1
- sum_of_first_n = sum(firstn(1000000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement