Python Notes For 12th Class
Python Notes For 12th Class
Python Notes For 12th Class
Python 0.9.0
Python 1.0
Python 2.0
Next major version − Python 2.0 was launched in October 2000. Many new
features such as list comprehension, garbage collection and Unicode support
were included with it.
Python 3.0
Features of Python
Let's highlight some of the important features of Python that make it widely
popular. Apart from these 10 features where are number of other interesting
features which make Python most of the developer's first choice.
Just type in the following code after you start the interpreter.
# Script Begins
print("GeeksQuiz")
# Scripts Ends
Output:
GeeksQuiz
Let’s analyze the script line by line.
Line 1: [# Script Begins] In Python, comments begin with a #. This
statement is ignored by the interpreter and serves as documentation for our
code.
Line 2: [print(“GeeksQuiz”)] To print something on the console, print()
function is used. This function also adds a newline after our message is
printed(unlike in C). Note that in Python 2, “print” is not a function but a
keyword and therefore can be used without parentheses. However, in Python
3, it is a function and must be invoked with parentheses.
Line 3: [# Script Ends] This is just another comment like in Line 1.
Python designed by Guido van Rossum at CWI has become a widely used
general-purpose, high-level programming language.
Prerequisites:
Knowledge of any programming language can be a plus.
LANGUAGE FEATURES
Interpreted
There are no separate compilation and execution steps like C
and C++.
Directly run the program from the source code.
Internally, Python converts the source code into an
intermediate form called bytecodes which is then translated
into native language of specific computer to run it.
No need to worry about linking and loading with libraries, etc.
Platform Independent
Python programs can be developed and executed on multiple
operating system platforms.
Python can be used on Linux, Windows, Macintosh, Solaris and
many more.
Free and Open Source; Redistributable
High-level Language
In Python, no need to take care about low-level details such
as managing the memory used by the program.
Simple
Closer to English language;Easy to Learn
More emphasis on the solution to the problem rather than the
syntax
Embeddable
Python can be used within C/C++ program to give scripting
capabilities for the program’s users.
Robust:
Exceptional handling features
Memory management techniques in built
Rich Library Support
The Python Standard Library is very vast.
Known as the “batteries included” philosophy of Python ;It
can help do various things involving regular expressions,
documentation generation, unit testing, threading, databases,
web browsers, CGI, email, XML, HTML, WAV files,
cryptography, GUI and many more.
Besides the standard library, there are various other high-
quality libraries such as the Python Imaging Library which is
an amazingly simple image manipulation library.
Python vs JAVA
Python Java
Uses Indentation for structuring code Uses braces for structuring code
Java Code
public class HelloWorld
{
public static void main (String[] args)
{
System.out.println("Hello, world!");
}
}
Python Code
print("Hello, world!")
Python - Interpreter