How to start developing with Python
A brief history of Python and why it’s become so popular
Python is a programming language that was conceived in the late 1980s, and its implementation was started in December 1989 by Guido van Rossum at CWI in the Netherlands as a successor to ABC capable of exception handling and interfacing with the Amoeba operating system1. It is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68, SmallTalk, and Unix shell, and other scripting languages2. The name comes from Monty Python as van Rossum was a fan of Monty Python’s Flying Circus. Python has become very popular for data science in recent times, because it contains costly tools from a mathematical or statistical perspective. Python also has a large and diverse standard library and a vibrant open-source community that provides many packages and frameworks for data analysis, visualization, machine learning, and artificial intelligence, such as NumPy, Pandas, Matplotlib, SciPy, Scikit-learn, TensorFlow, and PyTorch. Python is also easy to learn, read, and write, with a clear and consistent syntax, and supports multiple programming paradigms, such as object-oriented, functional, and procedural.
How does Python compare to other languages
Python is one of the most popular and versatile interpreted languages, but it also has some differences and trade-offs compared to other interpreted languages. Here are some of the main points of comparison between Python and other interpreted languages, based on the search results:
- Python vs Java: Python programs are generally expected to run slower than Java programs, but they also take much less time to develop. Python programs are typically 3-5 times shorter than equivalent Java programs, due to Python’s expressive and concise syntax, dynamic typing, and rich built-in data structures. Python also has a large and diverse standard library and a vibrant open-source community that provides many packages and frameworks for various domains. Java, on the other hand, is more suitable for high-performance, scalable, and enterprise-level applications, due to its static typing, strong concurrency support, and platform independence.
- Python vs Ruby: Python and Ruby are both high-level, interpreted, and multi-paradigm languages, with a lot of similarities in terms of syntax, features, and functionality. Both languages are expressive, concise, and readable, and support multiple programming paradigms, such as object-oriented, functional, and procedural. Both languages also have a large and active open-source community, and many libraries and frameworks for web development, data science, and machine learning. However, there are also some differences between Python and Ruby, such as Python’s emphasis on simplicity, clarity, and consistency, versus Ruby’s emphasis on flexibility, elegance, and expressiveness. Python also has a more diverse and mature ecosystem, while Ruby has a more niche and focused one. (source)
- Python vs PHP: Python and PHP are both interpreted languages that are widely used for web development, but they have different approaches and goals. Python is a general-purpose, full-stack programming language, that can be used for a variety of applications, not just web development. PHP, on the other hand, is a server-side scripting language, that is mainly designed for web development, and embedded in HTML. Python has a clear and consistent syntax, while PHP has a more complex and inconsistent one. Python also supports multiple programming paradigms, such as object-oriented, functional, and procedural, while PHP does not support functional programming. Python has a larger and more diverse standard library, while PHP has a more specialized and web-oriented one. (source)
What do you need to start developing with Python?
Most languages have specific tooling that you’d need in order to start developing. It’s not just writing the code, you also need to run it, install and manage dependencies, test your code… Here’s a list of some of the must-have tools you’ll need if you want to develop with Python:
- A Python IDE or editor: This is a software application that provides features such as syntax highlighting, code completion, debugging, testing, and refactoring for Python development. Some popular Python IDEs or editors are PyCharm, Visual Studio Code, Sublime Text, Atom, and Spyder.
- A Python interpreter: This is a program that executes Python code and displays the output. You can use the default Python interpreter that comes with the Python installation, or you can use other interpreters such as IPython, Jupyter Notebook, or Google Colab that offer interactive development, documentation, and code execution.
- A Python package manager: This is a tool that helps you install, update, and manage Python packages or libraries that provide additional functionality for your Python code. The most common Python package manager is pip, which can be used from the command line to install packages from the Python Package Index (PyPI). Other package managers include conda, poetry, and pipenv.
- A Python virtual environment: This is a tool that helps you create isolated environments for your Python projects, where you can install specific packages and dependencies without affecting the global Python installation. This way, you can avoid conflicts and compatibility issues between different projects and Python versions. Some tools for creating and managing Python virtual environments are venv, virtualenv, conda, and pipenv.
- A Python testing tool: This is a tool that helps you write and run tests for your Python code, to ensure its quality, functionality, and performance. Some popular Python testing tools are unittest, pytest, nose, and tox. For web applications, you can also use Selenium to conduct automation, manual, and cross-browser testing.
Popular projects & products running on Python
Python is a versatile and powerful programming language that is used to create many notable projects or products in various domains, such as web development, data science, machine learning, artificial intelligence, and more. Here are some examples of notable projects or products running on Python:
- Dropbox: Dropbox is a cloud-based file hosting service that allows users to store, sync, and share files online. Dropbox is perhaps the most famous site that is an example of Python sites. Dropbox uses Python for its desktop client, server infrastructure, website, API, and internal tools.
- Netflix: Netflix is the best subscription-based streaming service, which provides online streaming of a collection of film and TV songs. Netflix uses Python for its data analysis, recommendation engine, security, and content delivery network.
- Instagram: Instagram is a social media platform that allows users to share photos and videos with their followers. Instagram is inconceivable without the use of Python. Instagram uses Python for its backend web application, data engineering, artificial intelligence, and machine learning.
- Spotify: Spotify is a music streaming service that allows users to listen to millions of songs and podcasts. Spotify uses Python for its data analysis, backend services, and machine learning. Python also helps Spotify to perform data visualization and recommend music to users.
- Uber: Uber is a ride-hailing service that connects drivers and passengers via a mobile app. Uber uses Python for its backend web development, data analysis, geolocation, and machine learning. Python also helps Uber to optimize routes, estimate fares, and detect fraud.
- Roundup Issue Tracker: Roundup Issue Tracker is a simple and flexible issue tracking system that supports Python. The software provides the basic features of bug tracking and TODO list management. Roundup Issue Tracker is written in Python and can be customized using Python scripts.
- PyInstaller: PyInstaller is a tool that converts Python applications into standalone executables that can run on different platforms. PyInstaller is used to get an application from your system to the user’s system. PyInstaller creates a nice package of your application, which the user can install.
These are just some of the many notable projects or products running on Python. Python is also used for many other projects or products, such as Google, YouTube, Reddit, Quora, Facebook, Pinterest, NASA, and more.
Popular Python libraries
Python has a rich and diverse set of libraries that provide various functionalities and features for different domains and purposes. Here are some of the most notable examples:
- TensorFlow: TensorFlow is an open-source deep learning and machine learning library developed by Google Brain. TensorFlow allows users to create, train, and deploy neural networks and other machine learning models using a high-level API or a low-level API. TensorFlow also supports distributed computing, GPU acceleration, and various tools and frameworks, such as Keras, TensorFlow Lite, TensorFlow.js, and TensorFlow Hub.
- PyTorch: PyTorch is a free, open-source, and the largest machine learning library developed by Facebook’s AI Research Lab. PyTorch provides a flexible and dynamic way of creating and training neural networks and other machine learning models using tensors and automatic differentiation. PyTorch also supports distributed computing, GPU acceleration, and various tools and frameworks, such as TorchVision, TorchText, TorchAudio, and PyTorch Lightning.
- Scikit-learn: Scikit-learn is a free, open-source, and the most popular machine learning library for Python. Scikit-learn provides a consistent and user-friendly interface for implementing various machine learning algorithms, such as classification, regression, clustering, dimensionality reduction, feature selection, and model evaluation. Scikit-learn also integrates well with other Python libraries, such as NumPy, Pandas, and Matplotlib.
- Pandas: Pandas is a free, open-source, and the most widely used data analysis and manipulation library for Python. Pandas provides high-performance and easy-to-use data structures and tools for working with tabular, relational, and labeled data, such as Series and DataFrame. Pandas also supports various operations, such as indexing, slicing, filtering, grouping, aggregating, merging, reshaping, and pivoting data. Pandas also integrates well with other Python libraries, such as NumPy, Matplotlib, and Scikit-learn.
- NumPy: NumPy is a free, open-source, and the fundamental library for scientific computing in Python. NumPy provides a powerful and efficient way of working with multidimensional arrays and matrices, as well as various mathematical functions and operations, such as linear algebra, Fourier transform, random number generation, and more. NumPy also serves as the base for many other Python libraries, such as Pandas, Scikit-learn, Matplotlib, and TensorFlow.
- Matplotlib: Matplotlib is a free, open-source, and the most popular library for data visualization in Python. Matplotlib provides a comprehensive and customizable way of creating and displaying various types of plots and charts, such as line, bar, pie, scatter, histogram, and more. Matplotlib also supports interactive and animated visualization, as well as various backends and formats, such as GUI, web, and PDF. Matplotlib also integrates well with other Python libraries, such as NumPy, Pandas, and Scikit-learn.
- Selenium: Selenium is a free, open-source, and the most widely used library for web automation and testing in Python. Selenium allows users to control and interact with web browsers, such as Chrome, Firefox, and Edge, using a high-level API or a low-level API. Selenium also supports various operations, such as navigating, clicking, typing, scrolling, and capturing web elements. Selenium also integrates well with other Python libraries, such as BeautifulSoup, Requests, and PyTest.
- BeautifulSoup: BeautifulSoup is a free, open-source, and the most popular library for web scraping and parsing in Python. BeautifulSoup allows users to extract and manipulate data from HTML and XML documents, such as web pages, using a simple and intuitive API. BeautifulSoup also supports various operations, such as finding, navigating, modifying, and prettifying web elements. BeautifulSoup also integrates well with other Python libraries, such as Requests, Selenium, and Pandas.
These are just some of the many notable libraries running in Python. Python also has many other libraries for different domains and purposes, such as NLTK, Gensim, Statsmodels, Theano, Keras, Flask, Django, and more. Python is truly a remarkable and widely used programming language with a plethora of libraries.
10 projects you could build to master Python
If you want to start learning Python or get better at it, the best way of achieving this goal is by building stuff with the language. I have compiled 10 different projects you could create with Python, which cover most all the basics, but also a lot of advanced concepts. If you would finish a functional prototype of even half of these projects, you could already say you know Python quite well! This is the list:
- Calculator: A calculator is a simple and useful project that can help you learn the basic syntax, data types, operators, and functions of Python. You can create a calculator that can perform various arithmetic operations, such as addition, subtraction, multiplication, division, and more, using the input and output functions and the math module of Python.
- Hangman: Hangman is a fun and challenging project that can help you learn the control structures, strings, lists, and random module of Python. You can create a hangman game that can generate a random word from a list of words, and ask the user to guess the word by entering one letter at a time, while keeping track of the number of wrong guesses and displaying the word with blanks and letters.
- Mad Libs: Mad Libs is a humorous and creative project that can help you learn the string formatting, file handling, and regular expressions of Python. You can create a mad libs game that can read a text file with blanks, and ask the user to fill in the blanks with different types of words, such as nouns, verbs, adjectives, and more, and then display the modified text with the user’s inputs.
- Tic-Tac-Toe: Tic-Tac-Toe is a classic and popular project that can help you learn the data structures, loops, and functions of Python. You can create a tic-tac-toe game that can display a 3x3 board using a list of lists, and ask the user and the computer to take turns to mark the board with X and O, while checking the winning conditions and the board status.
- Rock-Paper-Scissors: Rock-Paper-Scissors is a simple and fun project that can help you learn the conditional statements, user input, and random module of Python. You can create a rock-paper-scissors game that can ask the user to choose one of the three options, and generate a random option for the computer, and then compare the options and display the result and the score.
- Password Generator: A password generator is a useful and practical project that can help you learn the string methods, random module, and functions of Python. You can create a password generator that can ask the user to enter the length and the type of characters for the password, and generate a random and secure password using the string and random modules of Python.
- Web Scraper: A web scraper is a powerful and interesting project that can help you learn the web requests, HTML parsing, and data extraction of Python. You can create a web scraper that can fetch a web page from a given URL using the requests module, and parse the HTML content using the BeautifulSoup module, and extract and display the relevant data, such as titles, links, images, and more.
- Web Development: Web development is a comprehensive and rewarding project that can help you learn the web frameworks, databases, and templates of Python. You can create a web application that can handle various web requests, such as GET, POST, PUT, and DELETE, using a web framework, such as Flask or Django, and store and retrieve data from a database, such as SQLite or MongoDB, and render dynamic web pages using templates, such as Jinja or Django.
- Chatbot: A chatbot is a smart and interactive project that can help you learn the natural language processing, machine learning, and user interface of Python. You can create a chatbot that can understand and respond to the user’s messages using natural language processing and machine learning libraries, such as NLTK, Gensim, or TensorFlow, and display the conversation using a graphical user interface, such as Tkinter or PyQt.
- Face Recognition: Face recognition is a advanced and fascinating project that can help you learn the computer vision, image processing, and machine learning of Python. You can create a face recognition system that can detect and identify faces from images or videos using computer vision and image processing libraries, such as OpenCV or Pillow, and machine learning libraries, such as TensorFlow or PyTorch.