Book Image

Python Fundamentals

By : Ryan Marvin, Mark Nganga, Amos Omondi
Book Image

Python Fundamentals

By: Ryan Marvin, Mark Nganga, Amos Omondi

Overview of this book

After a brief history of Python and key differences between Python 2 and Python 3, you'll understand how Python has been used in applications such as YouTube and Google App Engine. As you work with the language, you'll learn about control statements, delve into controlling program flow and gradually work on more structured programs via functions. As you settle into the Python ecosystem, you'll learn about data structures and study ways to correctly store and represent information. By working through specific examples, you'll learn how Python implements object-oriented programming (OOP) concepts of abstraction, encapsulation of data, inheritance, and polymorphism. You'll be given an overview of how imports, modules, and packages work in Python, how you can handle errors to prevent apps from crashing, as well as file manipulation. By the end of this book, you'll have built up an impressive portfolio of projects and armed yourself with the skills you need to tackle Python projects in the real world.
Table of Contents (12 chapters)
Python Fundamentals
Preface

Introduction


In the previous chapter, we covered the following topics:

  • How to use looping structures

  • How to branch within looping structures

  • How to break out of loops

We will continue to build on this knowledge by implementing what we have learned, to build functions in Python.

Functions are an integral part of the Python programming language, and a lot of languages, really. Throughout this book, you have already encountered some built-in functions, especially when dealing with certain data structures.

Functions are an easy way to group a few lines of code that implement a functionality together. This is especially useful if the code in question will be used several times in different parts of your program. You may want to use functions to abstract away some complex code that you need in your programs. You can think of functions as mini-programs within your bigger program that implement specific tasks.

It is important to remember that while it is tempting to tuck a lot of functionality into a single...