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
if(variablename > typename)
cout << "variablename is greater than typename << endl;
else
cout << "variable name is not greater than typename << endl;
The same exact statement in Python is
if variablename > typename:
print "variablename is greater than typename
else:
print "variable name is not greater than typename
This is why I really like Python. While it may be slower than C++ and other programming languages in execution, its very English-like syntax makes it quite easy to write.
12 comments:
Good post. Keeep it up.
sweet post.
Doing good man. F# is cool too, and you might like LUA because you can incorporate it into games that use C++.
I've only used python once, and it was a tutorial to learn it.
It is straight forward and useful, specifically for prototyping.
nice hope you get python down =)
Good luck, python is a pain :P
you are making great progress!
seems like python just said "fuck it, I'll do it myself" to ending lines.
good post!
great post =D
Hmm, I was thinking of learning a language, maybe Python is the way to go.
Python is a great programming language. It's easy syntax makes programming a lot more fun than with other lower level languages, and it's surprisingly fast for the type of language it is.
Post a Comment