Skip to main content
Engineering LibreTexts

13.2.2: Overview of Python

  • Page ID
    78426
  • \( \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}}\)

    Python is a widely used general-purpose, open-source, high-level programming language. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library. Please, visit Python.3

    Installation

    It is recommended to Install the Anaconda Distribution.4 You can either download Python 2 or 3. For the sake of compatibility with the packages to be used throughout the course, Python 2.7 is recommended. Anaconda is a completely free Python distribution (including for commercial use and redistribution). It includes more than 300 of the most popular Python packages for science, math, engineering, and data analysis.

    Installing packages

    Python capabilities are being built up based on continuous contributions of the community. These contributions are typically encapsulated in packages. For instance, We can start by Poliastro5 library, a space engineering library.

    To install this or any other package, we can make use of different package managers. There are two main package managers for python (both of them come with anaconda):

    Just invoke the any of the following sentences in your terminal/cmd window:

    conda install poliastro -c poliastro

    pip install poliastro

    Integrated Development Environment (IDE) environment

    We can use Python either invoking it form the terminal, or using ad-hoc IDE environments. In particular, Anaconda distribution comes with:

    • Spyder \(\to\) Desktop script.
    • i-Python \(\to\) html development environment

    Getting started with Python

    Write your first script in Python and run it using Spyder:

    # @author: manuelsolerarnedo (# to comment)

    print "hello world"
    a = 2
    b = 3
    c = a + b
    print c

    If you want to further learn about python (with aeronautical applications), the AeroPython course is strongly recommended (AeroPython Course).6 Notice however that the course has been prepared as a i-python notebook. Should you want to continue, just download the notebooks and start coding!


    3. https://www.python.org/

    4. https://www.continuum.io/why-anaconda

    5. https://poliastro.github.io/ by Juan Luis Cano

    6. http://pybonacci.org/2015/09/17/curs...on-en-la-uc3m/


    13.2.2: Overview of Python is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Manuel Soler Arnedo via source content that was edited to conform to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?