I learned Python from a book entitled "Beginning Python From Novice to Professional" by a fellow with an interesting sense of humor named Magnus Lie Hetland. He is professor of algorithms at NTNU.
He builds all of the computer jargon from the ground up, explaining things in a way that the absolute can understand. I say this because at the time that I was reading his book I was an absolute beginner to the computer programming scene.
Warning! Long story ahead:
--------------------------------------------------------------------------------------
I had just finished my Bachelors in Physics, and my only background in programming came from a pseudo-numerical-analysis course that was offered by the math department in Matlab. You should know that there are different paradigms, or ways of thinking about programming, which forces you to adopt a certain way of thinking about solving a problem. Two of these paradigms that exist are "Scripting Languages" and "Object Oriented Languages". Matlab is a "Scripting Language", so this is the only school of thought that I had been trained in at the time. Python allows someone to do both "Scripting programming" and "Object Oriented programming".
I too was faced with the choice of, "c++" and by extension "c", or python? "c++" is also capable of doing both scripting and object oriented programming. However, it is also requires you to keep track of a lot more information. Using c++ you have to deal with memory management on top of learning a brand new "grammar" (or syntax, in computer lingo) and you need to do this on top of learning how to solve problems in programming.
The greatest danger with trying to learn programming from c++ with no computer programming experience is that you'll become frustrated with all of the details long before you are able to appreciate the beauty and the power that being able to program gives you.
An example of what I mean:
A simple "hello world" program in python:
Note also that this program above is saved in a file called, "hello.py"
Execution of the program on Linux:
>> ls
hello.py
>> python hello.py
Hello world!
>>
A quick variable creation and manipulation in python with comments:
x = 'Hello world!' #This defines a variable 'x' with the string "Hello world!"
print x
The above program also this program above is saved in a file called, "hello.py"
Execution of the program on Linux:
>> ls
hello.py
>> python hello.py
Hello world!
>>
A simple "hello world" program in c++:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
}
The above program is put into a file called "hello.cpp"
Execution of the program on Linux
>> ls
hello.cpp
>> g++ hello.cpp -o hello
>> ./hello
Hello world!
>>
A quick variable creation and manipulation in c with comments:
#include <iostream>
using namespace std;
int main()
{
char x[] = "Hello world!"; //This defines a variable "x" with an array of characters
cout << x << endl; //"Hello world!"
}
The above program also this program above is saved in a file called, "hello.cpp"
Execution of the program on Linux:
>> ls
hello.cpp
>> g++ hello.cpp -o hello
>> ./hello
Hello world!
>>