fork download
  1. def generate_variables(value, mask, count, start=0, step=1):
  2. globals().update({mask.format(i): value for i in range(start, count, step)})
  3.  
  4. generate_variables('хуй', 'a{}', 5, 1)
  5.  
  6. print(a1, a2, a3, a4)
  7.  
  8. generate_variables(map(lambda x: x * 3, [1, 2, 3, 4, 5, 6]), 'b{}', 1)
  9.  
  10. print(*b0)
Success #stdin #stdout 0.02s 9944KB
stdin
Standard input is empty
stdout
хуй хуй хуй хуй
3 6 9 12 15 18