<html>
<body>
At 04:34 PM 9/8/2005, Goofball223@wmconnect.com wrote:<br>
<blockquote type=cite class=cite cite=""><font face="arial" size=2>I
would like to construct a table for my program but it does not seem to be
coming out evenly. Could someone please let me know what to do so that
everything will work out correctly? <br><br>
def main(): <br>
&nbsp;&nbsp; print &quot;This program shows a table of Celsius
temperatures and there Fahrenheit equivalents every 10 degrees from 0C to
100C&quot; <br>
&nbsp;&nbsp; print &quot;C F&quot; <br>
&nbsp;&nbsp; for i in(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100): <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fahrenheit = (9.0/5.0) * i + 32
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print i <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;&nbsp;&nbsp; &quot;,
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print fahrenheit <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
main() </font></blockquote><br>
1 - you are getting C and F on different lines because there is no ,
after print i. After you fix that you will get:<br>
<font face="Courier New, Courier">C F<br>
0&nbsp;&nbsp;&nbsp;&nbsp; 32.0<br>
10&nbsp;&nbsp;&nbsp;&nbsp; 50.0<br>
... similar lines deleted<br>
40&nbsp;&nbsp;&nbsp;&nbsp; 104.0<br>
... similar lines deleted<br>
100&nbsp;&nbsp;&nbsp;&nbsp; 212.0<br><br>
</font>Now the trick is to get things lined up. Here % formatting comes
in:<br><br>
print &quot;&nbsp; C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; F&quot;<br>
...<br>
&nbsp;&nbsp;&nbsp; print '%3s&nbsp;&nbsp;&nbsp; %5.1f' % (i,
farenheit)<br><br>
Giving:<br>
<font face="Courier New, Courier">&nbsp; C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
F<br>
&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 32.0<br>
&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp; 50.0<br>
</font>etc.</body>
</html>