Posts tagged with "Python"

How much programming knowledge do I need?

Last week I posted some of my experience doing continuing ed in Python programming with the O’reilly School of Technology.  Before entering in on learning programming some people want to know just how far they need to go with it in order for it to be useful.

In many ways, I’m sure the answer is the more the better.  But, you really don’t need to learn that much programming in order for it to save you a considerable amount of time on some tasks.  For example, I use these lines of code just about every day:

import codecs

data = []

f = codecs.open(“C:/xyz.txt”, “r”, “utf-16”)

for line in f.readlines():

line_data = line.split(“/t”)

data.append(line_data)

 

That little bit of code didn’t take me too awful long to learn.  But, it lets me read a tab-delimited text file and put the contents of each tab-delimited line in a list.  From there, if you know if-statements, for-loops, and operators like “and,” “or” and “not,” you can do a whole lot of things with the data that you read from a text file.  I have it on good authority (i.e., Rick Brannan told me) that if you add regular expressions to those statements, loops and operators, you can do almost anything that most non-professional programmers would need to do with Python.

Of course, there are always better and faster ways to do things.  That is one of the reasons I thought it was very helpful to have an instructor with O’reilly school.  Often he was able to tell me: your code works, but here’s a better way you could’ve done that.  Even with that said, code that works is better than beautiful code for most tasks.

I’d say that that it varies how long it would take someone to get to a point of doing useful tasks.  But, if you had a good month or two to dedicate an hour or so a day to learning a language like Python, I think you’d be really surprised by some of the things you might be able to do.

Tags:

Learning python with O’reilly school

Over the last year, I’ve taken two courses in Python programming through the O’reilly School of Technology (yes, the same people that publish those programming books). I don’t think I’ve blogged too much about that experience.

Before going with O’reilly, I tried out Code Academy.  That’s as good a jumping off point as I know of for anyone wanting to get their feet wet with computer programming, in general, or Python programming, in particular.  I certainly learned a lot from working through some of their exercises. But … once I got to a certain level I started to feel like I was getting what I was paying for.  The most difficult thing became working through an exercise and having a correct solution, and the interpreter not recognizing it as a correct solution.  That’s what my co-workers taught me is called “wonky.”  I always thought “janky” was the right word.

I don’t want to be too critical of Code Academy because they are really interesting, helpful things. But, eventually I got to a point where I felt like I wanted to do more than I was going to be able to learn there.  I eventually decided on the O’reilly school for one primary reason – access to an instructor.  Programming is certainly something that many people can learn from books, but having had a bit of experience with programming through Code Academy and wishing many times that I had someone I could talk through solutions with, I was convinced having an instructor would be good for me.

My experience with O’reilly was overwhelmingly positive.  The lessons were maybe not as interactive as they could have been sometimes, but Kirby, my instructor, was top notch. And, I learned a whole lot of things that help me with my day to day work. Most of what I do programming-wise on a daily basis is read tab-delimited text files, edit data in a database, and try to work with already existing data in a database to try to spit out new and interesting things.  The first of those tasks was directly covered in my classes and for the database tasks I learned the loops, if-statements, and logical statements to accomplish those things.  In addition, I learned just a little bit about making graphical user interfaces, and I made two, in particular, that saved me a considerable amount of editing time in my work over the last year.

Depending on your stage in life, you might consider the courses cheap, reasonably priced or expensive.  For me, I felt like they were reasonably priced, especially having a human being involved in the process. And, they are pretty frequently running 30% off promotions.

Overall, I would definitely recommend O’reilly school to anyone wanting to learn some programming (no I don’t get any kickback for that). I may end up taking the last two Python classes and getting the certification myself.  If you have any questions about how it works, hit me up in the comments here or on social media.

Python to save your soul

In a previous post, I showed you how Python can let you print important things over and over again. Here I’m posting a video that just might save your soul with the code for the quiz at the bottom of the post:

from random import randint
import sys

questions = {1 : [“Joel is a hell-bound heretic.”, “true”],
2: [“GrEEK is awesome.”, “false”],
3: [“John Wesley was a Christian.”, “false”],
4: [“GrEEK is lame.”, “true”],
5: [“Zwingli’s real name is Hurlrick Zwiggly.”, “true”],
6: [“The Orthodox are orthodox.”, “false”],
7: [“Luther started the reformation while inebriated.”, “true”],
8: [“Hebrew is awesome.”, “true”]}

while True:
question_number = randint(1, 8)
QA = questions.get(question_number)
inp = raw_input(QA[0] + ” True or False? “)
if inp.lower() == QA[1]:
print(‘yay! cool! you got it!’)
elif inp == “”:
break
else:
print(‘no! wrong! study to save your soul!’)