Python Forum
Change list which is in a function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change list which is in a function
#1
Hello guys,
I created a list into a function: 
n=eval(input("Enter a number of rows: "))
p=eval(input("Enter a number of columns: "))
def newBoard(n=5,p=4):
        a=[[1]*p for i in range(2)]
        b=[[0]*p for i in range(n-4)]
        c=[[2]*p for i in range(2)]
        grid=a+b+c
        return(grid)
now, I want to create another function:
"def display(board,n,p):"
and I want to put the list grid in my function newBoard into the parameter of display as board (board=grid)
Someone knows how can I do this pls?
Reply


Messages In This Thread
Change list which is in a function - by zakobenayoun - Nov-05-2016, 09:39 PM
RE: Change list which is in a function - by Yoriz - Nov-06-2016, 01:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Change font in a list or tuple apffal 4 2,745 Jun-16-2023, 02:55 AM
Last Post: schriftartenio
  How to change the datatype of list elements? mHosseinDS86 9 2,057 Aug-24-2022, 05:26 PM
Last Post: deanhystad
  find some word in text list file and a bit change to them RolanRoll 3 1,583 Jun-27-2022, 01:36 AM
Last Post: RolanRoll
  Change a list to integer so I can use IF statement buckssg 3 2,287 Sep-21-2021, 02:58 AM
Last Post: bowlofred
  change csv file into adjency list ainisyarifaah 0 1,532 Sep-21-2021, 02:49 AM
Last Post: ainisyarifaah
  write new function or change the old one to work "smartter? korenron 3 2,028 Aug-09-2021, 10:36 AM
Last Post: jamesaarr
  How to change odd to even numbers in the list? plumberpy 8 3,825 Aug-08-2021, 11:07 AM
Last Post: plumberpy
  Question about change hex string to integer sting in the list (python 2.7) lzfneu 1 2,572 May-24-2021, 08:48 AM
Last Post: bowlofred
  LIST or ARRAY Comparison and change of value nio74maz 0 1,721 Dec-21-2020, 05:52 PM
Last Post: nio74maz
Question dict value, how to change type from int to list? swissjoker 3 2,801 Dec-09-2020, 09:50 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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