<div dir="ltr">Thank you guys</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 3, 2014 at 11:26 PM, Alan Gauld <span dir="ltr"><<a href="mailto:alan.gauld@btinternet.com" target="_blank">alan.gauld@btinternet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 03/11/14 18:04, William Becerra wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
def printMultiples(n, high):<br>
     i = 1<br>
     while i<=high:<br>
         print n*i, "\t",<br>
         i = i + 1<br>
     print<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
def multipleTable(high):<br>
     i = 1<br>
     while i<=high:<br>
         printMultiples(i, i)<br>
         i = i + 1<br>
     print<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
print multipleTable(6)<br>
<br>
when i run this code the result i get is<br>
<br>
1<br>
2 4<br>
3 6 9<br>
4 8 12 16<br>
5 10 15 20 25<br>
6 12 18 24 30 36<br>
</blockquote>
<br>
</span><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Can someone please explain why does it print a triangular table and not<br>
a square table like this one:<br>
</blockquote>
<br></span>
Because you call print Multiples() from within multipleTable()<br>
Each time the loop executes the value of i increases so each line printed gets longer. The first line is printed by printMultiples(1,1)<br>
The second is called with printMultiples(2,2) and so on up to<br>
printMultiples(6,6).<br>
<br>
This yields a triangular printout.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
is there any documentation i can read on tables?<br>
</blockquote>
<br></span>
Not really, there's no such thing as a table in Python programming, its just a structure you create. In practice its usually composed of a list of lists.<br>
<br>
HTH<span class="HOEnZb"><font color="#888888"><br>
-- <br>
Alan G<br>
Author of the Learn to Program web site<br>
<a href="http://www.alan-g.me.uk/" target="_blank">http://www.alan-g.me.uk/</a><br>
<a href="http://www.flickr.com/photos/alangauldphotos" target="_blank">http://www.flickr.com/photos/<u></u>alangauldphotos</a><br>
<br>
______________________________<u></u>_________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="https://mail.python.org/mailman/listinfo/tutor" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/tutor</a><br>
</font></span></blockquote></div><br></div>