<br><br><div class="gmail_quote">On Fri, Mar 12, 2010 at 4:03 AM, yd <span dir="ltr">&lt;<a href="mailto:ydmt923@gmail.com">ydmt923@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div>Hi, </div>
<div>I am new to programming, altough i have read a few books about OOP and O&#39;Reily&#39;s Learning Python.</div>
<div>I would like some critique on my first program, is it normal for it to be this long to do something simple?</div>
<div>I know i could have turned some of these things into classes and functions but i don&#39;t know how to do that yet.</div>
<div>Some critique of the algorithm and writing style or anything in general would help and any pointers would be appreciated.</div>
<div>Thanks.</div>
<div> <br><br></div></blockquote><div>One thing you should do is use more indentation.  Your program structure is VERY hard to read with single space indentations.  Consider using 4-spaces.<br>This is not overtly long, I would say it&#39;s reasonable for a first program.<br>

There are some things that you could probably group together, though.  Remember that code reuse is one of the core tenets of computer programming!<br><br>One example: area of square, parallelogram and rectangle are all the same.  You could do something like this (assuming user enters strings as choice (rather than ints)):<br>

if choice in [&#39;rectangle&#39;, &#39;square&#39;, &#39;parallelogram&#39;]:<br>    height = int(raw_input(&quot;Height: &quot;))<br>    if choice != &#39;square&#39;:<br>        width = int(raw_input(&quot;Width: &quot;))<br>

    else:<br>        width = height<br>    print &quot;A %s with dimensions %sx%s has an area of %s.&quot; % (choice, height, width, width*height)<br><br><br>Similarly with Ellipses and Circles, you can group some stuff together.<br>

<br>One thing, though.  Most people are still using Python 2.6 (which is what my example above is in) and you appear to be using 3.0.  Perhaps you should learn on 2.6 first, there are more resources and libraries available than for 3.x at the moment.<br>

<br>I could probably make more comments but it&#39;s late and I need to go to bed, hopefully that&#39;s a decent enough start.<br><br>Also (just FYI - you didn&#39;t do anything wrong) when replying to a post please use &quot;reply-all&quot; so that the group will get the message.  If you use &quot;reply&quot; it will just come straight back to me.<br>

-Luke<br></div></div>