Skip to main content
Chemistry LibreTexts

1.1: Introduction to Python

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)


    Why Python?

    Python is a "high-level" (essentially human readable - not machine code) general purpose open source programming language that is used in a wide variety of applications like scientific computing, data analysis, web development and artificial intelligence.  Because it is open source there are vast quantities of freely accessible libraries along containing code that can be integrated into projects. There are also robust programming communities of coders who freely share information over the web and thus there is an ecosystem we can tap into and potentially contribute to, as we develop our projects.  Python will not be the only programming language we will need to use in this class, but it is an ideal language to learn coding with.

    By a high level program language we mean it is not running the hardware, but run in a virtual environment using the python interpreter (note, we capitalize Python when we refer to the language, and do not capitilize python when referring to the interpreter, which is essentially the virtual environment it runs in). Because of this, it can be run on a wide variety of platforms, like Windows, MacOS, Linux, and Unix.

    How was Python Created?

    Python is a general-purpose interpreted high-level programming language that was created in the Netherlands by the Dutch programmer Guido Van Rossum in 1991. It started as a hobby project for the programmer to avoid boredom and keep himself busy during the Christmas season. 

    The name "Python" came from Guido's being a big fan of the comedy troupe "Monty Python's Flying Circus" from the 1970s.

    Python was mainly developed to help programmers express concepts in fewer lines of code and to make their code more readable. 


    Figure \(\PageIndex{1}\): Guido Van Rossum (Stroud; CC BY-SA 4.0, Wikimedia Commons)


    Figure \(\PageIndex{1}\): Python Logo (Trademark of Python Software Foundation)

    Python Versions

    Today, Python comes in many types among which are:

    • CPython: Which is written in C programming language
    • Jython: Which is written in Java programming language
    • Brython: Which is "Browser Python" and runs in the browser
    • MicroPython: Which runs on a microcontroller


    Programming in IoT

    IoT projects mainly consist of physical objects (hardware) interacting with and through commands (Software). The hardware stores the software and executes ("runs") the code.

    Generally, the hardware consists of electrical circuits that are controlled through instructions called machine code.

    Definition: Machine code

    Machine code is a programming language composed of binary numbers or bits (1's and 0's) and is the only language that a computer or a circuit can understand.

    For example, the letter "A" is represented as 01000001 in machine language, yet it is shown on the screen as "A".

    By coding with Python, we will not need to learn machine code. We will be writing in code that looks like human language and will leave the translation task to a compiler or an interpreter.



    Robert E. Belford (University of Arkansas Little Rock; Department of Chemistry). The breadth, depth and veracity of this work is the responsibility of Robert E. Belford, You should contact him if you have any concerns. This material has both original contributions, and content built upon prior contributions of the LibreTexts Community and other resources, including but not limited to:

    • Emna Bouzid






    Below will be a series of links to various python resources.  As the semester continues this page will be updated.

    The following are resources that can be of value to learning Python



    Conversational Python: An Introduction to Computer Science Experienced Through Conversational Banter, Jason B. Shepherd



    This page titled 1.1: Introduction to Python is shared under a not declared license and was authored, remixed, and/or curated by Robert Belford.

    • Was this article helpful?