User:B9 hummingbird hovering/Blog/ComputerScience/Python

Wednesday 8 June 2011
I have configured PyDev in Eclipse, which was really lucky as I was just playing around seeing what stuff does and it found all the sources automatically. I determined for surety whether I was running a 32 or 64 bit kernel by executing the following command with switch in the Bash Terminal: uname -m When I went onto P2PU Beta today I have been accepted for the Python course so I am now a participant!
 * this returned "i686". NB: If it shows i686 or i386 it means 32 bits and if it shows x86_64 it means 64 bits. Source: http://www.ubuntugeek.com/find-which-ubuntu-linux-version-you-are-running.html
 * have been reading three different books on Python and running their exercises successfully (mostly) on the Python commandline in the Bash Terminal and I have successfully executed a number of scripts from the three books which I have coded on Kate and have then made executable and have executed via the Bash Terminal.

Flow control

 * watched Python for Informatics: Conditional Expressions (Chapter 3)
 * http://en.wikipedia.org/wiki/Control_flow

Sunday 5 June 2011
I have been playing around learning Python for the past week. I haven't abandoned Pascal. I know many people would say focus on one language before moving on to another but i wanted to have a basis for comparison to gather a cursory practical appreciation of conceptual differences between languages to ground concepts in compared difference and absence and exception. Somewhat like I only learnt English grammar (and English is my first language) when I started learning Sanskrit. I ran some simple scripts from the Python Interpreter that was already installed on my Natty Narwhal system via the Bash Terminal successfully. I activated the Python Interpreter within the Bash Terminal by typing "python" at the commandline prompt. I researched and found out how to run the "Hello World" script via the Python Interpreter which I did successfully. But once you run the script via the Python Interpreter in the Bash Terminal commandline, the program disappears so you in a sense lose all your hard work. I then wanted to figure out and problem solve how to do a Python "Hello World" program via a text document script so that my problem solving and scripting was preserved. They have the file extension .py. So then I endeavoured to work out how to run the Hello World script which I coded in Kate. I was reading an old version of Learning Python maybe 3rd edition by memory lent to me by a friend of Brandon's. I have since sourced a PDF version of the 4th edition. I made a Hello World! test script in Kate with a shabang shazaam of "#!usr/local/bin/python" which is a header note to the Python Interpreter that this is a Python Script. I then endeavoured to execute it like I ran the compiled programs of Pascal that I did via the Bash Terminal commandline but it didn't work. I even made the script an executable by commandline with the command: chmod +x <>.py. This has to be done by changing directory. This is done most effectively with typing "dir" at the commandline which displays the folder and file directory within the "home" folder which is changed by the "cd" command at the commandline followed by a space with the folder name or folder string wherein resides the file that we wish to make executable. A file may also be made executable by right mouse clicking and ticking the checkbox. I tried to run this script that I had made executable but no cigar. Then via IRC on the #Ubuntu channel of the Freenode server through the application Empathy on Ubuntu, a lovely person directed me to P2PU (beta) where there is an online learning of Python taking place. I have registered my interest but am awaiting confirmation via an Administrator and created the handle b9Jokerswild108. In the meantime I also downloaded Eclipse (via the Bash Terminal with the command: sudo apt-get install eclipse-platform) and installed the plugin PyDev which is done through the Help dropdown of the Eclipse application. I have not configured Eclipse or PyDev as yet and have used neither of them for any coding as yet. Brylie on P2PU gave me a different shebang shazaam of #!/usr/bin/python which I inserted in my Hello World script. As it was already executable I just saved the changes. Then I opened the Bash Terminal and via the process outlined above with "dir" and "cd" changed to the directory that had the Python script. Then I typed the command "python ./<>.py . Where in this instance <> read as "helloworld" where quotation marks enclose the particular. Therefore, command would look like "python helloworld.py" where quotation marks delineate the particular & it ran successfully on the evening of Sunday June 5, 2011. I'm wrapped! Oops, I almost forgot the code in the text document script: print 'Hello world!'
 * 1) !/usr/bin/python

NB:
 * http://www.python.org/community/irc/
 * http://docs.python.org/tutorial/

B9hummingbirdhoverin'æ•ω•ॐ 14:28, 5 June 2011 (UTC)