A Journey to Core Python
eBook - ePub

A Journey to Core Python

Experience the Applications of Tuples, Dictionary, Lists, Operators, Loops, Indexing, Slicing, and Matrices (English Edition)

Mr. Girish Kumar, Dr. Ajay Shriram Kushwah, Ms. Raji Ramakrishnan Nair, Ms. Subhashiny G

Share book
  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

A Journey to Core Python

Experience the Applications of Tuples, Dictionary, Lists, Operators, Loops, Indexing, Slicing, and Matrices (English Edition)

Mr. Girish Kumar, Dr. Ajay Shriram Kushwah, Ms. Raji Ramakrishnan Nair, Ms. Subhashiny G

Book details
Book preview
Table of contents
Citations

About This Book

Come and join hands together to learn Python from scratch. This book will help you understand Python from scratch and help you build a career in the field of programming.

Key Features
? Exciting examples and a solid grasp of the principles of Python.
? An easy guide for absolute beginners to enjoy coding while learning.
? Exception handling, OOPs fundamentals, inheritance, and reusability explained in detail.

Description
The book offers to teach a novice programmer the fundamentals of Python programming from the ground up. The book provides a brief history of Python, followed by exploring Python's fundamental concepts, features, and applications in detail.The book explains Python identifiers, keywords, variables, and assignments, as well as basic operators and decision-making statements. This book covers repetitive code, strings and integers (dictionaries), functions and modules (files), exception handling, and object-oriented programming in all of its variants. The book explains concepts with illustrations, thus making it simple for even the most unskilled reader to grasp the basics of the code execution flow.By the end of this book, you will have a firm grasp of all of Python's programming ideas. Additionally, it will help you to prepare for any upcoming job interviews with your comprehensive Python understanding.

What you will learn
? Quickly grasp the concepts of lists, tuples, dictionaries, and functions.
? Examine Python's effective use of exception handling.
? Makes object-oriented programming more understandable.
? Discover when and how to use Python's decision-making statements.
? Use Python to perform and execute file operations.

Who this book is for
This book is for web application developers, entry level developers, and IT graduates who want to learn the entire web application development by developing a solid hold on Python principles. Basic programming knowledge is recommended but not required.

Table of Contents
1. Introduction
2. Basic Syntax
3. Variable Types
4. Basic Operators
5. Decision Making
6. Repeating Code Using Loops
7. Numbers
8. Strings
9. Lists
10. Tuples
11. Dictionaries
12. Functions
13. Modules
14. Files I/O
15. Exception Handling
16. Object-Oriented Programming

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is A Journey to Core Python an online PDF/ePUB?
Yes, you can access A Journey to Core Python by Mr. Girish Kumar, Dr. Ajay Shriram Kushwah, Ms. Raji Ramakrishnan Nair, Ms. Subhashiny G in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Python. We have over one million books available in our catalogue for you to explore.

Information

CHAPTER 1

Introduction

Introduction

Python is a strong and straightforward programming language that delivers the power and complexity of traditional compiled languages and the ease-of-use (and then some) of simpler scripting and interpreted languages.

Structure

We will cover the following topics in this chapter:
  • History of Python
  • Features of Python
  • Benefits of Python
  • Applications of Python

Objectives

The main objectives of this chapter are to provide you with an overview of Python, and discuss its benefits, its future scope and importance, and its application in the real world.

History of Python

Python came into the picture in the late 1980s, and its implementation was started in December 1989 by Guido van Rossum at CWI in Netherlands.
At the time, Guido van Rossum was a researcher with considerable language design experience with the interpreted language ABC, also developed at CWI. Still, he was unhappy with its ability, so he came up with something more. Some of the tools he visualized performed general system administration tasks, so he also wanted access to the power of system calls, which is available with distributed operating systems such as Amoeba. Even though Amoeba-specific language gave some new thoughts, a generalized language gave more sense, and the seeds of Python were sown late in 1989.
Python was extracted from many other languages, including ABC, Modula-3, C, C++, Algol-68, SmallTalk, Unix shell, and other scripting languages.

Features of Python

The following are the main features of Python:
  • Easy-to-learn: Python hardly has any keywords or reserved words, understandable organization, and unambiguous syntax, which makes the language easy to understand for a student.
  • Readable: Python code is distinctly set and noticeable.
  • Simple-to-maintain: Python's source code is relatively simple to manage.
  • An extensive, conventional libraries: Python's conventional library is portable and cross-platform friendly with Windows, UNIX, and Macintosh operating systems.
  • Hands-on approach: Python provides a Do-It-Yourself REPL interpreter to learn the language and library features before moving them into the application. The REPL console can also write small test scripts.
  • Compactable: Python can work on various platforms and needs an indistinguishable interface for every platform.
  • Extendable: Python interpreter supports low-level modules and helps programmers add or customize their tools for efficient programming.
  • Databases: Python provides libraries for data-driven applications to interact with all major commercial databases.
  • GUI programming: Python supports GUI applications. It can be produced and ported to different system calls, libraries, and windows systems, for example, Windows MFC, Macintosh, and the X Window system of Unix operating systems.
  • Scalable: Python caters to a better organization and upholds wide programs than shell scripting.
Python has a list of other good features as well:
  • It supports functional and structured programming methods and also OOPs concepts.
  • It provides high-level dynamic data types and supports dynamic type checking.
  • It supports automatic garbage collection.
  • It can also be used as a scripting language or compiled to bytecode for developing a wide range of applications that perform enormous operations.
  • Even Python scripts that are executed are compiled to Python bytecode before execution.
  • It provides high-level dynamic data types and supports dynamic type checking. It can be easily unified with C, C++, COM, ActiveX, CORBA, and Java using Python APIs.

Benefits of Python

