0

I´m new in Python and I guess this is a very simple question because I can´t find an answer. I have this code:

Celsius = [39.2, 36.5, 37.3, 37.8]
Fah = map(lambda x: (float(9)/5)*x + 32, Celsius)
print(Fah)

I expect to get:

>>> [102.56, 97.700000000000003, 99.140000000000001, 100.03999999999999]

But I get:

>>> <map object at 0x000000000909CA20>
DeepSpace
  • 78,697
  • 11
  • 109
  • 154
VikramGS
  • 13
  • 2
  • 2
    In python 3.X `map` returns a `map object` which is an iterator like object. If you want to get a `list()`, you need to call the list function on your result. – Mazdak Dec 14 '15 at 15:13

2 Answers2

2

map() returns a generator, to view it convert it to list:

Fah = map(lambda x: (float(9)/5)*x + 32, Celsius)
print(list(Fah))
mirosval
  • 6,671
  • 3
  • 32
  • 46
0

Change:

print(Fah)

to:

print(list(Fah))
RD3
  • 1,089
  • 10
  • 24