Python

Typewriter effect in Python

I was looking for a way to get a typewriter effect on the console, and this is what I came up with - hopefully its useful to someone.  I'm not sure if the end="" will function in Python 2.x

 

Hash Tables - How cool are they...

I wrote this after finishing my degree... partly because I wanted to see if I could and partly to brush up on my coding skills (which had taken a back seat to my cramming for exams skills).   We'd studied hash tables back in 1st year, but that was the last time I'd had much to do with them.

The idea is that you can store anything using the value you are storing to generate the location you store it in - which means you can do the same calculation you did to store it in order to find it.

Bubblesort - it has a cool name, so it must be good... right?

Well, its been a while since I did any algorithm stuff, but I decided to give myself a refresher in sorting since, unlike Barack Obama, I still like Bubblesort (oops, did I just say that out loud?).  I like it because it has a cool name, and because it was the first sorting method I ever learned, and because for many years it was the only one I knew.

Using SESSION with Google App Engine and Python 2.7

So recently I was lucky enough to be part of a Google training session at Canterbury University, where Google Engineer James McGill gave a hands-on workshop on using Google App Engine with Python (2.7)  It opened a whole new avenue of web development to me, and I was able to use it to succesfully complete an assignment just a few weeks later.

Very simple Python script to count the number of words in a block of text

Recently I had to write a small 'essay' which required not more than 250 words.  Since it was Computer Science related, I figured I would write a small script to count the words for me... this is what I came up with.

doc = raw_input()
count = doc.count(' ') + 1
print count

 

 

Spider Coil Calculator for Radio Applications - Python Code

In my crystal set post I use spider coils, because they are easy to make (my 8yo daughter wound one all by herself), and because they have better Q than a TPR coil (Toilet Paper Roll - common type used in basic crystal sets).

Caesar Cipher / Affine Cipher cracking

Recently I started doing a course on encryption (which due to unforseen earthquakes I had to drop again).  What I did before I left the course is got quite interested in the process of cracking codes (actually, I had an interest in that already - this course just gave me an excuse to delve into it).

Knights Tour - Auto-Solver, written in Python

What follows is my first attempt at a Knights Tour solver.

It is written in Python (2.6), and is currently pretty ugly, but it works.
I'll post updates as I add them (IF I add them). Feel free to comment.

Steve

 

Python tkinter GUI - change default icon: Windows vs. Linux

I'm learning Python at the moment... and as part of that I've been looking at creating platform-independent applications.

The first step, I figured, was to get a basic window operating cross-platform.  I did this, no problem.  I did some reading on tkinter, which seems pretty straight forward (apart from being Tkinter in Python 2.x and tkinter in Python 3.x - note the case change - pretty annoying for converting apps from the old version).  So that was all good anyway.