Printing Hello World would be the first program you will encounter in any programming language. This represents that you write your first code where you give instructions to the computer to say Hello World.
Python Hello World Program
print("Hello World!")
Output:
Hello World!
If we compare Python with other programming languages, the same example would have taken more than 5 lines of code to print the same statement.
C++ Hello World Program
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World";
return 0;
}
This C++ program is similar to the above Python program. Both are supposed to print the 'Hello World' statement. In the above examples, you can see that, with Python, we have to write less code compared to the C++ programming language. This is what makes Python a beginner-friendly programming language.
To know the difference between C++ and Python, click here .
Conclusion
We have written simple Python and C++ programs that print 'Hello World.' While Python accomplishes the task of printing the given statement in one line, C++ requires you to write five lines for the same. So, Python has a simple and easy-to-grasp syntax that majorly uses English keywords.
To learn more about Python, click here .
People are also reading:
- Sort an Array Using Bubble Sort
- Python Program to Display Calendar
- Union of Two Arrays
- Rectangle & Pyramids Pattern
- Check whether the number is even or odd
- Find Factorial of Number Using Recursion
- Reverse a number
- Print all Prime Numbers in an Interval
- Calculate Compound Interest
- Display Powers of 2 Using Anonymous Function
Leave a Comment on this Post