Python Vs. C++ | same program [syntax]

preview_player
Показать описание
Subscribe if u enjoyed this
Рекомендации по теме
Комментарии
Автор

To the people who are being overly pedantic about him using an if-statement instead of a simple switch-case, and consequently using a string instead of a char, or similarly, being pedantic about his code being inefficient - stop being so pretentious and condescending, and give him some slack. This guy is obviously a casual layman who's learning the language, as I bet most of you who are crying about this video are. He's not trying to prove whether one language is better than the other or anything like that; he's simply comparing the semantics between Python and C++ for a specific task. He's not performing an extremely intricate Monte Carlo simulation problem that requires millions and millions of iterations and that needs every line of code to be optimised to the fullest, he's simply creating a multiplication game, you arrogant clueless dicks.

josea
Автор

Thanks. I'm familiar with c++ but not Python and this gives me a rough idea of some differences in syntax.

crankystinkleton
Автор

I now Python and there's not that much of a difference between the two examples. The choice between one and the other is complexity of the project and libraries you need. Obviusly for developing a software like Photoshop I wouldn't use Python but I would for a machine learning project or automating something. There's a place for both C++ and Python

milunacodes
Автор

i'm happy when I see italian people write this

minus
Автор

Thanks for sharing this video. Nice to watch other programmers code. I think you started a C++ vs Python battle. They are both great languages to learn.

ciphertester
Автор

For those who pooh-pooh such a “toy” example, and want to get their teeth into something more substantial, let me offer you a Python-versus-Java comparison. (C++ fans: feel free to show how you can do this better in C++ than Java.) Compare just the rules table here


with the equivalent part of here


(The Java version has a lot of GUI code which I am ignoring here.)

The Java code for defining the calculation rules is over 5 times the size of the equivalent Python code. By the way, this is an example of “data-driven” or “table-driven” programming, which is a great way to write very compact, yet very flexible, code.

lawrencedoliveiro
Автор

come here because of the title, stay here because of the song T_T

ThaiTran-lyok
Автор

Am I right that the basic difference between python and C++ is that for this example python doesn't require the use of {} in for loops and if statements and that variable declarations are not needed. In this example these are the basic differences is that correct?

allinthefamiliy
Автор

Very cool video.
But c++ is more faster than python.

andreivasileiorga
Автор

Sadly nobody knows the name of the music :(

brunor.
Автор

For everyone whining about the switch-case... realize that switch-case can't work on std::string, and that he'd need to hash them first. This is by far the most elegant solution.

willbradley
Автор

Your “generate” functions are not quite equivalent: the C++ one returns a value in [1 .. lvl], while the Python one returns in the range [0 .. lvl - 1].

lawrencedoliveiro
Автор

You can use a bred knives like python or a sharp knives like c++. With the sharp knives u can cut the meat perfekt, if the bred knives u dont have the energy to cut it like the sharp one. But you can cut ur finger with the sharp one too

Hundaloso
Автор

@yuri4life what is the song's name?

stunter
Автор

I wanted to learn a language Not knowing which language should I learn☹️
Can anyone suggest me.?

cap_jack_sparrow
Автор

What about the difference in runtime? This is the advantage of C++

TFx
Автор

True BASIC would be far easier and clearer than either C++ or Python....

Transpower
Автор

you dont have to put curly braces for only one expression. And also those braces dont have to be in a new row. c++11 still nuber one

TheRecocebo
Автор

с++ one love ^) c++ nice and eazy. Pyton - fe

FabioBannet
Автор

It's not c++'s disadvantage. C++ is faster than Python by far. It's all about syntax. And why do you use if statement instead of switch? And you don't have to use "{" symbol if you are writing just one line in if statement. But python is being improved very fast.

sundowatch
visit shbcf.ru