dxnge

1

Oct 28th, 2021 (edited)
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. def f_gen(n):
  2.     nums = []
  3.     x = 0
  4.     while x < n:
  5.         if x == 0:
  6.             nums.append(x)
  7.         else:
  8.             nums.append(x)
  9.             nums.append(-x)
  10.         yield x
  11.         x += 1
  12.     print(nums)
  13.  
  14.  
  15. gen = f_gen(int(input()))
  16. for a in gen:
  17.     next(gen)
Add Comment
Please, Sign In to add comment