Different programming languages are there
in the world of web that are programmed to create the various types of
programs. One such language is Python.
Python is one of the convenient object-oriented
programming languages as compared to other languages like Ruby, Java, Perl, or Scheme.
Right here in this blog, we will be looking
at some of the notable features of this language that are given below.
Some of
Python's notable features:
- The elegant syntax makes the
programs easier to read.
- Anyone can learn it as it is an
easy-to-use language. One can write code quickly to get it work.
- It’s easy to use feature makes
it an ideal option to go for ad-hoc programming and prototype development
tasks.
- It doesn’t compromise with
maintainability.
- It is a very large standard
library that lets the smooth execution of different tasks: reading the altering
the files, searching for text along with regular expressions, connecting to web
servers.
- You can test the short codes
using the interactive modes present in the language.
- You can not only modify the
files but also extend them by adding new modules that can be implemented.
- Snippet codes can also be
embedded into applications.
- It is a versatile language that
is able to run on different operating systems like Windows, Mac OS X, UNIX
and Linux.
- It is a free programming software
as it doesn't need any cost to use. It is available to download for free.
- Along with free to use, it is
also open source. You can embed its code directly in the applications. It is
open source that means, you can modify its code.
- Basic data types of this
software are: string that includes Unicode and ASCII, lists, dictionaries,
numbers that includes complex floating points, and integers.
- It also works with classes and
multiple inheritances as it is an object-oriented programming.
- The snippet code is adhering to
grouped into different packages and modules.
- It also cleans the error
handling by raising and catching exceptions.
Writing “Hello World” code with Python
Whenever we start learning any new
programming language, the very first traditional program that to be written is
the “Hello World” program.
You can write down the code to print the
output - “Hello World” into the terminal of Python.
You can go for any text editor in order to start. The written code then runs in the terminal.
Before we move further, let’s understand,
what terminal is? Terminal is where we start writing code and execute the
same.
Code can also be written into terminal
itself with the help of interpreter and type commands.
So, let’s follow the given steps.
Step 1. Open terminal, type, and click
enter. This will start Python Interpreter.
Now we can write directly into the interpreter.
So, let’s go for the “Hello World” program.
In order to print “Hello World”, write the
below code.
>>> print("Hello World")
Hello World
In the code, we can see that there is a
function that is added in it – print()
So, what will display in the print? The
content that is added in the parentheses and between the quotes will display as
output.
If you will leave it blank then you won’t
get any output.
>>> print("Hello World")
Hello World
In this code, the “Hello World” is an
example of String that will be printed by using a function known as
print() function.
You can print the String by using the
double as well as single quotes, for eg. “Hello World” or ‘Hello World’.
If you want to print the string along with
the quotes then you can add single quotes with the string, closing with double
quotes or you can try opposite combination too.
So, we saw that writing code is very easy
in Python.