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 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

15th Jan 2017, 10:11 AM
Diego
Diego - avatar
6 Answers
+ 8
You can write code in c++ like this: if(x>0) cout<<"x is positive";
15th Jan 2017, 10:49 AM
Filip
Filip - avatar
+ 6
And? You can even do this: cout<<"x is positive.\n"; And yea, boom, new line, that's 2 characters more
17th Jan 2017, 4:34 PM
Filip
Filip - avatar
+ 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)
16th Jan 2017, 7:15 PM
Phil
Phil - avatar
+ 1
you will write namespace std; in start program code
26th Jan 2017, 8:17 PM
Тимур Игнатьев
Тимур Игнатьев - avatar
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.
17th Jan 2017, 3:26 PM
Diego
Diego - avatar
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!
21st Jan 2017, 2:16 AM
M King
M King - avatar