Introduction to Python : Why Python , Modes in Python
Introduction to Python : Why Python , Modes in Python – Here We will see Introduction to Python – Why Python is so popular programming language, its pros and cons of using. Also discusses common working Modes in Python. For basic overview of Python Click HERE
For Notes Of other Important Topics CLICK HERE
What is a program?
A computer program is a collection of instructions that perform a specific task when executed by a computer. It is usually written by a computer program in a programming language.
Why Python for AI?
Artificial intelligence is the trending technology of the future. You can see so many applications around you. If you as an individual can also develop an AI application, you will require to know a programming language. There are various programming languages like Lisp, Prolog, C++, Java and Python, which can be used for developing applications of AI.
Python
Python was created by Guido van Rossum, and first released on February 20, 1991. It is Object oriented language , open source and free of cost.
Advantages of Python / Pros of Python
- It is Easy to read , learn and maintain object oriented language. It is very high level language thus programmer friendly.
- It has more simple syntax rules and is more capable in expressing codes’s purpose than any other language.
- It has a broad Standard Library.
- It Supports interactive mode for testing and debugging.
- Portable and compatible on a wide variety of operating systems.
- Extendable – We can add low level module to the python interpreter.
- Python is an open source language and freely available. It provides interfaces to all major open source and commercial databases along with a better structure and support for large programs than shell scripting.
- It is an interpreted language means python interprets and execute code line by line.
Cons of Pythons / Negatives of Python
- It is not fastest programming language . Python is interpreted not fully compiled language.
- Python offers huge library support but still lesser than C , Java etc.
- Python Interpreter is not so strong on catching type – mismatch issue.
- Python is very easy for programming due to simpler syntax but it makes it hard to convert programs from this language to other programming language.
Applications of Python
- Web and Internet Development
- Business application
- software Development
- Desktop and GUI Applications
- Games and 3D Graphics
- Databases Access.
Downloading and Setting up Python for use
Before we start working on Python we need to download an install Python on our computer. There are multiple distributors and versions available.
• Download Python from python.org using link python.org/downloads
• Select appropriate download link as per Operating System [Windows 32Bit/64 Bit, Apple iOS]
• FOR EXAMPLE, for Windows 64 Bit OS- Click the following link – LINK TO DOWNLOAD PYTHON
Once you have Python installed on our computers , we are ready to work in python.
Python can be used in two ways, viz., interactive mode and script mode. Where Interactive Mode, as the name suggests, allows us to interact with OS; script mode lets us create and edit Python source file.
The default distribution , Cpython comes with Python interpreter,Python IDLE( GUI Based) and pip ( Package installer).
IDLE (GUI integrated) is the standard, most popular Python development environment. IDLE is an acronym of Integrated Development Environment. It lets one edit, run, browse and debug Python Programs from a single interface. This environment makes it easy to write programs.
Working in Interactive Mode ( Python IDLE)
In interactive mode of working , you type the command at console – one command at a time and pyton executes the given command then and there and gives you output. It is good for new learners and beginners.
For Example –
Type 3+10 on the first Python prompt shows 13 as output in the next line.
When we typed 2+4*10 on the Python prompt, it shows 42 as output in the next line.
Again we typed command – print(“Hello Learner”) on the Python prompt , it shows Hello Learner as output in the next line.
This interactive mode does not save the command entered by us in form of a program.
Working in Script Mode –
In script mode, we type Python program in a file and then use the interpreter to execute the content from the file. Working in interactive mode is convenient for beginners and for testing small pieces of code, as we can test them immediately. But for coding more than few lines, we should always save our code so that we may modify and reuse the code.
Python Script/Program: Python statements written in a particular sequence to solve a problem is known as Python Script/Program.
To write a Python script/program, we need to open a new file – File >> New File, type a sequence of Python statements for solving a problem, save it with a meaningful name – File —> Save, and finally Run the program to view the output of the program.