dxnge

1

Oct 29th, 2021 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. def f_gen(n):
  2.     x = 0
  3.     while x <= n:
  4.         if x == 0:
  5.             yield x
  6.         else:
  7.             yield x
  8.             yield -x
  9.         x += 1
  10.  
  11. print(list(f_gen(int(input()))))
Add Comment
Please, Sign In to add comment