Table of contents
- Preface
-
Let's program
- Start the interactive Python environment
- Program comments
- Using the interactive mode
- Let's get technical
- Complex numbers
- Programming errors
- Miscellaneous
Preface
This module is one in a collection of modules on Python designed forteaching ITSE 1359 Introduction to Scripting Languages: Python at Austin Community College in Austin, TX. It explains various aspects of numbers in Python.
I will start out by showing you how to use Python as a programmable calculator. Inthe process, I will introduce you to some programming concepts, such as operators that I will explain in a more formal way in future modules.
Viewing tip
I recommend that you open another copy of this module in a separate browser window and use the following links to easily find and view the Figureswhile you are reading about them.
(Note to blind and visually impaired students: all of the Figures in this module are presented in plaintext format and should be accessible using an audio screen reader or a braille display.)
Figures
- Figure 1 . IDLE GUI at startup.
- Figure 2 . A Python comment.
- Figure 3 . The sum of 2 and 5.
- Figure 4 . Mixing comments and expressions on the command line interface.
- Figure 5 . Example prompts from The Python Tutorial.
- Figure 6 . A Python addition operator.
- Figure 7 . Some arithmetic operators.
- Figure 8 . Two division operators.
- Figure 9 . Whole number quotient and remainder.
- Figure 10 . A simple expression.
- Figure 11 . A simple expression in Python.
- Figure 12 . Grouping terms with parentheses.
- Figure 13 . Nested parentheses.
- Figure 14 . Negative integer division.
- Figure 15 . An error on the command-line interface.
- Figure 16 . An error on the IDLE GUI interface.
Let's program
Start the interactive Python environment
The first thing that you need to do is to start the interactive programming environment. If you have forgotten how to do that, see the earlier module titled Itse1359-1010-Getting Started in this book .
You can start the interactive Python environment from the Windows Start menu by selecting one of the following:
- IDLE (Python GUI)
- Python (command line).
Either way, the interactive programming environment should look something like Figure 1 when it starts running.
Figure 1 . IDLE GUI at startup. |
---|
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22)
[MSC v.1600 32 bit (Intel)]on win32
Type "copyright", "credits" or "license()" for moreinformation.>>> |