The divergent application of the Python language is a result of its combination of features. It makes Python more adaptable for a wide range of applications. Some of the perks of Python programming are:
  • The presence of third-party modules: The Python Package Index (PyPI) comprises numerous third-party modules, enabling Python to interact with distinct languages and platforms available.
  • Broad support libraries: Python provides aĀ large standard library, including internet protocols, string operations, web services tools, and operating system interfaces. Many high-level programming tasks have already been scripted into the standard library, leading to the reduction of the length of code to be written.
  • Open source and community development: Python language is constructed beneath an OSI-approved open-source license, making it free to use and distribute, even for commercial purposes.
  • Learning ease and support available: Python offers excellent readability and accessible simple-to-learn syntax, which helps beginners adopt the language effectively. The code style guidelines, such as PEP 8, provide rules to aid code formatting. Also, the distinct users and active developers made the internet resource bank rich, leading to the development and continued usage of this programming language. The Python Package Index (PyPI) comprises numerous third-party modules and enables Python to interact with distinct languages.
  • Handy data structures: Python holds a built-in list and dictionary data structures and is used to construct data structures with fast runtime. Moreover, it affords dynamic high-level data types, leading to reduction in code length.
  • Productivity and speed: Python holds an object-oriented design structure, giving a redesigned procedure control capacities, solid consolidation, text preparing capacities, and its unit testing framework. Each one of these capacities increase profitability. Python is seen as an appropriate choice for building complex multi-protocol network applications.

Applications of Python

Here are some of the application areas of Python:
  • GUI-based desktop applications: Python has a basic structure, modular design, rich tools for text processing, and the capacity to work on different operating systems, making it an acceptable choice for developing desktop-based applications. Several GUI toolkits like wxPython, PyQt, and PyGtkĀ accessible assist designers in making profoundly useful Graphical User Interface (GUI). The different applications created utilizing Python incorporates are:
    • Image processing and graphic design applications: Python is used to develop 2D imaging software, for example, Inkscape, GIMP, Paint Shop Pro, and Scribus. It is also used in variable proportions like in 3D animation packages such asĀ Blender, 3ds Max, Cinema 4D, Houdini, Lightwave, and Maya.
    • Scientific and Computational Applications: The high speed, productivity, and scope of various tools, like Scientific Python and Numeric Python, make Python an integral part of various applications involving computations and processing of scientific data. Various software are coded in Python, such as 3D modeling software like FreeCAD and finite element method software like Abaqus.
    • Games:Ā Python supports the development of games with diverse modules, libraries, and platforms. There are many examples available, and one of those is PySoy. It is a 3D game engine that supports Python 3, and PyGame contains a set of modules providing functionality and a related library for the game's development. Various games are built using Python, such as Battlefield 2, Bridge Commander, and Eve Online.
  • Web frameworks and web applications: Python has been used to build various web frameworks, including CherryPy, Django, Pyramid, TurboGears, Bottle, and Flask. These frameworks come up with standard libraries and modules that simplify tasks such as managing content, database interactions, and interfacing with different flavors of internet protocols like HTTP, SMTP, XML-RPC, FTP, and POP. Here are some of the popular web applications based on Python:
    • Plone is a content management system
    • ERP5 is an open-source ERP used mainly in aerospace, apparel, and banking
    • Odoo is a blended suite of different business applications and Google App Engine
  • Enterprise and business applications: Python is the most suitable language for coding and has special libraries, extensibility, scalability, and easily readable syntax. Reddit, which was initially developed in Common Lips, was rescripted in Python in the year 2005. Python also came up with different functionalities for the YouTube online video sharing platform.
  • Operating systems: Python is often a basic part of Linux distributions. For example, Ubuntu's Ubiquity Installer and Fedora and Red Hat Enterprise Linux's Anaconda Installer are developed in Python. Gentoo Linux used Python for its package management system known as Portage.
  • Language development: Python has affected the development of many languages with its design and module architecture. For example, Boo language uses an object model, syntax, and indentation equivalent to Python. Additionally, the syntax of many languages like Apple's Swift, CoffeeScript, Cobra, and OCaml share the features of the Python programming language.
  • Prototyping: Other than being brisk and simple to learn, Python has the open-source bit of leeway of being free with the help of a huge network. This helps it to be a favored decision for the development of prototypes. Python allows faster development of its prototype with features like agility, extensibility and scalability, and ease of refactoring code. Python is suited for prototyping primarily due to its scripting nature, ease of writing code, and library support. The availability of a developer network might not be a right pointer for creating prototypes as even JAVA/C# have solid developer networks.

Conclusion

In this chapter, we focused on basic things about Python. Python is a robust and straightforward programming language that delivers the power and complexity of traditional compiled languages and the ease of use of simpler scripting and interpreted languages. Guido van Rossum developed Python in the late 1980s, and its implementation was started in December 1989. This chapter discussed the basic features of Python. Currently, it is the most popular programming language, which is why it is used in every sector to develop web and desktop applications, AI, machine learning, and blockchain. So, we can develop user-friendly applications that are more useful to people.
In the upcoming chapter, you will learn the basic syntax of the Python programming language.

Key terms

  • Robust
  • Interpreted languages
  • Web frameworks
  • Django, CherryPy, Pyramid, TurboGears, Bottle, Flask
  • Python Package Index
  • Python libraries
  • Anaconda installer
  • GUI toolkits

Questions

  1. Explain the features of Python.
  2. Explain the real-world applications of Python.
  3. What is Python, and who developed it?
  4. Compare Python with C.
  5. Python is written in which language?
    Name the extension of Python files.. Is Python a purely object-oriented programming language?

CHAPTER 2

Basic Syntax

Introduction

To become an expert-level programmer, a learner must have a strong understanding of pro...

Table of contents