+ 1
Thanks to the lack of parenthesis and curly braces, the code is always much clearer and more readable than C or C++ code! Example: C++ vs Python if (x>0) { std::cout << "x is positive." << std::endl; } if x>0: print("x is positive.") #Python4president
6 Respostas
+ 8
You can write code in c++ like this:
if(x>0) cout<<"x is positive";
+ 6
And? You can even do this:
cout<<"x is positive.\n";
And yea, boom, new line, that's 2 characters more
+ 1
your statement is very much debatable and a case of personal taste and context, although I do personally like Python lots. Enforced and standardised whitespace is good for preventing code that is awkward to read, curly braces are great for finding where a long code block started (in good IDEs you can search backwards for a symbol, or even select/hover over one brace to find its partner)
+ 1
you will write namespace std; in start program code
0
@Filip: the function "print" of Python automatically puts a new line in the string it displays, so the std::endl in C++ is necessary to obtain the sane result.
0
i agree with Phil on this. it is debatable. how code is formatted is a personal choice.
while i find it novel that python uses indentation to enforce code blocks,
i find it very easy to screw up your logic because you missed an indent.
that said, to each their own. if you like python, good for you! if you like
c/c++, good for you!