Python [print "Learning Python in Maya."] *Hits number pad Enter*

So I'm starting the basics of Python scripting for Maya, although it can be used in other media I'm primarily focusing on one that'll help me with rigging. I've realised over the past couple of months that retail is not going to get me a job in a film/game studio and I really need to get my ass into gear. I've purchased a couple of books as well to go through during my lunch breaks and journeys to and from work but a lot of them require me to "follow" them point-by-point, working through as a practical. (Note, there will be a list of media used at the end of this post!)

I've acquired a copy of Digital Tutor's "Getting Starting with Python in Maya" video tutorials and tonight I've had my first practical into some basic Python commands.

First we have the print command. This command allows you to query your code to gain more information about it. You can also ask Maya to print out text and even solve equations. Another few tips included highlighting the code before running the command allows you to keep the code up in Python's input box without disappearing. Very useful!

Below are some of the exercises used in the video tutorial.
Example 1):
print "Hi! How are you?"(press num pad Enter)
Hi! How are you?
Simply using quotation marks you can have Maya echo what you want it to say. Not sure when this would be useful, but I suppose you could have Maya echo a particular command you've set it.

Example 2):
print 12/2
Now I'm introducing mathematics into Maya. I can use numbers without quotation marks and receive no syntax errors. Basically I've asked Maya to work out 12 divided by 2 and it has given me the answer 6. Clever Maya!

Example 3):
print 12/5
I've asked Maya to do a more 'complex' division, asking it to give me a decimal number. Now I am supposed to have a decimal in my equation in order for it to give me a precise division, but instead it has rounded down to give me 2.

Example 4):
print 12.0/5
Adding the decimal place after the 12 has now given me a more accurate answer (well, the correct one, as it is 2.4!). I suppose this is good for getting very precise angle numbers in joints and what not. Easy maths!

Last but not least, there is the comment command, which is defined with a hashtag #. This allows you to specify what code is what in your script without disturbing your workflow and keeping your script neat and organised. It's always good to keep a track of what you're doing in a script otherwise I'm sure it's easy to get lost in it!

Well, that concludes my first lesson into Python. :) It's very simple, but this small tools will most likely be a large help when I'm finally scripting!