Book Image

Dancing with Python

By : Robert S. Sutor
Book Image

Dancing with Python

By: Robert S. Sutor

Overview of this book

Dancing with Python helps you learn Python and quantum computing in a practical way. It will help you explore how to work with numbers, strings, collections, iterators, and files. The book goes beyond functions and classes and teaches you to use Python and Qiskit to create gates and circuits for classical and quantum computing. Learn how quantum extends traditional techniques using the Grover Search Algorithm and the code that implements it. Dive into some advanced and widely used applications of Python and revisit strings with more sophisticated tools, such as regular expressions and basic natural language processing (NLP). The final chapters introduce you to data analysis, visualizations, and supervised and unsupervised machine learning. By the end of the book, you will be proficient in programming the latest and most powerful quantum computers, the Pythonic way.
Table of Contents (29 chapters)
2
Part I: Getting to Know Python
10
PART II: Algorithms and Circuits
14
PART III: Advanced Features and Libraries
19
References
20
Other Books You May Enjoy
Appendices
Appendix C: The Complete UniPoly Class
Appendix D: The Complete Guitar Class Hierarchy
Appendix F: Production Notes

Preface

Skill is the unified force of experience, intellect and passion in their operation.

—John Ruskin

Coding is the art and engineering of creating software. Code is the collection of written instructions and functionality in one or more programming languages that provides directions for how computing hardware should operate. A coder creates code.

Coders go by other names as well. They are often called software developers or just developers. More traditionally, they have been called programmers.

The range of hardware devices that need code to tell them what to do is astounding. Cars have many computer processors in them to control how they operate and how to entertain you. As you can imagine, a vehicle with any degree of self-driving capability contains a lot of code. It’s not simple programming either: artificial intelligence (AI) software makes many operating decisions.

Your mobile phone is both a computing and a communication device. Low-level code controls how your phone connects to Wi-Fi or cellular networks. Someone wrote that code, but as an app developer, you don’t need to redo it; you call functions that access the Internet. Similarly, someone wrote the low-level graphics routines that put the color dots on the screen in the right places. While you may want to do that in some cases as an app developer, you mostly call higher-level functions that draw lines or shapes, show photos, or play videos.

Even at this level, several kinds of hardware get involved within your phone. There is the communications chip, general processor, arithmetic processor, floating-point processor, and the graphics processing unit (GPU). These are what we call classical computers or classical processors. Their architecture is descended from computers of the 1940s. While there is a range of ways of programming them, it is all called classical coding.

However, there is another kind of computer that has only been available on the cloud for general users since 2016. That is the quantum computer. Coding a quantum computer is radically different from classical device programming at the level close to the hardware. However, if you know or can learn Python, a programming language estimated to be used by over 8 million software developers globally and taught in many universities, you have a tremendous advantage in that you can do both classical and quantum computing together.

Classical hardware and software have proven themselves over the last seven decades, while quantum computing is new. It promises to help solve some kinds of problems that would take too much time, too much processing power, or too much memory, even for a classical supercomputer. Experts expect quantum computing to be useful in the future in areas including financial services, logistics, chemistry, materials science, drug discovery, scientific simulation of physical systems, optimization, and artificial intelligence.

If you plan to be a professional software developer or someone who needs high-performance computing for research, you should learn about quantum computing systems and how to code for them.