1

Using Python 3.6.4, I am using the following code to create a list of 4 element long lists, each of which contain integers. However, rather than creating a list of all the different 4 element lists, the list simply consists of the last 4 word list to be appended to the list. Are there any bugs in this code, or is there a problem with using the append function in my code at this scale? Any help is appreciated.


attemptList = []
dataCardList = []
currentAttempt = ""
alphabet = "abcdefghijklmnopqrstuvwxyz"
letter = 0
digit = 0
dataCard = [-1,-1,-1,-1]
while dataCard[0] <= 25:
    dataCard[0] += 1
    dataCard[1] = 0
    dataCard[2] = 0
    dataCard[3] = 0
    dataCardList.append(dataCard)
    print("17576 Cards Made")
    while dataCard[1] <= 25:
        dataCard[1] += 1
        dataCard[2] = 0
        dataCard[3] = 0
        dataCardList.append(dataCard)
        while dataCard[2] <= 25:
            dataCard[2] += 1
            dataCard[3] = 0
            dataCardList.append(dataCard)
            while dataCard[3] <= 25:
                dataCard[3] += 1
                dataCardList.append(dataCard)
                print(dataCard)
                print(dataCardList)
Patrick Haugh
  • 59,226
  • 13
  • 88
  • 96

0 Answers0