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?
#1
What i am trying to do:
create a inventory item that uses a function.
The code doesn't work but i will include it as it shows the function i am trying to call on as a list item.

def hall():
    inv=[]
    name=''
    name=input('enter name')
    print('you found an item')
    inv+=trophy(name)
    return name,inv

def show(inv):
        print(inv)

def trophy(name):
  sym='.'
  for i in range(1, len(name)+5, 1):
        print (sym, end="")
  print("\n.."+str(name)+"..")
  for i in range(1, len(name)+5, 1):
        print (sym, end="")

def main():
        name,inv=hall()
        show(inv)
        trophy(name)
main()
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,148 May-05-2020, 12:37 PM
Last Post: gumi543
  Calling function-- how to call simply return value, not whole process juliabrushett 2 3,295 Jul-01-2018, 01:17 AM
Last Post: juliabrushett
  Function call Antonio_Gallardo 3 3,308 Dec-29-2017, 11:13 PM
Last Post: Larz60+
  Error is function call Oracle_Rahul 2 3,284 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