why use python 1

why use python

#Hello world in C++

#include 
using namespace std;

int main() {
  cout << "Hello World!";
  return 0;
}

#Hello world in python

print('Hello World!')

Here is what the above code is Doing:
1. The first line is a comment. Comments are ignored by the compiler.
2. The second line is a preprocessor directive. It tells the compiler to include the contents of the iostream file.
3. The third line is a using directive. It tells the compiler to use the std namespace.
4. The next line is the main function. Every C++ program must have a main function.
5. The next line is a statement. It tells the compiler to display the text "Hello World!" on the screen.
6. The last line is a return statement. It tells the compiler to return 0 to the operating system.

Similar Posts