Pages

Today I took me first steps in learning Python. I didn't know much about the language before stepping in, other than it was easier than C++. Now, after having learned some of the language, I can safely say that it is much easier.

Here are some examples of how Python is easier than C++:

To declare any variable in C++, you have to precede the variable name with a type, like

Int variablename;
Or
Char variablename;

But in Python, you don't need to give a type, the language figures that out itself. So for example, this is how you declare a variable in Python

Variablename = 10

As you can see from above, Python also doesn't need anything to represent ending a line. So while you type a semi-colon is C++ to end the line, you type nothing and just move onto the next line in Python.

Outputting to the console is also much easier in Python. Here's some basic output in C++

Int variablename = 10;

cout << "The variable name equals " << variablename << endl;

The same in Python is

variablename = 10

print "The variable name equals", variablename

Finally, if/elseif/else statements are also easier in Python. An if/else statement in C++ is written like this