<div dir="ltr">Sorry, I skimmed the thread and didn't realize it was a school assignment.</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 17, 2015 at 2:55 PM Lewit, Douglas <<a href="mailto:d-lewit@neiu.edu">d-lewit@neiu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font size="4">Hey Tim,</font><div><font size="4"><br></font></div><div><font size="4">I like your solution! But I'm trying to handle as much of the code myself without relying on builtin tools. The builtin tools are awesome, but I know how my professor thinks. If there's a harder way to solve a problem, that's the way he wants me to do it.</font></div><div><font size="4"><br></font></div><div><font size="4">I modified my original code and this is what I have. Although my program will accept any positive integer between 1 and 10 inclusive, unless you have a lot of free time on your hands I would not recommend entering an integer greater than 7 or 8. </font></div><div><font size="4"><br></font></div><div><font size="4">Best,</font></div><div><font size="4"><br></font></div><div><font size="4">Doug.</font></div><div><br></div><div><font size="4">P.S. The itertools package is the best! I used it a lot last semester when I took Computational Biology and we had to generate gigantic lists of various combinations, permutations and products of the nucleotide bases (A, T, C, G for DNA and A, U, C, G for RNA.) Curiously enough, if you visit Amazon.com and search for books on BioInformatics you will end up with a very long list of books that use Perl rather than Python. Why is that?</font></div><div><font size="4"><br></font></div><div><font size="4"><br></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 17, 2015 at 1:49 PM, Tim Ottinger <span dir="ltr"><<a href="mailto:tottinge@gmail.com" target="_blank">tottinge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">did you use this:<p><span>number_of_lists = 4<br>numbers = range(10)<br>print list( itertools.product(*[numbers]*number_of_lists))</span></p><p><br></p><p><span>Yields a list from 1,1,1,1 to 9,9,9,9 given that all lists are identical in content.<br>number of lists and length of list are variable.<br>Inner ranges could be iterators too, to avoid having memory chewed up by <br>Note, the above example lets memory be consumed by list() and range(). </span></p><p><span><br></span></p></div><div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 17, 2015 at 7:38 AM Carl Karsten <<a href="mailto:carl@personnelware.com" target="_blank">carl@personnelware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div> def __init__(self, int1 = 1, int2 = 1, int3 = 1, int4 = 0):<br> self.int1 = int1<br> self.int2 = int2<br> self.int3 = int3<br> self.int4 = int4<br><br></div>1,2,3,4 hard coded is generally a red flag that you should be using a list.<br><br></div>I didn't look at what the code is doing, but you should be able to replace all the int1 with i[1]<br><div>(don't use int[1], int is a reserved word)<br><br></div><div>Step 2: Once you have that working, you should be able to replace all the 1,2,3,4's with for n in range(1,5): i[n]<br><br><br></div></div><div class="gmail_extra"></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 17, 2015 at 12:30 AM, Lewit, Douglas <span dir="ltr"><<a href="mailto:d-lewit@neiu.edu" target="_blank">d-lewit@neiu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font size="4">I think this works! Yay!!! Although I would like to make it more general for any integer n besides 4. Do I really need int1, int2, int3, int4? I think all I need is the initial vector = [1, 1, 1, 1, ......, 0].</font><div><font size="4"><br></font></div><div><font size="4">Gotta go! Oh yeah, code here is in Python 3. Not sure how well it will run in Python 2. I don't know when Python 4 is coming out, but if it's not backward compatible with Python 3 I have a feeling A LOT of folks in the Python community are going to be very, very upset!</font></div><div><font size="4"><br></font></div><div><font size="4">Best,</font></div><div><font size="4"><br></font></div><div><font size="4">Doug.</font></div></div>
<br>_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
<br></blockquote></div><br><br clear="all"><br></div><div class="gmail_extra">-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Carl K<br><br></div></div></div></div></div>
</div>
_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
</blockquote></div>