#!/usr/bin/env python # coding: utf-8 # # All the IPython Notebooks in **Python Introduction** lecture series by **[Dr. Milaan Parmar](https://www.linkedin.com/in/milaanparmar/)** are available @ **[GitHub](https://github.com/milaan9/01_Python_Introduction)** # # # Python Programming # # Python is a powerful multipurpose programming language created by *Guido van Rossum*. # # It has a simple and easy-to-use syntax, making it a popular first-choice programming language for beginners. # # This is a comprehensive guide that explores the reasons you should consider learning Python and the ways you can get started with Python. # # If you directly want to get started with Python, visit our **[Python Classes](https://github.com/milaan9/01_Python_Introduction/blob/main/000_Intro_to_Python.ipynb)**. # ## What is Python Programming Language? # # Python is an interpreted, object-oriented, high-level programming language. As it is general-purpose, it has a wide range of applications from web development, building desktop GUI to scientific and mathematical computing. # # Python is popular for its simple and relatively straightforward syntax. Its syntax readability increases productivity as it allows us to focus more on the problem rather than structuring the code. # ## Features of Python Programming # ### Simple and easy to learn # Python has a very simple and elegant syntax. It is much easier to read and write programs in Python compared to other languages like C, C++, or Java. # # Due to this reason, many beginners are introduced to programming with Python as their first programming language. # # ### Free and open-source # You can freely use and distribute Python programs even for commercial use. As it is open-source, you can even change Python's source code to fit your use case. # # ### Portability # A single Python program can run on different platforms without any change in source code. It runs on almost all platforms including Windows, Mac OS X, and Linux. # # ### Extensible and Embeddable # You can combine Python code with other programming languages like C or Java to increase efficiency. This allows high performance and scripting capabilities that other languages do not provide out of the box. # # ### High-Level Interpreted Language # Python itself handles tasks like memory management and garbage collection. So unlike C or C++, you don't have to worry about system architecture or any other lower-level operations. # # ### Rich library and large community # Python has numerous reliable built-in libraries. Python programmers have developed tons of free and open-source libraries, so you don't have to code everything by yourself. # # The Python community is very large and evergrowing. If you encounter errors while programming in Python, it's like that it has already been asked and solved by someone in this community. # ## Reasons to Choose Python as First Language # ### 1. Simple Elegant Syntax # # Programming in Python is fun. It's easier to understand and write Python code. The syntax feels natural. Let's take the following example where we add two numbers: # # ```python # a = 2 # b = 3 # sum = a + b # print(sum) # ``` # # Even if you have never programmed before, you can easily guess that this program adds two numbers and displays it. # ### 2. Not overly strict # # You don't need to define the type of a variable in Python. Also, it's not necessary to add a semicolon at the end of the statement. # # Python enforces you to follow good practices (like proper indentation). These small things can make learning much easier for beginners. # ### 3. The expressiveness of the language # # Python allows you to write programs having greater functionality with fewer lines of code. Let's look at code to swap the values of two variables. It can be done in Python with the following lines of code: # # ```python # a = 15 # b = 27 # print(f'Before swapping: a, b = {a},{b}') # a, b = b, a # print(f'After swapping: a, b = {a},{b}') # ``` # # Here, we can see that the code is very less and more readable. # # If instead, we were to use Java, the same program would have to be written in the following way: # # ```python # public class Swap { # public static void main(String[] args) { # int a, b, temp; # a = 15; # b = 27; # System.out.println("Before swapping : a, b = "+a+", "+ + b); # temp = a; # a = b; # b = temp; # System.out.println("After swapping : a, b = "+a+", "+ + b); # } # } # ``` # # This is just an example. There are many more such cases where Python increases efficiency by reducing the amount of code required to program something. # ## Python Applications Area # # Python is known for its **general purpose** nature that makes it applicable in almost each domain of software development. Python as a whole can be used in any sphere of development. # # # Here, we are **specifing applications** areas where python can be applied. # # 1. **Web Applications** # - We can use Python to develop web applications. It provides libraries to handle internet protocols such as HTML and XML, JSON, Email processing, request, beautifulSoup, Feedparser etc. It also provides Frameworks such as Django, Pyramid, Flask etc to design and delelop web based applications. Some important developments are: PythonWikiEngines, Pocoo, PythonBlogSoftware etc. # # 2. **AI & Machine Learning** # - Python has Prebuilt Libraries like Numpy for scientific computation, Scipy for advanced computing and Pybrain for machine learning (Python Machine Learning) making it one of the best languages For AI. # # 3. **Desktop GUI Applications** # - Python provides Tk GUI library to develop user interface in python based application. Some other useful toolkits wxWidgets, Kivy, pyqt that are useable on several platforms. The Kivy is popular for writing multitouch applications. # # 4. **Software Development** # - Python is helpful for software development process. It works as a support language and can be used for build control and management, testing etc. # # 5. **Scientific and Numeric** # - Python is popular and widely used in scientific and numeric computing. Some useful library and package are SciPy, Pandas, IPython etc. SciPy is group of packages of engineering, science and mathematics. # # 6. **Business Applications** # - Python is used to build Bussiness applications like ERP and e-commerce systems. Tryton is a high level application platform. # # 7. **Console Based Application** # - We can use Python to develop console based applications. For example: IPython. # # 8. **Audio or Video based Applications** # - Python is awesome to perform multiple tasks and can be used to develop multimedia applications. Some of real applications are: TimPlayer, cplay etc. # # 9. **3D CAD Applications** # - To create CAD application Fandango is a real application which provides full features of CAD. # # 10. **Enterprise Applications** # - Python can be used to create applications which can be used within an Enterprise or an Organization. Some real time applications are: OpenErp, Tryton, Picalo etc. # # 11. **Applications for Images** # - Using Python several application can be developed for image. Applications developed are: VPython, Gogh, imgSeek etc. # # 12. **Games and 3D Graphics** # - PyGame, PyKyra are two frameworks for game-development with Python. Apart from these, we also get a variety of 3D-rendering libraries. If you’re one of those game-developers, you can check out PyWeek, a semi-annual game programming contest. # ### 4. Great Community and Support # # Python has a large supporting community. There are numerous active online forums which can come in handy if you are stuck anywhere in the learning process. Some of them are: # # * **[Learn Python subreddit](https://www.reddit.com/r/learnpython)** # * **[Google Forum for Python](https://groups.google.com/forum/#!forum/comp.lang.python)** # * **[Python Questions - Stack Overflow](https://stackoverflow.com/questions/tagged/python)** # ## How you can learn to code in Python? # ### Learn Python from Dr. Milaan Parmar # # Programiz offers dozens of tutorials and examples to help you learn Python programming from scratch. Each tutorial is written in-depth with examples and detailed explanations. # # ### Learn Python from Books # # It is always a good idea to learn to program from books. You will get the big picture of programming concepts in the book which you may not find elsewhere. # # Here are 3 books we personally recommend. # # * **[Think Python: How to Think Like a Computer Scientist](http://amzn.to/2dVg5rG)** - a hands-on guide to start learning Python with lots of exercise materials # * **[Starting out With Python](http://amzn.to/2diJu8Z)** - introductory programming book for students with limited programming experience # * **[Effective Python: 59 Specific Ways to Write Better Python](http://amzn.to/2e2EiJt)** - an excellent book for learning to write robust, efficient and maintainable code in Python # # ## Final Words # # I personally think Python is a terrific language to learn. # # If you are getting started in programming, Python is an awesome choice. You will be amazed by how much you can do in Python once you know the basics. # # It is easy to overlook the fact that Python is a powerful language. Not only is Python good for learning programming, but it is also a good language to have in your arsenal. # # Python can help you to get started in everything, whether it is changing your idea into a prototype, creating a game, or getting in Machine Learning and Artificial Intelligence. # In[ ]: