0

I'm a rookie at Python so I don't know much about the limits of the language, but it seems that you can't write a function or a program that creates a list on its own.

I'm working with binary lists. I'm working with 7 bits so, as you can guess, I need 128 different lists to store all possibilities. Let me know if its possible, or if not please let me know why and what else could work for my needs.

    def list_creator:
        n=128
        "create a new_list n times with 7 of length"
        "Should display something like this"
        list1=[None]*7
        list2=[None]*7
        list(n)=[None]*7
  • So, you want to write a function that creates a `list` that contains all the possible 7-bit binary numbers? Where does the requirement for 128-`list`s or custom names come from? – Ma0 Jul 06 '17 at 15:30
  • 1
    No, you don't need to create separate names. You can create a dictionary mapping strings to lists, or just one list that holds 128 nested lists. – Martijn Pieters Jul 06 '17 at 15:31
  • I dont understand you Martijin Pieters – juan Mendez Jul 06 '17 at 15:46
  • Juan, you should approach this problem by pretending you know how to create this list by creating an empty function that does nothing. Then post some code that calls this function and manipulates the list in the way you want. This shows effort. Then your question can ask what code should be in the empty function. – quamrana Jul 06 '17 at 15:58
  • I follow your advice i want to look somenting like that if it is posible – juan Mendez Jul 06 '17 at 17:06
  • I see you have updated your question, but with a function that does actually create lists. What I wanted you to do was to post some code which called that function and then manipulated the return value so we can see how you want to use it. – quamrana Jul 07 '17 at 11:07

1 Answers1

0

You should make a list containing 128 empty lists and add to those.

Cary Shindell
  • 1,336
  • 8
  • 25