print "One if by land."
print "Two if by sea."
print "Three if by both."
raw_input("Press enter to exit.")
The output of the above program will look like this:
| One if by land. |
| Two if by sea. |
| Three if by by both. |
If you want the lines to print all on the same line you must use the a comma after the first two lines. Thus the following code prints everything as one line of text.
print "One if by land,",
print "two if by sea,",
print "three if by both??"
| One if by land, two if by sea, three if by both?? |
age = raw_input("Please enter your age: ")
We have just declared a variable called "age" that will hold
an the string value entered from the key board. Now we can use
our variable to hold user input.
age = raw_input("Please enter your age: ")
print "You are",
print age,
print "years old."
(Using variables will be covered in more detail in the next section. )