help with problem set 1? what is missing? primeList = [2] primeCandidate = 1 while len(primeList)<1000: primeCandidate = primeCandidate + 2 test = primeCandidate - 1 while test>2: while (primeCandidate%test)>0: test = test - 1 primeList.apppend(primeCandidate) if len(primeList) == 1000: print primeList[999]
what isn't it doing? please use a code pasting site: dpaste.com. pastebin.com. codepad.org, ideone.com
Hi dextere here I made few modifications to your code: http://dpaste.com/708859/ Hope it helps!And try to solve probles sets according to calendar.Have a good day!
after you run it and it doesn't print anything - primeList should still 'be available' for your inspection. how many items are in it? what is the last item? what is actually in primeList? those will give you clues to what is happening. if you are using a shell (like Idle) you should just be able to 'inspect' primeList using statements at the shell's prompt. while you are debugging, maybe set your limit to something more manageable like 10 instead of 1000.
Join our real-time social learning platform and learn together with your friends!