Python Forum
can you call a function from a list?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can you call a function from a list?
#7
(Nov-09-2020, 02:32 AM)KEYS Wrote: I feel i have to be able to hold the actual function in the list because i cant think of any other way to be able to select and print(see) the item as is through a list.
You can iterate over items in a list and apply a fucntion on each item, no need to have the function in a/the list
e.g.
for item in some_list:
    some_function(item)
or using list comprehension (e.g. if you have a list and want to create new list with elements being the result, i.e. value returned by some function)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
can you call a function from a list? - by KEYS - Nov-09-2020, 12:31 AM
RE: can you call a function from a list? - by KEYS - Nov-09-2020, 02:32 AM
RE: can you call a function from a list? - by KEYS - Nov-09-2020, 05:19 AM
RE: can you call a function from a list? - by buran - Nov-09-2020, 05:27 AM
RE: can you call a function from a list? - by KEYS - Nov-09-2020, 09:16 PM
RE: can you call a function from a list? - by KEYS - Nov-09-2020, 05:57 PM
RE: can you call a function from a list? - by KEYS - Nov-09-2020, 05:53 PM
RE: can you call a function from a list? - by KEYS - Nov-09-2020, 09:09 PM
RE: can you call a function from a list? - by buran - Nov-09-2020, 09:35 PM
RE: can you call a function from a list? - by KEYS - Nov-10-2020, 12:27 AM
RE: can you call a function from a list? - by KEYS - Nov-10-2020, 06:36 PM
RE: can you call a function from a list? - by buran - Nov-10-2020, 10:01 AM
RE: can you call a function from a list? - by KEYS - Nov-10-2020, 06:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Programming (identifier, literal and function call) ledangereux 5 5,063 May-05-2020, 12:37 PM
Last Post: gumi543
  Calling function-- how to call simply return value, not whole process juliabrushett 2 3,258 Jul-01-2018, 01:17 AM
Last Post: juliabrushett
  Function call Antonio_Gallardo 3 3,255 Dec-29-2017, 11:13 PM
Last Post: Larz60+
  Error is function call Oracle_Rahul 2 3,232 Sep-21-2017, 06:04 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020