Contents
Mastering Python for Web
Mastering Computer Science
Series Editor: Sufyan bin Uzayr
Mastering Python for Web: A Beginners Guide
Mathew Rooney and Madina Karybzhanova
Mastering Android Studio: A Beginners Guide
Divya Sachdeva and Reza Nafim
Mastering Swift: A Beginners Guide
Mathew Rooney and Madina Karybzhanova
Mastering C++: A Beginners Guide
Divya Sachdeva and Natalya Ustukpayeva
Mastering Git: A Beginners Guide
Sumanna Kaul, Shahryar Raz, and Divya Sachdeva
Mastering Ruby on Rails: A Beginners Guide
Mathew Rooney and Madina Karybzhanova
For more information about this series, please visit: https://www.routledge.com/Mastering-Computer-Science/book-series/MCS
The Mastering Computer Science series of books are authored by the Zeba Academy team members, led by Sufyan bin Uzayr.
Zeba Academy is an EdTech venture that develops courses and content for learners primarily in STEM fields, and offers education consulting to Universities and Institutions worldwide. For more info, please visit https://zeba.academy
First edition published 2022
by CRC Press
6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742
and by CRC Press
2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN
CRC Press is an imprint of Taylor & Francis Group, LLC
2022 Sufyan bin Uzayr
Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, access
Trademark Notice: Product or corporate names may be trademarks or registered trademarks and are used only for identification and explanation without intent to infringe.
ISBN: 9781032135670 (hbk)
ISBN: 9781032135656 (pbk)
ISBN: 9781003229896 (ebk)
DOI: 10.1201/9781003229896
Typeset in Minion
by KnowledgeWorks Global Ltd.
About the Editor
Sufyan bin Uzayr is a writer, coder, and entrepreneur with more than a decade of experience in the industry. He has authored several books in the past, pertaining to a diverse range of topics, ranging from History to Computers/IT.
Sufyan is the Director of Parakozm, a multinational IT company specializing in EdTech solutions. He also runs Zeba Academy, an online learning and teaching vertical with a focus on STEM fields.
Sufyan specializes in a wide variety of technologies, such as JavaScript, Dart, WordPress, Drupal, Linux, and Python. He holds multiple degrees, including ones in management, IT, literature, and political science.
Sufyan is a digital nomad, dividing his time between four countries. He has lived and taught in universities and educational institutions around the globe. Sufyan takes a keen interest in technology, politics, literature, history, and sports, and in his spare time, he enjoys teaching coding and English to young students.
Learn more at sufyanism.com.
CHAPTER Introduction to Python
DOI: 10.1201/9781003229896-1
IN THIS CHAPTER
Introducing Python coding language
Diving into the story of Python creation
Explaining how to install and configure Python
Python is a general-purpose coding language that is used for other types of programming and software development. It is considered a great force in web application creation and systems management and a key driver of the explosion in big data analytics and machine intelligence.
To put simply, Python is generally utilized for things like:
Writing system scripts
Processing big data
Performing mathematical computations
Connecting to database systems
Reading and modifying files
Python can be used on Creating web applications on a server
Creating workflows
Rapid prototyping
Production-ready software development
Back-end web and mobile app development
However, the most typical use case for Python is as a scripting and automation language. When creating scripts, Python is not considered a replacement for shell scripts or batch files but is used to automate interactions with web browsers or application graphical user interfaces (GUI). Thus, with Python, you can create both command-line and cross-platform GUI applications and deploy them as self-contained executables.
Sophisticated data analysis has become one of the most flourishing areas of IT, and the majority of popular software and data science libraries used for machine learning have Python interfaces, making it the most popular high-level command interface and numerical algorithms. Python's third-party web frameworks provide fast and convenient ways to create everything from simple lines of code to full-functioning, data-driven sites. Python's latest versions have strong support for operations, enabling sites to handle tens of thousands of requests per second. Python also works as a highly efficient code generator, making it possible to write applications that manipulate their own functions that would be difficult to implement in other languages. This coding is often described as a glue language, meaning it can make disparate code interoperable again. Thus, if you have applications or program domains that you would like to link with each other, you can use Python for this task.
PYTHON 2 VS. PYTHON 3
Python is available in two different versions: Python 2 and Python 3. Python 2, the older branch, as of January 1, 2020, is no longer supported by its creators, the Python Software Foundation. Python 3, the current and future version of the language, has many updated features that were not included in Python 2, such as new concurrency controls, and a better interpreter. There used to be a lot of competition between the two, but since version 3 incorporated few important functions, it has won over all the Python fan base. Few of those changes in Python 3 included:
Text vs. Data instead of Unicode vs. 8-bit.
Print is now a function.
Views and iterators instead of lists.
The rules for ordering comparisons have been simplified. So, a heterogeneous list cannot be sorted, because all the elements of a list must be comparable to each other.
, Learntowish blog
At first, Python 3 approval was slowed for some time due to a lack of third-party library support. Because most Python libraries supported only Python 2, it made the transaction to version 3 time consuming. But over the last couple of years, the number of libraries compatible with both Python 2 and Python 3 has increased. Today, Python 3 is the best, up-to-date choice for new projects.