-1

I have three arrays:

a = ['a', 'b', 'c']
b = [100, 200, 300]
c = [10.2, 20.2, 30.2]

How can i convert to below form in python?

result = {
    ['a', 100, 10.2],
    ['b', 200, 20.2],
    ['c', 300, 30.2]
}
teddcp
  • 1,514
  • 2
  • 11
  • 25
leonardorame
  • 1,131
  • 4
  • 18
  • 35

1 Answers1

0

You can do it using zip.

In [1]: a = ['a', 'b', 'c']
   ...: b = [100, 200, 300]
   ...: c = [10.2, 20.2, 30.2]

In [3]: list(zip(a,b,c))
Out[3]: [('a', 100, 10.2), ('b', 200, 20.2), ('c', 300, 30.2)]
teddcp
  • 1,514
  • 2
  • 11
  • 25
  • Please try to only answer well-asked questions. In this case this is an obvious duplicate and already has many answers – Tomerikoo Mar 23 '20 at 13:37