Teaching myself Python – Day 1

I’m a Rubyist, I love that language. It is so fun and makes me happy. Regardless, I keep seeing jobs at companies that excite me but require or majorly emphasize Python. It has been getting me down and I finally (with the help of awesome YKat) decided, why don’t I just teach myself another language! So we begin today.

Python definitely beats RoR on install…my mac already was all setup for Python. Boom. Did I tell you I just had to re-setup my whole system because I spilt coffee on my computer and fried it? *cries*. RIP MacBook Air. Anyways, back to Python.

I’m following Google’s Python Class for people with some programming experience. It is FREE online. They do it as a 2-day intensive on campus. It includes written lessons, exercises, and lecture videos. It is a bit outdated but the core concepts should all be good.

Day 1 – Intro, Strings, Arra…I mean lists,

Google’s Python Class comes from a “you probably came from a C++/Java background” stance and even though it has been 10 years since I coded in those languages, it helps to get those pointers. I will mainly just be focusing on Python vs Ruby though. *Reminder to create/find Ruby/Python Cheat-Sheet*. Formatting is imperative with Python ie. the end of the line marks the end of the statement, indentations are used to express meaning, no need for semi-colons, etc. Concise and clean. Reminds me of CoffeeScript, which I enjoy. Mmm Coffee.

Strings-known as str. The len(str) function gets the length of the string and if you are doing the Google Python Class, be prepared to use it over and over. There are a bunch of string methods found here which you should keep handy until memorized. To me, I thought of all the string exercises as math “in a good way” and that made it pretty easy for me.  Speaking of exercises, you best get on to them!

Lists-So I see the example and am like, oh arrays, cool I just spent 2 weeks doing this in JavaScript..again. But then it says they are called Lists in Python. So LISTS. These work similarly to strings, awesome. One of the key things to learn are FOR and IN, I’m told to learn this syntax as I will use it a lot. FOR is a way to look at items in a collection such as WORD in WORDS. IN is a way to look if an item is in a collection.  Also learned about Range and While loops. Got those in Ruby. There are a bunch of list methods you can use, check them out.

Overall, I feel like I am getting it pretty fast especially compared to other languages.  The exercises went well, I had some formatting issues (to be expected) but otherwise I did pretty good. Excited to return to the Google Python Class tomorrow. Also, just saw that Team Treehouse JUST launched a Python course…I think I might do that next.

Leave a comment