Database Reference
In-Depth Information
Let's modify the script so it asks the user for those numbers instead. For this, we need to
use the
input
command.
Right-click on the
sum.py
file and click on
Edit with IDLE
to open the Python editor.
Write the following code:
a = input("Enter the first number: ")
b = input("Enter the second number: ")
s = a + b
print "The sum is " + str(s)
input ("Press any key to continue..")
Save and run the code. Note that now you are prompted to enter the values of
a
and
b
in-
stead of having them hardcoded in the script. We will be using the
input
command a lot
to ask the user for parameters while working with our geodatabase.
Note
You can find this script along with other scripts that we will be using in the supporting
files for this chapter under
8648OT_05_Files\scripts
.