Download Python programming. and more Lecture notes Programming Languages in PDF only on Docsity!
Python
Programmin
g Language
Python is the future of AI and Machine Learning.
- (^) Python numerical computation engines such as NumPy and SciPy, allowing complex calculations to be done by a single “import” statement followed by a function call.
- (^) Given the flexibility of the language, its speed, and the machine learning functionality delivered by libraries such as scikit-learn, Keras, and TensorFlow, we’ll continue to see Python dominate the machine learning landscape.
Introduction
- (^) Python interpreters are available for many operating systems.
- (^) Like Java, once written, programs can be run on any operating system.
- (^) Like other dynamic languages, Python is often used as a scripting language, but is also used in a wide range of non scripting contexts.
- (^) It has automatic memory management(Garbage collection)
History
- (^) The history of Python starts with ABC.
- (^) Python was conceptualized by Guido Van Rossum in the late 1980s.
- (^) It was in late 1980’s, when Guido van Rossum came up with an idea to develop a programming language while working in CWI(Centrum Wiskunde and Informatica), Amsterdam, for a project named Amoeba which is a distributed operating system.
- (^) ABC is a general-purpose programming language and programming environment, which had been developed in the Netherlands, Amsterdam, at the CWI (Centrum Wiskunde & Informatica).
Features of Python Easy to Read, Learn and Use(Readability):
- (^) Python does not involve the use of complex syntaxes which makes it a highly readable language.
- (^) Python's syntax is clear and readable.
- (^) It is also very easy language to learn and use in web development and GUI- based applications. Interpreted Language-
- (^) Python is an interpreted language.
- (^) It means you don’t need to compile your codes to execute the program.
- (^) Following is a list of Python Interpreters.
- (^) CPython
- (^) PyPy
- (^) Stackless Python
Cont .. Interactive Language-
- (^) Python is an interactive language, which means you can write your programs in Python prompt thus enabling you to interact with the interpreter. Portable-
- (^) Since a python program has the ability to run on all platforms such as Windows, MacOS, Linux etc., thus making it a highly portable language.
- (^) It can run on various hardware platforms and has the same interface on all platforms.
Cont .. Cross-Compilation-
- (^) You can actually use python codes in other languages by means of several compilers that are listed below. - (^) Jython- compiles Python code to Java Bytecode - (^) Pyjs- compiles Python code to JavaScript - (^) Cython- compiles Python code to C and C++ - (^) Pythran- compiles Python code to C++ - (^) IronPython- it is used to run Python programs on .NET Framework.
Embeddable-
- (^) You can embed Python within your C/C++ program to give scripting capabilities for your program's users.
Cont .. Object Oriented-
- (^) Python supports procedure-oriented programming as well as object- oriented programming.
- (^) In procedure-oriented languages, the program is built around procedures or functions which are nothing but reusable pieces of programs.
- (^) In object-oriented languages, the program is built around objects which combine data and functionality. Extensible-
- (^) If you need a critical piece of code to run very fast, you can achieve this by writing that piece of code in C, and then combine that with your Python program.
Comments in python Single line comments:
- (^) # This would be a comment in Python