Wednesday, August 18, 2010

Python Challenges

For me to learn a programming language, I have to use it. For most people this is likely the case. When I decided to learn Python a couple days ago, I started looking for some fun projects/exercises to do to try and apply my skills. I came across a really cool site that will certainly give even a seasoned Python programmer a run for his money.

It's called Python Challenge. It's a series of puzzles that in order to get the URL to the next puzzle, you must solve the current one. The URL will somehow be the solution to the puzzle. I have to admit that so far they have been rather challenging. They all involve writing a short program to come up with the solution. Most of the solutions are only about 10 - 30 lines of code and don't involve alot of obscure Python tricks, they are more focused on the problem solving aspect.

I encourage anybody looking for a fun challenge to check them out. You really could solve these problems in any language you like, but the solutions to the problems are posted in Python (although people have given alternate solutions in other languages like Shell and Ruby).

Tuesday, August 17, 2010

Getting Into Python

I have decided that I need a good scripting language in my repertoire. I find that even in my physics courses it's good to have something to do some quick data analysis or to do some numerical calculations. These are obviously perfect uses for a scripting language.

I've decided to go with Python for a couple reasons. The first is that it has alot of support in the scientific community. The two big languages in physics today are C++ and, even after 60 years, FORTRAN. These languages have the power and the library support for scientific computing. However, I am hearing more and more people talk about Python. Some of the grad students here use it for alot of their data analysis.

I would be leery of using it as a substitute for C++ since I can't imagine that even compiled Python is very fast. However, I'm thinking on adopting it as my language of choice for quick "back of the envelope" type computing.

What do you guys think? Has anybody used Python for physics? I'm curious to know how many people use it for heavy duty computing or where you draw the line and just decide to use C++ or some other high powered language.