def powerof(num):
return num**2
number = [1,2,3,4,5,6,7,8]
s = list(map( powerof , number))
print(s)
Error : 'list' object is not callable
You have defined list
as a variable earlier in your code.
Do not do this. Call your variable lst
or perhaps something more descriptive.
Minimal example to replicate your error:
list = [1, 2, 3]
def powerof(num):
return num**2
number = [1,2,3,4,5,6,7,8]
s = list(map( powerof , number))
print(s)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-49-7efe90f8f07a> in <module>()
5
6 number = [1,2,3,4,5,6,7,8]
----> 7 s = list(map( powerof , number))
8 print(s)
TypeError: 'list' object is not callable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With