Recents in Beach

JESUS & MARY ACADEMY

AI and YOU 7 Chapter 7 & 8. More on Python

                                                                         Python 


Introducing to Python:

Python is a simple programming language used to write code for the computer programs.

Python was created by Guido Van Rossum when he was working at CWI (Centrun Wiskunde & Informatica),Which was a national Research Institute for mathematics and computer Science in Netherlands. The Language was released in 1991.

Python is a High Level Programming Language. 

Feature of Python:

Ø  It is an easy to learn general purpose programming language.

Ø  It is a platform independent programming language, which means it can be used on any machine and in any Operating system. It has a simple syntax.

Ø  Python is a case sensitive language.

Ø  It is interpreted language.

Ø  It if free to use and even free for commercial products.

Application / Uses of Pytgon Programming:

Ø  Build a website.

Ø  Develop Games.

Ø  Program Robots

Ø  Perform Scientific Computations.

Ø  Develop Artificial Intelligence Application

How to Install Python (Environment Set-up)

In order to become Python developer, the first step is to learn how to install or update Python on a local machine or computer. In this tutorial, we will discuss the installation of Python on various operating systems.

Installation on Windows

Python can be easily downloaded on your computer by following the given steps:

Obtain a python distribution: You can download python distributes from: www.python.org/download. For this chapter we will use python 3.7.0

Visit the link https://www.python.org/downloads/

to download the latest release of Python

    . In this process, we will install Python 3.8.6 on our Windows operating system

    . When we click on the above link, it will bring us the following page.

Step - 1: Select the Python's version to download.

Click on the download button or write on google python download as following screen.





        After downloading the python distribution, all you need to do is, to execute it.



    Step - 2: Click on the Install Now

    Double-click the executable file, which is downloaded; the following window will open. Select               Customize installation and proceed. Click on the Add Path check box, it will set the Python path             automatically.


    We can also click on the customize installation to choose desired location and features. Other                 important thing is install launcher for the all user must be checked.

    Step - 3 Installation in Process


    Now, try to run python on the command prompt. Type the command python -version in case of                 python3.





       

  We are ready to work with the Python.

 Installation on Mac

To install python3 on MacOS, visit the link https://www.javatpoint.com/how-to-install-python-on-mac

and follow the instructions given in the tutorial.


Installation on CentOS

To install Python3 on CentOS, visit the link https://www.javatpoint.com/how-to-install-python-on-centos

and follow the instructions given in the tutorial.


Installation on Ubuntu

To install Python3 on Ubuntu, visit the link https://www.javatpoint.com/how-to-install-python-in-ubuntu

and follow the instructions given in the tutorial.

COMPONENT OF PYTHON WINDOW

Just like any other application program, python window has the following components:


Title bar :

This is area that displays the name of the application and document, it also contains command buttons like

Minimize, maximize, restore, and close.

 

Menu Bar :

The menu bar consists of various menus with different options. The common menus you will be working with this chapter are File, Edit, Shell, Debug, Options, Window and Help.

 

ü     Working with FILE Menu: The File Menu is used to work with the options related to the currently used file. It includes sub options like opening a new file, opening an existing file, viewing recently used files, saving the files, closing the files, and exiting the application.

ü     Working with EDIT Menu: This Menu is generally used to edit the file in use. You can cut, copy or paste the selected text, you can also search for a particular text or phrase, and even replace it with some other text.

ü     Working with HELP Menu: To get help related to any topic of python, press F1 key or     click on the help menu.

 Script Area: This is the area where you type code.

 Status Bar: The Status Bar tells you the current status of your control/Cursor on the     window.

 

 After installing python, you are ready to work on it, Python provides us the two ways to run a program:

  • Using Interactive interpreter prompt
  • Using a script file

Let's discuss each one of them in detail.

Python programming in Interactive interpreter prompt

Python provides us the feature to execute the Python statement one by one at the interactive prompt. It is preferable in the case where we are concerned about the output of each line of our Python program giving the output.

 

To open the interactive mode, open the terminal (or command prompt) and type python

It will open the following prompt where we can execute the Python statement and check their impact on the console.

 

In this mode the commands are typed next to the python command prompt(>>>). For example, if you type 3+6, next to the python prompt, it will give the result as 9.

 

To Work in the interactive mode, following the process given below:

Click on the start button > all programs > python 3.8.3 > IDLE(python 3.8.3).



Here, we get the message "Hello World !" printed on the console.

Type the following commands next to python prompt and python will immediately give output:

Program 1.

>>>’welcome to python world’

>>>10

>>>12.78

>>>’A’

>>>10<5

>>>10+20

 

Output



Post a Comment

0 Comments