0

in pyDLM I create

data = [0]*100 + [3]*100.

data then is a list. How do I make all 200 items in data floating point numbers?

Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
NickG7999
  • 1
  • 1

1 Answers1

0

If you have a list of ints and want a list of floats, you can use various techniques.

For instance:

[float(n) for n in my_list]

Or:

map(float, my_list) # python2

list(map(float, my_list)) # python3
bli
  • 7,549
  • 7
  • 48
  • 94