Jump to content





Photo

My Very First Python Program [U]

Posted by le717 , in Triangular Minifigure Blog 05 January 2013 · 207 views

THIS PROGRAM WAS WRITTEN BY A BEGINNER PROGRAMMER. YOU WILL FIND IT TO BE VERY BASIC, AND NOT VERY USEFUL TO YOU. YOU HAVE BEEN WARNED.



It's more of a test program than a useful program, but it is my nevertheless my first program.

I call it Basic Shapes. It calculates the Perimeter and Area of a Triangle, Circle, Rectangle, and Square. Some of the shapes have other calculations attached to them. I also have an Easter egg thrown in (Hint: a 2x4 ____ brick).

I wrote it in Python 3.3 using IDLE (IDLE is horrible), and compiled x86 and x64 Windows EXEs using cx_freeze (why, since this is just a test, who knows). The Python script has no dependencies other than a Python interpreter. I did run it on Python 2.7, but it did not work (which is odd, since it is such a simple script). The EXEs also have no dependencies other than the files in the same folder as the EXE.

As of V1.1, all bugs have been fixed, and now works as I had originally planned.

Download Basic Shapes V1.1 from Sourceforge.net.

Special thanks to JrMasterModelBuilder for helping me set up the multiple Python installations correctly, for looking at my code because I thought it was broken, and just putting up with me and all my annoying questions! ;P

Update: I've basically rewritten the script, fixed it up a bit and correcting the bugs. If you care, get the updated version from the link above.



print """
This text will be formated as you see it.
You can write any number of lines with only one call to print.
If you still insist on putting newlines, \"print 'herpderp' +/n\" works.
You also don't need parenthesis. """
Photo
JrMasterModelBuilder
Jan 06 2013 03:27 PM
@TheDoctor: You need parenthesis in Python >= 3. It's also just good practice.

@TheDoctor: You need parenthesis in Python >= 3. It's also just good practice.

I feel that I need to say something about Python 3.x, but I don't know what. Maybe asking you what you can do that you can't in 2.7.x that's not related to syntax, but I still don't know.
Photo
JrMasterModelBuilder
Jan 08 2013 10:45 PM
It's cleaner, UTF8 support, bytes are treated as integers instead of chars (personal preference), nonlocal closure declaration, speed, new features are being added to 3 and not 2.
Plus, a lot of Python 2 stuff that kinda doesn't work too well has either been fixed, rewritten, or removed in Python 3. For example, raw_input() freezes FF with using it on Codecademy, and I've had issues with it on a computer before. In Python 3, it has been replaced with input(), which works much better. ;)
BTW, I've updated Basic Shapes to V1.1. It fixes the bugs, and have been overall fixed. If you want to, download it from the same link.

May 2013

S M T W T F S
   1234
567891011
12131415161718
1920212223 24 25
262728293031 

Recent Entries

Latest Visitors

  • Photo
    grappigegovert
    20 May 2013 - 15:50
  • Photo
    MTG1993Goblin
    19 May 2013 - 07:03
  • Photo
    Fushigisaur
    18 May 2013 - 16:26
  • Photo
    EXRicky
    18 May 2013 - 08:07
  • Photo
    McJobless
    18 May 2013 - 04:32
  • Photo
    McStudz
    18 May 2013 - 04:06
  • Photo
    TheDoctor
    18 May 2013 - 03:00
  • Photo
    Pranciblad
    18 May 2013 - 02:23
  • Photo
    Cirevam
    18 May 2013 - 00:49
  • Photo
    s0d3rb3rg
    17 May 2013 - 13:03
  • Photo
    Cyrem
    17 May 2013 - 02:12
  • Photo
    jamesster
    17 May 2013 - 01:08
  • Photo
    Brickulator
    16 May 2013 - 21:49
  • Photo
    StoneRainStudios
    16 May 2013 - 21:43
  • Photo
    PWNZOR
    15 May 2013 - 20:55

Recent Comments