samedi 9 janvier 2016

Can someone help me annotate my code? [on hold]

//what does the following code do. can someone help me annotate this code and describe in detail what id does.

   #Task 1
        file = open("words.txt" , "r")
#does the above open an external file.
        file = file.read().splitlines()
#I'm not sure what the above does.
        for word in file:
            wordlist.append(word)
#how does append work.

    #Task 2 

        for a in range(0,3):
            for b in range (0,3):
                words=random.randrange(0,len(wordlist),3)
                print(" ",wordlist[words], end=' ')
                firstgrid.append(wordlist.pop(words))
            print("\n")




Aucun commentaire:

Enregistrer un commentaire