Learn With Kbdk: (Python)Hello World Example
Python is a very simple language, and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code. The simplest directive in Python is the "print" directive - it simply prints out a line (and also includes a newline, unlike in C).
There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different. This tutorial uses Python 3, because it more semantically correct and supports newer features.
For example, one difference between Python 2 and 3 is the
print
statement. In Python 2, the "print" statement is not a function, and therefore it is invoked without parentheses. However, in Python 3, it is a function, and must be invoked with parentheses.
To print a string in Python 3, just write:
" print("This line will be printed.") "
The output will be like
This line will be printed.
print
Statement Examples :
Type this
" >>> print("Welcome to #kbdk blogs") "
You would get output as:
" Welcome to #kbdk blogs "
Type this
" >>> print("Created by K.b.D.k ") "
You would get output as :
" Created by K.b.D.k "
Type this
" >>> print("Proud to be a blogger") "
You would get output as :
" Proud to be a blogger "