At first glance Python may resemble an archaic language, but it’s not. Those of you who think that, well, I respect your opinion, but you’re wrong. Python is extremely powerful, especially for a scripting language, and rivals the functionality of classic compiled languages such as C, C++ and Java. To get a basic introduction to Python check out the links at the official Python site:
Python contains some cool basic data structures that make coding with less actual code possible and coding in general much easier. The two data structures I’ll talk about are lists, and dictionaries. If you’ve programmed before, think of a list as an array, because it can function like an array, but it so much more. A list is a data structure that can hold a variety of data types, all in one list, which is pretty badass. (Come on, admit it.) For example: list1 = [“ice”, 9, I, “Kids”, “Joe”] would be a valid declaration. Items in lists are referenced by index (0,1,2,...etc).
A dictionary contains items bound to keys. For example, dict1 = {“Cheese” : “good”, “Bob” : 92}
declares a dictionary. To references the object “good”, you would use dict1[“Cheese”]. Almost any data type can be an item in a dictionary, (integers, string, lists, other dictionaries, tuples, etc), but the types of items that can be keys are limited. It's too complicated to explain here, and you'll probably only want to use basic data types as keys anyway.
Another Note: Python can be extremely fast because many of the modules in the Python library are coded in C. In fact, it's really easy to write your own modules in C or C++ and use them in Python (if you write C or C++ of course).
Stay tuned for more tips on Python and other languages. Code On.
