Skip to main content
Global

My First LibreTexts Page

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

    How to create Lists in Python (Example Heading 1)

    Authors can use the LibreTexts Platform to create pages on a multitude of subjects and topics. In this tutorial, we will show you how an author can use the various features of the plugin to display information in a way that best suits their intent.

    How To Print the Code and Output from a Script

    example_list = ['apple', 'cherry', 'grape']
    print(example_list)
    ['apple', 'cherry', 'grape']
    

    How To Print Code with just Input

    example_list = ['apple', 'cherry', 'grape']
    print(example_list)

    How To Print Code with just the Output (no run button)

    example_list = ['apple', 'cherry', 'grape']
    print(example_list)
    ['apple', 'cherry', 'grape']
    

     

     

    How To Create Numpy Arrays in Python (Example Heading 2)

    Just like your favorite text editor, packages and libraries can also be imported. If there is a package of library that you would like to use and is not already available, simply email our team or open an issue (more information available on the dialogue box). 

    import numpy as np
    np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16]])
    array([[ 1,  2,  3,  4],
           [ 5,  6,  7,  8],
           [ 9, 10, 11, 12],
           [13, 14, 15, 16]])