Tag Archives: Python

Another Small Step with Python

As I blogged a while ago, I was planning on better learning Python and programming in general. Every once and a while I’ve been doing a tutorial, but there’s been no significant progress really. The last few days, I’ve been working on understanding the manipulation of lists and dictionaries in Python. These two aspects are essential for my little project of practicing vocabulary words for German.

term_german

I had been trying to find a way to iterate through a list of items, each of which contained both a german word and its english translation. I kept getting errors, and I finally figured out that these items are called “tuples”, and thus, have to be manipulated in a slightly different way.

One problem I was having had to do with how to go about looping through a list of tuples that included both parts of each tuple. I had to use a for-loop with two items (such as v and k in line 4):

for_loop_tuple

Now that I had figured out this small problem in creating the for-loop, I was able to allow the user to delete each item (vocab-card) in order to take it out of the “pile”:

list_german_remove

In this way, the user is able to work on the list until all tuples have been deleted. This isn’t an accomplishment to advanced programmers, but it’s cool to figure out these things.

Learning Kivy

I just started working on creating graphic user interfaces for Python with Kivy. I’ve written a Python script to help me practice German words, but I’d like to make it a bit more visual than simple text in a terminal like this:

a boring terminal window

a boring terminal window

Right now I’m thinking of interactive buttons acting like little vocabulary “cards”:

something a bit more interesting

something a bit more interesting

You’d click on it and it would tell you the answer. After that, you’d be able to move it into a correct or incorrect “pile” depending on whether you got it right or not. After running through the given list, you’d be able to start over with the incorrect pile until you had completed the notecards.

All this practice of vocabulary words could just be done with regular paper cards, but I’ll eventually end up with hundreds of cards stacked up all over my apartment, which I can do without. We’ll see how it goes.