Underneath i have two lists which have been imported from a text file. I need a way in which to be able to link the lines together. so say if line1 is printed randomly I want line2 to be printed.
line1 = (file.readline())
line2 = (file.readline())
line3 = (file.readline())
line4 = (file.readline())
line5 = (file.readline())
line6 = (file.readline())
line7 = (file.readline())
line8 = (file.readline())
line9 = (file.readline())
line10 = (file.readline())
line11 = (file.readline())
line12 = (file.readline())
line13 = (file.readline())
line14 = (file.readline())
line15 = (file.readline())
line16 = (file.readline())
line17 = (file.readline())
line18 = (file.readline())
line19 = (file.readline())
line20 = (file.readline())
line21 = (file.readline())
line22 = (file.readline())
line23 = (file.readline())
line24 = (file.readline())
line25 = (file.readline())
line26 = (file.readline())
line27 = (file.readline())
line28 = (file.readline())
line29 = (file.readline())
line30 = (file.readline())
# creates an empty list and fills it with all the definitions from the file
defi = []
defi.append(line2)
defi.append(line4)
defi.append(line6)
defi.append(line8)
defi.append(line10)
defi.append(line12)
defi.append(line14)
defi.append(line16)
defi.append(line18)
defi.append(line20)
defi.append(line22)
defi.append(line24)
defi.append(line26)
defi.append(line28)
defi.append(line30)
randdef = random.choice(defi) #chooses random lines from the list
randdefi = random.choice(defi) # " " " " " "
#creates an empty list and fills it with all the keywords from the file
key = []
key.append(line1)
key.append(line3)
key.append(line5)
key.append(line7)
key.append(line9)
key.append(line11)
key.append(line13)
key.append(line15)
key.append(line17)
key.append(line19)
key.append(line21)
key.append(line23)
key.append(line25)
key.append(line27)
key.append(line29)
randkey = random.choice(key)
But i need to link certain lines in each list together. so they print together