You are viewing our Forum Archives. To view or take place in current topics click here.
Basic Python tutorial
Posted:

Basic Python tutorialPosted:

Colorful
  • New Member
Status: Offline
Joined: Jan 21, 201212Year Member
Posts: 17
Reputation Power: 0
Status: Offline
Joined: Jan 21, 201212Year Member
Posts: 17
Reputation Power: 0
What is "Python"?
Python is a general-purpose high-level programming language whose design philosophy emphasizes code readability. Python aims to combine "remarkable power with very clear syntax", and its standard library is large and comprehensive.

Python is very different than most programming languages. Syntax wise, and in the way it runs. I would class python as a scripting language. So if you have some little tasks and you just want to dance and encode and be done then python is a good language for that. It is quick and friction-less. It's not quick in the sense that it runs faster than other languages but that you can learn it and then type/use it fast. Python is really good at providing quick turnarounds, so you could have an idea or experiment you can just type it in an try it immediately.

I recommend using python 2.7.2 which is what I will be using and you can download the 64 bit Windows version by clicking here: [ Register or Signin to view external links. ]
But if you are not using windows you can find the different download versions here: [ Register or Signin to view external links. ]

Getting Started:


Alright so lets get started... Python is an interpreter, so we type programs and it will interpret it for us. Once you download python "just keep clicking next" open up your CMD and type in:
cd C:\Python27

[ Register or Signin to view external links. ]
(And I changed my CMD properties to what I like)
[ Register or Signin to view external links. ]

Next type
python

[ Register or Signin to view external links. ]

Now we are using the Python interpreter so lets just mess around and I'll show you what is cool thing does... If you have ever using a different language before (Which I recommend you know at least the basics of one language before you embark on this adventure) you know that Variable have to be defined... well not in python.
Go ahead and type in a = 6 than hit enter. Then type 'a' and hit enter again.
[ Register or Signin to view external links. ]
You see that the variable is 'a' and it a is equal to '6'. This works for strings also. Don't believe go ahead and try.
[ Register or Signin to view external links. ]

This, however; is not where we type the program, but it great for testing ideas and experiments before you use it in your code such as "Hm I wonder what that one thing was that told me the length of a string... was it.. len()? hm let me try.. Oh cool it was"
[ Register or Signin to view external links. ]

Alright this concludes that starting point of this tutorial, see it's not so hard.



Edit: I'll be right back to continue this tutorial and clean it up/formatting (typograhgy and what now)... I'm installing Ubuntu 12.4
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.