Monday, September 12, 2011

LPTHW - Exercise 11

In this exercise we are going to accept input from the user.



Notes and extra credits:

When we print something with the print statement, it normally ends with a newline. We can prevent the new line by ending the print statement with a ',' as shown in the example above.

The raw_input() function is used to read input from the console. It will read one line of input, and pass it to the program with the ending newline stripped out.

It seems we can load the 'readline' module to provide some elaborate editing and history features.

In the output of the above program, all the instances of %r are replaced by the output of running __repr() on the arguments. The output is always delimited with ''. Since the height also uses a ' within it, it must be escaped.

No comments:

Post a Comment