I'm writing some code for a class, and I can't seem to figure out for the life of me how to get this to work. I'm using mod to find the remainder of a large range of numbers, and taking those numbers that only have the remainder to do the same thing repeatedly. For example: I have 100 apples, and I want a rem of 1 6 % 6 = 0 so that doesn't fit, but 7 % 6 = 1 so it fits. I do that for every # from 1-100, and take that list and do the same thing with a different remainder. I've been trying to find a decent method of storing all of the numbers that fit the criteria, because the program will search 10s - 100s of thousands of numbers. I settled on taking the first list of #s that fit the mod1, and creating an output file to store them all. Now all I need to do is reference the output file for the next revision of a different mod, but the output file is stored as a string (says "write() arg must be str, not int") but when I open it back up I can't figure out how to convert it back to all ints so I can use mod again to find a different rem. Heres some code:
With the mod = apple % 8 and if statement commented out, it prints out the whole list that was created in the first part. (I also commented out the line under outputFile on the second part that didn't work)I can't seem to edit that list. ANY help would be appreciated, or perhaps a different method of storing these numbers would be appreciated as well. Thanks! :)