fruit = ["Banana","Apple","Mango","Pineapple","Passionfruit","Figs","Appricots"]
for count1 in range(len(fruit)-1):
for count2 in range(len(fruit)-1):
if ( fruit[count2] > fruit[count2+1] ):
tmp = fruit[count2]
fruit[count2] = fruit[count2+1]
fruit[count2+1] = tmp
print fruit
Monday, October 12, 2009
Wednesday, September 9, 2009
Boa Constructor
Program Python Graphically with the GUI RAD Tools with an Awesome IDE:
http://boa-constructor.sourceforge.net/
Wednesday, May 20, 2009
Fast Python Computation Coding
As a parting bit of wisdom on how to create optimized python programs for very fast execution you should look into stackless python. My team at our game company is using this appoarch. I have laid out that we will use optimized C++ modules wrapped in stackless python code for very fast execution times with easy to use scripting interface for end users. This is for the Blender Game Engine, BGE for short.
Here is the Link to the Game Developer Magazine with the Article:http://www.gdmag.com/archive/feb09.htmHere is some stuff on Stackless Python
Programming: If you guys already know about this then very cool if you do not then it will probably be an interesting read. http://www.stackless.com/http://www.stackless.com/spcpaper.htmBenchmark of the
Stackless Python:http://muharem.wordpress.com/2007/07/31/erlang-vs-stackless-python-a-first-benchmark/
Blender:
http://www.blender.org
Our Company BGE developments:
http://blenderartists.org/forum/showthread.php?t=152782
Here is the Link to the Game Developer Magazine with the Article:http://www.gdmag.com/archive/feb09.htmHere is some stuff on Stackless Python
Programming: If you guys already know about this then very cool if you do not then it will probably be an interesting read. http://www.stackless.com/http://www.stackless.com/spcpaper.htmBenchmark of the
Stackless Python:http://muharem.wordpress.com/2007/07/31/erlang-vs-stackless-python-a-first-benchmark/
Blender:
http://www.blender.org
Our Company BGE developments:
http://blenderartists.org/forum/showthread.php?t=152782
Saturday, May 2, 2009
Monday, April 6, 2009
Cheap USB Hard Drive
Cheap USB 400 GB Western Digial 2.5 Hard Drive Free Shipping:
http://www.newegg.com/Product/Product.aspx?Item=N82E16822136340
http://www.newegg.com/Product/Product.aspx?Item=N82E16822136340
Friday, March 20, 2009
Loading Python Scripts From A CD and Saving
If you load a Python Script from a CD from your book into your text editor, it is then impossible to simply click save button in the text editor to save over that script. The reason for this is the fact that you are trying to save to a read only CD/DVD and this is an impossible task.
Yes its true there are read write CDs/DVDs but once a CD/DVD is fixed so that it runs on every computer and OS then it is no longer Read Write this is even true for Read Write CDs/DVDs. Manufactures of books commercial software always have their CDs/DVDs fixed so that they can distribute them to work on as many computers as possible.
So rather you have to save to your hard drive, thumb drive, USB Hard Drive with the File->Save As.
Yes its true there are read write CDs/DVDs but once a CD/DVD is fixed so that it runs on every computer and OS then it is no longer Read Write this is even true for Read Write CDs/DVDs. Manufactures of books commercial software always have their CDs/DVDs fixed so that they can distribute them to work on as many computers as possible.
So rather you have to save to your hard drive, thumb drive, USB Hard Drive with the File->Save As.
Thursday, March 19, 2009
Python Programming In Windows
The Easy Way:
Go To Start->Run
now type cmd and press enter
now you are at the prompt.
now you need to change directories into your python installation folder
now in order to run your python program from the prompt if python program is in the same director with the python installation folder, if it is not then move it to this folder, now you will want to type:
python.exe yourprogramnamehere.py
The Hard Way: I don't feel like listening to the instructor and I want to do what I want to do.
Go To Start->Run
now type cmd and press enter
now you are at the prompt.
now comes the fun. Type out your full installation path for your python program and the full path to where your file resides everytime you want to debug your program which will be quite often until you get rid of all of your syntax errors and logic errors. This will add a good bit of time to your debugging process.
The entry at the command prompt will look something like this and will wrap around several lines at the prompt.
C:\Python26\python.exe C:\Documents And Settings\02402530235\My Documents\Python Programs\yourpythonprogramhere.py
Yes you can run your programs in Idle but you won't get the detailed error messages that you need in order to debug your program. Its best to use the command prompt instead. Now that is just for running the program not counting setting up JEdit.
Setting Up JEdit:
Go To Utilities->Global Options
Click On Gutter
Line Numbering Checked
Now you can click on Monospace 10 and change the font size larger than 10 so you can actually see the line numbers.
Click On Text Area
Now you can change the font size and font if you like by clicking on the button to the right of Text Font.
You must save your file as a .py before text highlighting will show up for your python code in JEdit.
Go To Start->Run
now type cmd and press enter
now you are at the prompt.
now you need to change directories into your python installation folder
now in order to run your python program from the prompt if python program is in the same director with the python installation folder, if it is not then move it to this folder, now you will want to type:
python.exe yourprogramnamehere.py
The Hard Way: I don't feel like listening to the instructor and I want to do what I want to do.
Go To Start->Run
now type cmd and press enter
now you are at the prompt.
now comes the fun. Type out your full installation path for your python program and the full path to where your file resides everytime you want to debug your program which will be quite often until you get rid of all of your syntax errors and logic errors. This will add a good bit of time to your debugging process.
The entry at the command prompt will look something like this and will wrap around several lines at the prompt.
C:\Python26\python.exe C:\Documents And Settings\02402530235\My Documents\Python Programs\yourpythonprogramhere.py
Yes you can run your programs in Idle but you won't get the detailed error messages that you need in order to debug your program. Its best to use the command prompt instead. Now that is just for running the program not counting setting up JEdit.
Setting Up JEdit:
Go To Utilities->Global Options
Click On Gutter
Line Numbering Checked
Now you can click on Monospace 10 and change the font size larger than 10 so you can actually see the line numbers.
Click On Text Area
Now you can change the font size and font if you like by clicking on the button to the right of Text Font.
You must save your file as a .py before text highlighting will show up for your python code in JEdit.
Subscribe to:
Posts (Atom)