This is not a discussion on how to hack or program with python, it’s a discussion on why I personally chose python as my first programming language.
I’m not a developer, I’ve never written a program from source code to production. So when I started looking for a language to jump into I wanted something that could be used a stepping stone for lower level languages.
I chose python simply because I wanted to learn programming logic first, and syntax second. For those of you unfamiliar with those terms logic is how a program runs. It’s the decision making progress that determine what comes next and is derived of conditional statements such as if, if not, else, or’s etc. It’s the heart of any programming language and is usually the measure that separates good programmers from bad ones.
Syntax is how a program is written, it’s the way a language looks and reads/writes. Essentially syntax is programming grammar. Unlike grammar in the English language (Which I admit to being poor at) programs will NOT work unless you get the syntax exactly correct.
Logic is basically universal amongst all programs and to me is the difficult part while syntax can vary. This is exactly why I wanted to learn the logic first, once you understand how programming works you can kind of look at any program and pick it apart.
For example, in Java you would program:
public class HelloWorld
{
public static void main (String[] args)
{
System.out.println(“Hello, World!”);
}
}
but in python 3 you would type:
print(“Hello, world!”)
As you can see these two look very different, but they do the same thing. They print “Hello, world!” to standard out. As you can see Java has quite a bit going on compared to python but there are similarities behind each of the languages. The string “Hello, World!” that is printed to standard out is encased within quotes, and you call a function to print within each language. System.out.println() in Java and print() in python3. As you begin to learn more about functions, modules, libraries, variable declaration, objects, data structures and so on you will find that the similarities are even more apparent and your ability to decode them will expand. This is why many people can program or work in several languages.
As you saw from the above example python is a very compact and concise language. If you combine the large community, human readable syntax, powerful libraries and tutorial quantities its an easy choice to see why I started with python.
I did not learn from one resource and I bounced around between several sites and books. While I am not fluent in python I offer this bit of advice. Stick with it, programming is difficult. Its easily the most difficult thing I’ve ever had to learn in my life. I found that even though I struggle with learning concepts and logic after a while my mind adapts and and I begin to understand concepts that used to give me a lot of trouble. So stick with it.
If you’re interested in python I recommend learning from the following resources in the following order. Note: I did not use these resources linearly, but I did get a good way through each one before moving on.
- [easyazon_link identifier=”0321884914″ locale=”US” tag=”hackm01-20″]Learn Python the Hard Way[/easyazon_link]
- I really liked this resource to learn the basics. When I hit around lesson 39 I got a little bored and I found the exercises to be a little ridiculous and time consuming.
- Free Online Version
- Code Academy
- I see this recommended a lot, but I didn’t like it too much to start with. I think it really shines when you learn the basics and you use it as practice to reinforce things that you’ve already learned.
- [easyazon_link identifier=”1503212300″ locale=”US” tag=”hackm01-20″]Invent with Python[/easyazon_link]
- I would probably rank this along with Learn Python the Hard Way. I really liked it but have no real interest in game development. It kept my interest enough to learn many of the basics though.
- Free Online Version
- [easyazon_link identifier=”1593275994″ locale=”US” tag=”hackm01-20″]Automate the Boring Stuff with Python: Practical Programming for Total Beginners[/easyazon_link]
- This book is awesome because it takes you from beginner to practical programming very quickly. Task automation in an office environment can make you invaluable. Using the same principles for security testing increases your work power by a significant measure.
- Free Online Version
- [easyazon_link identifier=”1597499579″ locale=”US” tag=”hackm01-20″]Violent Python[/easyazon_link]
- Great book, but I don’t think its great for a beginner which is why I have it listed after a few basic primers. I really like this book as an example on how you can use, build and develop security tools with python.
- [easyazon_link identifier=”1449355730″ locale=”US” tag=”hackm01-20″]Learning Python[/easyazon_link]
- I consider this the Python encyclopedia. This is definitely not a book to just casually read but its a great resource when you want to use it as a reference. At the point you can get this book and understand everything you know you’ve made it as a python programmer.