fork download
  1. # your code goes here
  2. a = [30,10,15,10,2.5,10,10,20,10]
  3.  
  4. def f(k, lst):
  5. s = sum(lst)
  6. return list(map(
  7. lambda x: (x, round(k*x/s, 2)), lst))
  8.  
  9. print(f(1000, a))
Success #stdin #stdout 0.08s 14172KB
stdin
Standard input is empty
stdout
[(30, 255.32), (10, 85.11), (15, 127.66), (10, 85.11), (2.5, 21.28), (10, 85.11), (10, 85.11), (20, 170.21), (10, 85.11)]