.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\python\demo_variables.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_python_demo_variables.py: Basic variables ================== .. GENERATED FROM PYTHON SOURCE LINES 5-16 .. code-block:: Python counter = 100 # An integer assignment miles = 1000.0 # A floating point name = "itom" # A string comp = 1 + 1j * 5 # complex print(counter) print(miles) print(name) print(comp) .. rst-class:: sphx-glr-script-out .. code-block:: none 100 1000.0 itom (1+5j) .. GENERATED FROM PYTHON SOURCE LINES 18-19 Get type of variable .. GENERATED FROM PYTHON SOURCE LINES 19-24 .. code-block:: Python print(type(counter)) print(type(miles)) print(type(name)) print(type(comp)) .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 25-26 List, Tuples, Dictionary .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: Python listValues = ["abcd", 786, 2.23, "john", 70.2] # appending, deleting possible tuplesValues = ("abcd", 786, 2.23, "john", 70.2) # tuples cannot be changed tinydict = {"name": "john", "code": 6734, "dept": "sales"} .. _sphx_glr_download_11_demos_python_demo_variables.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_variables.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_variables.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_variables.zip `