Hi internet strangers, I’m going to be brushing up on my Python and documenting it for myself here. I’ll finally be moving to Python 3.5 from 2.7 as I believe there is enough support now. Here I’ll document random code-bits and snippets working from the bottom up. To get started with me, visit Python.org and download it for your preferred system. Then head over to the tutorial to get started! You might want to eventually have a page of the library and language open for reference use.
I’m starting simple here, nothing complicated. First and foremost let us use the interpreted environment, open your command line of choice, and start by typing “python” and press enter. You should see:
Now you can try things without having to compile. Try making variables, and doing simple math with it, you can copy mine or try your own thing. Below you’ll notice normal math functions work as expected. Things to note are “//” will force integer division, “**” is how we do exponents, “_” refers to the last result – this can be a string or a value.
Now some text! Double and single quotes are both accepted, but to use them within you must use a backslash to prevent the interpreter from reading them as control characters.
Having fun with this, try some things such as string multiplication!
Moving on, LISTS
Lists are much like everything else in python, len(listname) will return the number of objects within it, you can concatenate them, add them, etc. You can have lists within a list. Unlike strings, you CAN modify a position within a list as seen below:
Now that we have the basics out of the way, we’ll finally get around to programming within python. Stay tuned google’s web crawlers, you’ll find more links soon!