Commits

Allan Davis committed 9b53c47

changed some images to figures

  • Participants
  • Parent commits 9b112af

Comments (0)

Files changed (2)

File interactive_shell.rst

 
 To open IDLE on Windows, click on Start, then Programs, then Python 3.1, then IDLE (Python GUI). With IDLE open, let's do some simple math with Python. The interactive shell can work just like a calculator. Type 2+2 into the shell and press the Enter key on your keyboard. (On some keyboards, this is the Return key.) As you can see in Figure 2-1, the computer should respond with the number 4; the sum of 2+2.
 
-.. image:: images/2-1.png
+.. figure:: images/2-1.png
 
-Figure 2-1: Type 2+2 into the shell.
+    Figure 2-1: Type 2+2 into the shell.
 
 As you can see, we can use the Python shell just like a calculator. This isn't a program by itself because we are just learning the basics right now. The + sign tells the computer to add the numbers 2 and 2. To subtract numbers use the - sign, and to multiply numbers use an asterisk (\*), like so:
 
     
 Figure 2-2 is what the interactive shell in IDLE will look like after you type in the instructions above.
 
-.. image:: images/2-2.png 
+.. figure:: images/2-2.png 
 
-Figure 2-2: What the IDLE window looks like after entering instructions.
+    Figure 2-2: What the IDLE window looks like after entering instructions.
 
 These math problems are called expressions. Computers can solve millions of these problems in seconds. Expressions are made up of values (the numbers) connected by operators (the math signs). Let's learn exactly what values and operators are.
 
 
 Numbers are a type of value. Integers are a type of number. But, even though integers are numbers, not all numbers are integers. (For example, fractions and numbers with decimal points like 2.5 are numbers that are not integers.)
 
+.. figure:: images/2-3.png
+    :align: right
+    
+    Figure 2-3: An expression is a
+    made up of values and operators.
+
+
 This is like how a cat is a type of pet, but not all pets are cats. Someone could have a pet dog or a pet hermit crab. An expression is made up of values (such as integers like 8 and 6) connected by an operator (such as the * multiplication sign). A single value by itself is also considered an expression.
 
-.. image:: images/2-3.png
-
-Figure 2-3: An expression is a made up of values and operators.
-
 In the next chapter, we will learn about working with text in expressions. Python isn't limited to just numbers. It's more than just a fancy calculator!
 
 Evaluating Expressions
     >>> spam = 15
     >>>
 
-.. image:: images/2-4.png
-
-Figure 2-4: Variables are like boxes that can hold values in them.
+.. figure:: images/2-4.png
+    :align: right
+    
+    Figure 2-4: Variables are like boxes that can hold values in them.
 
 You can think of the variable like a box with the value 15 inside of it (as shown in Figure 2-4). The variable name "spam" is the label on the box (so we can tell one variable from another) and the value stored in it is like a small note inside the box.
 
 The input() Function
 ^^^^^^^^^^^^^^^^^^^^^^
 
-::
+.. code-block:: python
 
     myName = input()
 
 
 Remember, the computer only does exactly what you program it to do. In this, our first program, it is programmed to ask you for your name, let you type in a string, and then say hello and display the string you typed.
 
-But computers are dumb. The program doesn't care if you type in your name, someone else's name, or just something dumb. You can type in anything you want and the computer will treat it the same way:
+But computers are dumb. The program doesn't care if you type in your name, someone else's name, or just something dumb. You can type in anything you want and the computer will treat it the same way::
 
     Hello world!
     What is your name?