iNTERFACEWARE Products Manual > Learning Center > Learning Python > Working With Values and Variables > Displaying Values |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
To display a value or the contents of a variable on your screen, use print. Here is a simple example:
This displays Hello, world! on your screen.
You can use print to display more than one value at a time. For example:
This displays The patient ID is 42113. There are two things to notice in this program:
Normally, each print statement displays its output on a separate output line. If you want two print statements to display to the same output line, put a comma (,) at the end of the first print statement. For example:
Once again, this displays The patient ID is 42113. When printing, you can use %s to include the contents of a variable:
This also displays The patient ID is 42113. If you use %s to print more than one variable, Python processes them from left to right:
This displays The patient IDs are 42113 and 42114. If you supply more than one variable, you must enclose the list of variables in parentheses.
|