Class : XIInformatics Practices : IP (065)Getting Started with Python Chapter NotesBy : JD Sir (PGT Computer)
Program :
An ordered set of instructions or commands to be executed by a computer is called a program.
Programming Language:The language used to specify set of instructions to the computer is called a programming language for example Python, C, C++, Java, etc.
Introduction of Python:- Python is a very popular and easy to learn programming language, created by Guido van Rossum in 1991 at the National Research Institute for Mathematics and Computer Science, Netherland.
- Python is based on the ABC language, a teaching language created to replace the programming language BASIC.
- Python is a simple but powerful scripting language.
- Python is a general-purpose, dynamic, interpreted, interactive, high-level, multiplatform, object-oriented programming language.
- It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes.
- One of its most visible features is that it does not use semicolons and brackets, Python uses indentation instead.
- It is used in a variety of fields, including software development, web development, scientific computing, big data and Artificial Intelligence.
Why Name Python?Guido van Rossum, the creator of the Python language, named the language after the BBC show “Monty Python’s Flying Circus”. He doesn’t particularly like snakes that kill animals for food by winding their long bodies around them and crushing them.
Features of Python :- Python is a high level language.
- It is a free and open source language.
- It is an interpreted language, as Python programs are executed by an interpreter.
- Python programs are easy to understand as they have a clearly defined syntax and relatively simple structure.
- Python is case-sensitive. For example, NUMBER and number are not same in Python.
- Python is portable and platform independent means it can run on various operating systems and hardware platforms.
- Python is also helpful in web development. Many popular web services and applications are built using Python.
- Python uses indentation for blocks and nested blocks.
- Python provides interfaces to all major commercial databases.
Limitation (Minus) of python:- Not the fastest language.
- Lesser Libraries than C, Java or Perl.
- Not Strong on Type-binding.
- Not Easily convertible
Download Python:The latest version of Python is available on the official website:
Note: - ANACONDA Python distribution is one such highly recommended distribution that comes with preloaded many packages and libraries (NumPy, SciPy, Panda etc).
- Other Popular IDEs like Sypder, PytCharm, etc. Spyder IDE is available as a part of ANACONDA.
How to install python steps by steps :
- Python Interpreter : Python interpreter is must be installed on your computer, to write and execute a Python program. It is also called Python shell.
- >>> : Symbol >>> is called Python prompt.
- Python prompt : Python prompt, which indicates that the interpreter is ready to receive instructions. We can type commands or statements on this prompt for execution.
Execution Mode / Working Mode in Python :There are two ways to run a program using the Python interpreter: 1) Interactive mode and 2) Script mode
1) Interactive Mode :In the interactive mode, we can type a Python statement on the >>> prompt directly. As soon as we press enter, the interpreter executes the statement and displays the result(s).
Advantages of using interactive mode : It is convenient for testing a single line code for instant execution.
Disadvantage of using Interactive mode : The interactive mode, we cannot save the statements for future use and we have to retype the statements to run them again.
2) Script Mode :In the script mode, we can write a Python program in a file, save it and then use the interpreter to execute the program from the file.- Python program files have a .py extension.
- Python programs are also known as scripts.
- Python has a built-in editor called IDLE which can be used to create programs / scripts.
Advantages of using Script mode : - Multiple commands can be saved in a file as a program and then we can execute the entire program.
- 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.
Python IDLE :
IDLE : Integrated Development and Learning Environment
How to Create a Program :- First open the IDLE,
- Click File>New File to create a new file,
- then write your program on that file and
- save it with a desired name.
- By default, the Python scripts are saved in the Python installation folder.
An ordered set of instructions or commands to be executed by a computer is called a program.
Programming Language:
The language used to specify set of instructions to the computer is called a programming language for example Python, C, C++, Java, etc.
Introduction of Python:
- Python is a very popular and easy to learn programming language, created by Guido van Rossum in 1991 at the National Research Institute for Mathematics and Computer Science, Netherland.
- Python is based on the ABC language, a teaching language created to replace the programming language BASIC.
- Python is a simple but powerful scripting language.
- Python is a general-purpose, dynamic, interpreted, interactive, high-level, multiplatform, object-oriented programming language.
- It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes.
- One of its most visible features is that it does not use semicolons and brackets, Python uses indentation instead.
- It is used in a variety of fields, including software development, web development, scientific computing, big data and Artificial Intelligence.
Why Name Python?
Guido van Rossum, the creator of the Python language, named the language after the BBC show “Monty Python’s Flying Circus”. He doesn’t particularly like snakes that kill animals for food by winding their long bodies around them and crushing them.
Features of Python :
- Python is a high level language.
- It is a free and open source language.
- It is an interpreted language, as Python programs are executed by an interpreter.
- Python programs are easy to understand as they have a clearly defined syntax and relatively simple structure.
- Python is case-sensitive. For example, NUMBER and number are not same in Python.
- Python is portable and platform independent means it can run on various operating systems and hardware platforms.
- Python is also helpful in web development. Many popular web services and applications are built using Python.
- Python uses indentation for blocks and nested blocks.
- Python provides interfaces to all major commercial databases.
Limitation (Minus) of python:
- Not the fastest language.
- Lesser Libraries than C, Java or Perl.
- Not Strong on Type-binding.
- Not Easily convertible
Download Python:
The latest version of Python is available on the official website:
Note:
- ANACONDA Python distribution is one such highly recommended distribution that comes with preloaded many packages and libraries (NumPy, SciPy, Panda etc).
- Other Popular IDEs like Sypder, PytCharm, etc. Spyder IDE is available as a part of ANACONDA.
- Python Interpreter : Python interpreter is must be installed on your computer, to write and execute a Python program. It is also called Python shell.
- >>> : Symbol >>> is called Python prompt.
- Python prompt : Python prompt, which indicates that the interpreter is ready to receive instructions. We can type commands or statements on this prompt for execution.
Execution Mode / Working Mode in Python :
There are two ways to run a program using the Python interpreter:
1) Interactive mode and 2) Script mode
1) Interactive Mode :
In the interactive mode, we can type a Python statement on the >>> prompt directly. As soon as we press enter, the interpreter executes the statement and displays the result(s).
Advantages of using interactive mode : It is convenient for testing a single line code for instant execution.
Disadvantage of using Interactive mode : The interactive mode, we cannot save the statements for future use and we have to retype the statements to run them again.
2) Script Mode :
In the script mode, we can write a Python program in a file, save it and then use the interpreter to execute the program from the file.
- Python program files have a .py extension.
- Python programs are also known as scripts.
- Python has a built-in editor called IDLE which can be used to create programs / scripts.
Advantages of using Script mode :
- Multiple commands can be saved in a file as a program and then we can execute the entire program.
- 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.
Python IDLE :
IDLE : Integrated Development and Learning Environment
How to Create a Program :
- First open the IDLE,
- Click File>New File to create a new file,
- then write your program on that file and
- save it with a desired name.
- By default, the Python scripts are saved in the Python installation folder.