So, in case you were wondering, Pthree stands for Perl, Python and PHP. I know, I know. I haven’t posted hardly anything at all. So I make a feeble attempt at starting now.
Everything that I have been doing at work is supposed to be written in Python, but instead, I have been writing everything in Bash. Well, tonight, I turn over a new leaf. It’s time to convert many of Bash scripts into Python.
Problem.
I don’t know Python.
So, I have decided to start getting serious. I have literally jumped leaps and bounds these past few months learning Bash, and while I am far from perfect, I think I should begin applying that energy to Python. So, here we go.
First, I went to http://doc.python.org, and began reading. It wasn’t long, but I stumbled upon writing a Fibonacci sequence in Python. I thought, sure, why not?
1 2 3 4 | a,b=0,1 while b < 10: print b a, b = b, a+b |
Not bad. Only 4 simple lines, and already, I feel like I am getting the hang of the language. The only problem, is, if I don’t have any exercises to run through, then I won’t have any motivation to learn the language, and if I spend time learning the language, then by the time it will be time to convert everything over, the window will have passed, and I will feel like I wasted time.
Anyway, I am enjoying myself, and I guess that is what is most important. Maybe in the next post, I’ll post a solution in Python to the traveling salesman problem.
{ 3 } Comments
Have fun learning python. It’s a fun language. You might want to check out Dive into Python (http://diveintopython.org/) for a pretty good intro to python.
A lot of times, my job requires me to learn a new language really quickly. If you already know another language, you will soon start to see key similarities to the one you’re learning. You might find this article helpful:
http://programmers.awardspace.us/NewLanguage.php
And, yes, Python is a good language to learn. It was the first language that I really felt I mastered.
How did you do that? I took out the commas and all I got the sequence of exponential 2′s.
Post a Comment